예제 #1
0
        public Square(string name, SquareBoard board)
        {
            Name  = name;
            Board = board;
            Length boardWidth = Board.Width;

            Width = boardWidth / Board.DivisionsPerSide;
        }
예제 #2
0
        public static ICollection <PiecePlacement> PlaceStandardChessPeices
            (SquareBoard board, Player player1, Player player2)
        {
            ICollection <PiecePlacement> placedPieces = new List <PiecePlacement>();
            ICollection <Square>         squares      = AlgebraicNotatator.GetStandardChessSquares(board);

            return(placedPieces);
        }
예제 #3
0
        private static IEnumerable <Square> DiscardSquares(int i, SquareBoard board)
        {
            List <Square> squares = new List <Square>();

            squares.Add(GetLeftDiscardSquare(i, board));
            squares.Add(GetRightDiscardSquare(i, board));
            squares.Add(GetTopDiscardSquare(i, board));
            squares.Add(GetBottomDiscardSquare(i, board));
            return(squares);
        }
예제 #4
0
 public PickAndPlayService(PickAndPlaySettings settings)
 {
     Settings = settings;
     Board    = new SquareBoard(settings.BoardSize);
     Squares  = AlgebraicNotatator.GetStandardChessSquares(Board);
     Sender   = new GCoderSender();
     Sender.Start();
     Sender.SendHome();
     Sender.SetSepeed(Settings.Speed);
     State = new GameState();
 }
예제 #5
0
        public static ICollection <Square> GetStandardChessSquares(SquareBoard board)
        {
            List <Square> Squares = new List <Square>();

            for (int i = 1; i <= 8; i++)
            {
                Squares.AddRange(StandardSquaresForRow(i, board));
                Squares.AddRange(DiscardSquares(i, board));
            }
            return(Squares);
        }
예제 #6
0
        private static IEnumerable <Square> StandardSquaresForRow(int i, SquareBoard board)
        {
            List <Square> squares = new List <Square>();

            squares.Add(new Square("a" + i, board, GetCenterPoint(board, 1, i)));
            squares.Add(new Square("b" + i, board, GetCenterPoint(board, 2, i)));
            squares.Add(new Square("c" + i, board, GetCenterPoint(board, 3, i)));
            squares.Add(new Square("d" + i, board, GetCenterPoint(board, 4, i)));
            squares.Add(new Square("e" + i, board, GetCenterPoint(board, 5, i)));
            squares.Add(new Square("f" + i, board, GetCenterPoint(board, 6, i)));
            squares.Add(new Square("g" + i, board, GetCenterPoint(board, 7, i)));
            squares.Add(new Square("h" + i, board, GetCenterPoint(board, 8, i)));
            return(squares);
        }
예제 #7
0
 public Square(string name, SquareBoard board, Point center) : this(name, board)
 {
     Center = center;
 }
예제 #8
0
        private static Square GetBottomDiscardSquare(int i, SquareBoard board)
        {
            Point centerPoint = new Point(GetCoordinate(board, i), GetCoordinate(board, 0));

            return(new Square("l" + i, board, centerPoint));
        }
예제 #9
0
        private static Square GetRightDiscardSquare(int i, SquareBoard board)
        {
            Point centerPoint = new Point(GetCoordinate(board, 9), GetCoordinate(board, i));

            return(new Square("j" + i, board, centerPoint));
        }
예제 #10
0
        private static double GetCoordinate(SquareBoard board, int placeFromOrigin)
        {
            Length CenterAtOriginToFarthestCenter = (board.Width * (board.DivisionsPerSide - 1) / board.DivisionsPerSide);

            return((((board.Width / board.DivisionsPerSide) * (placeFromOrigin - 1)) - CenterAtOriginToFarthestCenter / 2).Millimeters);
        }
예제 #11
0
 private static Point GetCenterPoint(SquareBoard board, int placeFromLeft, int placeFromBottom)
 {
     return(new Point(GetCoordinate(board, placeFromLeft), GetCoordinate(board, placeFromBottom)));
 }