猫史档案馆


【Python作品分享】推箱子教程-前两个函数【教程贴】

用户:春娇Vicky春娇Vicky查看:0 回复:2 评论:0 创建时间:2021-07-12T17:50:30


【作品展示】

center_image

 

【作品介绍】

来了!推箱子小游戏!

 

【作品源代码】

def Init():

    Interface = [2, 0, 0, 0, 0, 2, 0, 0, 2, 2, 0, 2, 0, 5, 1, 2, 0, 2, 0, 0, 1, 2, 0, 0, 0, 0, 2, 1, 2, 0, 0, 4, 1, 2, 2, 0, 4, 4, 3, 4, 0, 0, 0, 0, 0, 0]
    return Interface

def show(Interface):

    global target_flag
    for i in range(len(Interface)):
        for j in range(len(Interface[i])):
            if ((j + 1) % len(Interface[i]) != 0):
                end = ''
            else:
                end = '\n'
            if (Interface[i][j] == 0):
                print('□', end = end)
            if (Interface[i][j] == 1):
                print('星形', end = end)
                # 因为符号中没有星星,所以我就打字了
            if (Interface[i][j] == 2):
                print('      ', end = end)
            if (Interface[i][j] == 3):
                print('○', end = end)
                if (target_flag == 1):
                    target.append([i, j])
                    if (Interface[i][j] == 4):
                        print('星星', end = end)
                    if (target_flag == 1):
                        target.append([i, j])
                    if (Interface[i][j] == 5):
                        print('♀', end = end)
    print('SHOW COMPLETE!')
    target_flag += 1

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 1下一页
浮躁的飓风雀HYKa浮躁的飓风雀HYKa

 

点赞0


评论


Python-happyyyyPython-happyyyy

哈哈

点赞0


评论