Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -25,4 +25,26 @@ def main():
|
|
25 |
st.write(f"Computer chose: {computer_choice}")
|
26 |
|
27 |
# Determine the winner
|
28 |
-
if user_choice ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
st.write(f"Computer chose: {computer_choice}")
|
26 |
|
27 |
# Determine the winner
|
28 |
+
if user_choice == computer_choice:
|
29 |
+
result = "It's a tie!"
|
30 |
+
elif (
|
31 |
+
(user_choice == "Rock" and computer_choice == "Scissors") or
|
32 |
+
(user_choice == "Paper" and computer_choice == "Rock") or
|
33 |
+
(user_choice == "Scissors" and computer_choice == "Paper")
|
34 |
+
):
|
35 |
+
result = "You win!"
|
36 |
+
st.session_state.user_points += 1
|
37 |
+
else:
|
38 |
+
result = "You lose!"
|
39 |
+
st.session_state.computer_points += 1
|
40 |
+
|
41 |
+
# Display the result
|
42 |
+
st.write(result)
|
43 |
+
|
44 |
+
# Display the points
|
45 |
+
st.write(f"Your points: {st.session_state.user_points}")
|
46 |
+
st.write(f"Computer's points: {st.session_state.computer_points}")
|
47 |
+
|
48 |
+
# Run the app
|
49 |
+
if __name__ == "__main__":
|
50 |
+
main()
|