예제 #1
0
    internal void UserInput(Gestures g)
    {
        Gestures aiGesture = ai.MakeDecision(g);

        figure1.text = GestureToString(g);
        figure2.text = GestureToString(aiGesture);

        result.text = "UNKNOWN";
        if (RPSRules.FirstBeatsSecond(g, aiGesture))
        {
            result.text = "WON";
            score.addP1();
        }
        else if (RPSRules.FirstBeatsSecond(aiGesture, g))
        {
            result.text = "LOST";
            score.addP2();
        }
        else if (RPSRules.IsDraw(aiGesture, g))
        {
            result.text = "DRAW";
        }

        gameObject.SetActive(true);
    }
예제 #2
0
        static void Main()
        {
            Logic  rules;
            Player player1, player2;
            Game   game;

            rules = new RPSRules();
            RulesInfo(rules);
            player1 = CreatePlayer(Player1Prompt, rules);
            player2 = CreatePlayer(Player2Prompt, rules);
            game    = new Game(player1, player2, rules);

            for (int i = 0; i < 10; i++)
            {
                NewRound(player1, player2, game);
            }


            rules = new RPSLSRules();
            RulesInfo(rules);

            player1 = CreatePlayer(Player1Prompt, rules);
            player2 = CreatePlayer(Player2Prompt, rules);
            game    = new Game(player1, player2, rules);

            for (int i = 0; i < 10; i++)
            {
                NewRound(player1, player2, game);
            }
        }
예제 #3
0
파일: IAI.cs 프로젝트: ilushareg/RPS_Unity
 public Gestures MakeDecision(Gestures gOpponent)
 {
     //TODO: make not so clever
     return(RPSRules.GetWinGesture(gOpponent));
 }
예제 #4
0
파일: IAI.cs 프로젝트: ilushareg/RPS_Unity
 public Gestures MakeDecision(Gestures gOpponent)
 {
     return(RPSRules.GetRandomGesture());
 }
예제 #5
0
파일: IAI.cs 프로젝트: ilushareg/RPS_Unity
 public Gestures MakeDecision(Gestures g)
 {
     return(RPSRules.GetWinGesture(g));
 }