提交 c161eb04 编写于 作者: struct_cym's avatar struct_cym

Update game.cpp

上级 3db4dee3
...@@ -9,6 +9,16 @@ board: 一些选项 ...@@ -9,6 +9,16 @@ board: 一些选项
有重要的变量 有重要的变量
option:通用选择 option:通用选择
游戏说明:
此游戏包含很多玩法
有迷宫,技能,等级制,战斗等等
可以自由去探索
*/ */
#include <bits/stdc++.h> #include <bits/stdc++.h>
...@@ -475,7 +485,7 @@ void huo(){ ...@@ -475,7 +485,7 @@ void huo(){
cout<<"恭喜你获得了 炎溶石 "<<endl; cout<<"恭喜你获得了 炎溶石 "<<endl;
} }
y=rand()%20+1; y=rand()%50+1;
if(y==5){ if(y==5){
cout<<"恭喜你找到了 火神传承 "<<endl; cout<<"恭喜你找到了 火神传承 "<<endl;
grade++; grade++;
...@@ -673,8 +683,7 @@ int boss_shanghai(double gong){ ...@@ -673,8 +683,7 @@ int boss_shanghai(double gong){
} }
} }
void ten() void ten(){
{
cout << "wsad = 上下左右, @ 为终点 ,O 为你的位置" << endl; cout << "wsad = 上下左右, @ 为终点 ,O 为你的位置" << endl;
char a[10][10] = char a[10][10] =
{ {
...@@ -689,10 +698,8 @@ void ten() ...@@ -689,10 +698,8 @@ void ten()
{'#','#',' ',' ',' ',' ','#','#',' ','#'}, {'#','#',' ',' ',' ',' ','#','#',' ','#'},
{'#','#','#','#','#','#','#','#','#','#'}, {'#','#','#','#','#','#','#','#','#','#'},
}; };
for(int i = 0; i < 10; i++) for(int i = 0; i < 10; i++){
{ for(int j = 0; j < 10; j++){
for(int j = 0; j < 10; j++)
{
cout << a[i][j] << " "; cout << a[i][j] << " ";
} }
cout << endl; cout << endl;
...@@ -700,45 +707,37 @@ void ten() ...@@ -700,45 +707,37 @@ void ten()
char ch; char ch;
int x = 4, y = 1; int x = 4, y = 1;
int q = 1, p = 9; int q = 1, p = 9;
while(ch = getch()) while(ch = getch()){
{
system("cls"); system("cls");
cout << "wsad = 上下左右, @ 为终点 ,O 为你的位置" << endl; cout << "wsad = 上下左右, @ 为终点 ,O 为你的位置" << endl;
if(ch == 'w' && a[x - 1][y] != '#') if(ch == 'w' && a[x - 1][y] != '#'){
{
a[x][y] = ' '; a[x][y] = ' ';
x--; x--;
a[x][y] = 'O'; a[x][y] = 'O';
} }
else if(ch == 's' && a[x + 1][y] != '#') else if(ch == 's' && a[x + 1][y] != '#'){
{
a[x][y] = ' '; a[x][y] = ' ';
x++; x++;
a[x][y] = 'O'; a[x][y] = 'O';
} }
else if(ch == 'a' && a[x][y - 1] != '#') else if(ch == 'a' && a[x][y - 1] != '#'){
{
a[x][y] = ' '; a[x][y] = ' ';
y--; y--;
a[x][y] = 'O'; a[x][y] = 'O';
} }
else if(ch == 'd' && a[x][y + 1] != '#') else if(ch == 'd' && a[x][y + 1] != '#'){
{
a[x][y] = ' '; a[x][y] = ' ';
y++; y++;
a[x][y] = 'O'; a[x][y] = 'O';
} }
for(int i = 0; i < 10; i++) for(int i = 0; i < 10; i++){
{ for(int j = 0; j < 10; j++){
for(int j = 0; j < 10; j++)
{
cout << a[i][j] << " "; cout << a[i][j] << " ";
} }
cout << endl; cout << endl;
} }
if(x == q && y == p) if(x == q && y == p){
{
cout << "win"<<endl; cout << "win"<<endl;
cout<<"你将获得10点经验"<<endl; cout<<"你将获得10点经验"<<endl;
jinyan+=10; jinyan+=10;
...@@ -746,8 +745,7 @@ void ten() ...@@ -746,8 +745,7 @@ void ten()
} }
} }
} }
void eleven() void eleven(){
{
cout << "wsad = 上下左右, @ 为终点 ,O 为你的位置" << endl; cout << "wsad = 上下左右, @ 为终点 ,O 为你的位置" << endl;
char a[11][11] = char a[11][11] =
{ {
...@@ -763,10 +761,8 @@ void eleven() ...@@ -763,10 +761,8 @@ void eleven()
{'#','#','#',' ',' ',' ',' ',' ',' ','#','#'}, {'#','#','#',' ',' ',' ',' ',' ',' ','#','#'},
{'#','#','#','#','#','#','#','#','#','#','#'}, {'#','#','#','#','#','#','#','#','#','#','#'},
}; };
for(int i = 0; i < 11; i++) for(int i = 0; i < 11; i++){
{ for(int j = 0; j < 11; j++){
for(int j = 0; j < 11; j++)
{
cout << a[i][j] << " "; cout << a[i][j] << " ";
} }
cout << endl; cout << endl;
...@@ -774,44 +770,36 @@ void eleven() ...@@ -774,44 +770,36 @@ void eleven()
char ch; char ch;
int x = 1, y = 1; int x = 1, y = 1;
int q = 6, p = 10; int q = 6, p = 10;
while(ch = getch()) while(ch = getch()){
{
system("cls"); system("cls");
cout << "wsad = 上下左右, @ 为终点 ,O 为你的位置" << endl; cout << "wsad = 上下左右, @ 为终点 ,O 为你的位置" << endl;
if(ch == 'w' && a[x - 1][y] != '#') if(ch == 'w' && a[x - 1][y] != '#'){
{
a[x][y] = ' '; a[x][y] = ' ';
x--; x--;
a[x][y] = 'O'; a[x][y] = 'O';
} }
else if(ch == 's' && a[x + 1][y] != '#') else if(ch == 's' && a[x + 1][y] != '#'){
{
a[x][y] = ' '; a[x][y] = ' ';
x++; x++;
a[x][y] = 'O'; a[x][y] = 'O';
} }
else if(ch == 'a' && a[x][y - 1] != '#') else if(ch == 'a' && a[x][y - 1] != '#'){
{
a[x][y] = ' '; a[x][y] = ' ';
y--; y--;
a[x][y] = 'O'; a[x][y] = 'O';
} }
else if(ch == 'd' && a[x][y + 1] != '#') else if(ch == 'd' && a[x][y + 1] != '#'){
{
a[x][y] = ' '; a[x][y] = ' ';
y++; y++;
a[x][y] = 'O'; a[x][y] = 'O';
} }
for(int i = 0; i < 11; i++) for(int i = 0; i < 11; i++){
{ for(int j = 0; j < 11; j++){
for(int j = 0; j < 11; j++)
{
cout << a[i][j] << " "; cout << a[i][j] << " ";
} }
cout << endl; cout << endl;
} }
if(x == q && y == p) if(x == q && y == p){
{
cout << "win"<<endl; cout << "win"<<endl;
cout<<"你将获得11点经验"<<endl; cout<<"你将获得11点经验"<<endl;
jinyan+=11; jinyan+=11;
...@@ -819,8 +807,7 @@ void eleven() ...@@ -819,8 +807,7 @@ void eleven()
} }
} }
} }
void twelve() void twelve(){
{
cout << "wsad = 上下左右, @ 为终点 ,O 为你的位置" << endl; cout << "wsad = 上下左右, @ 为终点 ,O 为你的位置" << endl;
char a[12][12] = char a[12][12] =
{ {
...@@ -836,10 +823,8 @@ void twelve() ...@@ -836,10 +823,8 @@ void twelve()
{'#',' ','#','#','#',' ',' ',' ',' ','#','#','#'}, {'#',' ','#','#','#',' ',' ',' ',' ','#','#','#'},
{'#','#','#','#','#','#','#','#','#','#','#','#'}, {'#','#','#','#','#','#','#','#','#','#','#','#'},
}; };
for(int i = 0; i < 12; i++) for(int i = 0; i < 12; i++){
{ for(int j = 0; j < 12; j++){
for(int j = 0; j < 12; j++)
{
cout << a[i][j] << " "; cout << a[i][j] << " ";
} }
cout << endl; cout << endl;
...@@ -847,44 +832,36 @@ void twelve() ...@@ -847,44 +832,36 @@ void twelve()
char ch; char ch;
int x = 2, y = 1; int x = 2, y = 1;
int q = 5, p = 11; int q = 5, p = 11;
while(ch = getch()) while(ch = getch()){
{
system("cls"); system("cls");
cout << "wsad = 上下左右, @ 为终点 ,O 为你的位置" << endl; cout << "wsad = 上下左右, @ 为终点 ,O 为你的位置" << endl;
if(ch == 'w' && a[x - 1][y] != '#') if(ch == 'w' && a[x - 1][y] != '#'){
{
a[x][y] = ' '; a[x][y] = ' ';
x--; x--;
a[x][y] = 'O'; a[x][y] = 'O';
} }
else if(ch == 's' && a[x + 1][y] != '#') else if(ch == 's' && a[x + 1][y] != '#'){
{
a[x][y] = ' '; a[x][y] = ' ';
x++; x++;
a[x][y] = 'O'; a[x][y] = 'O';
} }
else if(ch == 'a' && a[x][y - 1] != '#') else if(ch == 'a' && a[x][y - 1] != '#'){
{
a[x][y] = ' '; a[x][y] = ' ';
y--; y--;
a[x][y] = 'O'; a[x][y] = 'O';
} }
else if(ch == 'd' && a[x][y + 1] != '#') else if(ch == 'd' && a[x][y + 1] != '#'){
{
a[x][y] = ' '; a[x][y] = ' ';
y++; y++;
a[x][y] = 'O'; a[x][y] = 'O';
} }
for(int i = 0; i < 12; i++) for(int i = 0; i < 12; i++){
{ for(int j = 0; j < 12; j++){
for(int j = 0; j < 12; j++)
{
cout << a[i][j] << " "; cout << a[i][j] << " ";
} }
cout << endl; cout << endl;
} }
if(x == q && y == p) if(x == q && y == p){
{
cout << "win"<<endl; cout << "win"<<endl;
cout<<"你将获得12点经验"<<endl; cout<<"你将获得12点经验"<<endl;
jinyan+=12; jinyan+=12;
...@@ -892,8 +869,7 @@ void twelve() ...@@ -892,8 +869,7 @@ void twelve()
} }
} }
} }
void thirteen() void thirteen(){
{
cout << "wsad = 上下左右, @ 为终点 ,O 为你的位置" << endl; cout << "wsad = 上下左右, @ 为终点 ,O 为你的位置" << endl;
char a[13][13] = char a[13][13] =
{ {
...@@ -911,10 +887,8 @@ void thirteen() ...@@ -911,10 +887,8 @@ void thirteen()
{'#',' ',' ',' ',' ',' ','#',' ',' ','#','#','#','#'}, {'#',' ',' ',' ',' ',' ','#',' ',' ','#','#','#','#'},
{'#','#','#','#','#','#','#','#','#','#','#','#','#'}, {'#','#','#','#','#','#','#','#','#','#','#','#','#'},
}; };
for(int i = 0; i < 13; i++) for(int i = 0; i < 13; i++){
{ for(int j = 0; j < 13; j++){
for(int j = 0; j < 13; j++)
{
cout << a[i][j] << " "; cout << a[i][j] << " ";
} }
cout << endl; cout << endl;
...@@ -922,44 +896,36 @@ void thirteen() ...@@ -922,44 +896,36 @@ void thirteen()
char ch; char ch;
int x = 2, y = 1; int x = 2, y = 1;
int q = 7, p = 12; int q = 7, p = 12;
while(ch = getch()) while(ch = getch()){
{
system("cls"); system("cls");
cout << "wsad = 上下左右, @ 为终点 ,O 为你的位置" << endl; cout << "wsad = 上下左右, @ 为终点 ,O 为你的位置" << endl;
if(ch == 'w' && a[x - 1][y] != '#') if(ch == 'w' && a[x - 1][y] != '#'){
{
a[x][y] = ' '; a[x][y] = ' ';
x--; x--;
a[x][y] = 'O'; a[x][y] = 'O';
} }
else if(ch == 's' && a[x + 1][y] != '#') else if(ch == 's' && a[x + 1][y] != '#'){
{
a[x][y] = ' '; a[x][y] = ' ';
x++; x++;
a[x][y] = 'O'; a[x][y] = 'O';
} }
else if(ch == 'a' && a[x][y - 1] != '#') else if(ch == 'a' && a[x][y - 1] != '#'){
{
a[x][y] = ' '; a[x][y] = ' ';
y--; y--;
a[x][y] = 'O'; a[x][y] = 'O';
} }
else if(ch == 'd' && a[x][y + 1] != '#') else if(ch == 'd' && a[x][y + 1] != '#'){
{
a[x][y] = ' '; a[x][y] = ' ';
y++; y++;
a[x][y] = 'O'; a[x][y] = 'O';
} }
for(int i = 0; i < 13; i++) for(int i = 0; i < 13; i++){
{ for(int j = 0; j < 13; j++){
for(int j = 0; j < 13; j++)
{
cout << a[i][j] << " "; cout << a[i][j] << " ";
} }
cout << endl; cout << endl;
} }
if(x == q && y == p) if(x == q && y == p){
{
cout << "win"<<endl; cout << "win"<<endl;
cout<<"你将获得13点经验"<<endl; cout<<"你将获得13点经验"<<endl;
jinyan+=13; jinyan+=13;
...@@ -967,8 +933,7 @@ void thirteen() ...@@ -967,8 +933,7 @@ void thirteen()
} }
} }
} }
void forteen() void forteen(){
{
cout << "wsad = 上下左右, @ 为终点 ,O 为你的位置" << endl; cout << "wsad = 上下左右, @ 为终点 ,O 为你的位置" << endl;
char a[14][14] = char a[14][14] =
{ {
...@@ -987,10 +952,8 @@ void forteen() ...@@ -987,10 +952,8 @@ void forteen()
{'#','#','#','#','#','#',' ',' ',' ','#','#','#','#','#'}, {'#','#','#','#','#','#',' ',' ',' ','#','#','#','#','#'},
{'#','#','#','#','#','#','#','#','#','#','#','#','#','#'}, {'#','#','#','#','#','#','#','#','#','#','#','#','#','#'},
}; };
for(int i = 0; i < 14; i++) for(int i = 0; i < 14; i++){
{ for(int j = 0; j < 14; j++){
for(int j = 0; j < 14; j++)
{
cout << a[i][j] << " "; cout << a[i][j] << " ";
} }
cout << endl; cout << endl;
...@@ -998,44 +961,36 @@ void forteen() ...@@ -998,44 +961,36 @@ void forteen()
char ch; char ch;
int x = 2, y = 1; int x = 2, y = 1;
int q = 4, p = 13; int q = 4, p = 13;
while(ch = getch()) while(ch = getch()){
{
system("cls"); system("cls");
cout << "wsad = 上下左右, @ 为终点 ,O 为你的位置" << endl; cout << "wsad = 上下左右, @ 为终点 ,O 为你的位置" << endl;
if(ch == 'w' && a[x - 1][y] != '#') if(ch == 'w' && a[x - 1][y] != '#'){
{
a[x][y] = ' '; a[x][y] = ' ';
x--; x--;
a[x][y] = 'O'; a[x][y] = 'O';
} }
else if(ch == 's' && a[x + 1][y] != '#') else if(ch == 's' && a[x + 1][y] != '#'){
{
a[x][y] = ' '; a[x][y] = ' ';
x++; x++;
a[x][y] = 'O'; a[x][y] = 'O';
} }
else if(ch == 'a' && a[x][y - 1] != '#') else if(ch == 'a' && a[x][y - 1] != '#'){
{
a[x][y] = ' '; a[x][y] = ' ';
y--; y--;
a[x][y] = 'O'; a[x][y] = 'O';
} }
else if(ch == 'd' && a[x][y + 1] != '#') else if(ch == 'd' && a[x][y + 1] != '#'){
{
a[x][y] = ' '; a[x][y] = ' ';
y++; y++;
a[x][y] = 'O'; a[x][y] = 'O';
} }
for(int i = 0; i < 14; i++) for(int i = 0; i < 14; i++){
{ for(int j = 0; j < 14; j++){
for(int j = 0; j < 14; j++)
{
cout << a[i][j] << " "; cout << a[i][j] << " ";
} }
cout << endl; cout << endl;
} }
if(x == q && y == p) if(x == q && y == p){
{
cout << "win"<<endl; cout << "win"<<endl;
cout<<"你将获得14点经验"<<endl; cout<<"你将获得14点经验"<<endl;
jinyan+=14; jinyan+=14;
...@@ -1044,29 +999,23 @@ void forteen() ...@@ -1044,29 +999,23 @@ void forteen()
} }
} }
void shenming() void shenming(){
{
int n; int n;
cout << "请输入你想要的级别 1 ~ 5" << endl; cout << "请输入你想要的级别 1 ~ 5" << endl;
cin >> n; cin >> n;
if(n == 1) if(n == 1){
{
ten(); ten();
} }
else if(n == 2) else if(n == 2){
{
eleven(); eleven();
} }
else if(n == 3) else if(n == 3){
{
twelve(); twelve();
} }
else if(n == 4) else if(n == 4){
{
thirteen(); thirteen();
} }
else if(n == 5) else if(n == 5){
{
forteen(); forteen();
} }
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册