diff --git "a/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/2020qt\345\244\247\344\275\234\344\270\232.pptx" "b/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/2020qt\345\244\247\344\275\234\344\270\232.pptx"
new file mode 100644
index 000000000..d426e17f1
Binary files /dev/null and "b/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/2020qt\345\244\247\344\275\234\344\270\232.pptx" differ
diff --git "a/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/README.md" "b/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/README.md"
new file mode 100644
index 000000000..bac32ef51
--- /dev/null
+++ "b/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/README.md"
@@ -0,0 +1 @@
+## https://github.com/nldxtd/wchSnake
diff --git "a/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/README.md" "b/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/README.md"
new file mode 100644
index 000000000..448ba138c
--- /dev/null
+++ "b/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/README.md"
@@ -0,0 +1 @@
+### https://github.com/nldxtd/wchSnake
diff --git "a/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/image.qrc" "b/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/image.qrc"
new file mode 100644
index 000000000..5ac60555c
--- /dev/null
+++ "b/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/image.qrc"
@@ -0,0 +1,12 @@
+
+
+ image/start.ico
+ image/pause.ico
+ image/continue.ico
+ image/restart.ico
+ image/load.ico
+ image/save.ico
+ image/quit.ico
+ image/logo.ico
+
+
\ No newline at end of file
diff --git "a/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/image/README.md" "b/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/image/README.md"
new file mode 100644
index 000000000..448ba138c
--- /dev/null
+++ "b/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/image/README.md"
@@ -0,0 +1 @@
+### https://github.com/nldxtd/wchSnake
diff --git "a/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/image/continue.ico" "b/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/image/continue.ico"
new file mode 100644
index 000000000..45db75505
Binary files /dev/null and "b/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/image/continue.ico" differ
diff --git "a/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/image/load.ico" "b/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/image/load.ico"
new file mode 100644
index 000000000..8540da7fb
Binary files /dev/null and "b/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/image/load.ico" differ
diff --git "a/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/image/logo.ico" "b/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/image/logo.ico"
new file mode 100644
index 000000000..c5bb9cd7d
Binary files /dev/null and "b/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/image/logo.ico" differ
diff --git "a/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/image/pause.ico" "b/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/image/pause.ico"
new file mode 100644
index 000000000..5410ab444
Binary files /dev/null and "b/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/image/pause.ico" differ
diff --git "a/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/image/quit.ico" "b/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/image/quit.ico"
new file mode 100644
index 000000000..5661f139a
Binary files /dev/null and "b/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/image/quit.ico" differ
diff --git "a/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/image/restart.ico" "b/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/image/restart.ico"
new file mode 100644
index 000000000..6736f3ae6
Binary files /dev/null and "b/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/image/restart.ico" differ
diff --git "a/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/image/save.ico" "b/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/image/save.ico"
new file mode 100644
index 000000000..bd4eb51cb
Binary files /dev/null and "b/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/image/save.ico" differ
diff --git "a/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/image/start.ico" "b/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/image/start.ico"
new file mode 100644
index 000000000..79466bdea
Binary files /dev/null and "b/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/image/start.ico" differ
diff --git "a/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/main.cpp" "b/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/main.cpp"
new file mode 100644
index 000000000..fd3e53341
--- /dev/null
+++ "b/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/main.cpp"
@@ -0,0 +1,11 @@
+#include "mainwindow.h"
+
+#include
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+ MainWindow w;
+ w.show();
+ return a.exec();
+}
diff --git "a/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/mainwindow.cpp" "b/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/mainwindow.cpp"
new file mode 100644
index 000000000..d6a11e0b8
--- /dev/null
+++ "b/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/mainwindow.cpp"
@@ -0,0 +1,556 @@
+#include "mainwindow.h"
+#include "ui_mainwindow.h"
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+void paintWidget::init() {
+
+ head = tail = &map[0][0];
+ bonus = 0;
+ dx = 1;
+ dy = 0;
+ score = 0;
+ roadLen = 0;
+ snake.clear();
+ border.clear();
+ food.clear();
+ gamestart = false;
+
+ int snakelen = 2;
+ int snakex = 5;
+ int snakey = 5;
+ for(int i = 0; i < xlen; i++) {
+ for(int j = 0; j < ylen; j++) {
+ map[i][j].x = i;
+ map[i][j].y = j;
+ if(i == 0 | j == 0 | i == (xlen-1) | j == (ylen-1)) {
+ map[i][j].type = border_lable;
+ border.append(&map[i][j]);
+ }
+ else
+ map[i][j].type = empty_lable;
+ }
+ }
+ for(int i = 0; i < snakelen; i++) {
+ snake.append(&map[i+snakex][snakey]);
+ map[i+snakex][snakey].type = snake_label;
+ }
+}
+
+paintWidget::paintWidget(QMainWindow* parent)
+ : QWidget(parent){
+ score = 0;
+ roadLen = 0;
+ this->setGeometry(10, 85, 600, 600);
+ init();
+ timer=new QTimer;
+ QObject::connect(timer,SIGNAL(timeout()),this,SLOT(snakeMoveSlot()));
+ this->setFocusPolicy(Qt::StrongFocus);
+}
+
+void paintWidget::paintEvent(QPaintEvent*)
+{
+ paint = new QPainter;
+ paint->begin(this);
+ paint->setBrush(QBrush(Qt::black, Qt::SolidPattern));
+ for(int i = 0; i < border.length(); i++)
+ paint->drawRect(border[i]->x*xysize, border[i]->y*xysize, xysize, xysize);
+ paint->setBrush(QBrush(Qt::green, Qt::SolidPattern));
+ for(int i = 0; i < snake.length(); i++)
+ paint->drawRect(snake[i]->x*xysize, snake[i]->y*xysize, xysize, xysize);
+ paint->setBrush((QBrush(Qt::red, Qt::SolidPattern)));
+ for(int i = 0; i < food.length(); i++)
+ paint->drawEllipse(food[i]->x*xysize, food[i]->y*xysize, xysize, xysize);
+ paint->end();
+}
+
+void paintWidget::getHeadTail() {
+ head = snake.at(snake.length() - 1);
+ tail = snake.at(0);
+}
+
+void paintWidget::mousePressEvent(QMouseEvent *event) {
+ switch (event->button()) {
+ case Qt::LeftButton:
+ if(!gamestart) {
+ QPoint mouse = event->pos();
+ int temp_x = (mouse.x()) / 15;
+ int temp_y = (mouse.y()) / 15;
+ map[temp_x][temp_y].type = border_lable;
+ border.append(&map[temp_x][temp_y]);
+ }
+ update();
+ }
+}
+
+
+void MainWindow::keyPressEvent(QKeyEvent *event) {
+ switch (event->key()) {
+ case Qt::Key_Space:
+ if(gamewidget->gamestart)
+ pauseGameSlot();
+ else
+ continueGameSlot();
+ break;
+ default:
+ break;
+ }
+}
+
+void paintWidget::keyPressEvent(QKeyEvent *event) {
+ switch(event->key()) {
+ // 同方向或者反方向不做任何操作
+
+ case Qt::Key_Left:
+ if(dx == 0){
+ dx = -1;
+ dy = 0;
+ moveSnake();
+ }
+ break;
+ case Qt::Key_Right:
+ if(dx == 0){
+ dx = 1;
+ dy = 0;
+ moveSnake();
+ }
+ break;
+ case Qt::Key_Up:
+ if(dy == 0){
+ dx = 0;
+ dy = -1;
+ moveSnake();
+ }
+ break;
+ case Qt::Key_Down:
+ if(dy == 0){
+ dx = 0;
+ dy = 1;
+ moveSnake();
+ }
+ break;
+ case::Qt::Key_Space:
+ if(gamestart) {
+ pauseGameSlot();
+ update();
+ }
+ else {
+ continueGameSlot();
+ update();
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+void paintWidget::drawSnake(int x, int y) {
+ paint->begin(this);
+ paint->setBrush(QBrush(Qt::green, Qt::SolidPattern));
+ paint->drawRect(x*xysize, y*xysize, xysize, xysize);
+ paint->end();
+}
+
+void paintWidget::drawFood(int x, int y) {
+ paint->begin(this);
+ paint->setBrush(QBrush(Qt::red, Qt::SolidPattern));
+ paint->drawRect(x*xysize, y*xysize, xysize, xysize);
+ paint->end();
+}
+
+void paintWidget::drawBorder(int x, int y) {
+ paint->begin(this);
+ paint->setBrush(QBrush(Qt::black, Qt::SolidPattern));
+ paint->drawRect(x*xysize, y*xysize, xysize, xysize);
+ paint->end();
+}
+
+bool paintWidget::notinSnake(int x, int y) {
+ for(int i = 0; i < snake.length(); i++) {
+ if(snake.at(i)->x == x && snake.at(i)->y == y)
+ return false;
+ }
+ return true;
+}
+
+void paintWidget::createFood() {
+
+ int foodx;
+ int foody;
+ srand((unsigned)time(0));
+ do {
+ foodx = rand()%xlen;
+ foody = rand()%ylen;
+ }while(((foodx == 0)||(foody == 0)||(foodx==xlen-1)||(foody==ylen-1)) || !notinSnake(foodx, foody));
+ map[foodx][foody].type = food_label;
+ food.append(&map[foodx][foody]);
+}
+
+void paintWidget::moveSnake() {
+
+ roadLen++;
+ getHeadTail();
+ Node temp = map[(head->x)+dx][(head->y)+dy];
+ if(bonus == 0) {
+ snake.removeFirst();
+ tail->type = empty_lable;
+ }
+ else
+ bonus--;
+ if(temp.type == border_lable || temp.type == snake_label)
+ gameOver();
+ else {
+ snake.append(&map[(head->x)+dx][(head->y)+dy]);
+ if(temp.type == food_label) {
+ map[(head->x)+dx][(head->y)+dy].type = empty_lable;
+ score++;
+ food.removeFirst();
+ bonus += 3;
+ createFood();
+ }
+ else {
+ map[(head->x)+dx][(head->y)+dy].type = snake_label;
+ }
+ }
+ update();
+}
+
+void paintWidget::gameOver() {
+ gamestart = false;
+ timer->stop();
+ QMessageBox::information(this, "Message:", "Game is over! Do you want to try is again?", QMessageBox::Ok);
+ init();
+ update();
+ emit restared();
+}
+
+MainWindow::MainWindow(QWidget *parent)
+ : QMainWindow(parent)
+ , ui(new Ui::MainWindow)
+{
+ ui->setupUi(this);
+
+ this->setFixedSize(620, 787);
+ this->setWindowTitle("Snake");
+ this->setWindowIcon(QIcon(":/image/logo"));
+
+ mlabel = new QLabel(this);
+ mlabel->setStyleSheet("font-size:20px;");
+ mlabel->setGeometry(330, 50, 270, 30);
+
+ ui->startTool->setIcon(QIcon(":/image/start"));
+ ui->startTool->setStyleSheet("background-color:white");
+ ui->startTool->setToolTip("start the game!");
+ ui->continueTool->setIcon(QIcon(":/image/continue"));
+ ui->continueTool->setStyleSheet("background-color:white");
+ ui->continueTool->setToolTip("continue the game!");
+ ui->saveTool->setIcon(QIcon(":/image/save"));
+ ui->saveTool->setStyleSheet("background-color:white");
+ ui->saveTool->setToolTip("save the game!");
+ ui->loadTool->setIcon(QIcon(":/image/load"));
+ ui->loadTool->setStyleSheet("background-color:white");
+ ui->loadTool->setToolTip("load an existed game!");
+ ui->pauseTool->setIcon(QIcon(":/image/pause"));
+ ui->pauseTool->setStyleSheet("background-color:white");
+ ui->pauseTool->setToolTip("pause the game!");
+ ui->quitTool->setIcon(QIcon(":/image/quit"));
+ ui->quitTool->setStyleSheet("background-color:white");
+ ui->quitTool->setToolTip("quit the game!");
+ ui->restartTool->setIcon(QIcon(":/image/restart"));
+ ui->restartTool->setStyleSheet("background-color:white");
+ ui->restartTool->setToolTip("restart the game!");
+ gamewidget = new paintWidget(this);
+ ui->pauseButton->setEnabled(false);
+ ui->actioncontinueGame_2->setEnabled(false);
+ ui->actionpauseGame_2->setEnabled(false);
+ ui->continueButton->setEnabled(false);
+ ui->saveButton->setEnabled(false);
+ ui->actionsaveGame_2->setEnabled(false);
+ ui->restartButton->setEnabled(false);
+ ui->actionrestartGame_2->setEnabled(false);
+ ui->pauseTool->setEnabled(false);
+ ui->continueTool->setEnabled(false);
+ ui->saveTool->setEnabled(false);
+ ui->restartTool->setEnabled(false);
+ ui->actionpauseGame->setEnabled(false);
+ ui->actioncontinueGame->setEnabled(false);
+ ui->actionsaveGame->setEnabled(false);
+ ui->actionrestartGame->setEnabled(false);
+
+ mlabel->setText("移动路程:" + QString::number(gamewidget->roadLen, 10) + " 得分:" + QString::number(gamewidget->score, 10));
+ mlabel->show();
+
+
+ QObject::connect(ui->startButton, SIGNAL(clicked()), this->gamewidget, SLOT(startGameSlot()));
+ QObject::connect(ui->startButton, SIGNAL(clicked()), this, SLOT(startGameSlot()));
+ QObject::connect(ui->continueButton, SIGNAL(clicked()), this->gamewidget, SLOT(continueGameSlot()));
+ QObject::connect(ui->continueButton, SIGNAL(clicked()), this, SLOT(continueGameSlot()));
+ QObject::connect(ui->pauseButton, SIGNAL(clicked()), this->gamewidget, SLOT(pauseGameSlot()));
+ QObject::connect(ui->pauseButton, SIGNAL(clicked()), this, SLOT(pauseGameSlot()));
+ QObject::connect(ui->restartButton, SIGNAL(clicked()), this->gamewidget, SLOT(restartGameSlot()));
+ QObject::connect(ui->restartButton, SIGNAL(clicked()), this, SLOT(restartGameSlot()));
+ QObject::connect(ui->quitButton, SIGNAL(clicked()), this, SLOT(quitGameSlot()));
+ QObject::connect(gamewidget, SIGNAL(restared()), this, SLOT(restartGameSlot()));
+// QObject::connect(this->gamewidget->timer, SIGNAL(timeout()), this->gamewidget, SLOT(snakeMoveSlot()));
+ QObject::connect(ui->actionstartGame, SIGNAL(triggered()), this, SLOT(startGameSlot()));
+ QObject::connect(ui->actionstartGame, SIGNAL(triggered()), this->gamewidget, SLOT(startGameSlot()));
+ QObject::connect(ui->startTool, SIGNAL(clicked()), this, SLOT(startGameSlot()));
+ QObject::connect(ui->startTool, SIGNAL(clicked()), this->gamewidget, SLOT(startGameSlot()));
+ QObject::connect(ui->actionpauseGame, SIGNAL(triggered()), this, SLOT(pauseGameSlot()));
+ QObject::connect(ui->actionpauseGame, SIGNAL(triggered()), this->gamewidget, SLOT(pauseGameSlot()));
+ QObject::connect(ui->pauseTool, SIGNAL(clicked()), this, SLOT(pauseGameSlot()));
+ QObject::connect(ui->pauseTool, SIGNAL(clicked()), this->gamewidget, SLOT(pauseGameSlot()));
+ QObject::connect(ui->actioncontinueGame, SIGNAL(triggered()), this, SLOT(continueGameSlot()));
+ QObject::connect(ui->actioncontinueGame, SIGNAL(triggered()), this->gamewidget, SLOT(continueGameSlot()));
+ QObject::connect(ui->continueTool, SIGNAL(clicked()), this, SLOT(continueGameSlot()));
+ QObject::connect(ui->continueTool, SIGNAL(clicked()), this->gamewidget, SLOT(continueGameSlot()));
+ QObject::connect(ui->actionrestartGame, SIGNAL(triggered()), this, SLOT(restartGameSlot()));
+ QObject::connect(ui->actionrestartGame, SIGNAL(triggered()), this->gamewidget, SLOT(restartGameSlot()));
+ QObject::connect(ui->restartTool, SIGNAL(clicked()), this, SLOT(restartGameSlot()));
+ QObject::connect(ui->restartTool, SIGNAL(clicked()), this->gamewidget, SLOT(restartGameSlot()));
+ QObject::connect(ui->quitTool, SIGNAL(clicked()), this, SLOT(quitGameSlot()));
+ QObject::connect(ui->actionquitGame, SIGNAL(triggered()), this, SLOT(quitGameSlot()));
+ QObject::connect(ui->saveButton, SIGNAL(clicked()), this->gamewidget, SLOT(saveGameSlot()));
+ QObject::connect(ui->saveTool, SIGNAL(clicked()), this->gamewidget, SLOT(saveGameSlot()));
+ QObject::connect(ui->actionsaveGame, SIGNAL(triggered()), this->gamewidget, SLOT(saveGameSlot()));
+ QObject::connect(ui->loadButton, SIGNAL(clicked()), this->gamewidget, SLOT(loadGameSlot()));
+ QObject::connect(ui->loadTool, SIGNAL(clicked()), this->gamewidget, SLOT(loadGameSlot()));
+ QObject::connect(ui->actionloadGame, SIGNAL(triggered()), this->gamewidget, SLOT(loadGameSlot()));
+ QObject::connect(gamewidget, SIGNAL(paused()), this, SLOT(pauseGameSlot()));
+ QObject::connect(gamewidget, SIGNAL(moved()), this, SLOT(snakeMoveSlot()));
+// QObject::connect(time, SIGNAL(timeout()), this, SLOT(snakeMoveSlot()));
+// QObject::connect(ui->actionpauseGame, SIGNAL(triggered()), this, SLOT(startGameSlot()));
+// QObject::connect(ui->actioncontinueGame, SIGNAL(triggered()), this, SLOT(startGameSlot()));
+// QObject::connect(ui->actionrestartGame, SIGNAL(triggered()), this, SLOT(startGameSlot()));
+// QObject::connect(ui->actionsaveGame, SIGNAL(triggered()), this, SLOT(startGameSlot()));
+// QObject::connect(ui->actionloadGame, SIGNAL(triggered()), this, SLOT(startGameSlot()));
+// QObject::connect(ui->startButton, SIGNAL(clicked()), this->gamewidget, SLOT(startGameSlot()));
+// QObject::connect(ui->pauseButton, SIGNAL(clicked()), this, SLOT(pauseGameSlot()));
+// QObject::connect(ui->continueButton, SIGNAL(clicked()), this, SLOT(continueGameSlot()));
+// QObject::connect(ui->restartButton, SIGNAL(clicked()), this, SLOT(restartGameSlot()));
+// QObject::connect(ui->saveButton, SIGNAL(clicked()), this, SLOT(saveGameSlot()));
+// QObject::connect(ui->loadButton, SIGNAL(clicked()), this, SLOT(loadGameSlot()));
+}
+
+MainWindow::~MainWindow()
+{
+ delete ui;
+}
+
+void paintWidget::startGameSlot() {
+ gamestart = true;
+ createFood();
+ timer->start(150);
+}
+
+void paintWidget::continueGameSlot() {
+ gamestart = true;
+ timer->start(150);
+}
+
+void paintWidget::pauseGameSlot() {
+ gamestart = false;
+ timer->stop();
+}
+
+void paintWidget::restartGameSlot() {
+ gamestart = false;
+ timer->stop();
+ init();
+ update();
+}
+
+void paintWidget::saveGameSlot() {
+ QString path = QFileDialog::getSaveFileName(this, "Save", ".", "JSON(*.json)");
+ if(!path.isEmpty()) {
+ QFile file(path);
+ if(file.open(QIODevice::WriteOnly)) {
+ QJsonObject json;
+ QJsonDocument document;
+ QJsonArray jsonArr;
+ for(int i = 0; i < xlen; i++) {
+ for(int j = 0; j < ylen; j++) {
+ jsonArr.append(map[i][j].type);
+ }
+ }
+ QJsonArray snakeArr;
+ for(int i = 0; i < snake.length(); i++)
+ snakeArr.append((xlen*(snake.at(i)->x))+(snake.at(i)->y));
+ json.insert("map", jsonArr);
+ json.insert("dx", dx);
+ json.insert("dy", dy);
+ json.insert("bonus", bonus);
+ json.insert("snake", snakeArr);
+ json.insert("score", score);
+ json.insert("roadLen", roadLen);
+ document.setObject(json);
+ file.write(document.toJson());
+ file.close();
+ }
+ }
+ emit gameOver();
+}
+
+void paintWidget::loadGameSlot() {
+ QString path = QFileDialog::getOpenFileName(this, "Open", ".", "JSON(*.json)");
+ if (!path.isEmpty()) {
+ QFile file(path);
+ if (file.open(QIODevice::ReadOnly)) {
+ QByteArray allData = file.readAll();
+ file.close();
+ QJsonParseError json_error;
+ QJsonDocument jsonDoc(QJsonDocument::fromJson(allData, &json_error));
+ if (json_error.error != QJsonParseError::NoError) {
+ QMessageBox::warning(this, "Error", "Json Error!");
+ return;
+ }
+ QJsonObject object = jsonDoc.object();
+ dx = object["dx"].toInt();
+ dy = object["dy"].toInt();
+ bonus = object["bonus"].toInt();
+ score = object["score"].toInt();
+ roadLen = object["roadLen"].toInt();
+ border.clear();
+ snake.clear();
+ food.clear();
+ QJsonArray jsonArr = object["map"].toArray();
+ QJsonArray snakeArr = object["snake"].toArray();
+ for(int i = 0; i < 1600; i++) {
+ int tx = i / xlen;
+ int ty = i % ylen;
+ map[tx][ty].type = jsonArr.at(i).toInt();
+ if(map[tx][ty].type == 1) {
+ border.append(&map[tx][ty]);
+ }
+ else if(map[tx][ty].type == 3) {
+ food.append(&map[tx][ty]);
+ }
+ }
+ int l = snakeArr.size();
+ for(int i = 0; i < l; i++) {
+ int tx = snakeArr.at(i).toInt() / xlen;
+ int ty = snakeArr.at(i).toInt() % ylen;
+ snake.append(&map[tx][ty]);
+ }
+ }
+ }
+ pauseGameSlot();
+ emit paused();
+}
+
+void MainWindow::startGameSlot() {
+ ui->startButton->setEnabled(false);
+ ui->pauseButton->setEnabled(true);
+ ui->loadButton->setEnabled(false);
+ ui->startTool->setEnabled(false);
+ ui->pauseTool->setEnabled(true);
+ ui->loadTool->setEnabled(false);
+ ui->actionstartGame->setEnabled(false);
+ ui->actionpauseGame->setEnabled(true);
+ ui->actionloadGame->setEnabled(false);
+ ui->actionstartGame_2->setEnabled(false);
+ ui->actionpauseGame_2->setEnabled(true);
+ ui->actionloadGame_2->setEnabled(false);
+}
+
+void MainWindow::pauseGameSlot()
+{
+ ui->startButton->setEnabled(false);
+ ui->startTool->setEnabled(false);
+ ui->restartButton->setEnabled(true);
+ ui->pauseButton->setEnabled(false);
+ ui->continueButton->setEnabled(true);
+ ui->saveButton->setEnabled(true);
+ ui->restartTool->setEnabled(true);
+ ui->pauseTool->setEnabled(false);
+ ui->continueTool->setEnabled(true);
+ ui->saveTool->setEnabled(true);
+ ui->actionstartGame->setEnabled(false);
+ ui->actionrestartGame->setEnabled(true);
+ ui->actionpauseGame->setEnabled(false);
+ ui->actioncontinueGame->setEnabled(true);
+ ui->actionsaveGame->setEnabled(true);
+ ui->actionstartGame_2->setEnabled(false);
+ ui->actionrestartGame_2->setEnabled(true);
+ ui->actionpauseGame_2->setEnabled(false);
+ ui->actioncontinueGame_2->setEnabled(true);
+ ui->actionsaveGame_2->setEnabled(true);
+
+}
+
+void MainWindow::restartGameSlot() {
+ ui->pauseButton->setEnabled(false);
+ ui->actionpauseGame->setEnabled(false);
+ ui->actionpauseGame_2->setEnabled(false);
+ ui->continueButton->setEnabled(false);
+ ui->actioncontinueGame->setEnabled(false);
+ ui->actioncontinueGame_2->setEnabled(false);
+ ui->actionsaveGame->setEnabled(false);
+ ui->actionsaveGame_2->setEnabled(false);
+ ui->saveButton->setEnabled(false);
+ ui->startButton->setEnabled(true);
+ ui->actionstartGame->setEnabled(true);
+ ui->actionstartGame_2->setEnabled(true);
+ ui->restartButton->setEnabled(false);
+ ui->actionrestartGame->setEnabled(false);
+ ui->actionrestartGame_2->setEnabled(false);
+ ui->loadButton->setEnabled(true);
+ ui->actionloadGame->setEnabled(true);
+ ui->actionloadGame_2->setEnabled(true);
+ ui->pauseTool->setEnabled(false);
+ ui->continueTool->setEnabled(false);
+ ui->saveTool->setEnabled(false);
+ ui->startTool->setEnabled(true);
+ ui->restartTool->setEnabled(false);
+ ui->loadTool->setEnabled(true);
+}
+
+void MainWindow::continueGameSlot() {
+ ui->restartButton->setEnabled(false);
+ ui->actionrestartGame->setEnabled(false);
+ ui->actionrestartGame_2->setEnabled(false);
+ ui->pauseButton->setEnabled(true);
+ ui->actionpauseGame->setEnabled(true);
+ ui->actionpauseGame_2->setEnabled(true);
+ ui->continueButton->setEnabled(false);
+ ui->actioncontinueGame->setEnabled(false);
+ ui->actioncontinueGame_2->setEnabled(false);
+ ui->saveButton->setEnabled(false);
+ ui->actionsaveGame->setEnabled(false);
+ ui->actionsaveGame_2->setEnabled(false);
+ ui->restartTool->setEnabled(false);
+ ui->pauseTool->setEnabled(true);
+ ui->continueTool->setEnabled(false);
+ ui->saveTool->setEnabled(false);
+}
+
+void paintWidget::snakeMoveSlot() {
+ moveSnake();
+ emit moved();
+}
+
+void MainWindow::snakeMoveSlot() {
+ mlabel->setText("移动路程:" + QString::number(gamewidget->roadLen, 10) + " 得分:" + QString::number(gamewidget->score, 10));
+ mlabel->show();
+}
+
+void MainWindow::quitGameSlot() {
+ QCoreApplication::exit();
+ QWidget::close();
+}
+
+
+
+
diff --git "a/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/mainwindow.h" "b/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/mainwindow.h"
new file mode 100644
index 000000000..1201a9587
--- /dev/null
+++ "b/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/mainwindow.h"
@@ -0,0 +1,114 @@
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include
+#include
+#include
+#include
+
+#define xlen 40
+#define ylen 40
+#define xysize 15
+
+struct Node {
+ int x;
+ int y;
+ int type;
+};
+
+enum Label {
+ empty_lable,
+ border_lable,
+ snake_label,
+ food_label
+};
+
+QT_BEGIN_NAMESPACE
+namespace Ui { class MainWindow; }
+QT_END_NAMESPACE
+
+class paintWidget : public QWidget
+{
+ Q_OBJECT;
+
+public:
+ friend class MainWindow;
+ paintWidget(QMainWindow* parent = 0);
+ Node map[xlen+10][ylen+10]; // game map
+ bool gamestart;
+ QTimer *timer;
+
+private:
+ void paintEvent(QPaintEvent*);
+ QPainter* paint;
+ QList snake; //snake body
+ QList border;
+ QList food;
+
+ int dx, dy;
+ int moveSpeed;
+ int level;
+ int bonus;
+ int score;
+ int roadLen;
+
+ Node* head;
+ Node* tail;
+
+signals:
+ void restared();
+ void paused();
+ void moved();
+
+public slots:
+ void startGameSlot();
+ void continueGameSlot();
+ void restartGameSlot();
+ void pauseGameSlot();
+ void snakeMoveSlot();
+ void saveGameSlot();
+ void loadGameSlot();
+
+public:
+ void gameOver();
+ void init();
+ void drawSnake(int x, int y);
+ void drawBorder(int x, int y);
+ void drawFood(int x, int y);
+ void moveSnake();
+ void getHeadTail();
+ void createFood();
+ void keyPressEvent(QKeyEvent *event);
+ void mousePressEvent(QMouseEvent* event);
+ bool notinSnake(int x, int y);
+};
+
+class MainWindow : public QMainWindow
+{
+ Q_OBJECT
+
+public:
+ MainWindow(QWidget *parent = nullptr);
+ ~MainWindow();
+ paintWidget* gamewidget;
+ void keyPressEvent(QKeyEvent *event);
+ QTimer* time;
+ QString viewText;
+
+private:
+ Ui::MainWindow *ui;
+ QLabel* mlabel;
+
+
+
+public slots:
+ void startGameSlot();
+ void continueGameSlot();
+ void restartGameSlot();
+ void pauseGameSlot();
+ void quitGameSlot();
+ void snakeMoveSlot();
+// void saveGameSlot();
+// void loadGameSlot();
+};
+#endif // MAINWINDOW_H
diff --git "a/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/mainwindow.ui" "b/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/mainwindow.ui"
new file mode 100644
index 000000000..eccc00822
--- /dev/null
+++ "b/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/mainwindow.ui"
@@ -0,0 +1,593 @@
+
+
+ MainWindow
+
+
+
+ 0
+ 0
+ 621
+ 780
+
+
+
+
+ Segoe UI
+ 8
+ 75
+ true
+ true
+
+
+
+ MainWindow
+
+
+
+
+
+ 0
+ 640
+ 611
+ 32
+
+
+
+ -
+
+
+
+ Microsoft JhengHei UI
+ 10
+ 75
+ false
+ true
+
+
+
+ Qt::NoFocus
+
+
+ startGame
+
+
+
+ -
+
+
+
+ Microsoft JhengHei UI
+ 10
+ 75
+ false
+ true
+
+
+
+ Qt::NoFocus
+
+
+ pauseGame
+
+
+
+ -
+
+
+
+ Microsoft JhengHei UI
+ 10
+ 75
+ false
+ true
+
+
+
+ Qt::NoFocus
+
+
+ continueGame
+
+
+
+ -
+
+
+
+ Microsoft JhengHei UI
+ 10
+ 75
+ false
+ true
+
+
+
+ Qt::NoFocus
+
+
+ restartGame
+
+
+
+
+
+
+
+
+ 10
+ 10
+ 32
+ 32
+
+
+
+
+ Segoe UI Black
+ 7
+ 75
+ true
+ true
+
+
+
+ Qt::NoFocus
+
+
+ start
+
+
+
+
+
+ 42
+ 10
+ 32
+ 32
+
+
+
+
+ Segoe UI Black
+ 7
+ 75
+ true
+ true
+
+
+
+ Qt::NoFocus
+
+
+ pause
+
+
+
+
+
+ 74
+ 10
+ 32
+ 32
+
+
+
+
+ Segoe UI Black
+ 7
+ 75
+ true
+ true
+
+
+
+ Qt::NoFocus
+
+
+ conti
+
+
+
+
+
+ 106
+ 10
+ 32
+ 32
+
+
+
+
+ Segoe UI Black
+ 7
+ 75
+ true
+ true
+
+
+
+ Qt::NoFocus
+
+
+ res
+
+
+
+
+
+ 138
+ 10
+ 32
+ 32
+
+
+
+
+ Segoe UI Black
+ 7
+ 75
+ true
+ true
+
+
+
+ Qt::NoFocus
+
+
+ quit
+
+
+
+
+
+ 170
+ 10
+ 32
+ 32
+
+
+
+
+ Segoe UI Black
+ 7
+ 75
+ true
+ true
+
+
+
+ Qt::NoFocus
+
+
+ load
+
+
+
+
+
+ 202
+ 10
+ 32
+ 32
+
+
+
+
+ Segoe UI Black
+ 7
+ 75
+ true
+ true
+
+
+
+ Qt::NoFocus
+
+
+ save
+
+
+
+
+
+ 0
+ 680
+ 611
+ 32
+
+
+
+ -
+
+
+
+ Microsoft JhengHei UI
+ 10
+ 75
+ false
+ true
+
+
+
+ Qt::NoFocus
+
+
+ quitGame
+
+
+
+ -
+
+
+
+ Microsoft JhengHei UI
+ 10
+ 75
+ false
+ true
+
+
+
+ Qt::NoFocus
+
+
+ loadGame
+
+
+
+ -
+
+
+
+ Microsoft JhengHei UI
+ 10
+ 75
+ false
+ true
+
+
+
+ Qt::NoFocus
+
+
+ saveGame
+
+
+
+
+
+
+
+
+
+
+ toolBar
+
+
+ TopToolBarArea
+
+
+ true
+
+
+
+
+
+
+
+
+
+
+
+ startGame
+
+
+
+
+ pauseGame
+
+
+
+
+ continueGame
+
+
+
+
+ restartGame
+
+
+
+
+ quitGame
+
+
+
+
+ loadGame
+
+
+
+
+ saveGame
+
+
+
+
+ startGame
+
+
+
+
+ pauseGame
+
+
+
+
+ continueGame
+
+
+
+
+ restartGame
+
+
+
+
+ quitGame
+
+
+
+
+ loadGame
+
+
+
+
+ saveGame
+
+
+
+
+
+
+ actionrestartGame_2
+ triggered()
+ restartTool
+ click()
+
+
+ -1
+ -1
+
+
+ 121
+ 69
+
+
+
+
+ actionpauseGame_2
+ triggered()
+ pauseTool
+ click()
+
+
+ -1
+ -1
+
+
+ 57
+ 69
+
+
+
+
+ actioncontinueGame_2
+ triggered()
+ continueTool
+ click()
+
+
+ -1
+ -1
+
+
+ 89
+ 69
+
+
+
+
+ actionstartGame_2
+ triggered()
+ startTool
+ click()
+
+
+ -1
+ -1
+
+
+ 25
+ 69
+
+
+
+
+ actionloadGame_2
+ triggered()
+ loadTool
+ click()
+
+
+ -1
+ -1
+
+
+ 185
+ 69
+
+
+
+
+ actionsaveGame_2
+ triggered()
+ saveTool
+ click()
+
+
+ -1
+ -1
+
+
+ 217
+ 69
+
+
+
+
+ actionquitGame_2
+ triggered()
+ quitTool
+ click()
+
+
+ -1
+ -1
+
+
+ 153
+ 69
+
+
+
+
+
diff --git "a/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/wchSnake.pro" "b/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/wchSnake.pro"
new file mode 100644
index 000000000..b27ba84e4
--- /dev/null
+++ "b/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/wchSnake.pro"
@@ -0,0 +1,52 @@
+QT += core gui
+
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
+
+CONFIG += c++11
+
+# The following define makes your compiler emit warnings if you use
+# any Qt feature that has been marked deprecated (the exact warnings
+# depend on your compiler). Please consult the documentation of the
+# deprecated API in order to know how to port your code away from it.
+DEFINES += QT_DEPRECATED_WARNINGS
+
+# You can also make your code fail to compile if it uses deprecated APIs.
+# In order to do so, uncomment the following line.
+# You can also select to disable deprecated APIs only up to a certain version of Qt.
+#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
+
+SOURCES += \
+ main.cpp \
+ mainwindow.cpp
+
+HEADERS += \
+ mainwindow.h
+
+FORMS += \
+ mainwindow.ui
+
+# Default rules for deployment.
+qnx: target.path = /tmp/$${TARGET}/bin
+else: unix:!android: target.path = /opt/$${TARGET}/bin
+!isEmpty(target.path): INSTALLS += target
+
+DISTFILES += \
+ image/continue.jpg \
+ image/load.jpg \
+ image/pause.jpg \
+ image/quit.jpg \
+ image/restart.jpg \
+ image/save.jpg \
+ image/start.jpg \
+ image/continue.ico \
+ image/load.ico \
+ image/pause.ico \
+ image/quit.ico \
+ image/restart.ico \
+ image/save.ico \
+ image/start.ico \
+ image/logo.ico \
+ image/logo.ico
+
+RESOURCES += \
+ image.qrc
diff --git "a/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/wchSnake.pro.user" "b/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/wchSnake.pro.user"
new file mode 100644
index 000000000..07c23b3c9
--- /dev/null
+++ "b/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/wchSnake.pro.user"
@@ -0,0 +1,319 @@
+
+
+
+
+
+ EnvironmentId
+ {a91986f5-c153-4e59-8d49-42f2a721853a}
+
+
+ ProjectExplorer.Project.ActiveTarget
+ 0
+
+
+ ProjectExplorer.Project.EditorSettings
+
+ true
+ false
+ true
+
+ Cpp
+
+ CppGlobal
+
+
+
+ QmlJS
+
+ QmlJSGlobal
+
+
+ 2
+ UTF-8
+ false
+ 4
+ false
+ 80
+ true
+ true
+ 1
+ true
+ false
+ 0
+ true
+ true
+ 0
+ 8
+ true
+ 1
+ true
+ true
+ true
+ false
+
+
+
+ ProjectExplorer.Project.PluginSettings
+
+
+ false
+ {8e81bf86-0a7a-4021-adc2-64d620bddee2}
+
+
+
+ ProjectExplorer.Project.Target.0
+
+ Desktop Qt 5.14.0 clang 64bit
+ Desktop Qt 5.14.0 clang 64bit
+ qt.qt5.5140.clang_64_kit
+ 0
+ 0
+ 0
+
+ /Users/wuchenhao/Documents/code/qt/build-wchSnake-Desktop_Qt_5_14_0_clang_64bit-Debug
+
+
+ true
+ QtProjectManager.QMakeBuildStep
+ true
+
+ false
+ false
+ false
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ false
+
+
+ false
+
+ 2
+ Build
+ Build
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ true
+ clean
+
+ false
+
+ 1
+ Clean
+ Clean
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Debug
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 2
+
+
+ /Users/wuchenhao/Documents/code/qt/build-wchSnake-Desktop_Qt_5_14_0_clang_64bit-Release
+
+
+ true
+ QtProjectManager.QMakeBuildStep
+ false
+
+ false
+ false
+ true
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ false
+
+
+ false
+
+ 2
+ Build
+ Build
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ true
+ clean
+
+ false
+
+ 1
+ Clean
+ Clean
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Release
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 0
+
+
+ /Users/wuchenhao/Documents/code/qt/build-wchSnake-Desktop_Qt_5_14_0_clang_64bit-Profile
+
+
+ true
+ QtProjectManager.QMakeBuildStep
+ true
+
+ false
+ true
+ true
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ false
+
+
+ false
+
+ 2
+ Build
+ Build
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ true
+ clean
+
+ false
+
+ 1
+ Clean
+ Clean
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Profile
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 0
+
+ 3
+
+
+ 0
+ Deploy
+ Deploy
+ ProjectExplorer.BuildSteps.Deploy
+
+ 1
+ ProjectExplorer.DefaultDeployConfiguration
+
+ 1
+
+
+ dwarf
+
+ cpu-cycles
+
+
+ 250
+
+ -e
+ cpu-cycles
+ --call-graph
+ dwarf,4096
+ -F
+ 250
+
+ -F
+ true
+ 4096
+ false
+ false
+ 1000
+
+ true
+
+ false
+ false
+ false
+ false
+ true
+ 0.01
+ 10
+ true
+ kcachegrind
+ 1
+ 25
+
+ 1
+ true
+ false
+ true
+ valgrind
+
+ 0
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+ 10
+ 11
+ 12
+ 13
+ 14
+
+ 2
+
+ Qt4ProjectManager.Qt4RunConfiguration:/Users/wuchenhao/Documents/code/qt/wchSnake/wchSnake.pro
+ /Users/wuchenhao/Documents/code/qt/wchSnake/wchSnake.pro
+
+ false
+
+ false
+ true
+ false
+ true
+ false
+ false
+ true
+
+ /Users/wuchenhao/Documents/code/qt/build-wchSnake-Desktop_Qt_5_14_0_clang_64bit-Debug/wchSnake.app/Contents/MacOS
+
+ 1
+
+
+
+ ProjectExplorer.Project.TargetCount
+ 1
+
+
+ ProjectExplorer.Project.Updater.FileVersion
+ 22
+
+
+ Version
+ 22
+
+
diff --git "a/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/wchSnake.pro.user.a91986f.22" "b/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/wchSnake.pro.user.a91986f.22"
new file mode 100644
index 000000000..6f2d0d30f
--- /dev/null
+++ "b/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/wchSnake.pro.user.a91986f.22"
@@ -0,0 +1,319 @@
+
+
+
+
+
+ EnvironmentId
+ {a91986f5-c153-4e59-8d49-42f2a721853a}
+
+
+ ProjectExplorer.Project.ActiveTarget
+ 0
+
+
+ ProjectExplorer.Project.EditorSettings
+
+ true
+ false
+ true
+
+ Cpp
+
+ CppGlobal
+
+
+
+ QmlJS
+
+ QmlJSGlobal
+
+
+ 2
+ UTF-8
+ false
+ 4
+ false
+ 80
+ true
+ true
+ 1
+ true
+ false
+ 0
+ true
+ true
+ 0
+ 8
+ true
+ 1
+ true
+ true
+ true
+ false
+
+
+
+ ProjectExplorer.Project.PluginSettings
+
+
+ false
+ {8e81bf86-0a7a-4021-adc2-64d620bddee2}
+
+
+
+ ProjectExplorer.Project.Target.0
+
+ Desktop Qt 5.14.0 clang 64bit
+ Desktop Qt 5.14.0 clang 64bit
+ qt.qt5.5140.clang_64_kit
+ 0
+ 0
+ 0
+
+ /Users/wuchenhao/Documents/code/qt/build-wchSnake-Desktop_Qt_5_14_0_clang_64bit-Debug
+
+
+ true
+ QtProjectManager.QMakeBuildStep
+ true
+
+ false
+ false
+ false
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ false
+
+
+ false
+
+ 2
+ Build
+ Build
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ true
+ clean
+
+ false
+
+ 1
+ Clean
+ Clean
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Debug
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 2
+
+
+ /Users/wuchenhao/Documents/code/qt/build-wchSnake-Desktop_Qt_5_14_0_clang_64bit-Release
+
+
+ true
+ QtProjectManager.QMakeBuildStep
+ false
+
+ false
+ false
+ true
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ false
+
+
+ false
+
+ 2
+ Build
+ Build
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ true
+ clean
+
+ false
+
+ 1
+ Clean
+ Clean
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Release
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 0
+
+
+ /Users/wuchenhao/Documents/code/qt/build-wchSnake-Desktop_Qt_5_14_0_clang_64bit-Profile
+
+
+ true
+ QtProjectManager.QMakeBuildStep
+ true
+
+ false
+ true
+ true
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ false
+
+
+ false
+
+ 2
+ Build
+ Build
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Qt4ProjectManager.MakeStep
+
+ true
+ clean
+
+ false
+
+ 1
+ Clean
+ Clean
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Profile
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 0
+
+ 3
+
+
+ 0
+ Deploy
+ Deploy
+ ProjectExplorer.BuildSteps.Deploy
+
+ 1
+ ProjectExplorer.DefaultDeployConfiguration
+
+ 1
+
+
+ dwarf
+
+ cpu-cycles
+
+
+ 250
+
+ -e
+ cpu-cycles
+ --call-graph
+ dwarf,4096
+ -F
+ 250
+
+ -F
+ true
+ 4096
+ false
+ false
+ 1000
+
+ true
+
+ false
+ false
+ false
+ false
+ true
+ 0.01
+ 10
+ true
+ kcachegrind
+ 1
+ 25
+
+ 1
+ true
+ false
+ true
+ valgrind
+
+ 0
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+ 10
+ 11
+ 12
+ 13
+ 14
+
+ 2
+
+ Qt4ProjectManager.Qt4RunConfiguration:/Users/wuchenhao/Documents/code/qt/wchSnake/wchSnake.pro
+ /Users/wuchenhao/Documents/code/qt/wchSnake/wchSnake.pro
+
+ false
+
+ false
+ true
+ false
+ true
+ false
+ false
+ true
+
+ /Users/wuchenhao/Documents/code/qt/build-wchSnake-Desktop_Qt_5_14_0_clang_64bit-Debug/wchSnake.app/Contents/MacOS
+
+ 1
+
+
+
+ ProjectExplorer.Project.TargetCount
+ 1
+
+
+ ProjectExplorer.Project.Updater.FileVersion
+ 22
+
+
+ Version
+ 22
+
+
diff --git "a/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/wchSnake.pro.user.af283b5.4.8-pre1" "b/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/wchSnake.pro.user.af283b5.4.8-pre1"
new file mode 100644
index 000000000..ea63afbdb
--- /dev/null
+++ "b/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020/code/wchSnake.pro.user.af283b5.4.8-pre1"
@@ -0,0 +1,318 @@
+
+
+
+
+
+ EnvironmentId
+ {af283b5a-4bbd-41b1-a9ea-5310dc6d5406}
+
+
+ ProjectExplorer.Project.ActiveTarget
+ 0
+
+
+ ProjectExplorer.Project.EditorSettings
+
+ true
+ false
+ true
+
+ Cpp
+
+ CppGlobal
+
+
+
+ QmlJS
+
+ QmlJSGlobal
+
+
+ 2
+ UTF-8
+ false
+ 4
+ false
+ 80
+ true
+ true
+ 1
+ true
+ false
+ 0
+ true
+ true
+ 0
+ 8
+ true
+ 1
+ true
+ true
+ true
+ false
+
+
+
+ ProjectExplorer.Project.PluginSettings
+
+
+
+ ProjectExplorer.Project.Target.0
+
+ Desktop Qt 5.9.0 MinGW 32bit
+ Desktop Qt 5.9.0 MinGW 32bit
+ qt.59.win32_mingw53_kit
+ 0
+ 0
+ 0
+
+ E:/code/qt/build-wchSnake-Desktop_Qt_5_9_0_MinGW_32bit-Debug
+
+
+ true
+ qmake
+
+ QtProjectManager.QMakeBuildStep
+ true
+
+ false
+ false
+ false
+
+
+ true
+ Make
+
+ Qt4ProjectManager.MakeStep
+
+ false
+
+
+
+ 2
+ 构建
+
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Make
+
+ Qt4ProjectManager.MakeStep
+
+ true
+ clean
+
+
+ 1
+ 清理
+
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Debug
+
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 2
+ true
+
+
+ E:/code/qt/build-wchSnake-Desktop_Qt_5_9_0_MinGW_32bit-Release
+
+
+ true
+ qmake
+
+ QtProjectManager.QMakeBuildStep
+ false
+
+ false
+ false
+ false
+
+
+ true
+ Make
+
+ Qt4ProjectManager.MakeStep
+
+ false
+
+
+
+ 2
+ 构建
+
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Make
+
+ Qt4ProjectManager.MakeStep
+
+ true
+ clean
+
+
+ 1
+ 清理
+
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Release
+
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 0
+ true
+
+
+ E:/code/qt/build-wchSnake-Desktop_Qt_5_9_0_MinGW_32bit-Profile
+
+
+ true
+ qmake
+
+ QtProjectManager.QMakeBuildStep
+ true
+
+ false
+ true
+ false
+
+
+ true
+ Make
+
+ Qt4ProjectManager.MakeStep
+
+ false
+
+
+
+ 2
+ 构建
+
+ ProjectExplorer.BuildSteps.Build
+
+
+
+ true
+ Make
+
+ Qt4ProjectManager.MakeStep
+
+ true
+ clean
+
+
+ 1
+ 清理
+
+ ProjectExplorer.BuildSteps.Clean
+
+ 2
+ false
+
+ Profile
+
+ Qt4ProjectManager.Qt4BuildConfiguration
+ 0
+ true
+
+ 3
+
+
+ 0
+ 部署
+
+ ProjectExplorer.BuildSteps.Deploy
+
+ 1
+ 在本地部署
+
+ ProjectExplorer.DefaultDeployConfiguration
+
+ 1
+
+
+ false
+ false
+ 1000
+
+ true
+
+ false
+ false
+ false
+ false
+ true
+ 0.01
+ 10
+ true
+ 1
+ 25
+
+ 1
+ true
+ false
+ true
+ valgrind
+
+ 0
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+ 10
+ 11
+ 12
+ 13
+ 14
+
+ 2
+
+ wchSnake
+
+ Qt4ProjectManager.Qt4RunConfiguration:E:/code/qt/wchSnake/wchSnake.pro
+ true
+
+ wchSnake.pro
+ false
+
+ E:/code/qt/build-wchSnake-Desktop_Qt_5_9_0_MinGW_32bit-Debug
+ 3768
+ false
+ true
+ false
+ false
+ true
+
+ 1
+
+
+
+ ProjectExplorer.Project.TargetCount
+ 1
+
+
+ ProjectExplorer.Project.Updater.FileVersion
+ 18
+
+
+ Version
+ 18
+
+
diff --git "a/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020qt\345\244\247\344\275\234\344\270\232.pptx" "b/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020qt\345\244\247\344\275\234\344\270\232.pptx"
new file mode 100644
index 000000000..d426e17f1
Binary files /dev/null and "b/\345\244\247\344\270\200\345\260\217\345\255\246\346\234\237/Week_1-Qt/hw/2020qt\345\244\247\344\275\234\344\270\232.pptx" differ