Example #1
0
        public override string BoardToString(Node node)
        {
            OrderAndChaosNode n      = node as OrderAndChaosNode;
            string            output = "";

            for (int y = 0; y < 6; y++)
            {
                output += "|";
                for (int x = 0; x < 6; x++)
                {
                    switch (n.GetPiece(x, y))
                    {
                    case OrderAndChaosPiece.X:
                        output += "X|";
                        break;

                    case OrderAndChaosPiece.O:
                        output += "O|";
                        break;

                    default:
                        output += " |";
                        break;
                    }
                }
                output += '\n';
            }
            return(output);
        }
Example #2
0
        public override int GetHumanMove(Node node)
        {
            Console.WriteLine("Please pick a move (x,y,piece)");
            int x = Console.ReadKey().KeyChar - '1';
            int y = Console.ReadKey().KeyChar - '1';
            OrderAndChaosPiece piece = char.ToUpper(Console.ReadKey().KeyChar) == 'X' ? OrderAndChaosPiece.X : OrderAndChaosPiece.O;

            return(OrderAndChaosNode.GetMoveAsInt(x, y, piece));
        }
Example #3
0
 public override string MoveToString(int move)
 {
     return(OrderAndChaosNode.PieceComponent(move) + " at " + (OrderAndChaosNode.Xcomponent(move) + 1) + ", " + (OrderAndChaosNode.Ycomponent(move) + 1));
 }