You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Lets iterate through each of our rounds finding the results
45
+
score_data= []
46
+
forroundinround_data:
47
+
score_data.append(score_RPS(round))
48
+
49
+
returnscore_data
50
+
51
+
defscore_RPS(round_data) ->int:
52
+
''' Takes in a single game of rock paper scissors and returns the score.
53
+
54
+
Naming:
55
+
A, X: rock
56
+
B, Y: paper
57
+
C, Z: scissors
58
+
59
+
Scoring:
60
+
By Choice:
61
+
Rock: 1
62
+
Paper: 2
63
+
Scissors: 3
64
+
By outcome:
65
+
Win: 6
66
+
Draw: 3
67
+
Loss: 0
68
+
69
+
Arguments:
70
+
String representing two choices, your opponents and yours, split by a space.
71
+
72
+
Returns:
73
+
Integer representing number of point you would get for that round.
74
+
'''
75
+
''' Making both answers the same value + 1
76
+
77
+
Alright, listen up
78
+
79
+
ord is a python function that turns alphabetical characters into ordinals.
80
+
chr reverses that
81
+
82
+
i.e. ord('X') is 88, ord('A') is 65
83
+
Here is a table for continence https://www.johndcook.com/ascii.png
84
+
85
+
Now lets talk about scoring. If we ordinate our answer and minus 87, we just get our score. i.e. ord('X') - 87 == 1.
86
+
87
+
Now lets talk about solving. To start (stay with me), we'll ordinate our vote, remove 23, then characterize. This results in our votes being in the same field as our opponents. i.e. rock = A, paper = B...
88
+
Dual is simple, if we match, we draw
89
+
To check for winning, we can simply check if ours is one higher or two lower
0 commit comments