コード例 #1
0
        public static RoundResult GetResult(Gesture a, Gesture b)
        {
            if (a == b)
            {
                return(RoundResult.TIE);
            }
            GestVec gv = new GestVec(a, b);

            if (gestureComparisonResults.ContainsKey(gv))
            {
                return(gestureComparisonResults[gv]);
            }
            GestVec opp = gv.Opposite();

            if (gestureComparisonResults.ContainsKey(opp))
            {
                gestureComparisonResults.Add(gv, gestureComparisonResults[opp].Opposite());
                return(gestureComparisonResults[gv]);
            }
            return(RoundResult.TIE);
        }
コード例 #2
0
        public static string GetMessage(Gesture a, Gesture b)
        {
            GestVec gv = new GestVec(a, b);

            if (messages.ContainsKey(gv))
            {
                return(messages[gv]);
            }
            if (a == b)
            {
                messages.Add(gv, "The elements are at peace with each other.");
                return(messages[gv]);
            }
            GestVec opp = gv.Opposite();

            if (messages.ContainsKey(opp))
            {
                string m = messages[opp];
                messages.Add(gv, m);
                return(m);
            }
            return("");
        }