技术上没感觉到有难度的。应该JDK1.4之前的内容就足够了。 你尝试着先一点点写着吧,遇到不会的解不开的在发帖问。自己做和看别人做收获差别是很大的。 如果让我做,我会设计一个15*15的JLabel,225个Jlabel分别控制自己的格子显示相应的内容就行了。 剩余的就是逻辑层的显示了。 [其他解释] 还不如英文原题好理解 [其他解释] 英文原版在这里: The Paintbot game is played on a 15 by 15 grid on which the two robots reside and compete. Only one robot may occupy a square at a time. (If two robots try to occupy the same square at the same time, they crash. There is more about this later.) Robots may turn 90 degrees left, 90 degrees right, move forward one square, move backward one square, or stay in the same spot. In addition, at any of these moves, the robot may fire a blob of paint, red or blue. At the beginning of the game, all squares on the board are painted white (a neutral color) and each robot is randomly assigned a paint color of red or blue. The game lasts for 300 moves, and both robots move simultaneously. During each turn or move of the simulation, the robot may make a move, given by its control algorithm (the class you are writing). If the robot moves out of a square, the square that it leaves is turned the robot’s color. The goal of the game is to have more squares on the board painted your color than your robot opponent’s color. This is accomplished by moving
around the board and painting the squares. Thus, it is good to paint over squares colored your opponents color, as it adds a square that is your color and takes one away from your opponent. There are of course some wrinkles. 1. You may shoot a blob of paint, and if you hit your opponent’s robot, that robot will paint your color instead of its own when it moves. This will last for 20 moves. Shooting takes place at the end of the move. 2. You have only a limited number of paint blobs that you may shoot. This number is 30. 3. If you run into a wall, the game will end and your robot loses automatically. 4. If you run into the other robot, the game will end immediately and the robot with the most squares painted its color at that point will win. 5. The game board contains squares that have rocks in them. Neither robot may enter these squares, and running into a square with rocks will terminate the game with a loss for the player that runs into the rock. (Just like running into a wall.) 6. You cannot fire through a rock. 7. Each time your control algorithm decides on the next move, it has access to its current surroundings in the form of a 5 by 5 square. The robot you are controlling is at the center of the square, and the direction it is facing is always considered “up.” This is called a short-range or local scan 8. Your control algorithm may also receive a limited number of long-range scans which gives the contents of the entire 15 by 15 board. A long-range scan is available to you with any move. You are limited to 30 long-range scans. 10. At the beginning of the simulation, rocks are placed randomly on the board and the two robots in competition are placed at a random position on the board. [其他解释] 该回复于2012-11-24 09:58:00被管理员删除 [其他解释]