Exemplo n.º 1
0
 public Move(pos oldPosition, pos newPosition, FigID movedID, FigID removedID)
 {
     oldPos         = oldPosition;
     newPos         = newPosition;
     this.movedID   = movedID;
     this.removedID = removedID;
 }
Exemplo n.º 2
0
        private Lpos PawnEnPassantCapture(FigID oppositeFigID)
        {
            var retVal = new Lpos();

            if (position.Item1 < xwidth - 1 && state[position.Item1 + 1, position.Item2] == oppositeFigID)
            {
                retVal.Add(new pos((byte)(position.Item1 + 1), (byte)(position.Item2 + 1)));
            }
            if (position.Item1 > 0 && state[position.Item1 - 1, position.Item2] == oppositeFigID)
            {
                retVal.Add(new pos((byte)(position.Item1 - 1), (byte)(position.Item2 + 1)));
            }
            return(retVal);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Returns null if could not be converted.
        /// </summary>
        /// <param name="s"></param>
        /// <returns></returns>
        public static string InternalToConsoleOutput(pos from, pos to, FigID figID)
        {
            try
            {
                var xFrom           = char.ToLower((char)(from.Item1 + 65));
                var yFrom           = (from.Item2 + 1).ToString();
                var xTo             = char.ToLower((char)(to.Item1 + 65));
                var yTo             = (to.Item2 + 1).ToString();
                var outputShorthand = Constants.BlackIDToShorthand[figID];

                return(outputShorthand + xFrom + yFrom + "," + xTo + yTo);
            }
            catch
            {
                return(null);
            }
        }
Exemplo n.º 4
0
        public bool Color; //true = white;
        public Figure(FigID id, bool color = true)
        {
            Color = color;
            switch (id)
            {
            case FigID.Nothing:
                ID     = 0;
                Symbol = ' ';
                Value  = 0;
                Icon   = new bool[5, 12];
                break;

            case FigID.FKing:
                ID     = 1;
                Symbol = 'K';
                Value  = 0;
                Icon   = new bool[, ]
                {
                    { false, false, false, false, false, true, true, false, false, false, false, false, false },
                    { false, true, true, false, true, true, true, true, false, true, true, false, false },
                    { false, true, true, true, true, true, true, true, true, true, true, false, false },
                    { false, false, true, true, false, false, false, false, true, true, false, false, false },
                    { false, true, true, true, true, true, true, true, true, true, true, false, false },
                };
                break;

            case FigID.FQueen:
                ID     = 2;
                Symbol = 'Q';
                Value  = 9;
                Icon   = new bool[, ]
                {
                    { false, true, false, false, true, false, false, true, false, false, true, false, false },
                    { false, false, true, false, true, false, false, true, false, true, false, false, false },
                    { false, false, true, true, true, true, true, true, true, true, false, false, false },
                    { false, false, false, true, false, false, false, false, true, false, false, false, false },
                    { false, false, true, true, true, true, true, true, true, true, false, false, false },
                };
                break;

            case FigID.FRook:
                ID     = 3;
                Symbol = 'R';
                Value  = 5;
                Icon   = new bool[, ]
                {
                    { false, false, true, false, true, false, false, true, false, true, false, false },
                    { false, false, true, true, true, true, true, true, true, true, false, false },
                    { false, false, false, true, true, true, true, true, true, false, false, false },
                    { false, false, false, true, true, true, true, true, true, false, false, false },
                    { false, false, true, true, true, true, true, true, true, true, false, false },
                };
                break;

            case FigID.FKnight:
                ID     = 4;
                Symbol = 'N';
                Value  = 3;
                Icon   = new bool[, ]
                {
                    { false, false, false, false, true, true, true, true, true, false, false, false },
                    { false, false, false, true, true, true, false, true, true, true, false, false },
                    { false, false, true, true, false, false, true, true, true, true, false, false },
                    { false, false, false, false, false, true, true, true, true, true, false, false },
                    { false, false, false, true, true, true, true, true, true, true, true, false },
                };
                break;

            case FigID.FBishop:
                ID     = 5;
                Symbol = 'B';
                Value  = 3;
                Icon   = new bool[, ]
                {
                    { false, false, false, false, false, true, true, false, false, false, false, false },
                    { false, false, false, false, true, true, true, true, false, false, false, false },
                    { false, false, false, true, true, false, false, true, true, false, false, false },
                    { false, false, false, false, true, true, true, true, false, false, false, false },
                    { false, false, true, true, true, true, true, true, true, true, false, false },
                };
                break;

            case FigID.FPawn:
                ID     = 6;
                Symbol = 'P';
                Value  = 1;
                Icon   = new bool[, ]
                {
                    { false, false, false, false, false, false, false, false, false, false, false, false },
                    { false, false, false, false, false, true, true, false, false, false, false, false },
                    { false, false, false, false, true, true, true, true, false, false, false, false },
                    { false, false, false, false, false, true, true, false, false, false, false, false },
                    { false, false, false, true, true, true, true, true, true, false, false, false },
                };
                break;

            default:
                break;
            }
        }
Exemplo n.º 5
0
 protected void SetPositionToFigure(pos givenPosition, FigID givenID)
 {
     IDtoFigure[givenID].position = givenPosition;
 }