Click here to Skip to main content
15,894,405 members
Home / Discussions / Algorithms
   

Algorithms

 
GeneralRe: Search Algorithm Pin
bob1697216-Apr-11 17:52
bob1697216-Apr-11 17:52 
GeneralRe: Search Algorithm Pin
Cyclone_S20-Apr-11 9:58
Cyclone_S20-Apr-11 9:58 
GeneralRe: Search Algorithm Pin
bob1697220-Apr-11 18:06
bob1697220-Apr-11 18:06 
GeneralRe: Search Algorithm Pin
Cyclone_S21-Apr-11 14:45
Cyclone_S21-Apr-11 14:45 
GeneralRe: Search Algorithm Pin
Cyclone_S22-Apr-11 9:57
Cyclone_S22-Apr-11 9:57 
GeneralRe: Search Algorithm Pin
bob1697224-Apr-11 4:59
bob1697224-Apr-11 4:59 
GeneralRe: Search Algorithm Pin
Cyclone_S27-Apr-11 13:43
Cyclone_S27-Apr-11 13:43 
AnswerRe: Search Algorithm Pin
Luc Pattyn20-Apr-11 12:39
sitebuilderLuc Pattyn20-Apr-11 12:39 
IMO you should come up with a valid algorithm before you start coding; you may of course describe your algorithmic attempts in some kind of pseudo-code.

Here are a few requirement issues you should settle first:
- is the world a rectangle?
- are there any obstacles?
- can the snake SEE the food from a distance, or will it have to stumble upon it?
- is the snake length limited? could it exceed twice the smaller dimension of its world?

Depending on your requirements the algorithm may be quite different, or even unsolvable (without backtracking that is).

Example: if the snake could be longer than twice the height, it could corner itself when moving up (or down) close to an edge (say the right edge), and accidentally turning nearer to that edge (hence right) when reaching the top edge.

Smile | :)
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

AnswerRe: Search Algorithm Pin
AspDotNetDev20-Apr-11 13:12
protectorAspDotNetDev20-Apr-11 13:12 
GeneralRe: Search Algorithm Pin
Cyclone_S20-Apr-11 13:40
Cyclone_S20-Apr-11 13:40 
AnswerRe: Search Algorithm Pin
Stefan_Lang26-Apr-11 4:32
Stefan_Lang26-Apr-11 4:32 
GeneralRe: Search Algorithm Pin
Cyclone_S27-Apr-11 13:50
Cyclone_S27-Apr-11 13:50 
Questionconverting MFC program into web based Pin
shiks11-Apr-11 17:06
shiks11-Apr-11 17:06 
AnswerRe: converting MFC program into web based Pin
Albert Holguin11-Apr-11 18:13
professionalAlbert Holguin11-Apr-11 18:13 
GeneralRe: converting MFC program into web based Pin
shiks12-Apr-11 5:15
shiks12-Apr-11 5:15 
GeneralRe: converting MFC program into web based Pin
Albert Holguin12-Apr-11 5:19
professionalAlbert Holguin12-Apr-11 5:19 
GeneralRe: converting MFC program into web based Pin
Albert Holguin12-Apr-11 5:21
professionalAlbert Holguin12-Apr-11 5:21 
AnswerRe: converting MFC program into web based Pin
Eddy Vluggen12-Apr-11 8:25
professionalEddy Vluggen12-Apr-11 8:25 
GeneralRe: converting MFC program into web based Pin
shiks13-Apr-11 17:02
shiks13-Apr-11 17:02 
QuestionGood way to detect a useful portion of equivalent expressions Pin
David198718-Mar-11 0:00
David198718-Mar-11 0:00 
AnswerRe: Good way to detect a useful portion of equivalent expressions Pin
CPallini18-Mar-11 1:29
mveCPallini18-Mar-11 1:29 
GeneralRe: Good way to detect a useful portion of equivalent expressions Pin
David198718-Mar-11 1:41
David198718-Mar-11 1:41 
AnswerRe: Good way to detect a useful portion of equivalent expressions Pin
Luc Pattyn18-Mar-11 2:18
sitebuilderLuc Pattyn18-Mar-11 2:18 
GeneralRe: Good way to detect a useful portion of equivalent expressions Pin
David198718-Mar-11 2:24
David198718-Mar-11 2:24 
AnswerRe: Good way to detect a useful portion of equivalent expressions Pin
Luc Pattyn18-Mar-11 3:32
sitebuilderLuc Pattyn18-Mar-11 3:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.