Ejemplo n.º 1
0
        public string Input(string c)
        {
            string   result = "";
            Sentence n      = new Sentence(c, reg);

            foreach (string[] action in n.action)
            {
                if (action[0].Equals("send"))
                {
                    n.from.Send(action[1], n.to);
                    result = n.to_str;
                }
                else if (action[0].Equals("claim"))
                {
                    n.from.Claim(action[1], n.to, this);
                    result = n.to_str;
                }
                else if (action[0].Equals("pass"))
                {
                    if (n.from.Pass(n.to, this))
                    {
                        result = n.to_str;
                    }
                    else
                    {
                        result = "!" + n.from_str;
                        break;
                    }
                }
                else if (action[0].Equals("guess"))
                {
                    bool guess = (action[1] == "1") ? true : false;
                    if (n.from.Guess(guess, this))
                    {
                        n.from.last.showedcardlist.Add(n.from.onpass);
                        result = reg.getRef(n.from.last);
                    }
                    else
                    {
                        n.from.showedcardlist.Add(n.from.onpass);
                        result = n.from_str;
                    }
                }
                else
                {
                    result = "DIE";
                }
            }
            if (this.isGameOver(n))
            {
                this.gameGoing = false;
                return(result);
            }
            return(result);
        }