import os
import random
countries = ['Start', 'Japan', 'China', 'America', 'Canada', 'France', 'Spain', 'Korea']
value = {'Start':20, 'Japan':30, 'China':30, 'America':60, 'Canada':60, 'France':80, 'Spain':80, 'Korea':100}
countryOwner = ['N'] * len(countries)
countryHere = [''] * len(countries)
users = ['R', 'B', 'G']
usermoney = [240, 240, 240]
user = [0, 0, 0]
countryCount = len(countries)
userCount = len(users)
order = 0
def allClear():
for i in range(countryCount):
countryHere[i] = ''
while True:
for i in range(countryCount):
print('[%8s(%1s)]' %(countries[i], countryOwner[i] ), end=' ')
print()
allClear()
countryHere[user[0]] += 'R/'
countryHere[user[1]] += 'B/'
countryHere[user[2]] += 'G/'
for i in range(countryCount):
print('[%11s]' %countryHere[i], end=' ')
print()
print('%d번째 유저의 주사위 굴리는 시간입니다.(y 또는 Y를 누르고 엔터하시면 주사위가 굴러갑니다): ' %(order+1), end='>>>')
x = input()
if x == 'y' or x == 'Y':
dice = random.randint(1, 6)
print('Dice result is %d' %dice)
user[order] += dice
user[order] %= countryCount
print('%d번째 유저의 위치는 %d입니다.' %(order+1, user[order]))
print(user)
order += 1
order %= userCount
print('%d번째 유저님 땅을 사실건지 결정하는 시간입니다.(y 또는 Y를 누르고 엔터하시면 사고 n 또는 N을 누르시면 넘어갑니다): '%(order), end='>>>')
z = input()
if z == 'y' or z == 'Y':
if usermoney == 0:#게임을 끝내는 조건문(원한는 것:한명 파산하면 게임 끝)
print('게임이 끝났습니다. 게임을 다시하고 싶으시다면 개임을 재실행해주세요.')
break
if countryOwner[dice] != 'N': #남의 땅을 밟았을 때
usermoney[order - 1] = usermoney[order - 1] - value[countries[dice]] #나의 돈 감소(남의 돈 추가 코드 필요)
print(usermoney) #현재 돈 프린트
continue
if countryHere[dice] == 0: #시작지점을 밟았을 때
usermoney[order - 1] = usermoney[order - 1] + value[countries[dice]] #돈 20만원 받음
print(usermoney)
countryOwner[dice] = users[order-1] #고침 필요 코드!
usermoney[order-1] = usermoney[order-1]- value[countries[dice]]#위 2사항에 해당하지 않는 경우 밟은 땅을 산다.
print(usermoney)
elif z == 'n' or z == 'N':
continue
top of page
실제 작동 상태를 확인하려면 라이브 사이트로 이동하세요.
230422
230422
댓글 0개
좋아요
댓글(0)
bottom of page