From f215a9a3988941bd14b3eba4cc5f65a7162dc717 Mon Sep 17 00:00:00 2001 From: BellCodeEditor <bellcode_dev@bell.ai> Date: Sun, 17 Apr 2022 09:43:04 +0800 Subject: [PATCH] auto save --- diy1.py | 21 --------------------- quiz.py | 8 -------- 贪吃蛇一/121.py | 2 ++ 贪吃蛇一/adsa.py | 17 +++++++++++++++++ 贪吃蛇一/das.py | 12 ++++++++++++ 贪吃蛇一/dscsd.py | 2 ++ 贪吃蛇一/image/apple.png | Bin 0 -> 2102 bytes 贪吃蛇一/image/bg.png | Bin 0 -> 23029 bytes 贪吃蛇一/image/body.png | Bin 0 -> 1432 bytes 贪吃蛇一/image/down.png | Bin 0 -> 2058 bytes 贪吃蛇一/image/left.png | Bin 0 -> 2122 bytes 贪吃蛇一/image/right.png | Bin 0 -> 2099 bytes 贪吃蛇一/image/up.png | Bin 0 -> 2103 bytes 贪吃蛇一/snake.py | 32 ++++++++++++++++++++++++++++++++ 14 files changed, 65 insertions(+), 29 deletions(-) delete mode 100644 diy1.py delete mode 100644 quiz.py create mode 100644 贪吃蛇一/121.py create mode 100644 贪吃蛇一/adsa.py create mode 100644 贪吃蛇一/das.py create mode 100644 贪吃蛇一/dscsd.py create mode 100644 贪吃蛇一/image/apple.png create mode 100644 贪吃蛇一/image/bg.png create mode 100644 贪吃蛇一/image/body.png create mode 100644 贪吃蛇一/image/down.png create mode 100644 贪吃蛇一/image/left.png create mode 100644 贪吃蛇一/image/right.png create mode 100644 贪吃蛇一/image/up.png create mode 100644 贪吃蛇一/snake.py diff --git a/diy1.py b/diy1.py deleted file mode 100644 index c36d75a..0000000 --- a/diy1.py +++ /dev/null @@ -1,21 +0,0 @@ -# 悟空想海龟作图画出弹簧隧道,但是出现了bug,运行不了,请你帮助他,修改bug~ -import turtle - -pen=turtle.Pen() -screen=turtle.Screen() -pen.speed('fast') -pen.hideturtle() -screen.bgcolor('black') - -i=0 -while i<135: - screen.pencolor('pink') - pen.penup() - pen.goto(0,0) - pen.forward(200) - pen.pendown() - screen.circle(100) - pen.left(2) - i+=1 - -turtle.done() \ No newline at end of file diff --git a/quiz.py b/quiz.py deleted file mode 100644 index f2ae506..0000000 --- a/quiz.py +++ /dev/null @@ -1,8 +0,0 @@ -# 勇于挑战的创造师,下面的代码犯了两类典型错误,请你把bug揪出来吧。 -area = ['盘丝洞','白骨洞','大雁塔'] -monster = {'盘丝洞':'蜘蛛精','白骨洞': '白骨精','大雁塔':'花妖'} -# 打印出大雁塔 -print(area[2]) -# 向字典中添加 '地府':'僵尸' -monster['地府']='僵尸' -print(monster) \ No newline at end of file diff --git "a/\350\264\252\345\220\203\350\233\207\344\270\200/121.py" "b/\350\264\252\345\220\203\350\233\207\344\270\200/121.py" new file mode 100644 index 0000000..b2eff6e --- /dev/null +++ "b/\350\264\252\345\220\203\350\233\207\344\270\200/121.py" @@ -0,0 +1,2 @@ +for i in range(1,1): + print(0) \ No newline at end of file diff --git "a/\350\264\252\345\220\203\350\233\207\344\270\200/adsa.py" "b/\350\264\252\345\220\203\350\233\207\344\270\200/adsa.py" new file mode 100644 index 0000000..2d07e5c --- /dev/null +++ "b/\350\264\252\345\220\203\350\233\207\344\270\200/adsa.py" @@ -0,0 +1,17 @@ +import random +while True: + computer = random.randint(1,3) + player = int(input("请输入你的猜拳数字石头(1),剪刀(2),布(3):")) + if player==0: + break + print("电脑出",computer) + if (player == 1 and computer == 2) or (player == 2 and computer == 3) or (player == 3 and computer == 1): + print("嗷嗷,电脑弱爆了") + if player == computer: + print("心有灵犀,再来一局") + else: + print("不要走,决战到天亮") +print("游戏结束") + + + diff --git "a/\350\264\252\345\220\203\350\233\207\344\270\200/das.py" "b/\350\264\252\345\220\203\350\233\207\344\270\200/das.py" new file mode 100644 index 0000000..40d14b6 --- /dev/null +++ "b/\350\264\252\345\220\203\350\233\207\344\270\200/das.py" @@ -0,0 +1,12 @@ +# a=1 +# while a<=9: +# b=1 +# while b<=a: +# print("%dx%d=%d"%(a,b,a*b),end="\t") +# b+=1 +# print() +# a+=1 +for i in range(1,10): + for j in range(1,i+1): + print("%dx%d=%d"%(i,j,i*j),end="\t") + print() diff --git "a/\350\264\252\345\220\203\350\233\207\344\270\200/dscsd.py" "b/\350\264\252\345\220\203\350\233\207\344\270\200/dscsd.py" new file mode 100644 index 0000000..eeff50b --- /dev/null +++ "b/\350\264\252\345\220\203\350\233\207\344\270\200/dscsd.py" @@ -0,0 +1,2 @@ +for i in range(100,1000): + \ No newline at end of file diff --git "a/\350\264\252\345\220\203\350\233\207\344\270\200/image/apple.png" "b/\350\264\252\345\220\203\350\233\207\344\270\200/image/apple.png" new file mode 100644 index 0000000..e58cb8f Binary files /dev/null and "b/\350\264\252\345\220\203\350\233\207\344\270\200/image/apple.png" differ diff --git "a/\350\264\252\345\220\203\350\233\207\344\270\200/image/bg.png" "b/\350\264\252\345\220\203\350\233\207\344\270\200/image/bg.png" new file mode 100644 index 0000000..a085237 Binary files /dev/null and "b/\350\264\252\345\220\203\350\233\207\344\270\200/image/bg.png" differ diff --git "a/\350\264\252\345\220\203\350\233\207\344\270\200/image/body.png" "b/\350\264\252\345\220\203\350\233\207\344\270\200/image/body.png" new file mode 100644 index 0000000..a254609 Binary files /dev/null and "b/\350\264\252\345\220\203\350\233\207\344\270\200/image/body.png" differ diff --git "a/\350\264\252\345\220\203\350\233\207\344\270\200/image/down.png" "b/\350\264\252\345\220\203\350\233\207\344\270\200/image/down.png" new file mode 100644 index 0000000..41d1525 Binary files /dev/null and "b/\350\264\252\345\220\203\350\233\207\344\270\200/image/down.png" differ diff --git "a/\350\264\252\345\220\203\350\233\207\344\270\200/image/left.png" "b/\350\264\252\345\220\203\350\233\207\344\270\200/image/left.png" new file mode 100644 index 0000000..365dffe Binary files /dev/null and "b/\350\264\252\345\220\203\350\233\207\344\270\200/image/left.png" differ diff --git "a/\350\264\252\345\220\203\350\233\207\344\270\200/image/right.png" "b/\350\264\252\345\220\203\350\233\207\344\270\200/image/right.png" new file mode 100644 index 0000000..e77639a Binary files /dev/null and "b/\350\264\252\345\220\203\350\233\207\344\270\200/image/right.png" differ diff --git "a/\350\264\252\345\220\203\350\233\207\344\270\200/image/up.png" "b/\350\264\252\345\220\203\350\233\207\344\270\200/image/up.png" new file mode 100644 index 0000000..44f2e28 Binary files /dev/null and "b/\350\264\252\345\220\203\350\233\207\344\270\200/image/up.png" differ diff --git "a/\350\264\252\345\220\203\350\233\207\344\270\200/snake.py" "b/\350\264\252\345\220\203\350\233\207\344\270\200/snake.py" new file mode 100644 index 0000000..be49502 --- /dev/null +++ "b/\350\264\252\345\220\203\350\233\207\344\270\200/snake.py" @@ -0,0 +1,32 @@ +import pygame +from pygame import locals + +# 初始化pygame,为使用硬件做准备 +pygame.init() + +# 创建一个窗口 +screen = pygame.display.set_mode((660, 480)) + +# 背景 +background = pygame.image.load('贪吃蛇一/image/bg.png') +right = pygame.image.load('贪吃蛇一/image/right.png') +food = pygame.image.load('贪吃蛇一/image/apple.png') +body = pygame.image.load('贪吃蛇一/image/body.png') + +while True: + for event in pygame.event.get(): + if event.type == locals.QUIT: + # 接收到退出事件后退出程序 + exit() + # 将背景图画上去 + screen.blit(background, (0, 0)) + # 将贪吃蛇画上去 + screen.blit(right, (240, 120)) + # 将贪吃蛇的身体画上去 + screen.blit(body, (210, 120)) + screen.blit(body, (180, 120)) + screen.blit(body, (180, 90)) + # 将果实画上去 + screen.blit(food, (360, 300)) + # 刷新画面 + pygame.display.update() \ No newline at end of file -- libgit2 0.25.0