コード例 #1
0
        public static Boolean CheckTowerMovement(CheckerPoint start, CheckerPoint end)
        {
            if (start.X == end.X) return true;

            if (start.Y == end.Y) return true;

            return false;
        }
コード例 #2
0
        public static Boolean CheckJumperMovement(CheckerPoint start, CheckerPoint end)
        {
            if (end.X == start.X + 2 && (end.Y == start.Y + 1 || end.Y == start.Y - 1)) return true;    //left and up, left and down
            if (end.X == start.X - 2 && (end.Y == start.Y + 1 || end.Y == start.Y - 1)) return true;    //right and up, right and down
            if (end.Y == start.Y + 2 && (end.X == start.X + 1 || end.X == start.X - 1)) return true;    // up and right, up and left
            if (end.Y == start.Y - 2 && (end.X == start.X + 1 || end.X == start.X - 1)) return true;    // down and right, up and left

            return false;
        }
コード例 #3
0
        public static Boolean CheckHetmanMovement(CheckerPoint start, CheckerPoint end)
        {
            //Hetman's movement is tower + bishop movement

            if (CheckTowerMovement(start, end)) return true;
            if (CheckBishopMovement(start, end)) return true;

            return false;
        }
コード例 #4
0
        public static Boolean CheckBishopMovement(CheckerPoint start, CheckerPoint end)
        {
            int x_move = end.X - start.X;
            int y_move = end.X - start.X;

            if (x_move < 0) x_move = - x_move;
            if (y_move < 0) y_move = - y_move;

            if (x_move == y_move) return true;
            else return false;
        }
コード例 #5
0
ファイル: Chessman.cs プロジェクト: Skarbor/ChessBattle
 public abstract void Move(CheckerLogic.Checker checker, CheckerPoint point);
コード例 #6
0
ファイル: Checker.cs プロジェクト: Skarbor/ChessBattle
 public bool CheckIfFieldIsEmpty(CheckerPoint point)
 {
     if (CheckerTab[point.X, point.Y] == null) return true;
     else return false;
 }