/* public bool is_possible_to_keep_move (int x, int y, String Player){ * if (can_eat_something(x,y,Player)){ * return true; * } * return false; * } */ /* * public bool can_eat_something (int x, int y, String Player){ * if (can_move(x,y,x+2,y+2,Player)) return true; * if (can_move(x,y,x+2,y-2,Player)) return true; * if (can_move(x,y,x-2,y+2,Player)) return true; * if (can_move(x,y,x-2,y-2,Player)) return true; * return false; * }*/ public override bool move(int x1, int y1, int x2, int y2, int Player) { if (canMove(x1, y1, x2, y2, Player)) { BOARD.replacePiece(x1, y1, x2, y2); CONFIRM_MOVE = true; /*if (Player == Player1){ * Actual_player = Player2; * }else{ * Actual_player = Player1; * } */ CONT_ID++; endTurn(Player); return(true); } return(false); }
public override bool rotate(int x, int y, String direction, int Player) { if (ACTUAL_PLAYER == Player) { if (canRotate(x, y, Player)) { DeflexionPiece P1 = ((DeflexionPiece)BOARD.getPiece(x, y)); String ori = P1.get_orientation(); if (direction.Equals(CLOCKWISE, StringComparison.CurrentCultureIgnoreCase)) { if (ori.Equals("NE", StringComparison.CurrentCultureIgnoreCase)) { P1.update_orientation("SE"); } else if (ori.Equals("SE", StringComparison.CurrentCultureIgnoreCase)) { P1.update_orientation("SW"); } else if (ori.Equals("SW", StringComparison.CurrentCultureIgnoreCase)) { P1.update_orientation("NW"); } else if (ori.Equals("NW", StringComparison.CurrentCultureIgnoreCase)) { P1.update_orientation("NE"); } else { Console.WriteLine("Invalid orientation: " + ori); } } else if (direction.Equals(ANTICLOCKWISE, StringComparison.CurrentCultureIgnoreCase) || direction.Equals(COUNTERCLOCKWISE, StringComparison.CurrentCultureIgnoreCase)) { if (ori.Equals("NE", StringComparison.CurrentCultureIgnoreCase)) { P1.update_orientation("NW"); } else if (ori.Equals("SE", StringComparison.CurrentCultureIgnoreCase)) { P1.update_orientation("NE"); } else if (ori.Equals("SW", StringComparison.CurrentCultureIgnoreCase)) { P1.update_orientation("SE"); } else if (ori.Equals("NW", StringComparison.CurrentCultureIgnoreCase)) { P1.update_orientation("SW"); } else { Console.WriteLine("Invalid orientation: " + ori); } } else { Console.WriteLine("Invalid type of rotation."); return(false); } Console.WriteLine("Deflexion rotation OK"); BOARD.replacePiece(x, y, P1); CONFIRM_MOVE = true; endTurn(Player); return(true); } } return(false); }