public override bool[,] possiMov()
        {
            bool[,] mat = new bool[board.lines, board.coluns];

            Position pos = new Position(0, 0);

            //N
            pos.setValues(position.line - 1, position.column);
            while (board.positionTrue(pos) && canMov(pos))
            {
                mat[pos.line, pos.column] = true;

                if (board.piece(pos) != null && board.piece(pos).collor != collor)
                {
                    break;
                }
                pos.line = pos.line - 1;
            }

            //S
            pos.setValues(position.line + 1, position.column);
            while (board.positionTrue(pos) && canMov(pos))
            {
                mat[pos.line, pos.column] = true;

                if (board.piece(pos) != null && board.piece(pos).collor != collor)
                {
                    break;
                }
                pos.line = pos.line + 1;
            }
            //E
            pos.setValues(position.line, position.column + 1);
            while (board.positionTrue(pos) && canMov(pos))
            {
                mat[pos.line, pos.column] = true;

                if (board.piece(pos) != null && board.piece(pos).collor != collor)
                {
                    break;
                }
                pos.column = pos.column + 1;
            }
            //W
            pos.setValues(position.line, position.column - 1);
            while (board.positionTrue(pos) && canMov(pos))
            {
                mat[pos.line, pos.column] = true;

                if (board.piece(pos) != null && board.piece(pos).collor != collor)
                {
                    break;
                }
                pos.column = pos.column - 1;
            }

            return(mat);
        }
Exemple #2
0
        public override bool[,] possiMov()
        {
            bool[,] mat = new bool[board.lines, board.coluns];

            Position pos = new Position(0, 0);

            //
            pos.setValues(position.line - 1, position.column - 2);
            if (board.positionTrue(pos) && canMov(pos))
            {
                mat[pos.line, pos.column] = true;
            }
            //
            pos.setValues(position.line - 2, position.column - 1);
            if (board.positionTrue(pos) && canMov(pos))
            {
                mat[pos.line, pos.column] = true;
            }
            //
            pos.setValues(position.line - 2, position.column + 1);
            if (board.positionTrue(pos) && canMov(pos))
            {
                mat[pos.line, pos.column] = true;
            }
            //
            pos.setValues(position.line - 1, position.column + 2);
            if (board.positionTrue(pos) && canMov(pos))
            {
                mat[pos.line, pos.column] = true;
            }
            //
            pos.setValues(position.line + 1, position.column + 2);
            if (board.positionTrue(pos) && canMov(pos))
            {
                mat[pos.line, pos.column] = true;
            }
            //
            pos.setValues(position.line + 2, position.column + 1);
            if (board.positionTrue(pos) && canMov(pos))
            {
                mat[pos.line, pos.column] = true;
            }
            //
            pos.setValues(position.line + 2, position.column - 1);
            if (board.positionTrue(pos) && canMov(pos))
            {
                mat[pos.line, pos.column] = true;
            }
            //
            pos.setValues(position.line + 1, position.column - 2);
            if (board.positionTrue(pos) && canMov(pos))
            {
                mat[pos.line, pos.column] = true;
            }


            return(mat);
        }
Exemple #3
0
        public override bool[,] possiMov()
        {
            bool[,] mat = new bool[board.lines, board.coluns];

            Position pos = new Position(0, 0);

            //N
            pos.setValues(position.line - 1, position.column);
            if (board.positionTrue(pos) && canMov(pos))
            {
                mat[pos.line, pos.column] = true;
            }
            //Ne
            pos.setValues(position.line - 1, position.column + 1);
            if (board.positionTrue(pos) && canMov(pos))
            {
                mat[pos.line, pos.column] = true;
            }
            //E
            pos.setValues(position.line, position.column + 1);
            if (board.positionTrue(pos) && canMov(pos))
            {
                mat[pos.line, pos.column] = true;
            }
            //SE
            pos.setValues(position.line + 1, position.column + 1);
            if (board.positionTrue(pos) && canMov(pos))
            {
                mat[pos.line, pos.column] = true;
            }
            //S
            pos.setValues(position.line + 1, position.column);
            if (board.positionTrue(pos) && canMov(pos))
            {
                mat[pos.line, pos.column] = true;
            }
            //SW
            pos.setValues(position.line + 1, position.column - 1);
            if (board.positionTrue(pos) && canMov(pos))
            {
                mat[pos.line, pos.column] = true;
            }
            //W
            pos.setValues(position.line, position.column - 1);
            if (board.positionTrue(pos) && canMov(pos))
            {
                mat[pos.line, pos.column] = true;
            }
            //NW
            pos.setValues(position.line - 1, position.column - 1);
            if (board.positionTrue(pos) && canMov(pos))
            {
                mat[pos.line, pos.column] = true;
            }
            //
            if (amountOfMov == 0 && !match.check)
            {
                // small rock
                Position posT1 = new Position(position.line, position.column + 3);
                if (testeTorreParaRoque(posT1))
                {
                    Position p1 = new Position(position.line, position.column + 1);
                    Position p2 = new Position(position.line, position.column + 2);
                    if (board.piece(p1) == null && board.piece(p2) == null)
                    {
                        mat[position.line, position.column + 2] = true;
                    }
                }
                // #jogadaespecial roque grande
                Position posT2 = new Position(position.line, position.column - 4);
                if (testeTorreParaRoque(posT2))
                {
                    Position p1 = new Position(position.line, position.column - 1);
                    Position p2 = new Position(position.line, position.column - 2);
                    Position p3 = new Position(position.line, position.column - 3);
                    if (board.piece(p1) == null && board.piece(p2) == null && board.piece(p3) == null)
                    {
                        mat[position.line, position.column - 2] = true;
                    }
                }
            }

            return(mat);
        }