问题标题: 历代IWC

2
3
已解决
宣墨一
宣墨一
初级守护
初级守护
//1.0
#include<iostream>
#include<bits/stdc++.h>
#include<windows.h>
#include<time.h>
#include<unistd.h>
#include<conio.h>
#include<iomanip>
using namespace std;
int b[20][20]={1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
               1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
               1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
               1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
               1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,
               1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
               1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
void out1(){
    for(int i=0;i<=19;i++){
        for(int j=0;j<=19;j++){
            if(b[i][j]==1){
                cout<<'#';
            }else if(b[i][j]==0){
                cout<<' ';
            }else{
                cout<<'@';
            }
        }
        cout<<endl;
    }
}
int main(){
    int x=16,y=19;
    while(1){
        out1();
        char ch=getch();
        if(ch=='s'){
            system("cls");
            swap(b[x][y],b[x+1][y]);
            out1();
            Sleep(1000);
            x+=1;
            system("cls");

        }else if(ch=='w'){
            system("cls");
            swap(b[x][y],b[x-1][y]);
            out1();
            Sleep(1000);
            x-=1;
            if(b[x+1][y]!=0){
                system("cls");
                continue;
            }
            system("cls");
            swap(b[x][y],b[x+1][y]);
            x+=1;
            out1();
            system("cls");
        }
    }
    return 0;
}

//2.0
#include<iostream>
#include<bits/stdc++.h>
#include<windows.h>
#include<time.h>
#include<unistd.h>
#include<conio.h>
#include<iomanip>
using namespace std;
int b[20][30]={1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
               1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,
               1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,
               1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,
               1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,
               1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
               1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
void out1(){
    for(int i=0;i<=29;i++){
        for(int j=0;j<=29;j++){
            if(b[i][j]==1){
                cout<<'#';
            }else if(b[i][j]==0){
                cout<<' ';
            }else if(b[i][j]==2){
                cout<<'@';
            }
        }
        cout<<endl;
    }
}
void windows(){
    HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
    CONSOLE_SCREEN_BUFFER_INFO bInfo;
    GetConsoleScreenBufferInfo(hOut, &bInfo );
    SetConsoleTitle("IWC 2.0"); // 设置窗口的标题
    COORD size = {110, 30};//设置窗口大小
    SetConsoleScreenBufferSize(hOut,size);
    SMALL_RECT rc = {0,0, 110, 30};
    SetConsoleWindowInfo(hOut,true ,&rc);
}
int main(){
    windows();
    int x=17,y=29;
    while(1){
        out1();
        char ch=getch();
        if(ch=='s'){
            system("cls");
            if(b[x+1][y]!=0){
                system("cls");
                continue;
            }
            swap(b[x][y],b[x+1][y]);


            x+=1;


        }else if(ch=='w'){
            system("cls");
            if(b[x-1][y]!=0){
                system("cls");
                continue;
            }
            swap(b[x][y],b[x-1][y]);
            b[x][y]=1;
            x-=1;


        }else if(ch=='a'){
            system("cls");
            if(b[x][y-1]!=0){
                system("cls");
                continue;
            }
            swap(b[x][y],b[x][y-1]);
            y-=1;

        }else if(ch=='d'){
            system("cls");
            if(b[x][y+1]!=0){
                system("cls");
                continue;
            }
            swap(b[x][y],b[x][y+1]);
            y+=1;

        }
    }
    return 0;
}

//3.0

#include<iostream>
#include<bits/stdc++.h>
#include<windows.h>
#include<time.h>
#include<unistd.h>
#include<conio.h>
#include<iomanip>
using namespace std;
int b[20][30]={1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
               1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,
               1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,
               1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,
               1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,
               1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
               1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
void setColor(int color) {
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), color);
}
void out1(){
    for(int i=0;i<=29;i++){
        for(int j=0;j<=29;j++){
            if(b[i][j]==1){
                cout<<'#';
            }else if(b[i][j]==0){
                cout<<' ';
            }else if(b[i][j]==2){
                cout<<'@';
            }
        }
        cout<<endl;
    }
}
void windows(){
    HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
    CONSOLE_SCREEN_BUFFER_INFO bInfo;
    GetConsoleScreenBufferInfo(hOut, &bInfo );
    SetConsoleTitle("IWC 2.0"); // 设置窗口的标题
    COORD size = {110, 30};//设置窗口大小
    SetConsoleScreenBufferSize(hOut,size);
    SMALL_RECT rc = {0,0, 110, 30};
    SetConsoleWindowInfo(hOut,true ,&rc);
}
int main(){
    windows();
    //system("color 1F");

    setColor(4);
    int x=17,y=29;
    while(1){
        out1();
        char ch=getch();
        if(ch=='s'){
            system("cls");
            if(b[x+1][y]!=0){
                system("cls");
                continue;
            }
            swap(b[x][y],b[x+1][y]);


            x+=1;


        }else if(ch=='w'){
            system("cls");
            if(b[x-1][y]!=0){
                system("cls");
                continue;
            }
            swap(b[x][y],b[x-1][y]);
            b[x][y]=1;
            x-=1;


        }else if(ch=='a'){
            system("cls");
            if(b[x][y-1]!=0){
                system("cls");
                continue;
            }
            swap(b[x][y],b[x][y-1]);
            y-=1;

        }else if(ch=='d'){
            system("cls");
            if(b[x][y+1]!=0){
                system("cls");
                continue;
            }
            swap(b[x][y],b[x][y+1]);
            y+=1;

        }else if(ch=='i'){
            b[x-1][y]=0;

            system("cls");
        }else if(ch=='k'){
            b[x+1][y]=0;

            system("cls");
        }else if(ch=='j'){
            b[x][y-1]=0;

            system("cls");
        }else if(ch=='l'){
            b[x][y+1]=0;

            system("cls");
        }else{
            system("cls");
            continue;
        }
    }

    return 0;
}





//4.0
#include<iostream>
#include<bits/stdc++.h>
#include<windows.h>
#include<time.h>
#include<unistd.h>
#include<conio.h>
#include<iomanip>
using namespace std;
int b[20][50]={1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
               1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,
               1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
               1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
void setColor(int color) {
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), color);
}
void out1(){
    for(int i=0;i<=19;i++){
        for(int j=0;j<=49;j++){
            if(b[i][j]==1){
                cout<<'#';
            }else if(b[i][j]==0){
                cout<<' ';
            }else if(b[i][j]==2){
                cout<<'@';
            }
        }
        cout<<endl;
    }
}
void windows(){
    HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
    CONSOLE_SCREEN_BUFFER_INFO bInfo;
    GetConsoleScreenBufferInfo(hOut, &bInfo );
    SetConsoleTitle("IWC 2.0"); // 设置窗口的标题
    COORD size = {110, 30};//设置窗口大小
    SetConsoleScreenBufferSize(hOut,size);
    SMALL_RECT rc = {0,0, 110, 30};
    SetConsoleWindowInfo(hOut,true ,&rc);
}
int main(){
    windows();
    //system("color 1F");

    setColor(4);
    int x=17,y=49;
    while(1){
        out1();
        char ch=getch();
        if(ch=='s'){
            system("cls");
            if(b[x+1][y]!=0){
                system("cls");
                continue;
            }
            swap(b[x][y],b[x+1][y]);


            x+=1;


        }else if(ch=='w'){
            system("cls");
            if(b[x-1][y]!=0){
                system("cls");
                continue;
            }
            swap(b[x][y],b[x-1][y]);
            b[x][y]=1;
            x-=1;


        }else if(ch=='a'){
            system("cls");
            if(b[x][y-1]!=0){
                system("cls");
                continue;
            }
            swap(b[x][y],b[x][y-1]);
            y-=1;

        }else if(ch=='d'){
            system("cls");
            if(b[x][y+1]!=0){
                system("cls");
                continue;
            }
            swap(b[x][y],b[x][y+1]);
            y+=1;

        }else if(ch=='i'){
            b[x-1][y]=0;

            system("cls");
        }else if(ch=='k'){
            b[x+1][y]=0;

            system("cls");
        }else if(ch=='j'){
            b[x][y-1]=0;

            system("cls");
        }else if(ch=='l'){
            b[x][y+1]=0;

            system("cls");
        }else{
            system("cls");
            continue;
        }
    }

    return 0;
}





//5.0
#include<iostream>
#include<bits/stdc++.h>
#include<windows.h>
#include<time.h>
#include<unistd.h>
#include<conio.h>
#include<iomanip>
using namespace std;
int b[20][50]={1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
               1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,
               1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
               1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
void setColor(int color) {
    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), color);
}
void out1(){
    for(int i=0;i<=19;i++){
        for(int j=0;j<=49;j++){
            if(b[i][j]==1){
                cout<<"#";
            }else if(b[i][j]==0){
                cout<<' ';
            }else if(b[i][j]==2){
                cout<<"@";
            }
        }
        cout<<endl;
    }
}
void windows(){
    HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
    CONSOLE_SCREEN_BUFFER_INFO bInfo;
    GetConsoleScreenBufferInfo(hOut, &bInfo );
    SetConsoleTitle("IWC 5.0"); // 设置窗口的标题
    COORD size = {110, 30};//设置窗口大小
    SetConsoleScreenBufferSize(hOut,size);
    SMALL_RECT rc = {0,0, 110, 30};
    SetConsoleWindowInfo(hOut,true ,&rc);
}
int main(){
    windows();
    //system("color 1F");

    setColor(4);
    int x=17,y=49;
    while(1){
        out1();
        char ch=getch();
        if(ch=='s'){
            system("cls");
            if(b[x+1][y]!=0){
                system("cls");
                continue;
            }
            swap(b[x][y],b[x+1][y]);


            x+=1;


        }else if(ch=='w'){
            system("cls");
            if(b[x-1][y]!=0){
                system("cls");
                continue;
            }
            swap(b[x][y],b[x-1][y]);
            b[x][y]=1;
            x-=1;


        }else if(ch=='a'){
            system("cls");
            if(b[x][y-1]!=0){
                system("cls");
                continue;
            }
            swap(b[x][y],b[x][y-1]);
            y-=1;

        }else if(ch=='d'){
            system("cls");
            if(b[x][y+1]!=0){
                system("cls");
                continue;
            }
            swap(b[x][y],b[x][y+1]);
            y+=1;

        }else if(ch=='i'){
            b[x-1][y]=0;

            system("cls");
        }else if(ch=='k'){
            b[x+1][y]=0;

            system("cls");
        }else if(ch=='j'){
            b[x][y-1]=0;

            system("cls");
        }else if(ch=='l'){
            b[x][y+1]=0;

            system("cls");
        }else if(ch=='t'){
            b[x-1][y]=1;
            system("cls");
        }else if(ch=='g'){
            b[x+1][y]=1;
            system("cls");
        }else if(ch=='f'){
            b[x][y-1]=1;
            system("cls");
        }else if(ch=='h'){
            b[x][y+1]=1;
            system("cls");
        }else{
            system("cls");
            continue;
        }
    }

    return 0;
}





//6.0
#include<iostream>
#include<bits/stdc++.h>
#include<windows.h>
#include<time.h>
#include<unistd.h>
#include<conio.h>
#include<iomanip>
using namespace std;

int b[20][50]={1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
               1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,
               1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
               1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
class Iwc{
    public:
        void setColor(int color) {
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), color);
        }
        void out1(){
            for(int i=0;i<=19;i++){
                for(int j=0;j<=49;j++){
                    if(b[i][j]==1){
                        cout<<"#";
                    }else if(b[i][j]==0){
                        cout<<' ';
                    }else if(b[i][j]==2){
                        cout<<"@";
                    }
                }
                cout<<endl;
            }
        }
};


void windows(){
    HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
    CONSOLE_SCREEN_BUFFER_INFO bInfo;
    GetConsoleScreenBufferInfo(hOut, &bInfo );
    SetConsoleTitle("IWC 6.0"); // 设置窗口的标题
    COORD size = {110, 30};//设置窗口大小
    SetConsoleScreenBufferSize(hOut,size);
    SMALL_RECT rc = {0,0, 110, 30};
    SetConsoleWindowInfo(hOut,true ,&rc);
}
int main(){
    windows();
    //system("color 1F");
    Iwc iwc;
    iwc.setColor(1);
    int x=17,y=49;
    while(1){
        iwc.out1();
        char ch=getch();
        if(ch=='s'){
            system("cls");
            if(b[x+1][y]!=0){
                system("cls");
                continue;
            }
            swap(b[x][y],b[x+1][y]);


            x+=1;


        }else if(ch=='w'){
            system("cls");
            if(b[x-1][y]!=0){
                system("cls");
                continue;
            }
            swap(b[x][y],b[x-1][y]);
            b[x][y]=1;
            x-=1;


        }else if(ch=='a'){
            system("cls");
            if(b[x][y-1]!=0){
                system("cls");
                continue;
            }
            swap(b[x][y],b[x][y-1]);
            y-=1;

        }else if(ch=='d'){
            system("cls");
            if(b[x][y+1]!=0){
                system("cls");
                continue;
            }
            swap(b[x][y],b[x][y+1]);
            y+=1;

        }else if(ch=='i'){
            b[x-1][y]=0;

            system("cls");
        }else if(ch=='k'){
            b[x+1][y]=0;

            system("cls");
        }else if(ch=='j'){
            b[x][y-1]=0;

            system("cls");
        }else if(ch=='l'){
            b[x][y+1]=0;

            system("cls");
        }else if(ch=='t'){
            b[x-1][y]=1;
            system("cls");
        }else if(ch=='g'){
            b[x+1][y]=1;
            system("cls");
        }else if(ch=='f'){
            b[x][y-1]=1;
            system("cls");
        }else if(ch=='h'){
            b[x][y+1]=1;
            system("cls");
        }else{
            system("cls");
            continue;
        }
    }

    return 0;
}


//7.0
#include<iostream>
#include<bits/stdc++.h>
#include<windows.h>
#include<time.h>
#include<unistd.h>
#include<conio.h>
#include<iomanip>
#include<fstream>
using namespace std;

int b[20][50]={1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
               1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,
               1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
               1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
int a[20][50];
class Iwc{
    public:
        void setColor(int color) {
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), color);
        }
        void out1(){
            for(int i=0;i<=19;i++){
                for(int j=0;j<=49;j++){
                    if(a[i][j]==1){
                        cout<<"#";
                    }else if(a[i][j]==0){
                        cout<<' ';
                    }else if(a[i][j]==2){
                        cout<<"@";
                    }
                }
                cout<<endl;
            }
        }
};


void windows(){
    HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
    CONSOLE_SCREEN_BUFFER_INFO bInfo;
    GetConsoleScreenBufferInfo(hOut, &bInfo );
    SetConsoleTitle("IWC 6.0"); // 设置窗口的标题
    COORD size = {110, 30};//设置窗口大小
    SetConsoleScreenBufferSize(hOut,size);
    SMALL_RECT rc = {0,0, 110, 30};
    SetConsoleWindowInfo(hOut,true ,&rc);
}
int main(){
    windows();
    //system("color 1F");
    Iwc iwc;
    iwc.setColor(1);

    int x=17,y=49;
    ifstream fin;
    fin.open("cd.iwdate");
    ofstream fout;
    if(!fin.is_open()){
        for(int i=0;i<=19;i++){
            for(int j=0;j<=49;j++){
                a[i][j]=b[i][j];
            }
        }
    }else{
        for(int i=0;i<=19;i++){
            for(int j=0;j<=49;j++){
                int e;
                fin>>e;
                if(e==2){
                    x=i;
                    y=j;
                }
                a[i][j]=e;
            }
        }
    } 
    fin.close() ;
    while(1){
        iwc.out1();
        char ch=getch();
        if(ch=='s'){
            system("cls");
            if(a[x+1][y]!=0){
                system("cls");
                continue;
            }
            swap(a[x][y],a[x+1][y]);


            x+=1;


        }else if(ch=='w'){
            system("cls");
            if(a[x-1][y]!=0){
                system("cls");
                continue;
            }
            swap(a[x][y],a[x-1][y]);
            a[x][y]=1;
            x-=1;


        }else if(ch=='a'){
            system("cls");
            if(a[x][y-1]!=0){
                system("cls");
                continue;
            }
            swap(a[x][y],a[x][y-1]);
            y-=1;

        }else if(ch=='d'){
            system("cls");
            if(a[x][y+1]!=0){
                system("cls");
                continue;
            }
            swap(a[x][y],a[x][y+1]);
            y+=1;

        }else if(ch=='i'){
            a[x-1][y]=0;

            system("cls");
        }else if(ch=='k'){
            a[x+1][y]=0;

            system("cls");
        }else if(ch=='j'){
            a[x][y-1]=0;

            system("cls");
        }else if(ch=='l'){
            a[x][y+1]=0;

            system("cls");
        }else if(ch=='t'){
            a[x-1][y]=1;
            system("cls");
        }else if(ch=='g'){
            a[x+1][y]=1;
            system("cls");
        }else if(ch=='f'){
            a[x][y-1]=1;
            system("cls");
        }else if(ch=='h'){
            a[x][y+1]=1;
            system("cls");
        }else if(ch=='q'){
            fout.open ("cd.iwdate");
            for(int i=0;i<=19;i++){
                for(int j=0;j<=49;j++){
                    fout<<a[i][j]<<" ";

                }
                cout<<endl;
            }
            return 0;
        }else{
            system("cls");
            continue;
        }
    }
    fout.close();
    return 0;
}






//8.0
#include<iostream>
#include<bits/stdc++.h>
#include<windows.h>
#include<time.h>
#include<unistd.h>
#include<conio.h>
#include<iomanip>
#include<fstream>
using namespace std;

int b[20][50]={1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
               1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,
               1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
               1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
int a[20][50];
class Iwc{
    public:
        void setColor(int color) {
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), color);
        }
        void out1(){
            for(int i=0;i<=19;i++){
                for(int j=0;j<=49;j++){
                    if(a[i][j]==1){
                        cout<<"#";
                    }else if(a[i][j]==0){
                        cout<<' ';
                    }else if(a[i][j]==2){
                        cout<<"@";
                    }
                }
                cout<<endl;
            }
        }
};


void windows(){
    HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
    CONSOLE_SCREEN_BUFFER_INFO bInfo;
    GetConsoleScreenBufferInfo(hOut, &bInfo );
    SetConsoleTitle("IWC 8.0"); // 设置窗口的标题
    COORD size = {110, 30};//设置窗口大小
    SetConsoleScreenBufferSize(hOut,size);
    SMALL_RECT rc = {0,0, 110, 30};
    SetConsoleWindowInfo(hOut,true ,&rc);
}
int main(){
    windows();
    //system("color 1F");
    Iwc iwc;
    iwc.setColor(1);
    cout<<"wasd 上下左右"<<endl;
    sleep(1);
    cout<<"tfgh 上下左右添加方块"<<endl;
    sleep(1);
    cout<<"ijkl 上下左右删除方块"<<endl;
    sleep(1);
    cout<<"q 存档并退出"<<endl;
    sleep(1);
    cout<<"7秒后自动进入";
    sleep(7);
    system("cls"); 
    int x=17,y=49;
    ifstream fin;
    fin.open("cd.iwdate");
    ofstream fout;
    if(!fin.is_open()){
        for(int i=0;i<=19;i++){
            for(int j=0;j<=49;j++){
                a[i][j]=b[i][j];
            }
        }
    }else{
        for(int i=0;i<=19;i++){
            for(int j=0;j<=49;j++){
                int e;
                fin>>e;
                if(e==2){
                    x=i;
                    y=j;
                }
                a[i][j]=e;
            }
        }
    } 
    fin.close() ;
    while(1){
        iwc.out1();
        cout<<"x:"<<x<<" "<<"y:"<<y;
        char ch=getch();
        if(ch=='s'){
            system("cls");
            if(a[x+1][y]!=0){
                system("cls");
                continue;
            }
            swap(a[x][y],a[x+1][y]);


            x+=1;


        }else if(ch=='w'){
            system("cls");
            if(a[x-1][y]!=0){
                system("cls");
                continue;
            }
            swap(a[x][y],a[x-1][y]);
            a[x][y]=1;
            x-=1;


        }else if(ch=='a'){
            system("cls");
            if(a[x][y-1]!=0){
                system("cls");
                continue;
            }
            swap(a[x][y],a[x][y-1]);
            y-=1;

        }else if(ch=='d'){
            system("cls");
            if(a[x][y+1]!=0){
                system("cls");
                continue;
            }
            swap(a[x][y],a[x][y+1]);
            y+=1;

        }else if(ch=='i'){
            a[x-1][y]=0;

            system("cls");
        }else if(ch=='k'){
            a[x+1][y]=0;

            system("cls");
        }else if(ch=='j'){
            a[x][y-1]=0;

            system("cls");
        }else if(ch=='l'){
            a[x][y+1]=0;

            system("cls");
        }else if(ch=='t'){
            a[x-1][y]=1;
            system("cls");
        }else if(ch=='g'){
            a[x+1][y]=1;
            system("cls");
        }else if(ch=='f'){
            a[x][y-1]=1;
            system("cls");
        }else if(ch=='h'){
            a[x][y+1]=1;
            system("cls");
        }else if(ch=='q'){
            system("cls");
            fout.open ("cd.iwdate");
            for(int i=0;i<=19;i++){
                for(int j=0;j<=49;j++){
                    fout<<a[i][j]<<" ";

                }
                cout<<endl;
            }
            return 0;
        }else{
            system("cls");
            continue;
        }
    }
    fout.close();
    return 0;
}


//9.0
#include<iostream>
#include<bits/stdc++.h>
#include<windows.h>
#include<time.h>
#include<unistd.h>
#include<conio.h>
#include<iomanip>
#include<fstream>
using namespace std;

int b[20][50]={1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
               1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
               1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,
               1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
               1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
int a[20][50];
class Iwc{
    public:
        void setColor(int color) {
            SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), color);
        }
        void out1(){
            for(int i=0;i<=19;i++){
                for(int j=0;j<=49;j++){
                    if(a[i][j]==1){
                        cout<<"#";
                    }else if(a[i][j]==0){
                        cout<<' ';
                    }else if(a[i][j]==2){
                        cout<<"@";
                    }
                }
                cout<<endl;
            }
        }
};


void windows(){
    HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
    CONSOLE_SCREEN_BUFFER_INFO bInfo;
    GetConsoleScreenBufferInfo(hOut, &bInfo );
    SetConsoleTitle("IWC 9.0"); // 设置窗口的标题
    COORD size = {110, 30};//设置窗口大小
    SetConsoleScreenBufferSize(hOut,size);
    SMALL_RECT rc = {0,0, 110, 30};
    SetConsoleWindowInfo(hOut,true ,&rc);
}
int main(){
    windows();
    //system("color 1F");
    Iwc iwc;
    iwc.setColor(2);
    cout<<"↑↓←→上下左右"<<endl;
    sleep(1);
    cout<<"tfgh 上下左右添加方块"<<endl;
    sleep(1);
    cout<<"ijkl 上下左右删除方块"<<endl;
    sleep(1);
    cout<<"q 存档并退出"<<endl;
    sleep(1);
    cout<<"7秒后自动进入";
    sleep(7);
    system("cls"); 
    int x=17,y=49;
    ifstream fin;
    fin.open("cd.iwdate");
    ofstream fout;
    ofstream cfout;
    cfout.open("记录.iwiu");
    if(!fin.is_open()){
        for(int i=0;i<=19;i++){
            for(int j=0;j<=49;j++){
                a[i][j]=b[i][j];
            }
        }
    }else{
        for(int i=0;i<=19;i++){
            for(int j=0;j<=49;j++){
                int e;
                fin>>e;
                if(e==2){
                    x=i;
                    y=j;
                }
                a[i][j]=e;
            }
        }
    } 
    fin.close() ;
    while(1){
        iwc.out1();
        cout<<"x:"<<x<<" "<<"y:"<<y;
        char ch=getch();
        if (ch == '\xE0') {  // 特殊键前缀
            ch = getch();
            if(ch=='P'){
                system("cls");
                if(a[x+1][y]!=0){
                    system("cls");
                    continue;
                }
                swap(a[x][y],a[x+1][y]);


                x+=1;
                cfout<<"↓"<<endl;

            }else if(ch=='H'){
                system("cls");
                if(a[x-1][y]!=0){
                    system("cls");
                    continue;
                }
                swap(a[x][y],a[x-1][y]);
                a[x][y]=1;
                x-=1;
                cfout<<"↑"<<endl;

            }else if(ch=='K'){
                system("cls");
                if(a[x][y-1]!=0){
                    system("cls");
                    continue;
                }
                swap(a[x][y],a[x][y-1]);
                y-=1;
                cfout<<"←"<<endl;
            }else if(ch=='M'){
                system("cls");
                if(a[x][y+1]!=0){
                    system("cls");
                    continue;
                }
                swap(a[x][y],a[x][y+1]);
                y+=1;
                cfout<<"→"<<endl;
            }
        }
        else if(ch=='i'){
            a[x-1][y]=0;

            system("cls");
            cfout<<ch<<endl;
        }else if(ch=='k'){
            a[x+1][y]=0;

            system("cls");
            cfout<<ch<<endl;
        }else if(ch=='j'){
            a[x][y-1]=0;

            system("cls");
            cfout<<ch<<endl;
        }else if(ch=='l'){
            a[x][y+1]=0;

            system("cls");
            cfout<<ch<<endl;
        }else if(ch=='t'){
            a[x-1][y]=1;
            system("cls");
            cfout<<ch<<endl;
        }else if(ch=='g'){
            a[x+1][y]=1;
            system("cls");
            cfout<<ch<<endl;
        }else if(ch=='f'){
            a[x][y-1]=1;
            system("cls");
            cfout<<ch<<endl;
        }else if(ch=='h'){
            a[x][y+1]=1;
            system("cls");
            cfout<<ch<<endl;
        }else if(ch=='q'){
            system("cls");
            fout.open ("cd.iwdate");
            for(int i=0;i<=19;i++){
                for(int j=0;j<=49;j++){
                    fout<<a[i][j]<<" ";

                }
                cout<<endl;
            }
            return 0;
        }else{
            system("cls");
            continue;
        }
    }
    cfout<<endl<<endl;
    cfout.close();
    fout.close();
    return 0;
}

 


0
已采纳
金沙赫北
金沙赫北
初级光能
初级光能

这是你写的代码吗

0
0
我要回答