public void AddressableBoard_Distance_TwoPieces()
        {
            AddressableBoard board = new AddressableBoard();

            board.Fields = new Common.SchemaWrapper.TaskField[10, 10];
            for (int i = 0; i < 10; i++)
            {
                for (int j = 2; j < 9; j++)
                {
                    board.Fields[i, j] = new TaskField()
                    {
                        X = (uint)i, Y = (uint)j
                    };
                }
            }
            List <Piece> pieceList = new List <Piece>();

            pieceList.Add(new Piece()
            {
                Location = new Common.Schema.Location()
                {
                    x = 3, y = 4
                }, IsCarried = false, PlayerId = null
            });
            pieceList.Add(new Piece()
            {
                Location = new Common.Schema.Location()
                {
                    x = 6, y = 6
                }, IsCarried = false, PlayerId = null
            });
            board.UpdateDistanceToPiece(pieceList);

            Assert.AreEqual((int)1, (board.Fields[3, 5] as TaskField).DistanceToPiece);
        }
        public static void Print(AddressableBoard board)
        {
            if (board.Width > Console.LargestWindowWidth)
            {
                Console.WriteLine("Board too wide. Won't be displayed properly");
            }

            uint boardHeight = board.TasksHeight + 2 * board.GoalsHeight;

            for (int y = 0; y < boardHeight; y++)
            {
                for (int x = 0; x < board.Width; x++)
                {
                    PrintField(board.Fields[x, y]);
                }
                Console.WriteLine();
            }
        }
        public static void PrintAlternative(AddressableBoard board)
        {
            for (int y = 0; y < board.Height; y++)
            {
                for (int x = 0; x < board.Width; x++)
                {
                    var field = board.Fields[x, y];
                    if (field == null)
                    {
                        Console.Write("?");
                        return;
                    }
                    if (field is GoalField)
                    {
                        var f = field as GoalField;
                        //switch (f.Team)
                        //{
                        //    case Schema.TeamColour.red:
                        //        Console.ForegroundColor = ConsoleColor.DarkRed;
                        //        break;
                        //    case Schema.TeamColour.blue:
                        //        Console.ForegroundColor = ConsoleColor.DarkBlue;
                        //        break;
                        //}
                        switch (f.Type)
                        {
                        case Schema.GoalFieldType.goal:
                        {
                            Console.BackgroundColor = ConsoleColor.Yellow;
                            break;
                        }

                        case Schema.GoalFieldType.nongoal:
                        {
                            Console.BackgroundColor = ConsoleColor.DarkYellow;
                            break;
                        }

                        case Schema.GoalFieldType.unknown:
                        {
                            Console.BackgroundColor = ConsoleColor.Gray;
                            break;
                        }
                        }
                        Console.ForegroundColor = ConsoleColor.Black;
                        if (f.PlayerId.HasValue)
                        {
                            Console.Write(f.PlayerId.Value);
                        }
                        else
                        {
                            Console.Write(" ");
                        }
                    }
                    else if (field is TaskField)
                    {
                        var f = field as TaskField;
                        Console.BackgroundColor = ConsoleColor.DarkGreen;

                        if (f.PieceId.HasValue)
                        {
                            Console.BackgroundColor = ConsoleColor.Magenta;
                            //Console.Write("P");
                        }
                        if (f.PlayerId.HasValue)
                        {
                            ulong plid = f.PlayerId.Value;
                            Console.ForegroundColor = ConsoleColor.Black;
                            Console.Write(plid);
                        }
                        else
                        {
                            Console.ForegroundColor = ConsoleColor.Black;
                            Console.Write(" ");
                        }
                    }

                    Console.ResetColor();
                }
                Console.WriteLine();
            }
        }
 public GameState(AddressableBoard board)
 {
     this.board = board;
 }