Exemplo n.º 1
0
 public void WriteLine()
 {
     for (int i = 0; i < this.controller.GetWidth(); i++)
     {
         Consola.GetInstance().Write(Message.SECRET.ToString());
     }
     Consola.GetInstance().WriteLine();
 }
        public void Read()
        {
            Error error;

            do
            {
                String combination = Consola.GetInstance().ReadString(Message.PROPOSED_COMBINATION.ToString());
                error = this.proposedCombination.CheckError(combination);
                Consola.GetInstance().WriteLine(error.ToString());
                if (error.IsNull())
                {
                    this.proposedCombination.GetColors().AddRange(combination.Select(Color.GetInstance));
                }
            } while (!error.IsNull());
        }
        public List <Color> Read()
        {
            Error        error;
            List <Color> colors = new List <Color>();

            do
            {
                String combination = Consola.GetInstance().ReadString(Message.PROPOSED_COMBINATION.ToString());
                error = this._logic.CheckError(combination);
                Consola.GetInstance().WriteLine(error.ToString());
                if (error.IsNull())
                {
                    colors.AddRange(combination.Select(Color.GetInstance));
                }
            } while (!error.IsNull());

            return(colors);
        }
Exemplo n.º 4
0
        public void Write()
        {
            Consola.GetInstance().WriteLine();
            Consola.GetInstance()
            .WriteLine(Message.ATTEMPTS.ToString().Replace("#attempts", this.Board.GetAttemps().ToString()));
            this._secretCombinationView.WriteLine();
            for (int i = 0; i < this.Board.GetAttemps(); i++)
            {
                new ProposedCombinationView(this.Board.GetProposedCombination(i)).Write();
                new ResultView(this.Board.GetResult(i)).WriteLine();
            }

            if (this.Board.IsWinner())
            {
                Consola.GetInstance().WriteLine(Message.WINNER.ToString());
            }
            else if (this.Board.IsLooser())
            {
                Consola.GetInstance().WriteLine(Message.LOOSER.ToString());
            }
        }
        public void Write()
        {
            Consola.GetInstance().WriteLine();
            Consola.GetInstance()
            .WriteLine(Message.ATTEMPTS.ToString().Replace("#attempts", this._playController.GetAttemps().ToString()));
            this._secretCombinationView.WriteLine();
            for (int i = 0; i < this._playController.GetAttemps(); i++)
            {
                this._proposedCombinationView.Write(i);
                this._resultView.WriteLine(i);
            }

            if (this._playController.IsWinner())
            {
                Consola.GetInstance().WriteLine(Message.WINNER.ToString());
            }
            else if (this._playController.IsLooser())
            {
                Consola.GetInstance().WriteLine(Message.LOOSER.ToString());
            }
        }
Exemplo n.º 6
0
        public void Write()
        {
            int attempts = this.playController.GetAttemps();

            Consola.GetInstance().WriteLine();
            new MessageView().WriteLine(Message.ATTEMPTS, attempts);
            new SecretCombinationView(this.playController).WriteLine();
            for (int i = 0; i < attempts; i++)
            {
                new ProposedCombinationView(this.playController).Write(i);
                new ResultView(this.playController).WriteLine(i);
            }

            if (this.playController.IsWinner())
            {
                Consola.GetInstance().WriteLine(Message.WINNER.ToString());
            }
            else if (this.playController.IsLooser())
            {
                Consola.GetInstance().WriteLine(Message.LOOSER.ToString());
            }
        }
 public void Interact(StartController startController)
 {
     Consola.GetInstance().WriteLine(Message.TITLE.ToString());
     new SecretCombinationView(startController).WriteLine();
     startController.Next();
 }
Exemplo n.º 8
0
 public void Interact()
 {
     Consola.GetInstance().WriteLine(Message.TITLE.ToString());
     new SecretCombinationView(this._logic).WriteLine();
 }
 public void WriteLine(Message message)
 {
     Consola.GetInstance().WriteLine(message.ToString());
 }
        public void WriteLine(Message message, int blacks, int whites)
        {
            Debug.Assert(message == Message.RESULT);

            Consola.GetInstance().WriteLine(message.ToString().Replace("#blacks", blacks.ToString()).Replace("#whites", whites.ToString()));
        }
        public void WriteLine(Message message, int attempts)
        {
            Debug.Assert(message == Message.ATTEMPTS);

            Consola.GetInstance().WriteLine(message.ToString().Replace("#attempts", attempts.ToString()));
        }
 public void WriteLine(int position)
 {
     Consola.GetInstance().WriteLine(Message.RESULT.ToString().Replace("#blacks", this.playController.GetBlacksResult(position).ToString()).Replace("#whites", "" + this.playController.GetWhitesResult(position).ToString()));
 }
 public void WriteLine()
 {
     Consola.GetInstance().WriteLine(Message.RESULT.ToString().Replace("#blacks", this._result.GetBlacks().ToString()).Replace("#whites", "" + this._result.GetWhites().ToString()));
 }