๋ชฉ์ฐจ
728x90
์คํฐ๋ํ๋ฉด์ ๋ฐฑ์ค๋ธ๋ก ์ฆ๋ฌธ์ ์ ์๋ ๊ฒ์ ์์ฉํด์ ๋ฒ ํ ๊ฒ์์ ๋ง๋ค์ด๋ณด์!
๋ผ๊ณ ์๊ฐ์ด ๋ค์ด์ ์ฆํฅ์ ์ผ๋ก ๋ง๋ค์ด๋ณด์์ต๋๋ค.
from random import *
import time
dice_list=[]
point = 1000
game = 1
cnt = 1
print('-์ฃผ์ฌ์ ๊ฒ์-')
print('''
[๊ท์น]
1~6 ์ฃผ์ฌ์ 3๊ฐ์ ๊ฒฐ๊ณผ์ ๋ฒ ํ
ํ๋ผ!
์น๋ฆฌ ์ ํด๋น ํฌ์ธํธ ํ๋
์์ ํฌ์ธํธ 1000p
[์น๋ฆฌ ํฌ์ธํธ]
๊ฐ์ ๋ 3๊ฐ : ๋ฒ ํ
ํฌ์ธํธ +(๊ฐ์ ๋)×1,0000p
๊ฐ์ ๋ 2๊ฐ : ๋ฒ ํ
ํฌ์ธํธ +(๊ฐ์ ๋)×200p
๋ชจ๋ ๋ค๋ฅธ ๋ : ๋ฒ ํ
ํฌ์ธํธ + (๊ฐ์ฅ ํฐ ๋)×100p
[๋ฆฌ์คํฌ]
๊ฐ์ ๋ 3๊ฐ : ๋จ์ ํฌ์ธํธ์ 75%
๊ฐ์ ๋ 2๊ฐ : ๋จ์ ํฌ์ธํธ์ 50%
๋ชจ๋ ๋ค๋ฅธ ๋ : ๋จ์ ํฌ์ธํธ์ 50%
''')
while True:
game = input("๊ฒ์์ ์์ํ์๊ฒ ์ต๋๊น? (Y/N) : ").upper()
if game == 'Y':
game = 1
break
elif game == 'N':
game = 0
break
else :
print("๋ค์ ์
๋ ฅํด์ฃผ์ธ์.")
continue
while game == 1:
print("ใ
กใ
กใ
กใ
กใ
กใ
กใ
กใ
กใ
กใ
กใ
กใ
กใ
กใ
กใ
กใ
กใ
กใ
กใ
กใ
กใ
กใ
ก")
print(f"(Game-{cnt}) ์์! (ํ์ฌ ํฌ์ธํธ : {point}p)\n((1) ๊ฐ์ ๋ 3๊ฐ | (2) ๊ฐ์ ๋ 2๊ฐ | (3) ๋ชจ๋ ๋ค๋ฅธ ๋) ",end='')
while True:
start_bet = input(": ")
if start_bet == '1' or start_bet == '2' or start_bet == '3':
break
else:
print("๋ค์ ์
๋ ฅํด์ฃผ์ธ์")
continue
while True: #๋ฒ ํ
ํ๊ธฐ
betting_money= int(input(f"๋ฒ ํ
ํ ํฌ์ธํธ๋ฅผ ์
๋ ฅํ์ธ์. (ํ์ฌ ๋ณด์ ํฌ์ธํธ {point}p): "))
if point >= betting_money:
point -= betting_money
break
else :
print("ํฌ์ธํธ๋ฅผ ์๋ชป ์
๋ ฅํ์
จ์ต๋๋ค. ๋ค์ ์
๋ ฅํด์ฃผ์ธ์")
continue
for i in range(3): # ์ฃผ์ฌ์ ๋์ง๊ธฐ
throw_dice = randint(1,6)
dice_list.append(throw_dice)
print("๊ณผ์ฐ ์ฃผ์ฌ์ ๋์?")
for i in range(3):
print('|', end=' ')
time.sleep(0.7)
print(f'[{dice_list[i]}]', end=' ')
time.sleep(0.7)
print("|")
dice_overlap = set(dice_list)
dice_list.sort()
if str(len(dice_overlap))==start_bet:
print("๋ฒ ํ
์ฑ๊ณต!")
if len(dice_overlap)==3: #๋ชจ๋ ๋ค๋ฅธ ๋
earn = dice_list[-1]*100+betting_money
point += earn
print(f"ํ๋ ํฌ์ธํธ : {earn}p")
elif len(dice_overlap)==2: #๊ฐ์ ๋ 2๊ฐ
earn = dice_list[1]*200+betting_money
point += earn
print(f"ํ๋ ํฌ์ธํธ : {earn}p")
else: # ๊ฐ์ ๋ 3๊ฐ
earn = dice_list[0]*10000+betting_money
point += earn
print(f"ํ๋ ํฌ์ธํธ : {earn}p")
dice_list.clear()
while True:
print(f'ํ์ฌ ํฌ์ธํธ : {point}p')
more_game = input("๊ฒ์์ ๊ณ์ํ์๊ฒ ์ต๋๊น? (Y/N) : ").upper()
if more_game == 'Y':
cnt += 1
break
elif more_game == 'N':
game = 0
break
else :
print("๋ค์ ์
๋ ฅํด์ฃผ์ธ์.")
continue
else :
dice_list.clear()
print("์ ๋ฐ.. ํ๋ ธ์ต๋๋ค.")
if point <= 0:
print('๋ชจ๋ ํฌ์ธํธ๋ฅผ ์์์ต๋๋ค.\n-GAME OVER-')
game = 0
break
if start_bet=='1':
risk = int(point*0.75)
print(f"๋จ์ ํฌ์ธํธ์ 75%({risk}p)๋ฅผ ์์ต๋๋ค.")
point -= risk
elif start_bet=='2':
risk = int(point*0.5)
print(f"๋จ์ ํฌ์ธํธ์ 50%({risk}p)๋ฅผ ์์ต๋๋ค.")
point -= risk
else :
risk = int(point*0.5)
print(f"๋จ์ ํฌ์ธํธ์ 50%({risk}p)๋ฅผ ์์ต๋๋ค.")
point -= risk
while True:
print(f'ํ์ฌ ํฌ์ธํธ : {point}')
more_game = input("๊ฒ์์ ๊ณ์ํ์๊ฒ ์ต๋๊น? (Y/N) : ").upper()
if more_game == 'Y':
cnt += 1
break
elif more_game == 'N':
game = 0
break
else :
print("๋ค์ ์
๋ ฅํด์ฃผ์ธ์.")
continue
print("ใ
กใ
กใ
กใ
กใ
กใ
กใ
กใ
กใ
กใ
กใ
กใ
กใ
กใ
กใ
กใ
กใ
กใ
กใ
กใ
กใ
กใ
ก")
print(f"์ต์ข
ํฌ์ธํธ : {point}p")
'๐ | Python > ํ์ด์ฌ ์ด๊ฐ๋จ ํ๋ก์ ํธ' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[Python] BLE ํต์ ํ๊ธฐ with bleak (MacOS) - 2) ๋ฐ์ดํฐ ๋ฐ๊ธฐ (0) | 2023.05.24 |
---|---|
[Python] BLE ํต์ ํ๊ธฐ with bleak (MacOS) - 1) ํ์, ์ฐ๊ฒฐ (0) | 2023.05.24 |
Python_์ฌ์๋ฐค๋ฐ๋ค '์' ํ์๋ฅผ ์ธ์ด๋ณด์ (0) | 2022.01.17 |
์น ํฌ๋กค๋ง _ ๋ฆฌ๊ทธ์ค๋ธ๋ ์ ๋ ์ ์ ๊ฒ์๊ธฐ (0) | 2021.12.27 |
์ซ์์ผ๊ตฌ (0) | 2021.11.03 |
๋๊ธ