Exemplo n.º 1
0
        public (List <Pos2> m, List <Pos2> c) ListMoves(Board board, Pos2 pos, int player)
        {
            List <Pos2> maneuvers = new List <Pos2>();
            List <Pos2> captures  = new List <Pos2>();

            int dy, dx;

            for (int i = 0; i < 2; i++)
            {
                for (int j = 0; j < 2; j++)
                {
                    dy = i * (1 - 2 * j);
                    dx = (i == 0 ? 1 : 0) * (1 - 2 * j);

                    var(tmpm, tmpc) = IPiece.CastMoves(board, pos, dy, dx, player);

                    maneuvers.AddRange(tmpm);
                    captures.AddRange(tmpc);
                }
            }
            return(maneuvers, captures);
        }
Exemplo n.º 2
0
        public (List <Pos2> m, List <Pos2> c) ListMoves(Board board, Pos2 pos, int player)
        {
            List <Pos2> maneuvers = new List <Pos2>();
            List <Pos2> captures  = new List <Pos2>();

            int dy, dx;

            for (int i = 0; i < 2; i++)
            {
                for (int j = 0; j < 2; j++)
                {
                    dy = 1 - 2 * i; // every combination of 1 & -1
                    dx = 1 - 2 * j;

                    var(tmpm, tmpc) = IPiece.CastMoves(board, pos, dy, dx, player);

                    maneuvers.AddRange(tmpm);
                    captures.AddRange(tmpc);
                }
            }
            return(maneuvers, captures);
        }
Exemplo n.º 3
0
        public (List <Pos2> m, List <Pos2> c) ListMoves(Board board, Pos2 pos, int player)
        {
            List <Pos2> maneuvers = new List <Pos2>();
            List <Pos2> captures  = new List <Pos2>();

            for (int dx = -1; dx < 2; dx++)
            {
                for (int dy = -1; dy < 2; dy++)
                {
                    if (dx == 0 && dy == 0)
                    {
                        continue;
                    }

                    var(tmpm, tmpc) = IPiece.CastMoves(board, pos, dy, dx, player);

                    maneuvers.AddRange(tmpm);
                    captures.AddRange(tmpc);
                }
            }
            return(maneuvers, captures);
        }