Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ This version is for Windows only. Chinese output or comments may be garbled, so

此版本只适用于Windows。中文的输出或注释可能出现乱码,可以进行反馈或转码(代码使用编码:GB2312)。

The newly introduced portable version of Linux may damage the experience.

新推出了linux的移植版本,体验可能受损。

## 版本

### V2.2
Expand Down
121 changes: 121 additions & 0 deletions linux-version/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# My-Map
## 注意事项
This version is for Windows only. Chinese output or comments may be garbled, so feedback or transcoding can be performed (code usage code: GB2312).

此版本只适用于Windows。中文的输出或注释可能出现乱码,可以进行反馈或转码(代码使用编码:GB2312)。

## 版本

### V2.2

#### V2.2.4

Slightly revised RENAME.md.

略微改版RENAME.md。

#### V2.2.3

1. Expand comments.

2. Change the structure slightly.

3. New mode: All in one mode.

1、扩充注释。

2、稍微更改结构。

3、新增模式:清一色模式。

#### V2.2.2

Modification of some details.

一些细节的修改。

#### V2.2.1

1. New mode setting: Hell mode.

2. Functional comments are provided for part of the code.

1、新增模式设置:地狱模式。

2、为部分代码提供了功能注释。

#### V2.2.0

New mode settings: normal mode and developer mode.

新增模式设置:普通模式和开发者模式。

### V2.1

#### V2.1.3:

Merge pop-window-version into main branch.

合并pop-window-version为main分支。

#### V2.1.2

Optimization of some details.

一些细节的优化。

#### V2.1.1

Optimization of some details.

一些细节的优化。

#### V2.1.0

Expand the egg of the previous version and add new achievements. Add language menu option.

对上一版本的彩蛋进行扩充,新增成就。新增语言菜单选项。

### V2.0

#### V2.0.0

New eggs. Please explore or consult the code yourself.

新增彩蛋。请自行探索或查阅代码。

### V1.3

#### V1.3.1

Add small balls; Discard the archive function and stop providing it until the bug is fixed.

新增小球;弃用存档功能,在修复好bug之前不再提供。

#### V1.3.0

Fix the bug that the ball does not update, and make changes to the screen related help.

修复小球不更新的bug,并对屏幕相关帮助作出更改。

### V1.2

#### V1.2.0
Added the function of importing and exporting documents.

新增导入导出文档功能。

### V1.1

#### V1.1.0
The new portal function can easily reach remote places.

新增传送门功能,可以方便地到达遥远之地。

### V1.0

#### V1.0.0
This is a new Sandbox game. You can create or destroy rocks here, and you can walk freely. More functions are under development.

这是一个新的沙盒游戏。你在这里可以创建或销毁岩石,也可以自由行走。更多功能开发中。

100 changes: 100 additions & 0 deletions linux-version/defines/Eggs.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
#ifndef EGGS_CPP_CPP
#define EGGS_CPP_CPP
#include <cstdlib>
#include "Eggs.h"
#include "People.h"
#include "help_func.h"
int Egg::isegg(const int &lang,People &p,Map &h){
if(lang==English &&
h[EGG_POS[English][0][0]][EGG_POS[English][0][1]]==rock){
has_ach=true;
system(("mode "+to_string(COLS+ADD_COLS)+","+to_string(LINES+ADD_LINE)).c_str());
} else if(lang==Chinese &&
p.at(EGG_POS[Chinese][0][0],EGG_POS[Chinese][0][1])==
People::node(EGG_POS[Chinese][0][0],EGG_POS[Chinese][0][1])
&& p.get_pos().x==EGG_POS[Chinese][0][0] && p.get_pos().y==EGG_POS[Chinese][0][1]) return CHI_egg_1;
else if(lang==unable &&
p.get_pos().x==EGG_POS[unable][0][0] && p.get_pos().y==EGG_POS[unable][0][1]
&& h[EGG_POS[unable][0][0]][EGG_POS[unable][0][1]]==ball
&& p.move_f==rights) return UNABLE_egg_1;
return empty_egg;
}
void Egg::check_run(const int &lang,People &p,Map &h){
system("clear");
switch(isegg(lang,p,h)){
case CHI_egg_1:
{
achs[6]=true;
::print("恭喜您,发现了彩蛋!\n");
::print(">>>");
string s;
while(getline(cin,s) && s!="quit"){
if(s=="creater"){
::print("c_cpp_a,Github网址:www.github.com/c-cpp-a/My-Map\n");
} else if(s=="lgker"){
::print("哈哈,恭喜您发现了隐藏的彩蛋!\n洛谷账号:c_cpp_a,洛谷UID:346332。\n");
} else if(s=="Snake"){
::print("加载贪吃蛇游戏中……\n");
usleep(10000);//空留着以后再补
::print("加载失败!\n");
} else{
::print("对不起,您输入的不是任何指令。\n");
}
::print(">>>");
}
::print("已退出!");
}
break;
case UNABLE_egg_1:
{
achs[7]=true;
::print("恭喜您,发现了彩蛋!\n");
::print("Congratulations, you found the egg!\n");
::print("<<<");
string s;
while(getline(cin,s) && s!="quit"){
if(s=="D o D o oooo"){
::print(s);
::print("\n挺不错嘛,这个彩蛋可难找到了!\n");
::print("Very good. It's hard to find this egg!\n");
::print("彩蛋提示:中文、10、传送门。\n");
::print("Egg tips: Chinese, 10. Transmission gate.\n");
} else{
::print(s);
::print("\n");
}
::print("<<<");
}
}
}
}
void Egg::print_ach(){
auto y=0;
y=ach_print("achievement",y);
if(achs[0]){
y=ach_print("1.creat your first floor.",y);
}
if(achs[1]){
y=ach_print("2.creat your first rock.",y);
}
if(achs[2]){
y=ach_print("3.creat your first portal.",y);
}
if(achs[3]){
y=ach_print("4.creat your first ball.",y);
}
if(achs[4]){
y=ach_print("5.first access to the portal",y);
}
if(achs[5]){
y=ach_print("6.move your ball the first time.",y);
}
if(achs[6]){
y=ach_print("7.found Chinese egg 1.",y);
}
if(achs[7]){
y=ach_print("8.found [unable] Egg 1.",y);
}
}

#endif
27 changes: 27 additions & 0 deletions linux-version/defines/Eggs.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#ifndef EGGS_H_
#define EGGS_H_
//include STL
//导入标准库
#include<string>
#include<iostream>
//include custom library
//导入自定义库
#include "def.h"
class People;
class Map;
class Egg{
private:
bool has_ach=false;
bool achs[10]={};
public:
int isegg(const int &,People &,Map &);
void check_run(const int &,People &,Map &);
void print_ach();
inline bool is_ach(){
return has_ach;
}
inline bool &operator[](size_t i){
return achs[i];
}
};
#endif
89 changes: 89 additions & 0 deletions linux-version/defines/Map.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
void Map::print(int x,int y,const int &direct){
gotoxy(0,0);
if(x>=COLS/2 && y>=LINES/2){
for(int i=x-LINES/2+1;i<=x+LINES/2;i++){
for(int j=y-COLS/2+1;j<=y+COLS/2;j++){
if(i==x && j==y){
putchar('#');
continue;
}
map_print(a[i][j]);
}
putchar('\n');
}
} else if(x>=COLS/2){
for(int i=x-LINES/2+1;i<=x+LINES/2;i++){
for(int j=1;j<=COLS;j++){
if(i==x && j==y){
putchar('#');
continue;
}
map_print(a[i][j]);
}
putchar('\n');
}
} else if(y>=COLS/2){
for(int i=1;i<=LINES;i++){
for(int j=y-COLS/2+1;j<=y+COLS/2;j++){
if(i==x && j==y){
putchar('#');
continue;
}
map_print(a[i][j]);
}
putchar('\n');
}
} else{
for(int i=1;i<=LINES;i++){
for(int j=1;j<=COLS;j++){
if(i==x && j==y){
putchar('#');
continue;
}
map_print(a[i][j]);
}
putchar('\n');
}
}
if(::mode==debugger){
string contents="pos=("+to_string(x)+","+to_string(y)+"),direct="+direct_content[::lang][direct];
gotoxy(0,COLS);
cout << contents;
}
}
void Map::change(int x,int y,int c){
a[x][y]=c;
downx=max(downx,x);
righty=max(righty,y);
}
bool Map::issave(int x,int y){
return a[x][y]!=rock;
}
//void Map::imports(){
// ifstream fin;
// fin.open(SAVE_NAME);
// fin >> downx >> righty;
// for(int i=1;i<=downx;i++){
// for(int j=1;j<=righty;j++){
// char ch;
// fin >> ch;
// a[i][j]=ch;
// }
// }
// fin.close();
//}
//void Map::save(){
// ofstream fout;
// fout.open(SAVE_NAME);
// fout << downx << ' ' << righty;
// for(int i=1;i<=downx;i++){
// for(int j=1;j<=righty;j++){
// fout << a[i][j] << ' ';
// }
// fout << '\n';
// }
// fout.close();
//}
map<int,int> Map::operator[](const int i){
return a[i];
}
23 changes: 23 additions & 0 deletions linux-version/defines/Map.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#ifndef MAP_H_
#define MAP_H_
//include STL
//导入标准库
#include<map>
#include<fstream>
//include custom library
//导入自定义库
#include "def.h"
using namespace std;
class Map{
private:
map<int,map<int,int>> a;
int downx=0,righty=0;
public:
void print(int,int,const int &);
void change(int,int,int);
bool issave(int,int);
// void imports();
// void save();
map<int,int> operator[](const int i);
};
#endif
Loading