ungleich-learning-circle/kjg/python-the-hard-way/baseballgame.py
2020-06-25 00:52:32 +09:00

64 lines
1.3 KiB
Python

import baseballgameclass
size = []
a_test2 = baseballgameclass.InputNumber()
#size = a_test2.getGameSize()
#print(size)
a_test = baseballgameclass.GameNumber()
#a_test.createNumberSet(size[1], size[0])
#number = a_test.createGameNumber()
#print(number)
guess = []
a_test2 = baseballgameclass.InputNumber()
#guess = a_test2.getNumber(size[0])
a_test3 = baseballgameclass.CheckNumber()
#result3 = a_test3.compareNumber(number, guess)
a_test4 = baseballgameclass.PrintResult()
#a_test4.printResult(result3)
#print(result3)
a = 0
b = {}
b = set()
while True:
if a == 0:
# get game size and max of number
size = a_test2.getGameSize()
b = a_test.createNumberSet(size[1], size[0])
number = a_test.createGameNumber(b)
a = 1
elif a != 3:
while True:
guess = a_test2.getNumber(size[0])
result3 = a_test3.compareNumber(number, guess)
a_test4.printResult(result3)
print(number)
if result3[0] == size[0]:
print('You win.')
b = input('continue a game (y or n) : ')
if b == 'y':
a = 0
break
else:
a = 3
break
elif a == 3:
break