コード例 #1
0
 private void SetMovesForAllies(Color color)
 {
     for (int i = 0; i < TempGameBoard.Count; i++)
     {
         if (TempGameBoard[i].PieceColor == color)
         {
             AiMove.SetMovementList(TempGameBoard[i], TempGameBoard);
         }
     }
 }
コード例 #2
0
        // eftersom ennemy inte har några moves, så får dom de här!

        private void SetMovesForEnemiesInList(Pieces piece)
        {
            foreach (var enemie in TempGameBoard)
            {
                if (enemie.PieceColor != piece.PieceColor)
                {
                    AiMove.SetMovementList(enemie, TempGameBoard);
                }
            }
        }
コード例 #3
0
        private bool CanIThreatenTheKing(Move possibleMove, Pieces piece)
        {
            var testPiece = GetPieceFromTempBoard(piece);

            testPiece.CurrentPosition._PosX = possibleMove.endPositions._PosX;
            testPiece.CurrentPosition._PosY = possibleMove.endPositions._PosY;

            AiMove.SetMovementList(testPiece, TempGameBoard);

            foreach (var move in testPiece.ListOfMoves)
            {
                if (CompareEnemyPositionToMyMove(GetPositionOfEnemyKing(), move))
                {
                    RestoreTempGameBoard();
                    return(false);
                }
            }
            RestoreTempGameBoard();
            return(false);
        }
コード例 #4
0
        private bool WillIthreaten(Pieces piece, Move move)
        {
            Pieces tempPiece = GetPieceFromTempBoard(piece);



            tempPiece.CurrentPosition = new Point(move.endPositions._PosX, move.endPositions._PosY);
            AiMove.SetMovementList(tempPiece, TempGameBoard);

            foreach (Move tempMove in tempPiece.ListOfMoves)
            {
                if (CanItakeSomething(tempMove))
                {
                    RestoreTempGameBoard();
                    return(true);
                }
            }

            RestoreTempGameBoard();
            return(false);
        }