org/homelinux/largo/games/board/checkersboard/CheckersBoard.java
changeset 7 93fe1f21e0d8
parent 0 e0dbaef72362
child 13 f83884cc7d2f
equal deleted inserted replaced
6:ad18534e08fd 7:93fe1f21e0d8
    69 	 * Checks, wether this move is possible or not.
    69 	 * Checks, wether this move is possible or not.
    70 	 */
    70 	 */
    71 	public boolean validMove (int t, int o) {
    71 	public boolean validMove (int t, int o) {
    72 		int steps;
    72 		int steps;
    73 		int rows;
    73 		int rows;
    74 		int dx;
       
    75 
    74 
    76 		if ( t == o )
    75 		if ( t == o )
    77 			return false;
    76 			return false;
    78 
    77 
    79 		if (isSamePiece(t, o))
    78 		if (isSamePiece(t, o))
   202 	/**
   201 	/**
   203 	 * simulates a "valid" move or returns false.
   202 	 * simulates a "valid" move or returns false.
   204 	 * all changes are relative to pieces and will not be painted.
   203 	 * all changes are relative to pieces and will not be painted.
   205 	 */
   204 	 */
   206 	public boolean simulateMove(int t, int o) {
   205 	public boolean simulateMove(int t, int o) {
   207 		int steps = Math.abs(t-o);
       
   208 		int rows = Math.abs(t/8 - o/8);
   206 		int rows = Math.abs(t/8 - o/8);
   209 		int pos;
   207 		int pos;
   210 
   208 
   211 		if ( !validMove(t, o) ) {
   209 		if ( !validMove(t, o) ) {
   212 			return false;
   210 			return false;