org/homelinux/largo/games/board/Board.java
changeset 7 93fe1f21e0d8
parent 0 e0dbaef72362
child 12 d28c1e402d82
equal deleted inserted replaced
6:ad18534e08fd 7:93fe1f21e0d8
    34 	int yPos;
    34 	int yPos;
    35 
    35 
    36 	boolean black;
    36 	boolean black;
    37 	boolean blacksTurn;
    37 	boolean blacksTurn;
    38 
    38 
    39 	MouseListener listener = null;
    39 	MouseListener listener;
    40 
    40 
    41 	/**
    41 	/**
    42 	 * The init method initializes an empty board with a history.
    42 	 * The init method initializes an empty board with a history.
    43 	 */
    43 	 */
    44 	public void init() {
    44 	public void init() {
   274 
   274 
   275 	/**
   275 	/**
   276 	 * Moves one half-move backward.
   276 	 * Moves one half-move backward.
   277 	 */
   277 	 */
   278 	public void backwards() {
   278 	public void backwards() {
   279 		History h1 = null;
   279 		History h1;
   280 		History h2 = null;
   280 		History h2;
   281 
   281 
   282 		if ( moveNr < 2)
   282 		if ( moveNr < 2)
   283 			return;
   283 			return;
   284 
   284 
   285 		moveNr -= 2;
   285 		moveNr -= 2;
   295 
   295 
   296 	/**
   296 	/**
   297 	 * Moves one half-move forward.
   297 	 * Moves one half-move forward.
   298 	 */
   298 	 */
   299 	public void forward() {
   299 	public void forward() {
   300 		History h1 = null;
   300 		History h1;
   301 		History h2 = null;
   301 		History h2;
   302 
   302 
   303 		if ( moveNr > stack.size()-2 )
   303 		if ( moveNr > stack.size()-2 )
   304 			return;
   304 			return;
   305 
   305 
   306 		h1 = stack.elementAt(moveNr);
   306 		h1 = stack.elementAt(moveNr);
   323 
   323 
   324 	/**
   324 	/**
   325 	 * pop: undo the push operation.
   325 	 * pop: undo the push operation.
   326 	 */
   326 	 */
   327 	public void undo() {
   327 	public void undo() {
   328 		History h1 = null;
   328 		History h1;
   329 		History h2 = null;
   329 		History h2;
   330 		int size = stack.size();
   330 		int size = stack.size();
   331 
   331 
   332 		if ( size < 2 )
   332 		if ( size < 2 )
   333 			return;
   333 			return;
   334 
   334