Ejemplo n.º 1
0
        private void MatchAgainstComputer(MatchmakerTicket ticket)
        {
            // TODO: randomize colors and pieces, now the AI is always black

            var match = new MatchEntity {
                WhitePlayer    = ticket.Player,
                WhitePlayerSet = ticket.ChessSet.whiteHalf,

                BlackPlayer    = null,
                BlackPlayerSet = ChessHalfSet.CreateDefaultHalfSet(
                    PieceColor.Black
                    )
            };

            SaveAndStartMatch(new[] { ticket }, match);
        }
Ejemplo n.º 2
0
        public static ChessHalfSet CreateDefaultHalfSet(PieceColor color)
        {
            var edition = PieceEdition.Default;

            var set = new ChessHalfSet(color);

            for (int i = 0; i < 8; i++)
            {
                set.pawns[i] = new PieceId(PieceType.Pawn, color, edition);
            }

            set.king        = new PieceId(PieceType.King, color, edition);
            set.queen       = new PieceId(PieceType.Queen, color, edition);
            set.leftRook    = new PieceId(PieceType.Rook, color, edition);
            set.rightRook   = new PieceId(PieceType.Rook, color, edition);
            set.leftKnight  = new PieceId(PieceType.Knight, color, edition);
            set.rightKnight = new PieceId(PieceType.Knight, color, edition);
            set.leftBishop  = new PieceId(PieceType.Bishop, color, edition);
            set.rightBishop = new PieceId(PieceType.Bishop, color, edition);

            return(set);
        }