# coding: utf-8
#じゃんけん using for ...()
import random
import os
import time
os.system('clear')
WinCnt = loseCnt = draw = 0
cnt = int(input("じゃんけんを何回するか"))
for x in range(cnt):
print(f'{x+1 }回目')
pc= random.randint(0,2)
hand =int(input('1:チョキ 2:パー 3:グー\n'))-1
while hand < 0 or hand >2:
print ("入力ミス\n")
hand = int(input(' 1: チョキ 2: パー 3: ぐー \n'))-1
#じゃんけんの勝敗判断
if hand == pc:
print('あいこ! (~^~)\n')
draw += 1
elif hand == (pc + 1) % 3:
print('パソコンの勝ち! \n')
loseCnt += 1
else:
print('''プレイヤーの勝ち!
,--,
,---. ,--, .---. ,--.'| ,---,
' ,'\ ,'_ /| /. ./| | |, ,-+-. / |
.--, / / | .--. | | : .-'-. ' | `--'_ ,--.'|' |
/_ ./| . ; ,. : ,'_ /| : . | /___/ \: | ,' ,'| | | ,"' |
, ' , ' : ' | |: : | ' | | . . .-'.. ' ' . ' | | | | / | |
/___/ \: | ' | .; : | | ' | | | /___/ \: ' | | : | | | | |
. \ ' | | : | : | : ; ; | . \ ' .\ ' : |__ | | | |/
\ ; : \ \ / ' : `--' \ \ \ ' \ | | | '.'| | | |--'
\ \ ; `----' : , .-./ \ \ |--" ; : ; | |/
: \ \ `--`----' \ \ | | , / '---'
\ ' ; '---" ---`-'
`--` \n''')
WinCnt += 1
time.sleep(1)
#結果表示
jrate = WinCnt / cnt
print(f'\n プレイ回数は{cnt}回\n プレイヤーが{WinCnt}勝ち, {loseCnt}負け, {draw}引き分け\n 勝率は{jrate*100:.1f}%.\n' )
print("BYE")