Pygame
高一少年
Things will come your way
展开
-
collapse.动态规划
题目分析 from building import * def max_food(building: Building) -> int: """returns the maximum number of food that can be collected from given building""" length = 2 * building.size + 1 dp = [[0 for i in range(length)] for j in range(length原创 2020-06-02 08:55:38 · 479 阅读 · 0 评论 -
迷宫探索—图的应用
迷宫探索——DFS&BFS应用 深度优先搜索DFS 广度优先搜索BFS 迷宫的初始化 import pygame import random black = ( 0, 0, 0) white = ( 255, 255, 255) green = ( 0, 255, 0) red = ( 255, 0, 0) yellow = (...原创 2019-11-17 11:00:46 · 282 阅读 · 1 评论 -
Python贪吃蛇——‘AI’锁头
- 主要任务 实现游戏结束判定,包括: 玩家碰到边界、玩家撞到障碍物、玩家撞到AI、AI撞到玩家、玩家撞到自己 食物设置、障碍物设置 分数设置 - 游戏特点 AI能实现锁头追踪 具体代码如下: import pygame import random # --- Globals --- # Colors BLACK = (0, 0, 0) WHITE = (255, 255, 255) R...原创 2019-11-02 20:40:39 · 973 阅读 · 0 评论