![]() |
|
#1
|
|||
|
|||
Karel: draw a checkerboard using beepersI am doing an online course through Stanford school of Engineering, and its free. Feel free to check it out, its high quality. Anyway the assignment is to make Karel the robot, which is a program in Java that can perform a small set of actions, make an empty matrix into a checkerboard. I have "beepers" which are grey diamonds, and I must put no more than one beeper on every other square. The X axis is "avenues" 1st avenue, second avenue, etc., and the Y axis is "streets". Karel can move(); turnLeft(); turnRight(); turnAround(); putBeeper(); and pickBeeper();
So far I get him/her to make the checkerboard, but when it is completed, Karel continues to move around the matrix, putting more beepers ontop of one another, resulting in an infinite loop. How do I get Karel to stop when he/she is finished at the top left of the screen? JAVA Code:
and this the description of the world Karel occupies: Dimension: 8, 8 BeeperBag: INFINITY Karel: (1, 1) East Speed: 0.75 |
|||
|
#2
|
|||
|
|||
Re: Karel: draw a checkerboard using beepersHello,
I got Karel to stop after a couple runs around but couldn't get it to stop in the top left corner on his first run... I used the code you created, (which was admirable by the way) and added a couple lines down at the bottom. JAVA Code:
Last edited by admin : 07-Dec-2008 at 21:33.
Reason: Please insert your example Java codes between [JAVA] and [/JAVA] tags
|
Recent GIDBlog
Vista ?Widgets? on Windows XP by LocalTech
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Barcode reader code problem | copa_21 | C Programming Language | 5 | 13-Oct-2006 00:40 |
| problem with code | arikeri | C++ Forum | 3 | 06-Mar-2005 00:22 |
| Insert problem in linked list with two function code | Kay Chan | C++ Forum | 1 | 03-Sep-2004 09:52 |
| problem with C code | belludandy | C Programming Language | 1 | 26-Jan-2004 21:28 |
| Code problem (a newbie question) | monkster87 | C++ Forum | 3 | 11-Aug-2003 12:46 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The