贪吃蛇小游戏 pycharm——pygame game.py import pygame # 导包 from game_items import * # 导类和变量 class Game(object): # 这里的object类,意为顶级/基础类。 def __init__(self): self ...
分类:
编程语言 时间:
2020-07-30 14:24:28
阅读次数:
72
一 词汇训练 类(class):告诉python创建一个新类型的东西。(Tell python to make a new type of thing). 对象(object):两种含义:最基本类型的东西,任何实例。(the most basic type of thing,and any inst ...
分类:
其他好文 时间:
2020-07-29 21:49:24
阅读次数:
77
//面向对象开发//创建方格var sw=20, //小方格的宽 sh=20, //小方格的高 tr=30, //行数 td=30; //列数//蛇的实例 var snake = null,//食物的实例 food=null,//游戏的实例 game=null;// 构造函数// x 横坐标 y 纵 ...
分类:
Web程序 时间:
2020-07-29 21:42:16
阅读次数:
78
通过文件夹导入包要求每个目录下都有一个__init__.py文件,此文件可空白。也可不空。 a@ubuntu:~/Desktop$ tree myp myp ├── a │ ├── b.py │ └── __init__.py └── __init__.py 1 directory, 3 files ...
分类:
编程语言 时间:
2020-07-29 21:41:32
阅读次数:
70
npm init的作用 在node开发中使用npm init会生成一个pakeage.json文件, 这个文件主要是用来记录这个项目的详细信息的,它会将我们在项目开发中所要用到的包,以及项目的详细信息等记录在这个项目中。 方便在以后的版本迭代和项目移植的时候会更加的方便。 也是防止在后期的项目维护中 ...
分类:
其他好文 时间:
2020-07-29 21:40:42
阅读次数:
112
class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = Nonea = TreeNode(1)b = TreeNode(2)c = TreeNode(3)a.left = ba.right = ...
分类:
其他好文 时间:
2020-07-29 21:25:43
阅读次数:
70
# 1:什么是对象?class File: def read(self): print('读取文件内容')# F = File() # 实例化类# 1: 其中file就叫File()的对象,其实很好理解,还记得变量的# 关联关系吧,F变量名 和 File()变量值是关联关系所以通过F就# 可以调用c ...
分类:
其他好文 时间:
2020-07-29 15:27:36
阅读次数:
102
AcWing 826. 单链表 #include <bits/stdc++.h> using namespace std; const int N=1e6+10; int e[N],ne[N],head,idx; //初始化 void init(){ head=-1; idx=0; } //将x插到 ...
AcWing 827. 双链表 #include <bits/stdc++.h> using namespace std; const int N=1e6+10; int e[N],l[N],r[N],idx; void init(){ //0表示左端点,1表示右端点 r[0]=1; l[1]=0; ...
AcWing 828. 模拟栈 #include <bits/stdc++.h> using namespace std; const int N=1e6+10; int stk[N],tt; void init(){ tt=0; } void add(int x){ stk[++tt]=x; } ...