harry 視窗版猜拳和優化

2021-10-02 02:48:04 字數 1421 閱讀 1397

import requests as rq

import easygui as g

defreply

(talk)

: url =

''url = url + talk

r = rq.get(url, timeout=20)

print

(r.text)

g.msgbox(r.text)

for i in

range(10

):talk = g.enterbox(

'你好,siri'

) reply(talk)

import easygui as g

import random

# 出拳

for i in

range(3

):punches =

['石頭'

,'剪刀'

,'布'

] computer = random.choice(punches)

# 輸入視窗

user = g.enterbox(

'請出拳:(石頭,剪刀,布'

)# 展示視窗 meassage

g.msgbox(

"戰鬥中------電腦出的是%s,我們出的是%s"

%(computer, user)

)# 誰贏誰輸:判斷if(

(user ==

'石頭'

and computer ==

'剪刀')or

(user ==

'剪刀'

and computer ==

'布')

or(user ==

'布'and computer ==

'石頭'))

: g.msgbox(

'---------結果---------\n\t你贏了'

)elif user == computer:

g.msgbox(

'---------結果---------\n\t平局'

)elif

((computer ==

'石頭'

and user ==

'剪刀')or

(computer ==

'剪刀'

and user ==

'布')

or(computer ==

'布'and user ==

'石頭'))

: g.msgbox(

'---------結果---------\n\t你輸了'

)else

: g.msgbox(

'---------結果---------\n\t你呀出的是啥'

)

song 無bug版的猜拳遊戲

石頭1 布2 剪刀3 贏電腦 我們 結果 1 2 1 2 3 1 3 1 2 輸電腦 我們 結果 1 3 2 2 1 1 3 2 1 平局電腦 我們 結果 1 1 0 2 2 0 3 3 0 import random computer random.randint 1,3 int 電腦出拳 我們出...

boren 學習製作標籤版的猜拳遊戲

import random import easygui as g defpanduan c,u if c 石頭 and u 布 or c 布 and u 剪刀 or c 剪刀 and u 石頭 g.msgbox 我們贏了 elif u c g.msgbox 平局 else g.msgbox 電腦贏...

WPF開啟子視窗給父視窗新增蒙版效果

private void button click object sender,routedeventargs e 父級窗體原來的內容 uielement original mainwindows.content as uielement mainwindows父窗體 mainwindows.con...