Exemplo n.º 1
0
        public static void Main()
        {
            // mozna sobie cos posprawdzac
            Console.WriteLine("Checkers");
            int[,] array = { { 2, 0, 2, 0, 2, 0, 2, 0 },
                             { 0, 2, 0, 2, 0, 2, 0, 2 },
                             { 2, 0, 2, 0, 2, 0, 2, 0 },
                             { 0, 0, 0, 0, 0, 0, 0, 0 },
                             { 0, 0, 0, 0, 0, 0, 0, 0 },
                             { 1, 0, 1, 0, 1, 0, 1, 0 },
                             { 0, 1, 0, 1, 0, 1, 0, 1 },
                             { 1, 0, 1, 0, 1, 0, 1, 0 }, };
            var myBoard  = new CheckerBoard();
            var myPlayer = new Player(Color.BLACK, myBoard);

            if (myBoard[2, 2] == null)
            {
                Console.WriteLine("NULL REFERENCE");
            }
            else
            {
                Console.WriteLine("IsCorrectPiece: " + myPlayer.IsCorrectPiece(myBoard[2, 2]));
            }
            myBoard.DrawBoard(myPlayer);

            Console.WriteLine("CanAttack: " + myBoard[4, 2].CanAttack(myBoard));
            Position dest;
            Piece    myPiece;

            myPlayer.Input(out myPiece, out dest, myBoard);
            myPiece.Move(myBoard, dest);
            myBoard.DrawBoard(myPlayer);
            Console.ReadKey();
        }