技术上没感觉到有难度的。应该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