Last active
October 9, 2022 11:49
-
-
Save nns2009/43227b114eddf732deaffe9b6abd0f4b to your computer and use it in GitHub Desktop.
I made a game (Bachet/Nim) in under one minute (once again, this is the second one), here it is
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Made in 43 seconds | |
# Watch this video to see how: | |
# https://youtu.be/vnYES_fba-M | |
from random import randint | |
n = randint(20, 30) | |
while True: | |
print(f'{n:2}', '|' * n) | |
v = int(input('Your turn: ')) | |
if not 1 <= v <= min(3, n): | |
continue | |
n -= v | |
if n == 0: | |
print('You win') | |
break | |
print(f'{n:2}', '|' * n) | |
v = n % 4 or randint(1, min(3, n)) | |
print('Bot turn:', v) | |
n -= v | |
if n == 0: | |
print('You lose') | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
noice