From a85a8097aeea690cd209172e1a21664ab7175299 Mon Sep 17 00:00:00 2001 From: hnu202309010107 <2215403613@qq.com> Date: Sun, 26 May 2024 16:01:39 +0800 Subject: [PATCH] ADD file via upload --- main.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 main.py diff --git a/main.py b/main.py new file mode 100644 index 0000000..99dd7ed --- /dev/null +++ b/main.py @@ -0,0 +1,34 @@ +#-*- coding:utf-8 -*- + +import pygame, sys +from pygame.locals import * +from map_show import * +from button_event import * +from ai2048 import * + + + +def run(): + game_init() + start_base_game() + while True: + #固定代码段,实现点击"X"号退出界面的功能,几乎所有的pygame都会使用该段代码 + game_drawing() + if ai2048.game_state == 0: + base_game_going() + elif ai2048.game_state == 1: + ai_2048_game_going(map_game.ai_delay_time) + #ai_2048_game_going(1) + elif ai2048.game_state == 2: + reshow_mode(map_game.ai_delay_time)#用和AI相同的速度进行回放 + #事件判断 + for event in pygame.event.get(): + if event.type == QUIT: + pygame.quit() + sys.exit() + #绘制屏幕内容 + pygame.display.update() + + +if __name__ == '__main__': + run() # 开始游戏