public virtual GameFlow ApplyAction(Board board, string action)
        {
            GameFlow flow = GameFlow.KEEP_PLAYING;

            if (movementDisplayNamesResolver.TryResolve(action, out Movement movement))
            {
                if (!tileMover.TryMove(board, movement, out string error))
                {
                    io.WriteLine($"Failed moving a tile: {error}", 3000);
                }
            }
            else if (action == newGameSymbol)
            {
                flow = GameFlow.NEW_GAME;
            }
            else if (action == endGameSymbol)
            {
                flow = GameFlow.END_GAME;
            }
            else
            {
                io.WriteLine($"'{action}' is not a legal input", 3000);
            }

            return(flow);
        }
Exemple #2
0
        private void PrintBoard(Board board)
        {
            string renderedBoard = boardRenderer.Render(board);

            io.Clear();
            io.WriteLine(renderedBoard);
        }
Exemple #3
0
 private void Welcome()
 {
     io.Clear();
     io.WriteLine("Welcome to the MagicSquare!", 1000);
 }