15,848,723 members
Home / Discussions / Algorithms

# Algorithms

 Shortes pass find + walls bypassing alikalik14-May-11 23:22 alikalik 14-May-11 23:22
 Re: Shortes pass find + walls bypassing Luc Pattyn15-May-11 3:43 Luc Pattyn 15-May-11 3:43
 Re: Shortes pass find + walls bypassing dasblinkenlight16-May-11 0:11 dasblinkenlight 16-May-11 0:11
 Ackerman non-recursive function Raminnamiranian4-May-11 23:31 Raminnamiranian 4-May-11 23:31
 Re: Ackerman non-recursive function Ravi Sant5-May-11 1:31 Ravi Sant 5-May-11 1:31
 Re: Ackerman non-recursive function Luc Pattyn5-May-11 2:48 Luc Pattyn 5-May-11 2:48
 Re: Ackerman non-recursive function Richard MacCutchan5-May-11 5:18 Richard MacCutchan 5-May-11 5:18
 Search Algorithm Cyclone_S16-Apr-11 9:22 Cyclone_S 16-Apr-11 9:22
 Hi, I am coding an algorithm that searches for a box on the screen. So far I got the snake to find the food which works great except that for example. If the snake is moving right it will sometimes move left and move ontop of it's self. I've spent awhile trying to figure it out on my own with no success. I think it has to do with the two blocks of if statements but I'm not sure. Maybe they need to be combined somehow? This is the last thing I need to figure out and my program is finished. Thanks in advance. I tried. `if(direction_comp!=1){direction_comp=-1;} else {direction_comp=2;} // If snake is not moving left then move it right else move it up to avoid it from moving on top of it's self.` ```direction_comp of 1 = left; direction_comp of -1 = right; direction_comp of 2 = up; direction_comp of -2 = down;``` ```void comp_direction() { if(tick_comp==0 && avoiding==false) { if(segments_comp[head_comp]->panel->Left <= Food->Left) { if(segments_comp[head_comp]->panel->Top >= Food->Top){direction_comp =2;} else{direction_comp=-1;} } else if(segments_comp[head_comp]->panel->Left >= Food->Left) { if(segments_comp[head_comp]->panel->Top >= Food->Top){direction_comp =2;} else{direction_comp=1;} } if(segments_comp[head_comp]->panel->Top <= Food->Top) { if(segments_comp[head_comp]->panel->Left <= Food->Left){direction_comp =-1;} else{direction_comp=-2;} } else if(segments_comp[head_comp]->panel->Top >= Food->Top) { if(segments_comp[head_comp]->panel->Left >= Food->Left){direction_comp =1;} else{direction_comp=2;} } } }```
 Re: Search Algorithm bob1697216-Apr-11 10:28 bob16972 16-Apr-11 10:28
 Re: Search Algorithm Cyclone_S16-Apr-11 14:10 Cyclone_S 16-Apr-11 14:10
 Re: Search Algorithm bob1697216-Apr-11 18:52 bob16972 16-Apr-11 18:52
 Re: Search Algorithm Cyclone_S20-Apr-11 10:58 Cyclone_S 20-Apr-11 10:58
 Re: Search Algorithm bob1697220-Apr-11 19:06 bob16972 20-Apr-11 19:06
 Re: Search Algorithm Cyclone_S21-Apr-11 15:45 Cyclone_S 21-Apr-11 15:45
 Re: Search Algorithm Cyclone_S22-Apr-11 10:57 Cyclone_S 22-Apr-11 10:57
 Re: Search Algorithm bob1697224-Apr-11 5:59 bob16972 24-Apr-11 5:59
 Re: Search Algorithm Cyclone_S27-Apr-11 14:43 Cyclone_S 27-Apr-11 14:43
 Re: Search Algorithm Luc Pattyn20-Apr-11 13:39 Luc Pattyn 20-Apr-11 13:39
 Re: Search Algorithm AspDotNetDev20-Apr-11 14:12 AspDotNetDev 20-Apr-11 14:12
 Re: Search Algorithm Cyclone_S20-Apr-11 14:40 Cyclone_S 20-Apr-11 14:40
 Re: Search Algorithm Stefan_Lang26-Apr-11 5:32 Stefan_Lang 26-Apr-11 5:32
 Re: Search Algorithm Cyclone_S27-Apr-11 14:50 Cyclone_S 27-Apr-11 14:50
 converting MFC program into web based shiks11-Apr-11 18:06 shiks 11-Apr-11 18:06
 Re: converting MFC program into web based Albert Holguin11-Apr-11 19:13 Albert Holguin 11-Apr-11 19:13
 Re: converting MFC program into web based shiks12-Apr-11 6:15 shiks 12-Apr-11 6:15
 Last Visit: 31-Dec-99 19:00     Last Update: 29-Feb-24 1:49 Refresh ᐊ Prev1...9899100101102103104105106107 Next ᐅ