Ejemplo n.º 1
0
 internal void UpdateBoard(Tile[,] board) {
     for(int y = 0;y < BoardSize;y += 1) {
         for(int x = 0;x < BoardSize;x += 1) {
             Bitmap image = null;
             switch(board[x,y]) {
                 case Tile.White:
                     image = CheckerBoardImages.White;
                     break;
                 case Tile.Black:
                     image = CheckerBoardImages.Black;
                     break;
                 case Tile.RedChecker:
                     image = CheckerBoardImages.RedChecker;
                     break;
                 case Tile.WhiteChecker:
                     image = CheckerBoardImages.WhiteChecker;
                     break;
                 case Tile.KingedRedChecker:
                     image = CheckerBoardImages.RedCheckerKing;
                     break;
                 case Tile.KingedWhiteChecker:
                     image = CheckerBoardImages.WhiteCheckerKing;
                     break;
             }
             PictureBoxes[x,y].Image = image;
         }
     }
 }
Ejemplo n.º 2
0
        public Board()
        {
            tiles = new Tile[8][];

            for (int i = 0; i < 8; i++)
            {
                tiles[i] = new Tile[8];
                for (int j = 0; j < 8; j++)
                {
                    if (((j == 0 || j == 2) && i % 2 != 0) || (j == 1 && i % 2 == 0))
                        tiles[i][j] = new Tile(new BlackPc(GamePlay.currPl.next, new Vector3(i * 5, 0, j * 5)));
                    else if (((j == 5 || j == 7) && i % 2 == 0) || (j == 6 && i % 2 != 0))
                        tiles[i][j] = new Tile(new WhitePc(GamePlay.currPl, new Vector3(i * 5, 0, j * 5)));

                    else if ((j == 3 && i % 2 == 0) || (j == 4 && i % 2 != 0))
                        tiles[i][j] = new Tile(null);
                    else
                        tiles[i][j] = new Tile(null);
                }
            }
        }
Ejemplo n.º 3
0
        //Rule number (f) in the .pdf :)
        public void fRule()
        {
            Tile[] delete = new Tile[12]; //12 penalties at maximum.
            int count = 0;

            for(int i = 0; i < 8; i++)
                for(int j = 0; j < 8; j++)
                {
                    Piece tmpPc = tiles[i][j].p;
                    if(tmpPc != null && tmpPc.isHis(GamePlay.currPl))
                    {
                        Vector src = new Vector(i, j);
                        for(int k = 0; k < tmpPc.possAttacks.Length; k++)
                        {
                            Vector dest = Vector.add(src, tmpPc.possAttacks[k]);
                            if(dest.x>=0 && dest.x<=7 && dest.y>=0 && dest.y<=7 && isEmpty(dest)
                                && validateAttack(tmpPc, src, tmpPc.possAttacks[k]))
                                {
                                    delete[count] = tiles[i][j]; //add the tile containing the coward piece in an array.
                                    count++; //increment the number of cowards :D
                                    break; //to avoid penalizing the same piece twice.
                                }
                        }
                    }
                }

            //nullify the coward pieces !
            for(int i = 0; i < count; i++)
                delete[i].p = null;

            if (count != 0)
            {
                fruled = true; //a flag that should be true if at least one piece was penalized.
                attackAgain = null;
            }
        }
Ejemplo n.º 4
0
 private static void TileCheck(int botNumber, ref Tile checkOne, ref Tile checkTwo) {
     switch(botNumber) {
         case 1:
             checkOne = Tile.WhiteChecker;
             checkTwo = Tile.KingedWhiteChecker;
             break;
         case 2:
             checkOne = Tile.RedChecker;
             checkTwo = Tile.KingedRedChecker;
             break;
     }
 }