Commit e6d3ead6 by BellCodeEditor

auto save

parent 47f05618
Showing with 43 additions and 17 deletions
a={} import random
a[1]='abc' i=0
a[True]=234 while True:
a[False]=123 a=input("玩家:")
a[0]=567 print("玩家出拳:",a)
a[3.14]=88 cq=["石头","剪刀","布"]
a["ab"]=100 b=random.choice(cq)
a[(4,5)]=1000 print("电脑出拳:",b)
for x in a.keys(): if a in cq:
print(x) if a==b:
for x in a.values(): print("平局")
print(x) elif a=="石头" and b=="剪刀" or a=="剪刀" and b=="布" or a=="布" and b=="石头":
for x,y in a.items(): print("You Win")
print(x,y) else:
\ No newline at end of file print("You Lose")
else:
print("输入错误!")
\ No newline at end of file
import turtle
turtle.speed(0)
for i in range(5):
turtle.seth(-15)
turtle.left(30*i)
turtle.circle(70, 90)
turtle.left(90)
turtle.circle(70, 90)
turtle.hideturtle()
turtle.done()
\ No newline at end of file
a=[1,2,3]
print(id(a))
a.append(100)
print(id(a))
\ No newline at end of file
...@@ -46,16 +46,23 @@ cube_colors = [ ...@@ -46,16 +46,23 @@ cube_colors = [
(153, 0, 51), (204, 255, 102), (255, 153, 0)] (153, 0, 51), (204, 255, 102), (255, 153, 0)]
center = [2, 8] # 第2行第8列 center = [2, 8] # 第2行第8列
current_shape = t[0] index=random.randint(0,len(t)-1)
current_shape = t[index]
color=random.choice(cube_colors) color=random.choice(cube_colors)
def check(center):
for cube in current_shape:
pos = (cube[0] + center[0], cube[1] + center[1])
if cube[0]<1 or cube[1]<1 or cube[0]>grid_num_width or cube[1]>grid_num_height:
return False
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
if event.type == locals.QUIT: if event.type == locals.QUIT:
exit() exit()
if event.type == locals.KEYDOWN: if event.type == locals.KEYDOWN:
if event.key == locals.K_RIGHT: # 向右 if event.key == locals.K_RIGHT: # 向右
if center[1] < 15:
center[1] += 1 center[1] += 1
if check(center)==False:
center[1] -= 1
elif event.key == locals.K_LEFT: # 向左 elif event.key == locals.K_LEFT: # 向左
if center[1] > 1: if center[1] > 1:
center[1] -= 1 center[1] -= 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment