Created
November 24, 2024 20:23
-
-
Save ariedov/63cc2a359b0545a9e90ee52b82e0c925 to your computer and use it in GitHub Desktop.
A little silly game I made with my son in a few minutes.
This file contains hidden or 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
import random | |
import os | |
random.seed() | |
row = -1 | |
col = -1 | |
egg_row = random.randint(1, 3) | |
egg_col = random.randint(1, 3) | |
while True: | |
os.system('cls' if os.name == 'nt' else 'clear') | |
for i in range(1, 4): | |
for j in range(1, 4): | |
if ((i == egg_row and j == egg_col) | |
and (row == egg_row and col == egg_col)): | |
print("0", end=" ") | |
elif i == row and j == col: | |
print("X", end=" ") | |
else: | |
print("#", end=" ") | |
print() | |
if row == egg_row and col == egg_col: | |
input("Вітаю, ти знайшов яйце!") | |
row = -1 | |
col = -1 | |
random.seed() | |
egg_row = random.randint(1, 3) | |
egg_col = random.randint(1, 3) | |
try: | |
row = int(input("Який рядок? ")) | |
print(row) | |
col = int(input("Яка колонка? ")) | |
print(col) | |
except ValueError: | |
pass | |
except EOFError: | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment