ソースコード
#coding:utf-8
# じゃんけん using for ... range()
import random
import os
import time
os.system('clear')
winCnt = loseCnt = draw = 0
cnt = int(input("じゃんけんを何回するか? "))
#順にcnt回じゃんけんをする
for x in range(cnt):
print(f'{x+1}回目')
#PCの手を乱数で決める
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
_
__| |_ __ __ ___ __
/ _` | '__/ _` \ \ /\ / /
| (_| | | | (_| |\ V V /
\__,_|_| \__,_| \_/\_/
''')
draw += 1
elif hand == (pc + 1) % 3:
print('パソコンの勝ち! (T_T) \n')
loseCnt += 1
else:
print('プレイヤーの勝ち!!! \(^O^)/ \n')
winCnt += 1
time.sleep(1)
#結果表示
jrate = winCnt / cnt*100
print(f'\n プレイ回数は{cnt}回\n プレイヤーが{winCnt}勝ち, {loseCnt}負け, {draw}引き分け\n 勝率は{jrate*1:.1f}%.\n' )
if jrate > 60:
print('''プレイヤーの勝ち!!! \n
@@ @@
,-@@~@-.
_ (_, O _/
| Y~. (__d._)
| r.| Y@oooood@@@@@@@@oooo@F
Y || _Y@@@@@@P "V" Y@@@@f
| t_\_/ _)@@@@@ @@@@f __ ,--,
\ `. / ~@@@@@ . . @@@@ (_ `---' ~~)
`-._/) @@@@b__|@_@|_d@@@ _l,'~ ~~)
(,db ( _ `-' _ ) ,d@_)---~~~~
Yb. \ '|\____/|` / od@P
Y@b \ | nn /','d@@P
Y@b `\`---'/'od@P
~@@@@`---'@@@P~
Y@@@@@@@@@~
@@@@@@@@ ''')
else:
print(''' プレイヤーの負け!!!
/eeeeeeeeeee\
/RRRRRRRRRR\ /eeeeeeeeeeeee\ /RRRRRRRRRR\
/RRRRRRRRRRRR\|eeeeeeeeeeeee|/RRRRRRRRRRRR\
/RRRRRRRRRRRRRR +++++++++++++ RRRRRRRRRRRRRR\
|RRRRRRRRRRRRRR ############### RRRRRRRRRRRRRR|
|RRRRRRRRRRRRR #######負 け####### RRRRRRRRRRRR|
\RRRRRRRRRRR ######### ######### RRRRRRRRRR/
|RRRRRRRRR ########## ######## RRRRRRRR|
|RRRRRRRRRR ################### RRRRRRRRR|
###### ######
##### #####
#nnn# #nnn#''')
print("BYE")