problem about artificial-intelligence-Collection of common programming errors


  • Kassem

  • AndreaNobili
    prolog logic artificial-intelligence swi-prolog declarative
    I am studying on Ivan Bratko book: “Programming for Artificial Intelligence” for an universitary exame and using SWI Prolog and I have some doubts about an example show on this book regarding the assert and retract predicates.It simply prese

  • AndreaNobili
    prolog logic artificial-intelligence swi-prolog declarative
    I am studying Prolog on Ivan Bratko book: Programming for Artificial Intelligence and on the book I have found this version of 8 Queens problem that use a space state “graph” to solve the problem:s(Queens, [Queen|Queens]) :- member(Queen, [1,2,3,4,5,6,7,8]),noattack(Queen, Queens).goal([_,_,_,_,_,_,_,_]).noattack(_,[],_).noattack(Y,[Y1|Ylist],Xdist) :-Y1-Y =\= Xdist,Y-Y1 =\= Xdist,Dist1

  • AndreaNobili

  • Jon Seigel

  • UnhinderedLimpidity
    c++ if-statement recursion artificial-intelligence
    I had to de

  • kaybenleroll
    lisp artificial-intelligence reinforcement-learning
    I have been reading a lot about Reinforcement Learning lately, and I have found “Reinforcement Learning: An Introduction” to be an excellent guide. The author’s helpfully provice source code for a lot of their worked examples.Before I begin the question I should point out that my practical knowledge of lisp is minimal. I know the basic concepts and how it works, but I have never really used lisp in a meaningful way, so it is likely I am just doing something incredibly n00b-ish. :)Also, the author states on his page that he will not answer questions about his code, so I did not contact him, and figured Stack Overflow would be a much better choice.I have been trying to run the code on a linux machine, using both GNU’s CLISP and SBCL but have not been able to run it. I keep getting a whole list of errors using either interpreter. In particular, most of the code appears to use a lot of util

  • MHardy
    artificial-intelligence neural-network ubuntu-12.04 fann
    I am trying to build fann neural network library in ubuntu 12.04 but failed to use it as the testing routine is not working. Following the instructions in http://leenissen.dk/fann/wp/help/installing-fann/. After cmake and install when I want to test if the library is working, by cd to examples and then running:m

  • steveha
    python c artificial-intelligence solver game-ai
    Vexed is a popular puzzle game, with many versions available (some of them GPL free software). It is very suitable for small screen devices; versions are available for Android, iOS, etc. I discovered it on the PalmOS platform.Just for fun, I’d like to write a solver that will solve Vexed levels.Vexed is a block-sliding puzzle game. Here are the rules in a nutshell:0) Each level is a grid of squares, bounded by an impassible border. In any level there will be some solid squares, which are impassible. There are some number of blocks of various colors; these could be resting on the bottom border, resting on solid squares, or resting on other blocks (of a different color). Most levels are 8×8 or smaller.1) The only action you can take is to slide a block to the left or to the right. Each square traveled by a block counts as one move.2) There is gravity. If, after you slide a block, it is no longer resting on a solid square or another block, it will fall until it comes to rest on another block, a solid square, or the bottom border. Note that you cannot ever lift it up again.3) Any time two or more blocks of the same color touch, they disappear. Note that chains are possible: if a supporting block disappears, blocks that rested upon it will fall, which could lead to more blocks of the same color touching and thus disappearing.4) The goal is to make all blocks disappear in the minimum number of moves. Each level has a “par score” which tells you the minimum number of moves. (In the original PalmOS game, the “par score” wasn’t necessarily the minimum, but in the Android version I play these days it is the minimum.)Here is the SourceForge project with the source for the PalmOS version of the game:http://sourceforge.net/projects/vexed/I’m an experienced software developer, but I haven’t done really any work in AI sort of stuff (pathfinding, problem-solving, etc.) So I’m looking for advice to get me pointed in the right direction.At the moment, I can see two basic strategies for me to pursue:0) Just write a brute-force solver, probably in C for the speed, that cranks through every possible solution for every game and returns a list of all solutions, best one first. Would this be a reasonable approach, or would the total number of possible moves make this too slow? I don’t think any levels exist larger than 10×10.1) Learn some AI-ish algorithms, and apply them in a clever way to solve the problem, probably using Python.Note that the source for PalmOS Vexed includes a solver. According to the author, “The solver uses A* with pruning heuristics to find solutions.”http://www.scottlu.com/Content/Vexed.htmlSo, one strategy I could pursue would be to study the A* algorithm and then study the C++ code for the existing solver and try to learn from that.I’m going to tag this with Python and C tags, but if you think I should be using something else, make your sales pitch and I’ll consider it!Here is ASCII art of a level from “Variety 25 Pack”; level 48, “Dark Lord”. I am able to solve most levels but this one has, well, vexed me. Par score for this level is 25 moves, but I have not yet solved it at all!__________ |## g####| |## # b##| |## # p##| |#g ###| |bp ###| |p# p g | ==========In this picture, the borders are underscores, vertical bars, and equals characters. Filled-in squares are ‘#’. Open spaces are

  • 2vision2
    image-processing opencv artificial-intelligence computer-vision face-detection
    I am using OpenCV for face and eye detection. To start with, I tested the sample program in OpenCV/Samples/c/facedetect.cpp. I gave two images as an input to this facedetect.exe – one is full and the other is cropped face of the same person. Now, the facedetect.cpp works fine with full image whereas it is not even detecting the face with the cropped image as input.Although the cropped image contains only the face which is cropped using OpenCV face detector, In some bad cases I will get only mouth or lips or only part of the face. So my requirement here is to check both the eyes are there in an image or not.The below are the two sample pictures one is full image where I get proper output:The below is the image where I need to detect the eyes using facedetect.cpp:So my question here is how to detect the eyes in the cropped image?The below is the code of sample facedetect.cpp#include “opencv2/objdetect/objdetect.hpp” #include “opencv2/highgui/highgui.hpp” #include “opencv2/imgproc/imgproc.hpp”#include #include using namespace std; using namespace cv;static void help() {cout

Originally posted 2013-11-09 23:29:29.