![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Dec 2004
Posts: 1
Rep Power: 0
![]() |
Hi,
I have recently begun studying computer science in Cork, Ireland.We are using karel the robot at the moment to introduce us to programming.I have a problem and can not crack it and I am just wondering could anyone that is familiar with Karel the Robot help me out. THE PROBLEM: Write a robot program to find the closest beeper ( to the north, South,East, or West of the robot), and carry it back to the starting corner, facing towards the former location of the beeper. create a new class of robot, a `Retriever` , to assist in performing this task. this class should have a method with heading: public void retrieveClosestBeeper( ) which retrieves the closest beeper. it may also have other appropriate private methods. The program may make the following assumptions: 1) There is a beeper somewhere to to the north, south, east or west of the starting corner; however, there needv not necessarily be beepers in all four directions. 2) there is no beeper at the staring corner. 3) There are no walls which are closer to the starting corner than the closest beeper. ANY HELP WOULD BE GREATLY APPRECIATED. THANK YOU, ROSS ( ram2@student.cs.ucc.ie ) |
|
|
|
|
|
#2 |
|
Programming Guru
![]() ![]() |
What language are you using?
__________________
Profanity is the one language that all programmers understand. Check out my Blog <---updated Nov 30 2007! |
|
|
|
|
|
#3 |
|
Programming Guru
![]() ![]() ![]() |
He's probably using Java.
There is some C++ source code posted for the same thing but it is "Rat and Cheese" objects. You could easily derive a Java program from their C++ code, check out the C++ forum for it.
__________________
http://jasonpowers.net "There are a thousand hacking at the branches of evil to one who is striking at the root." |
|
|
|
|
|
#4 |
|
The Supreme Ruler
![]() Join Date: May 2004
Location: Houston
Posts: 1,476
Rep Power: 6
![]() |
__________________
"Every gun that is made, every warship launched, every rocket signifies, in the final sense, a theft from those who hunger and are not fed, from those who are cold and are not clothed. The world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children." - Dwight D. Eisenhower |
|
|
|
|
|
#5 |
|
Programming Guru
![]() ![]() ![]() |
That link is right on the money... I thought it was in the C++ forum, obviously because I wrote code for it in C++ and not Java... failed to look at the forum name first... then just got carried away with the C++ version.
__________________
http://jasonpowers.net "There are a thousand hacking at the branches of evil to one who is striking at the root." |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|