1. Re: Robot challenge - More Complex Maze Needed!
- Posted by C & K L <candk at TICNET.COM> Nov 06, 1998
- 384 views
Irv, I've got my little one-pixel 'bot screaming through your maze, but it goes so fast that I can't see the little guy zip through it... so... I'm proposing you develop a more complex maze... :) T'anks! ck Irv Mullins wrote: > > Since there were no takers for my "real life" programming > example, let's try writing some robot logic. There should > be some creative ways to code this. (Also possible to pit > one algorithm against another) > > --------------------------------------------------------------- > -- Given a maze (which may change at any time) > -- write a robot routine to navigate the maze starting > -- at the green dot in the upper lefthand corner, and ending > -- at the red rectangle in the lower right. > -- Do not refer to the coordinates in the draw_maze routine! > -- your initial robot position is given: {24,24} > -- (center of the green dot) > --------------------------------------------------------------- > include graphics.e > include image.e > include get.e > > atom key > > procedure draw_maze() > object playfield > playfield = {{20,20},{120,20},{120,120},{20,120},{20,20}} > polygon(BLUE,1,playfield) -- blue field cause green looks yucky > polygon(YELLOW,0,playfield) -- border in yellow for visibility > draw_line(YELLOW,{{20,40},{110,40}}) -- draw a few walls > draw_line(YELLOW,{{40,60},{100,60}}) > draw_line(YELLOW,{{40,60},{40,40}}) > draw_line(YELLOW,{{20,80},{60,80}}) > draw_line(YELLOW,{{60,88},{60,70}}) > draw_line(YELLOW,{{80,120},{80,100}}) > draw_line(YELLOW,{{90,80},{120,80}}) > draw_line(YELLOW,{{90,80},{60,100}}) > draw_line(YELLOW,{{80,100},{100,100}}) > ellipse(GREEN,1,{22,22},{26,26}) > polygon(RED,1,{{110,110},{118,110},{118,118},{110,118},{110,110}}) > end procedure > > if graphics_mode(19) then > end if > > draw_maze() > -------------------------------- > -- your bot procedure(s) here > -------------------------------- > > key = wait_key() > > if graphics_mode(-1) then > end if > > -- Irv