问题标题: SUPERCRAFT2.0-版

2
1
已解决
陈俊霖
陈俊霖
新手天翼
新手天翼

/*
0=黑色
1=蓝色
2=绿色
3=湖蓝色
4=红色
5=紫色
6=**
7=白色
8=灰色
9=淡蓝色
A=淡绿色
B=淡浅绿色
C=淡红色
D=淡紫色
E=淡黄
F=亮白色
*/

#include <iostream>
#include <fstream>
#include <cstdlib>
#include <time.h>
#include <windows.h>
#include <pthread.h>
#include <conio.h>
#include <vector>
#include <map>
#define CgDu 5000
using namespace std;
int gold=6;
int diamond=1;
HANDLE hout = GetStdHandle(STD_OUTPUT_HANDLE), hsout;
HWND hwnd = GetConsoleWindow();
string xs;
char KD[128];
//基**操作函数
void gotoxy(short x, short y) { //移动光标函数
    COORD coord = {x, y};
    SetConsoleCursorPosition(hout, coord);
}
void cursor(bool visible) { //控制光标函数
    CONSOLE_CURSOR_INFO CursorInfo;
    GetConsoleCursorInfo(hout, &CursorInfo);
    CursorInfo.bVisible = visible;
    SetConsoleCursorInfo(hout, &CursorInfo);
}
void color(int ForgC, int BackC) { //设置颜色函数
    WORD wColor = ((BackC & 0x0F) << 4) + (ForgC & 0x0F);
    SetConsoleTextAttribute(hout, wColor);
}
void generation(int);
WORD get_font(int ForgC, int BackC) { //获取字体颜色参数
    return ((BackC & 0x0F) << 4) + (ForgC & 0x0F);
}
void color(int ForgC) {
    WORD wColor;
    CONSOLE_SCREEN_BUFFER_INFO csbi;
    if (GetConsoleScreenBufferInfo(hout, &csbi)) {
        wColor = (csbi.wAttributes & 0xF0) + (ForgC & 0x0F);
        SetConsoleTextAttribute(hout, wColor);
    }
}
void nofastedit() { //关闭快速编辑
    HANDLE hStdin = GetStdHandle(STD_INPUT_HANDLE);
    DWORD mode;
    GetConsoleMode(hStdin, &mode);
    mode &= ~ENABLE_QUICK_EDIT_MODE;
    mode &= ~ENABLE_INSERT_MODE;
    mode &= ~ENABLE_MOUSE_INPUT;
    SetConsoleMode(hStdin, mode);
}
COORD home_coord = {0, 0};
DWORD written;
void write(const char *str, int ssize) { //快速渲染
    WriteConsoleOutputCharacterA(hout, str, ssize, home_coord, &written);
}
void writefont(const WORD *font, int fsize) { //快速渲染颜色信息
 WriteConsoleOutputAttribute(hout, font, fsize, home_coord, &written);
}
bool keydown(int key) { //判断键状态
    return GetAsyncKeyState(key);
}
bool keyup(int key){
    if(KD[key]==0){
        if(keydown(key)){
            KD[key]=1;
        }
        return 0;
    }else{
        if(keydown(key)){
            return 0;
        }
        KD[key]=0;
        return 1;
    }
}
int setfontsize(int x, int y) { //设置字体大小
    CONSOLE_FONT_INFOEX cfi;
    GetCurrentConsoleFontEx(hout, FALSE, &cfi);
    cfi.cbSize = sizeof(cfi);
    cfi.nFont = 0;
    cfi.dwFontSize.X = x;
    cfi.dwFontSize.Y = y;
    cfi.FontFamily = FF_DONTCARE;
    cfi.FontWeight = 400;
    wcscpy(cfi.FaceName, L"NSimSun");
    return SetCurrentConsoleFontEx(hout, TRUE, &cfi);
}
int rand(int a, int b) { //rand()随机数
    return (rand() % (b - a + 1)) + a;
}
void swrite(string str) { //输出到设置缓冲区
    WriteConsoleA(hsout, str.c_str(), str.size(), NULL, NULL);
}
bool access(string name) { //判断文件是否存在
    ifstream f(name.c_str());
    return f.good();
}
int nozero(int k) {
    if (k < 0) {
        return 0;
    } else {
        return k;
    }
}
bool jianzao;
int on_car;
//常量
int blocks[1000][10][10] = {
    {
        //0:air(空气)
        {15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
        {15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
        {15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
        {15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
        {15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
        {15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
        {15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
        {15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
        {15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
        {15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
    },
    {
        //1:grass_block(草方块)
        {2, 10, 2, 10, 2, 10, 2, 10, 2, 10},
        {10, 2, 10, 2, 10, 2, 10, 2, 10, 2},
        {2, 6, 2, 6, 2, 6, 2, 6, 2, 6},
        {6, 6, 6, 6, 6, 6, 6, 6, 6, 6},
        {6, 6, 6, 6, 6, 6, 6, 6, 6, 6},
        {6, 6, 6, 6, 6, 6, 6, 6, 6, 6},
        {6, 6, 6, 6, 6, 6, 6, 6, 6, 6},
        {6, 6, 6, 6, 6, 6, 6, 6, 6, 6},
        {6, 6, 6, 6, 6, 6, 6, 6, 6, 6},
        {6, 6, 6, 6, 6, 6, 6, 6, 6, 6}
    },
    {
        //2:dirt(泥土)
        {6, 6, 6, 6, 6, 6, 6, 6, 6, 6},
        {6, 6, 6, 6, 6, 6, 6, 6, 6, 6},
        {6, 6, 6, 6, 6, 6, 6, 6, 6, 6},
        {6, 6, 6, 6, 6, 6, 6, 6, 6, 6},
        {6, 6, 6, 6, 6, 6, 6, 6, 6, 6},
        {6, 6, 6, 6, 6, 6, 6, 6, 6, 6},
        {6, 6, 6, 6, 6, 6, 6, 6, 6, 6},
        {6, 6, 6, 6, 6, 6, 6, 6, 6, 6},
        {6, 6, 6, 6, 6, 6, 6, 6, 6, 6},
        {6, 6, 6, 6, 6, 6, 6, 6, 6, 6}
    },
    {
        //3:stone(石头)
        {8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
        {8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
        {8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
        {8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
        {8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
        {8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
        {8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
        {8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
        {8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
        {8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
    },
    {
        //4:none(基岩)
        {0, 8, 0, 8, 0, 8, 0, 8, 0, 8},
        {8, 0, 8, 0, 8, 0, 8, 0, 8, 0},
        {0, 8, 0, 8, 0, 8, 0, 8, 0, 8},
        {8, 0, 8, 0, 8, 0, 8, 0, 8, 0},
        {0, 8, 0, 8, 0, 8, 0, 8, 0, 8},
        {8, 0, 8, 0, 8, 0, 8, 0, 8, 0},
        {0, 8, 0, 8, 0, 8, 0, 8, 0, 8},
        {8, 0, 8, 0, 8, 0, 8, 0, 8, 0},
        {0, 8, 0, 8, 0, 8, 0, 8, 0, 8},
        {8, 0, 8, 0, 8, 0, 8, 0, 8, 0},
    },
    {
        //5:water(水)
        {9, 9, 9, 9, 9, 9, 9, 9, 9, 9},
        {9, 9, 9, 9, 9, 9, 9, 9, 9, 9},
        {9, 9, 9, 9, 9, 9, 9, 9, 9, 9},
        {9, 9, 9, 9, 9, 9, 9, 9, 9, 9},
        {9, 9, 9, 9, 9, 9, 9, 9, 9, 9},
        {9, 9, 9, 9, 9, 9, 9, 9, 9, 9},
        {9, 9, 9, 9, 9, 9, 9, 9, 9, 9},
        {9, 9, 9, 9, 9, 9, 9, 9, 9, 9},
        {9, 9, 9, 9, 9, 9, 9, 9, 9, 9},
        {9, 9, 9, 9, 9, 9, 9, 9, 9, 9}
    },
    {

                    //6:原木
                    {0, 6, 6, 0, 6, 14, 6, 0, 6, 14},
                    {0, 14, 6, 0, 14, 0, 14, 6, 0, 14},
                    {0, 14, 6, 0, 14, 0, 14, 6, 0, 6},
                    {14, 6, 0, 14, 6, 0, 14, 6, 0, 14},
                    {6, 14, 6, 6, 14, 6, 6, 6, 0, 14},
                    {6, 0, 6, 0, 14, 6, 0, 6, 6, 14},
                    {6, 0, 14, 0, 14, 6, 0, 6, 14, 6},
                    {14, 0, 14, 6, 0, 14, 6, 0, 14, 0},
                    {14, 0, 6, 14, 0, 14, 6, 14, 14, 0},
                    {6, 14, 6, 14, 0, 6, 14, 6, 14, 0}
                },
                {
                    //7:树叶
                    {10, 2, 15, 10, 2, 15, 10, 2, 15, 10},
                    {10, 15, 10, 15, 15, 10, 15, 2, 10, 2},
                    {15, 10, 15, 10, 2, 15, 10, 15, 15, 10},
                    {10, 2, 15, 10, 15, 10, 15, 10, 2, 15},
                    {10, 15, 10, 15, 10, 15, 2, 2, 15, 10},
                    {2, 15, 2, 10, 2, 15, 10, 15, 10, 2},
                    {15, 10, 15, 10, 15, 10, 15, 2, 15, 10},
                    {10, 10, 10, 15, 10, 2, 15, 10, 2, 10},
                    {15, 2, 15, 10, 10, 15, 10, 2, 10, 15},
                    {10, 10, 10, 2, 15, 10, 15, 15, 10, 2}
                }
    ,{
            //8:iron
            {8, 8,    8,    8, 8, 8, 8, 8, 8, 8},
            {8, 8,    8,    8, 8, 8, 8, 8, 8, 8},
            {8, 8,    8,8, 8, 7,7, 8, 8, 8},
            {8, 8, 7, 7, 8, 8, 8, 8, 8, 8},
            {7, 8,    8,    8, 8, 8, 8, 8, 8, 8},
            {8, 8,8, 7, 8, 8, 8, 8, 8, 8},
            {8, 8,    8,    8, 7, 8, 8, 8, 8, 8},
            {8, 8,    8,    8, 8, 8, 8, 8, 8, 8},
            {8, 8,    8,    8, 8, 8, 7, 8, 8, 8},
            {8, 8,    8,    8, 8, 8, 8, 8, 8, 8},
        }
        ,{
            //9:diamond
            {8, 8,    8,    8, 8, 8, 8, 8, 8, 8},
            {8, 8,    8,    8, 8, 8, 8, 8, 8, 8},
            {8, 8,    8,8, 8, diamond,diamond, 8, 8, 8},
            {8, 8, diamond, diamond, 8, 8, 8, 8, 8, 8},
            {diamond, 8,    8,    8, 8, 8, 8, 8, 8, 8},
            {8, 8,8, diamond, 8, 8, 8, 8, 8, 8},
            {8, 8,    8,    8, diamond, 8, 8, 8, 8, 8},
            {8, 8,    8,    8, 8, 8, 8, 8, 8, 8},
            {8, 8,    8,    8, 8, 8, diamond, 8, 8, 8},
            {8, 8,    8,    8, 8, 8, 8, 8, 8, 8},
        }
        ,{
            //10:gold
            {8, 8,    8,    8, 8, 8, 8, 8, 8, 8},
            {8, 8,    8,    8, 8, 8, 8, 8, 8, 8},
            {8, 8,    8,8, 8, gold,gold, 8, 8, 8},
            {8, 8, gold, gold, 8, 8, 8, 8, 8, 8},
            {gold, 8,    8,    8, 8, 8, 8, 8, 8, 8},
            {8, 8,8, gold, 8, 8, 8, 8, 8, 8},
            {8, 8,    8,    8, gold, 8, 8, 8, 8, 8},
            {8, 8,    8,    8, 8, 8, 8, 8, 8, 8},
            {8, 8,    8,    8, 8, 8, gold, 8, 8, 8},
            {8, 8,    8,    8, 8, 8, 8, 8, 8, 8},

        },
        {//11、木板
        {14,14,0,14,14,14,0,14,14,14},
        {14,14,0,14,14,14,0,14,14,14},
        {14,14,0,14,14,14,0,14,14,14},
        {14,14,0,14,14,14,0,14,14,14},
        {14,14,0,14,14,14,0,14,14,14},
        {14,14,0,14,14,14,0,14,14,14},
        {14,14,0,14,14,14,0,14,14,14},
        {14,14,0,14,14,14,0,14,14,14},
        {14,14,0,14,14,14,0,14,14,14},
        {14,14,0,14,14,14,0,14,14,14},
        },{//12、工作台
        {15,15,15,15,15,15,15,15,15,15},
        {0,0,0,0,0,0,0,0,0,0},
        {0,14,14,14,14,14,14,14,14,0},
        {0,0,0,0,0,0,0,0,0,0},
        {15,0,14,0,15,15,0,14,0,15},
        {15,0,14,0,15,15,0,14,0,15},
        {15,0,14,0,15,15,0,14,0,15},
        {15,0,14,0,15,15,0,14,0,15},
        {15,0,14,0,15,15,0,14,0,15},
        {15,0,0,0,15,15,0,0,0,15},
        }
        ,{
            //13:煤炭
            {8, 8,    8,    8, 8, 8, 8, 8, 8, 8},
            {8, 8,    8,    8, 8, 8, 8, 8, 8, 8},
            {8, 8,    8,8, 8, 0,0, 8, 8, 8},
            {8, 8, 0, 0, 8, 8, 8, 8, 8, 8},
            {8, 8,    8,    8, 8, 8, 8, 8, 8, 8},
            {8, 8,8, 0, 8, 8, 8, 8, 8, 8},
            {8, 8,    8,    8, 0, 8, 8, 8, 8, 8},
            {8, 8,    8,    8, 8, 8, 8, 8, 8, 8},
            {8, 8,    8,    8, 8, 8, 0, 8, 8, 8},
            {8, 8,    8,    8, 8, 8, 8, 8, 8, 8},
        },{
            //14:钻块
            {0, 0,    0,    0, 0, 0, 0, 0, 0, 0},
            {0, 1,    1,    1, 1, 1, 1, 1, 1, 0},
            {0, 1,    1,    1, 1, 1, 1, 1, 1, 0},
            {0, 1,    1,    1, 1, 1, 1, 1, 1, 0},
            {0, 1,    1,    1, 1, 1, 1, 1, 1, 0},
            {0, 1,    1,    1, 1, 1, 1, 1, 1, 0},
            {0, 1,    1,    1, 1, 1, 1, 1, 1, 0},
            {0, 1,    1,    1, 1, 1, 1, 1, 1, 0},
            {0, 1,    1,    1, 1, 1, 1, 1, 1, 0},
            {0, 0,    0,    0, 0, 0, 0, 0, 0, 0}
        }
        ,{
            //15:熔炉
            {0, 0,0,0, 0, 0, 0, 0, 0, 0},
            {0, 8,8,8, 8, 8, 8, 8, 8, 0},
            {0, 8,8,8, 8, 8, 8, 8, 8, 0},
            {0, 8,8,8, 8, 8, 8, 8, 8, 0},
            {0, 0,0,0, 0, 0, 0, 0, 0, 0},
            {0, 8,8,8, 8, 8, 8, 8, 8, 0},
            {0, 8,8,0, 0, 0, 0, 8, 8, 0},
            {0, 8,8,0, 8, 8,0, 8, 8, 0},
            {0, 8,8,0, 8, 8, 0, 8, 8, 0},
            {0, 0,0,0, 0, 0, 0, 0,0, 0}
        },{
            //16:铁锭
            {15,15,15,15,15,15,15,15,15,15},
            {15,15,15,15,15,15,15,15,15,15},
            { 0, 0, 0, 0, 0, 0, 0, 0,15,15},
            { 0, 0, 7, 7, 7, 7, 7, 7, 0,15},
            { 0, 7, 0, 0, 0, 0, 0, 0, 0, 0},
            {15, 0, 0, 7, 7, 7, 7, 7, 7, 0},
            {15,15, 0, 0, 0, 0, 0, 0, 0, 0},
            {15,15,15,15,15,15,15,15,15,15},
            {15,15,15,15,15,15,15,15,15,15},
            {15,15,15,15,15,15,15,15,15,15}
        },{
            //17:金锭
            {15,15,15,15,15,15,15,15,15,15},
            {15,15,15,15,15,15,15,15,15,15},
            { 0, 0, 0, 0, 0, 0, 0, 0,15,15},
            { 0, 0, 6, 6, 6, 6, 6, 6, 0,15},
            { 0, 6, 0, 0, 0, 0, 0, 0, 0, 0},
            {15, 0, 0, 6, 6, 6, 6, 6, 6, 0},
            {15,15, 0, 0, 0, 0, 0, 0, 0, 0},
            {15,15,15,15,15,15,15,15,15,15},
            {15,15,15,15,15,15,15,15,15,15},
            {15,15,15,15,15,15,15,15,15,15}
        },{
            //18:铁块
            {0, 0,    0,    0, 0, 0, 0, 0, 0, 0},
            {0, 7,    7,    7, 7, 7, 7, 7, 7, 0},
            {0, 7,    7,    7, 7, 7, 7, 7, 7, 0},
            {0, 7,    7,    7, 7, 7, 7, 7, 7, 0},
            {0, 7,    7,    7, 7, 7, 7, 7, 7, 0},
            {0, 7,    7,    7, 7, 7, 7, 7, 7, 0},
            {0, 7,    7,    7, 7, 7, 7, 7, 7, 0},
            {0, 7,    7,    7, 7, 7, 7, 7, 7, 0},
            {0, 7,    7,    7, 7, 7, 7, 7, 7, 0},
            {0, 0,    0,    0, 0, 0, 0, 0, 0, 0}
        },{
            //19:金块
            {0, 0,    0,    0, 0, 0, 0, 0, 0, 0},
            {0, 6,    6,    6, 6, 6, 6, 6, 6, 0},
            {0, 6,    6,    6, 6, 6, 6, 6, 6, 0},
            {0, 6,    6,    6, 6, 6, 6, 6, 6, 0},
            {0, 6,    6,    6, 6, 6, 6, 6, 6, 0},
            {0, 6,    6,    6, 6, 6, 6, 6, 6, 0},
            {0, 6,    6,    6, 6, 6, 6, 6, 6, 0},
            {0, 6,    6,    6, 6, 6, 6, 6, 6, 0},
            {0, 6,    6,    6, 6, 6, 6, 6, 6, 0},
            {0, 0,    0,    0, 0, 0, 0, 0, 0, 0}
        },{
        //20:木棍
        {15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
        {15, 15, 15, 15, 15, 4, 15, 15, 15, 15},
        {15, 15, 15, 15, 15, 4, 15, 15, 15, 15},
        {15, 15, 15, 15, 4, 15, 15, 15, 15, 15},
        {15, 15, 15, 15, 4, 15, 15, 15, 15, 15},
        {15, 15, 15, 4, 15, 15, 15, 15, 15, 15},
        {15, 15, 15, 4, 15, 15, 15, 15, 15, 15},
        {15, 15, 4, 15, 15, 15, 15, 15, 15, 15},
        {15, 15, 4, 15, 15, 15, 15, 15, 15, 15},
        {15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
    },{
        //21:木镐
        {15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
        {15, 15, 15,  0,  0,  0, 15, 15, 15, 15},
        {15, 15, 15,  0, 14, 14,  0, 15, 15, 15},
        {15, 15, 15,  0,  0,  0, 14,  0, 15, 15},
        {15, 15, 15, 15,  0,  4,  0, 14,  0, 15},
        {15, 15, 15,  0,  4,  0,  0, 14,  0, 15},
        {15, 15,  0,  4,  0, 15,  0,  0,  0, 15},
        {15,  0,  4,  0, 15, 15, 15, 15, 15, 15},
        {15,  0,  0, 15, 15, 15, 15, 15, 15, 15},
        {15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
    }
    ,{
        //22:木镐
        {15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
        {15, 15, 15,  0,  0,  0, 15, 15, 15, 15},
        {15, 15, 15,  0, 8, 8,  0, 15, 15, 15},
        {15, 15, 15,  0,  0,  0, 8,  0, 15, 15},
        {15, 15, 15, 15,  0,  4,  0, 8,  0, 15},
        {15, 15, 15,  0,  4,  0,  0, 8,  0, 15},
        {15, 15,  0,  4,  0, 15,  0,  0,  0, 15},
        {15,  0,  4,  0, 15, 15, 15, 15, 15, 15},
        {15,  0,  0, 15, 15, 15, 15, 15, 15, 15},
        {15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
    },{
        //23:铁镐
        {15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
        {15, 15, 15,  0,  0,  0, 15, 15, 15, 15},
        {15, 15, 15,  0, 7, 7,  0, 15, 15, 15},
        {15, 15, 15,  0,  0,  0, 7,  0, 15, 15},
        {15, 15, 15, 15,  0,  4,  0, 7,  0, 15},
        {15, 15, 15,  0,  4,  0,  0, 7,  0, 15},
        {15, 15,  0,  4,  0, 15,  0,  0,  0, 15},
        {15,  0,  4,  0, 15, 15, 15, 15, 15, 15},
        {15,  0,  0, 15, 15, 15, 15, 15, 15, 15},
        {15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
    },{
        //24:钻镐
        {15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
        {15, 15, 15,  0,  0,  0, 15, 15, 15, 15},
        {15, 15, 15,  0, 1, 1,  0, 15, 15, 15},
        {15, 15, 15,  0,  0,  0, 1,  0, 15, 15},
        {15, 15, 15, 15,  0,  4,  0, 1,  0, 15},
        {15, 15, 15,  0,  4,  0,  0, 1,  0, 15},
        {15, 15,  0,  4,  0, 15,  0,  0,  0, 15},
        {15,  0,  4,  0, 15, 15, 15, 15, 15, 15},
        {15,  0,  0, 15, 15, 15, 15, 15, 15, 15},
        {15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
    },{
        //25:单独矿车
        {15,  0,  0,  0,  0,  0,  0,  0,  0, 15},
        {15,  0,  7,  7,  7,  7,  7,  7,  0, 15},
        {15,  0,  7,  7,  7,  7,  7,  7,  0, 15},
        {15,  0,  7,  7,  7,  7,  7,  7,  0, 15},
        {15,  0,  7,  7,  7,  7,  7,  7,  0, 15},
        {15,  0,  0,  0,  0,  0,  0,  0,  0, 15},
        {15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
        {15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
        {15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
        {15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
    },{
        //26:轨道
        {15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
        {15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
        {15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
        {15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
        {15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
        {15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
          { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
        { 7,  7,  7,  7,  7,  7,  7,  7,  7,  7},
        { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
        {15,  4, 15,  4, 15, 15,  4, 15,  4, 15},
    },{
        //27:轨道加矿车
        {15,  0,  0,  0,  0,  0,  0,  0,  0, 15},
        {15,  0,  7,  7,  7,  7,  7,  7,  0, 15},
        {15,  0,  7,  7,  7,  7,  7,  7,  0, 15},
        {15,  0,  7,  7,  7,  7,  7,  7,  0, 15},
        {15,  0,  7,  7,  7,  7,  7,  7,  0, 15},
        {15,  0,  0,  0,  0,  0,  0,  0,  0, 15},
        { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
        { 7,  7,  7,  7,  7,  7,  7,  7,  7,  7},
        { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
        {15,  4, 15,  4, 15, 15,  4, 15,  4, 15},
    },
    {
        //28:r-l台阶
        {8, 8, 8, 8, 8, 15, 15, 15, 15, 15},
        {8, 8, 8, 8, 8, 15, 15, 15, 15, 15},
        {8, 8, 8, 8, 8, 15, 15, 15, 15, 15},
        {8, 8, 8, 8, 8, 15, 15, 15, 15, 15},
        {8, 8, 8, 8, 8, 15, 15, 15, 15, 15},
        {8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
        {8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
        {8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
        {8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
        {8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
    },
    {
        //29:l-r台阶
        {15, 15, 15, 15, 15,8, 8, 8, 8, 8},
        {15, 15, 15, 15, 15,8, 8, 8, 8, 8},
        {15, 15, 15, 15, 15,8, 8, 8, 8, 8},
        {15, 15, 15, 15, 15,8, 8, 8, 8, 8},
        {15, 15, 15, 15, 15,8, 8, 8, 8, 8},
        {8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
        {8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
        {8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
        {8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
        {8, 8, 8, 8, 8, 8, 8, 8, 8, 8},
    }
};
int pLus[10][10]{
{15,15,15,15,0,0,15,15,15,15},
{15,15,15,15,0,0,15,15,15,15},
{15,15,15,15,0,0,15,15,15,15},
{15,15,15,15,0,0,15,15,15,15},
{0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0},
{15,15,15,15,0,0,15,15,15,15},
{15,15,15,15,0,0,15,15,15,15},
{15,15,15,15,0,0,15,15,15,15},
{15,15,15,15,0,0,15,15,15,15}
};
int eq[10][10]{
{15,15,15,15,15,15,15,15,15,15},
{15,15,15,15,15,15,15,15,15,15},
{0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0},
{15,15,15,15,15,15,15,15,15,15},
{15,15,15,15,15,15,15,15,15,15},
{0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0},
{15,15,15,15,15,15,15,15,15,15},
{15,15,15,15,15,15,15,15,15,15}
};
int good[10][10]{
{15,15,15,15,15,15,15,15,15,15},
{15,15,15,15,15,15,15,15,15,2},
{15,15,15,15,15,15,15,15,2,15},
{15,15,15,15,15,15,15,2,15,15},
{15,15,15,15,15,15,2,15,15,15},
{15,2,15,15,15,2,15,15,15,15},
{15,15,2,15,2,15,15,15,15,15},
{15,15,15,2,15,15,15,15,15,15},
{15,15,15,15,15,15,15,15,15,15},
{15,15,15,15,15,15,15,15,15,15}
};
int bad[10][10]{
{15,15,15,15,15,15,15,15,15,15},
{15,15,15,15,15,15,15,15,15,15},
{15,15,4,15,15,15,4,15,15,15},
{15,15,15,4,15,4,15,15,15,15},
{15,15,15,15,4,15,15,15,15,15},
{15,15,15,4,15,4,15,15,15,15},
{15,15,4,15,15,15,4,15,15,15},
{15,15,15,15,15,15,15,15,15,15},
{15,15,15,15,15,15,15,15,15,15},
{15,15,15,15,15,15,15,15,15,15}
};
int nums[10][10][5]{
    {
    {7,7,7,7,7},
    {7,0,0,0,7},
    {7,0,7,0,7},
    {7,0,7,0,7},
    {7,0,7,0,7},
    {7,0,7,0,7},
    {7,0,7,0,7},
    {7,0,7,0,7},
    {7,0,0,0,7},
    {7,7,7,7,7}
    },
    {
    {7,7,7,7,7},
    {7,7,7,0,7},
    {7,7,7,0,7},
    {7,7,7,0,7},
    {7,7,7,0,7},
    {7,7,7,0,7},
    {7,7,7,0,7},
    {7,7,7,0,7},
    {7,7,7,0,7},
    {7,7,7,7,7}
    },
    {
    {7,7,7,7,7},
    {7,0,0,0,7},
    {7,7,7,0,7},
    {7,7,7,0,7},
    {7,0,0,0,7},
    {7,0,7,7,7},
    {7,0,7,7,7},
    {7,0,7,7,7},
    {7,0,0,0,7},
    {7,7,7,7,7}
    },
    {
    {7,7,7,7,7},
    {7,0,0,0,7},
    {7,7,7,0,7},
    {7,7,7,0,7},
    {7,0,0,0,7},
    {7,7,7,0,7},
    {7,7,7,0,7},
    {7,7,7,0,7},
    {7,0,0,0,7},
    {7,7,7,7,7}
    },
    {
    {7,7,7,7,7},
    {7,0,7,0,7},
    {7,0,7,0,7},
    {7,0,7,0,7},
    {7,0,0,0,7},
    {7,7,7,0,7},
    {7,7,7,0,7},
    {7,7,7,0,7},
    {7,7,7,0,7},
    {7,7,7,7,7}
    },
    {
    {7,7,7,7,7},
    {7,0,0,0,7},
    {7,0,7,7,7},
    {7,0,7,7,7},
    {7,0,0,0,7},
    {7,7,7,0,7},
    {7,7,7,0,7},
    {7,7,7,0,7},
    {7,0,0,0,7},
    {7,7,7,7,7}
    },
    {
    {7,7,7,7,7},
    {7,0,0,0,7},
    {7,0,7,7,7},
    {7,0,7,7,7},
    {7,0,0,0,7},
    {7,0,7,0,7},
    {7,0,7,0,7},
    {7,0,7,0,7},
    {7,0,0,0,7},
    {7,7,7,7,7}
    },
    {
    {7,7,7,7,7},
    {7,0,0,0,7},
    {7,7,7,0,7},
    {7,7,7,0,7},
    {7,7,7,0,7},
    {7,7,7,0,7},
    {7,7,7,0,7},
    {7,7,7,0,7},
    {7,7,7,0,7},
    {7,7,7,7,7}
    },
    {
    {7,7,7,7,7},
    {7,0,0,0,7},
    {7,0,7,0,7},
    {7,0,7,0,7},
    {7,0,0,0,7},
    {7,0,7,0,7},
    {7,0,7,0,7},
    {7,0,7,0,7},
    {7,0,0,0,7},
    {7,7,7,7,7}
    },
    {
    {7,7,7,7,7},
    {7,0,0,0,7},
    {7,0,7,0,7},
    {7,0,7,0,7},
    {7,0,0,0,7},
    {7,7,7,0,7},
    {7,7,7,0,7},
    {7,7,7,0,7},
    {7,0,0,0,7},
    {7,7,7,7,7}
    }
};
int player[20][10] = {
    {15, 15, 15, 15, 15, 15, 15, 15, 15, 15},
    {15, 15, 0, 0, 0, 0, 0, 0, 15, 15},
    {15, 15, 0, 0, 0, 0, 0, 0, 15, 15},
    {15, 15, 14, 14, 0, 0, 0, 0, 15, 15},
    {15, 15, 14, 14, 14, 14, 0, 0, 15, 15},
    {15, 15, 14, 14, 14, 14, 14, 14, 15, 15},
    {15, 15, 14, 14, 14, 14, 14, 14, 15, 15},
    {15, 15, 15, 3, 3, 3, 3, 15, 15, 15},
    {15, 15, 15, 3, 3, 3, 3, 15, 15, 15},
    {6, 3, 3, 3, 3, 3, 3, 15, 15, 15},
    {6, 3, 3, 3, 3, 3, 3, 15, 15, 15},
    {15, 15, 15, 3, 3, 3, 3, 15, 15, 15},
    {15, 15, 15, 3, 3, 3, 3, 15, 15, 15},
    {15, 15, 15, 1, 1, 1, 3, 15, 15, 15},
    {15, 15, 15, 1, 1, 1, 1, 15, 15, 15},
    {15, 15, 15, 1, 1, 1, 1, 15, 15, 15},
    {15, 15, 15, 1, 1, 1, 1, 15, 15, 15},
    {15, 15, 15, 1, 1, 1, 1, 15, 15, 15},
    {15, 15, 15, 1, 1, 1, 1, 15, 15, 15},
    {15, 15, 15, 8, 8, 8, 8, 15, 15, 15},
};
ofstream wlog("log.txt"); //日志输出
struct obj{
    int id,num;
};
vector<obj>bag;
int pointer1,pointer2,pointer3;
//程序函数
int WDOUBLE = 0;
void hello() { //首次运行设置
    nofastedit();
    cursor(false);
    SetConsoleActiveScreenBuffer(hsout);
    swrite("你好,欢迎使用SUPERCRAFT。\n");
    swrite("在开始之前,我们需要进行一些设置。\n");
    swrite("[按任意键继续]");
    getch();
    system("cls");
    swrite("在显示的两个正方形中,选择较为规整的一个\n");
    swrite("[按任意键继续]");
    getch();
    system("cls");
    SetConsoleActiveScreenBuffer(hout);
    setfontsize(4, 4);
    for (int i = 1; i <= 10; i++) {
        WORD w[1005];
        int pos = 0;
        COORD coord = {1, i};
        for (int j = 1; j <= 10; j++) {
            w[pos++] = get_font(4, 4);
        }
        WriteConsoleOutputAttribute(hout, w, pos, coord, &written);
    }
    for (int i = 1; i <= 10; i++) {
        WORD w[1005];
        int pos = 0;
        COORD coord = {13, i};
        for (int j = 1; j <= 10; j++) {
            w[pos++] = get_font(4, 4);
            w[pos++] = get_font(4, 4);
        }
        WriteConsoleOutputAttribute(hout, w, pos, coord, &written);
    }
    getch();
    system("cls");
    SetConsoleActiveScreenBuffer(hsout);
    swrite("哪一个正方形是最规整的?\n");
    swrite("1.左边的  2.右边的");
reinput:
    int ipt = getch();
    if (ipt == '1') {
        WDOUBLE = 0;
    } else if (ipt == '2') {
        WDOUBLE = 1;
    } else {
        goto reinput;
    }
    system("cls");
    swrite("按+/-调整窗口大小,F键确定\n");
    swrite("请保持白色方块为正方形\n[按任意键继续]");
    getch();
    SetConsoleActiveScreenBuffer(hout);
    if (WDOUBLE == 0) {
        system("mode con:cols=200 lines=100");
    } else {
        system("mode con:cols=400 lines=100");
    }
    if (WDOUBLE == 0) {
        for (int i = 1; i <= 10; i++) {
            WORD w[1005];
            int pos = 0;
            COORD coord = {1, i};
            for (int j = 1; j <= 10; j++) {
                w[pos++] = get_font(4, 4);
            }
            WriteConsoleOutputAttribute(hout, w, pos, coord, &written);
        }
    } else {
        for (int i = 1; i <= 10; i++) {
            WORD w[1005];
            int pos = 0;
            COORD coord = {1, i};
            for (int j = 1; j <= 10; j++) {
                w[pos++] = get_font(4,4);
                w[pos++] = get_font(4, 4);
            }
            WriteConsoleOutputAttribute(hout, w, pos, coord, &written);
        }
    }
    int sizes = 4;
    while (1) {
        int ipt = getch();
        if (ipt == '+' || ipt == '=') {
            sizes++;
            setfontsize(sizes, sizes);
            if (WDOUBLE == 0) {
                system("mode con:cols=200 lines=100");
            } else {
                system("mode con:cols=400 lines=100");
            }
        }
        if (ipt == '-' || ipt == '_') {
            sizes--;
            if (sizes < 1) {
                sizes = 1;
            }
            setfontsize(sizes, sizes);
            if (WDOUBLE == 0) {
                system("mode con:cols=200 lines=100");
            } else {
                system("mode con:cols=400 lines=100");
            }
        }
        if (WDOUBLE == 0) {
            for (int i = 1; i <= 10; i++) {
                WORD w[1005];
                int pos = 0;
                COORD coord = {1, i};
                for (int j = 1; j <= 10; j++) {
                    w[pos++] = get_font(4,4);
                }
                WriteConsoleOutputAttribute(hout, w, pos, coord, &written);
            }
        } else {
            for (int i = 1; i <= 10; i++) {
                WORD w[1005];
                int pos = 0;
                COORD coord = {1, i};
                for (int j = 1; j <= 10; j++) {
                    w[pos++] = get_font(4, 4);
                    w[pos++] = get_font(4, 4);
                }
                WriteConsoleOutputAttribute(hout, w, pos, coord, &written);
            }
        }
        if (ipt == 'f' || ipt == 'F') {
            break;
        }
    }
    SetConsoleActiveScreenBuffer(hsout);
    system("cls");
    ofstream sout("sets");
    sout << WDOUBLE << " " << sizes;
    sout.close();
    swrite("谢谢!\n设置已保存,以后将不会出现此窗口。\n");
    swrite("如果对此次设定不满意,可以删除sets文件以重新设置\n[按任意键继续]");
    getch();
    SetConsoleActiveScreenBuffer(hout);
}

int world[CgDu+5][256];
int X = CgDu*5, Y = 1280, LR = 0, FPS = 60; //玩家位置


int output[201][121]; //输出缓存

void sendprint() { //绘制控制台
    WORD col[24005] = {};
    int pos = 0;
    //将二维数组存储到一维内
    for (int i = 1; i <= 120; i++) {
        for (int j = 1; j <= 200; j++) {
            col[pos] = get_font(output[j][i], output[j][i]);
            pos++;
        }
    }
    writefont(col, 24000);
}
bool unLight[CgDu+5][256];
void sendprint_double() { //绘制控制台
    WORD col[48005] = {};
    int pos = 0;
    //将二维数组存储到一维内
    for (int i = 1; i <= 120; i++) {
        for (int j = 1; j <= 200; j++) {
            col[pos] = get_font(output[j][i], output[j][i]);
            pos++;
            col[pos] = get_font(output[j][i], output[j][i]);
            pos++;
        }
    }
    writefont(col, 48000);
}
 //世界

int dx[4]{0,0,-1,1},dy[4]{1,-1,0,0};
map<int,bool>unblock;
struct craft{
    int num1,id1,num2,id2,num3,id3,num4,id4;
};
vector<craft>crafta,craftb,craftc;
int mode=0;
void init();
void render_block(int y,int x,int id){
    for(int i=0;i<10;i++){
        for(int j=0;j<10;j++){
            output[x+i][y+j]=blocks[id][j][i];
        }
    }
}
void render_plus(int y,int x,int black=0,int white=15){
    for(int i=0;i<10;i++){
        for(int j=0;j<10;j++){
            output[x+i][y+j]=(pLus[j][i]?white:black);
        }
    }
}
void render_eq(int y,int x,int black=0,int white=15){
    for(int i=0;i<10;i++){
        for(int j=0;j<10;j++){
            output[x+i][y+j]=(eq[j][i]?white:black);
        }
    }
}
void render_number(int y,int x,int num,int black=0,int
white=15){
    for(int i=0;i<5;i++){
        for(int j=0;j<10;j++){
            int k=nums[num/10][j][i];
            output[x+i][y+j]=(k?white:black);
        }
    }
    for(int i=0;i<5;i++){
        for(int j=0;j<10;j++){
            int k=nums[num%10][j][i];
            output[x+i+5][y+j]=(k?white:black);
        }
    }
}
void render_good(int y,int x){
    for(int i=0;i<10;i++){
        for(int j=0;j<10;j++){
            output[x+i][y+j]=good[j][i];
        }
    }
}
void render_bad(int y,int x){
    for(int i=0;i<10;i++){
        for(int j=0;j<10;j++){
            output[x+i][y+j]=bad[j][i];
        }
    }
}
bool check(craft a){
    int s1=0,s2=0,s3=0;
    for(int i=0;i<bag.size();i++){
        if(bag[i].id==a.id1){
            s1+=bag[i].num;
        }
        if(bag[i].id==a.id2){
            s2+=bag[i].num;
        }
        if(bag[i].id==a.id3){
            s3+=bag[i].num;
        }
    }
    if((s1>=a.num1||a.id1==0)&&(s2>=a.num2||a.id2==0)&&(
    s3>=a.num3||a.id3==0)){
        return 1;
    }
    return 0;
}
void Craft(craft cr){
    int s1=cr.num1,s2=cr.num2,s3=cr.num3;
    for(int i=0;i<bag.size();i++){
        if(bag[i].id==cr.id1&&s1!=0){
            if(bag[i].num>=s1){
                bag[i].num-=s1;
            }else{
                s1-=bag[i].num;
                bag[i].num=0;
            }
        }
        if(bag[i].id==cr.id2&&s2!=0){
            if(bag[i].num>=s2){
                bag[i].num-=s2;
            }else{
                s2-=bag[i].num;
                bag[i].num=0;
            }
        }
        if(bag[i].id==cr.id3&&s3!=0){
            if(bag[i].num>=s3){
                bag[i].num-=s3;
            }else{
                s3-=bag[i].num;
                bag[i].num=0;
            }
        }
    }
    for(int i=0;i<bag.size();i++){
        if(bag[i].num==0){
            bag.erase(bag.begin()+i);
            i--;
        }
    }
    obj o;
    o.num=cr.num4;
    o.id=cr.id4;
    for(int i=0;i<bag.size();i++){
        if(o.id==bag[i].id){
            bag[i].num+=o.num;
            return;
        }
    }
    bag.push_back(o);
}
bool check_block_unlight(int m){
    return m==3||m==4||m==8||m==9||m==10||m==13;
}
bool check_light(int x,int y){
    for(int i=0;i<=3;i++){
        if(unLight[x+dx[i]][y+dy[i]]==0&&!check_block_unlight(
        world[x+dx[i]][y+dy[i]])){
            return 1;
        }
    }
    return 0;
}
int wat,*wab;
void console() { //设置控制台
    system("title SUPERCRAFT");
    system("chcp 936");
    system("cls");
    hsout = CreateConsoleScreenBuffer(GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, 1, NULL);
    if (!access("sets")) { //不存在
        hello();
    }
    cout<<"请输入存档名:(输入none重新建档)";
    cin>>xs;
    if(xs=="none"){
        cout<<"请输入档名:"
        ;cin>>xs;
        generation(-1);

    }else{
        if(access(xs)){
            ifstream sin(xs.c_str());
            for(int i=1;i<=CgDu;i++){
                for(int j=1;j<=256;j++){
                    sin>>world[i][j];
                }
            }
            for(int i=1;i<=CgDu;i++){
                for(int j=1;j<=256;j++){
                    int x;
                    sin>>unLight[i][j];//=bool(x);
                }
            }
            sin>>X>>Y;
            int t,t2;
            while(sin>>t>>t2){
                bag.push_back({t,t2});
            }
        }else{
            generation(-1);
        }
        
    }
    nofastedit(); //关闭快速输入
    cursor(false); //关闭光标显示
    ifstream sin("sets");
    int sizes;
    sin >> WDOUBLE >> sizes; //读入设置
    sin.close();
    setfontsize(sizes, sizes);
    if (WDOUBLE == 0) {
        system("mode con:cols=200 lines=120");
    } else {
        system("mode con:cols=400 lines=120");
    }
}
void render() { //软件渲染器
    if(mode==0){
        int x_left = X / 10 - 9,
        x_right = (X % 10 == 0) ? (X / 10 + 10) :
         (X / 10 + 11); //计算需要渲染的左边线和右边线
        int y_left = (Y % 10 == 0) ? (Y / 10 - 5) :
         (Y / 10 - 6), y_right = Y / 10 + 5; //计算需要渲染的上边线和下边线
        int x_more = X % 10, y_more = Y % 10; //计算多出的部分
        int x_pos = 1, y_pos = 1; //渲染位置计算
        //渲染世界
        for (int i = x_left; i <= x_right; i++) {
            y_pos = 1;
            for (int j = y_right; j >= y_left; j--) {
                for (int p_i = 0; p_i < 10; p_i++) {
                    for (int p_j = 0; p_j < 10; p_j++) {
                        if (x_pos + p_i - x_more < 0 ||
                        x_pos + p_i - x_more > 200 ||
                         y_pos - p_j + y_more < 0 ||
                         y_pos - p_j + y_more > 100) {
                            continue; //如果越界则跳过
                        }
                        if(check_light(i,j)){
                        unLight[i][j]=0;
                        output[x_pos + p_i - x_more][y_pos - p_j
                         + y_more] = blocks[world[i][j]][9 - p_j
                         ][p_i];
                        }else
                        output[x_pos + p_i - x_more][y_pos - p_j
                         + y_more]=0;
                    }
                }
                y_pos += 10;
            }
            x_pos += 10;
        }
        //渲染玩家
        for (int i = 0; i < 10; i++) {
            for (int j = 0; j < 20; j++) {
                if(on_car==0||j<11)
                if (LR == 0) {
                    if (player[j][i] != 15) {
                        output[91 + i][36 + j] = player[j][i];
                    }
                } else {
                    if (player[j][9 - i] != 15) {
                        output[91 + i][36 + j] = player[j][9 - i];
                    }
                }
            }
        }
    }
    else if(mode==1){
        for(int i=1;i<=200;i++){
            for(int j=1;j<=100;j++){
                output[i][j]=15;
            }
        }
        for(int i=pointer3;i<crafta.size()&&i<pointer3+9;i++){
            int k=i-pointer3;
            render_number(k*11+1,0,crafta[i].num1);
            render_block(k*11+1,10,crafta[i].id1);
            render_plus(k*11+1,20);
            render_number(k*11+1,30,crafta[i].num2);
            render_block(k*11+1,40,crafta[i].id2);
            render_plus(k*11+1,50);
            render_number(k*11+1,60,crafta[i].num3);
            render_block(k*11+1,70,crafta[i].id3);
            render_eq(k*11+1,80);
            render_number(k*11+1,90,crafta[i].num4);
            render_block(k*11+1,100,crafta[i].id4);
            if(check(crafta[i])){
                render_good(k*11+1,120);
            }else{
                render_bad(k*11+1,120);
            }
        }
    }else if(mode==2){
        for(int i=1;i<=200;i++){
            for(int j=1;j<=100;j++){
                output[i][j]=15;
            }
        }
        for(int i=pointer3;i<craftb.size()&&i<pointer3+9;i++){
            int k=i-pointer3;
            render_number(k*11+1,0,craftb[i].num1);
            render_block(k*11+1,10,craftb[i].id1);
            render_plus(k*11+1,20);
            render_number(k*11+1,30,craftb[i].num2);
            render_block(k*11+1,40,craftb[i].id2);
            render_plus(k*11+1,50);
            render_number(k*11+1,60,craftb[i].num3);
            render_block(k*11+1,70,craftb[i].id3);
            render_eq(k*11+1,80);
            render_number(k*11+1,90,craftb[i].num4);
            render_block(k*11+1,100,craftb[i].id4);
            if(check(craftb[i])){
                render_good(k*11+1,120);
            }else{
                render_bad(k*11+1,120);
            }
        }
    }else if(mode==3){
        for(int i=1;i<=200;i++){
            for(int j=1;j<=100;j++){
                output[i][j]=15;
            }
        }
        for(int i=pointer3;i<craftc.size()&&i<pointer3+9;i++){
            int k=i-pointer3;
            render_number(k*11+1,0,craftc[i].num1);
            render_block(k*11+1,10,craftc[i].id1);
            render_plus(k*11+1,20);
            render_number(k*11+1,30,craftc[i].num2);
            render_block(k*11+1,40,craftc[i].id2);
            render_plus(k*11+1,50);
            render_number(k*11+1,60,craftc[i].num3);
            render_block(k*11+1,70,craftc[i].id3);
            render_eq(k*11+1,80);
            render_number(k*11+1,90,craftc[i].num4);
            render_block(k*11+1,100,craftc[i].id4);
            if(check(craftc[i])){
                render_good(k*11+1,120);
            }else{
                render_bad(k*11+1,120);
            }
        }
    }
    int colour=(jianzao?9:12);
    for(int i=0;i+pointer2*20<bag.size();i++){
        for(int j=0;j<5;j++){
            for(int k=0;k<10;k++){
                if(pointer1!=i)
                    output[i*10+1+j][111+k]=nums[bag[i
                    +pointer2*20].num%100/10][k][j];
                else
                    output[i*10+1+j][111+k]=((nums[bag[i+
                    pointer2*20].num%100/10][k][j]==0)?colour:7);
            }
        }
        for(int j=0;j<5;j++){
            for(int k=0;k<10;k++){
                if(pointer1!=i)
                    output[i*10+6+j][111+k]=nums[bag[i+
                    pointer2*20].num%10][k][j];
                else
                    output[i*10+6+j][111+k]=((nums[bag[i+
                    pointer2*20].num%10][k][j]==0)?colour:7);
            }
        }
    }
    for(int i=0;i+pointer2*20<bag.size();i++){
        for(int j=0;j<10;j++){
            for(int k=0;k<10;k++){
                output[i*10+1+j][101+k]=blocks[bag[i+pointer2*20
                ].id][k][j];
            }
        }
    }
    for(int i=max((int)bag.size()-pointer2*20,0);i<=20;i++){
        for(int j=0;j<10;j++){
            for(int k=0;k<20;k++){
                output[i*10+1+j][101+k]=0;
            }
        }
    }
}
void dfs_dong(int st,int x,int y){
    if(x<=80||y<=80||x>=CgDu-80||world[x][y]==0||st==0){
        return ;
    }
    world[x][y]=0;
    for(int i=0;i<3;i++){
        if(rand(1,3)>1){
            dfs_dong(st-1,x+dx[i],y+dy[i]);
        }
    }
}
int check_time(int bl,int cr){
    int T;
    if(cr==21){
        if(bl==1||bl==2){
            return 2;
        }
        if(bl==3||bl==15||bl==13){
            return 2;
        }
        if(bl==6||bl==11||bl==12){
            return 3;
        }
        if(bl==7){
            return 1;
        }
        if(bl==8||bl==18){
            return 7;
        }
        if(bl==10||bl==19){
            return 15;
        }
        if(bl==9||bl==14){
            return 35;
        }
    }else if(cr==22){
        if(bl==1||bl==2){
            return 2;
        }
        if(bl==3||bl==15||bl==13){
            return 1;
        }
        if(bl==6||bl==11||bl==12){
            return 3;
        }
        if(bl==7){
            return 1;
        }
        if(bl==8||bl==18){
            return 5;
        }
        if(bl==10||bl==19){
            return 10;
        }
        if(bl==9||bl==14){
            return 25;
        }
    }else if(cr==23){
        if(bl==1||bl==2){
            return 2;
        }
        if(bl==3||bl==15||bl==13){
            return 1;
        }
        if(bl==6||bl==11||bl==12){
            return 3;
        }
        if(bl==7){
            return 1;
        }
        if(bl==8||bl==18){
            return 1;
        }
        if(bl==10||bl==19){
            return 3;
        }
        if(bl==9||bl==14){
            return 15;
        }
    }else if(cr==24){
        if(bl==1||bl==2){
            return 1;
        }
        if(bl==3||bl==15||bl==13){
            return 1;
        }
        if(bl==6||bl==11||bl==12){
            return 1;
        }
        if(bl==7){
            return 1;
        }
        if(bl==8||bl==18){
            return 1;
        }
        if(bl==10||bl==19){
            return 1;
        }
        if(bl==9||bl==14){
            return 5;
        }
    }
     else{
        if(bl==1||bl==2){
            return 2;
        }
        if(bl==3||bl==15||bl==13){
            return 5;
        }
        if(bl==6||bl==11||bl==12){
            return 3;
        }
        if(bl==7){
            return 1;
        }
        if(bl==8||bl==18){
            return 10;
        }
        if(bl==10||bl==19){
            return 20;
        }
        if(bl==9||bl==14){
            return 50;
        }
    }
    return 1;
}
void generation(int seed) {
    //生成种子
    if (seed == -1) {
        srand(time(0));
        srand(rand() + time(0));
        seed = rand();
    }
    srand(seed);
    //生成空气
    for (int i = 0; i < CgDu; i++) {
        for (int j = 1; j < 256; j++) {
            world[i][j] = 0;
        }
    }
    //生成基本地形
    int grass = rand(50, 80);
    int higher = rand(1, 3);
    int trend = 1, stop_sum = 1;
    bool biome = rand(0, 1);
    int tree;
    for (int i = 0; i < CgDu; i++) {
        world[i][0] = 4; //基岩
        for (int j = 1; j < grass - 3; j++) {
            unLight[i][j]=1;
            if(i<80||i>CgDu-80){
                for(int j=1;j<300;j++){
                    world[i][j]=4;
                }
                goto again;
            }
            if(j==14){
                if(rand(1,14)==1){
                    world[i][j]=9;
                    continue;
                }
            }
            if(rand(1,1000)==1){
                dfs_dong(rand(3,5),i-1,j);
            }
            if(rand(1,6000)==1){
                dfs_dong(rand(12,15),i-1,j);
            }
            if(rand(1,20000)==1){
                dfs_dong(rand(20,30),i-1,j);
            }
            if(rand(1,30)!=1){
                world[i][j]=3;
            }else if(rand(1,5)!=1){
                world[i][j]=8+rand(0,1)*5;
            }else if(rand(1,5)==3&&j<20){
                world[i][j]=9;
            }else{
                world[i][j]=10;
            }
        }
        for (int j = grass - 3; j < grass; j++) {
            world[i][j] = 2; //泥土
        }
        world[i][grass] = 1;
        if(tree==0&&(world[i][grass]!=5&&grass>63))
            tree=int(!rand(0,20))*5;
        else
            tree=0;
        if(tree!=0&&i>80&&i<CgDu-80){
            for(int j=grass+1;j<grass+tree;j++){
                world[i][j]=6;
                if(j==grass+tree-1){
                    for(int k=-2;k<=2;k++){
                        if(world[i+k][j]==0){
                            world[i+k][j]=7;
                        }
                    }
                    for(int k=-2;k<=2;k++){
                        if(world[i+k][j+1]==0){
                            world[i+k][j+1]=7;
                        }
                    }
                    for(int k=-1;k<=1;k++){
                        if(world[i+k][j+2]==0){
                            world[i+k][j+2]=7;
                        }
                    }
                }
            }
        }
        
        if (biome) { //生成下一个草方块高度
            if (rand(0, 7) == 3) {
                grass += trend;
                stop_sum = 1;
            } else {
                stop_sum++;
            }
        } else {
            if (rand(0, nozero(3 - stop_sum)) == 0) {
                grass += trend * higher;
                stop_sum = 1;
            } else {
                stop_sum++;
            }
        }
        //随机更新高度
        if (rand(0, 1) == 1) {
            higher++;
        } else {
            higher--;
        }
        if (rand(0, 40) == 10) {
            trend *= -1;
        }
        if (rand(0, 100) == 50) {
            biome = !biome;
        }
        //限制范围
        if (grass > 120) {
            grass = 120;
        }
        if (grass < 40) {
            grass = 40;
        }
        if (higher > 2) {
            higher = 2;
        }
        if (higher < 1) {
            higher = 1;
        }
        if(grass<=55){
            if(rand(1,3)==3){
                trend=1;
            }
        }
        again:;
    }
}
void *printmain(void *arg) {
    clock_t st, tmp;
    int sum = 0, fps = -1;
    char t[1005];
    st = clock();
    while (1) {
        render(); //软件渲染
        if (WDOUBLE == 0) { //发送渲染
            sendprint();
        } else {
            sendprint_double();
        }
        sum++; //记录渲染个数
        sprintf(t, "SUPERCRAFT (X:%.1f,Y:%.1f,FPS:%d)", X * 1.0 / 10.0, Y * 1.0 / 10.0, fps); //输出FPS,坐标
        tmp = clock();
        if (tmp - st >= 1000) { //计算FPS
            fps = sum / ((tmp - st) / 1000.0);
            sum = 0;
            st = tmp;
        }
        SetConsoleTitleA(t); //输出FPS
    }
}
bool canin(int x) { //判断人能否进入方块
    return x == 0 || x == 5||x==6||x==7||x==16||x==17||x==20
    ||x==21||x==22||x==23||x==26||x==27||x==25||x==24;
}
bool _canin(int x,int y){
    return canin(world[x/10][y/10]);
}
void inita(){
    craft now_craft;
    now_craft.id1=6;    now_craft.num1=1;
    now_craft.id2=0;    now_craft.num2=0;
    now_craft.id3=0;    now_craft.num3=0;
    now_craft.id4=11;    now_craft.num4=4;
    crafta.push_back(now_craft);
    
    now_craft.id1=11;    now_craft.num1=4;
    now_craft.id2=0;    now_craft.num2=0;
    now_craft.id3=0;    now_craft.num3=0;
    now_craft.id4=12;    now_craft.num4=1;
    crafta.push_back(now_craft);
    
    now_craft.id1=11;    now_craft.num1=2;
    now_craft.id2=0;    now_craft.num2=0;
    now_craft.id3=0;    now_craft.num3=0;
    now_craft.id4=20;    now_craft.num4=4;
    crafta.push_back(now_craft);
}
void initb(){
    craft now_craft;
    now_craft.id1=6;    now_craft.num1=1;
    now_craft.id2=0;    now_craft.num2=0;
    now_craft.id3=0;    now_craft.num3=0;
    now_craft.id4=11;    now_craft.num4=4;
    craftb.push_back(now_craft);

    now_craft.id1=11;    now_craft.num1=4;
    now_craft.id2=0;    now_craft.num2=0;
    now_craft.id3=0;    now_craft.num3=0;
    now_craft.id4=12;    now_craft.num4=1;
    craftb.push_back(now_craft);
    
    now_craft.id1=9;    now_craft.num1=9;
    now_craft.id2=0;    now_craft.num2=0;
    now_craft.id3=0;    now_craft.num3=0;
    now_craft.id4=14;    now_craft.num4=1;
    craftb.push_back(now_craft);
    
    now_craft.id1=14;    now_craft.num1=1;
    now_craft.id2=0;    now_craft.num2=0;
    now_craft.id3=0;    now_craft.num3=0;
    now_craft.id4=9;    now_craft.num4=9;
    craftb.push_back(now_craft);
    
    now_craft.id1=3;    now_craft.num1=8;
    now_craft.id2=0;    now_craft.num2=0;
    now_craft.id3=0;    now_craft.num3=0;
    now_craft.id4=15;    now_craft.num4=1;
    craftb.push_back(now_craft);
    
    now_craft.id1=16;    now_craft.num1=9;
    now_craft.id2=0;    now_craft.num2=0;
    now_craft.id3=0;    now_craft.num3=0;
    now_craft.id4=18;    now_craft.num4=1;
    craftb.push_back(now_craft);
    
    now_craft.id1=17;    now_craft.num1=9;
    now_craft.id2=0;    now_craft.num2=0;
    now_craft.id3=0;    now_craft.num3=0;
    now_craft.id4=19;    now_craft.num4=1;
    craftb.push_back(now_craft);
    
    now_craft.id1=19;    now_craft.num1=1;
    now_craft.id2=0;    now_craft.num2=0;
    now_craft.id3=0;    now_craft.num3=0;
    now_craft.id4=17;    now_craft.num4=9;
    craftb.push_back(now_craft);
    
    now_craft.id1=11;    now_craft.num1=2;
    now_craft.id2=0;    now_craft.num2=0;
    now_craft.id3=0;    now_craft.num3=0;
    now_craft.id4=20;    now_craft.num4=4;
    craftb.push_back(now_craft);
    
    now_craft.id1=11;    now_craft.num1=3;
    now_craft.id2=20;    now_craft.num2=2;
    now_craft.id3=0;    now_craft.num3=0;
    now_craft.id4=21;    now_craft.num4=1;
    craftb.push_back(now_craft);
    
    now_craft.id1=16;    now_craft.num1=3;
    now_craft.id2=20;    now_craft.num2=2;
    now_craft.id3=0;    now_craft.num3=0;
    now_craft.id4=23;    now_craft.num4=1;
    craftb.push_back(now_craft);
    
    now_craft.id1=3;    now_craft.num1=3;
    now_craft.id2=20;    now_craft.num2=2;
    now_craft.id3=0;    now_craft.num3=0;
    now_craft.id4=22;    now_craft.num4=1;
    craftb.push_back(now_craft);
    
    now_craft.id1=9;    now_craft.num1=3;
    now_craft.id2=20;    now_craft.num2=2;
    now_craft.id3=0;    now_craft.num3=0;
    now_craft.id4=24;    now_craft.num4=1;
    craftb.push_back(now_craft);
    
    now_craft.id1=16;    now_craft.num1=5;
    now_craft.id2=0;    now_craft.num2=0;
    now_craft.id3=0;    now_craft.num3=0;
    now_craft.id4=25;    now_craft.num4=1;
    craftb.push_back(now_craft);
    
    now_craft.id1=16;    now_craft.num1=6;
    now_craft.id2=20;    now_craft.num2=1;
    now_craft.id3=0;    now_craft.num3=0;
    now_craft.id4=26;    now_craft.num4=6;
    craftb.push_back(now_craft);
    
    now_craft.id1=18;    now_craft.num1=1;
    now_craft.id2=0;    now_craft.num2=0;
    now_craft.id3=0;    now_craft.num3=0;
    now_craft.id4=16;    now_craft.num4=9;
    craftb.push_back(now_craft);
    
    now_craft.id1=3;    now_craft.num1=3;
    now_craft.id2=0;    now_craft.num2=0;
    now_craft.id3=0;    now_craft.num3=0;
    now_craft.id4=28;    now_craft.num4=4;
    craftb.push_back(now_craft);
    
    now_craft.id1=3;    now_craft.num1=3;
    now_craft.id2=0;    now_craft.num2=0;
    now_craft.id3=0;    now_craft.num3=0;
    now_craft.id4=29;    now_craft.num4=4;
    craftb.push_back(now_craft);
}
void initc(){
    craft now_craft;
    now_craft.id1=8;    now_craft.num1=1;
    now_craft.id2=11;    now_craft.num2=1;
    now_craft.id3=0;    now_craft.num3=0;
    now_craft.id4=16;    now_craft.num4=1;
    craftc.push_back(now_craft);
    
    now_craft.id1=10;    now_craft.num1=1;
    now_craft.id2=11;    now_craft.num2=1;
    now_craft.id3=0;    now_craft.num3=0;
    now_craft.id4=17;    now_craft.num4=1;
    craftc.push_back(now_craft);
    
    now_craft.id1=8;    now_craft.num1=6;
    now_craft.id2=13;    now_craft.num2=1;
    now_craft.id3=0;    now_craft.num3=0;
    now_craft.id4=16;    now_craft.num4=6;
    craftc.push_back(now_craft);
    
    now_craft.id1=10;    now_craft.num1=6;
    now_craft.id2=13;    now_craft.num2=1;
    now_craft.id3=0;    now_craft.num3=0;
    now_craft.id4=17;    now_craft.num4=6;
    craftc.push_back(now_craft);
    
    now_craft.id1=11;    now_craft.num1=2;
    now_craft.id2=0;    now_craft.num2=0;
    now_craft.id3=0;    now_craft.num3=0;
    now_craft.id4=13;    now_craft.num4=1;
    craftc.push_back(now_craft);
}
int main() {
    inita();
    initb();
    initc();
    console(); //控制台设置
    pthread_create(NULL, NULL, printmain, NULL); //创建渲染线程
    //生成世界
    int jumps = 0;
    int cnt[129]{0};
    while (1) { //主循环:游戏刻
        if(mode==0){//世界部分
            if(!on_car){//行动部分
                if (keydown('A') &&_canin(X-1,Y-4)&&_canin(X-1,Y+6)) {
                    X--; //向左走
                    LR = 0;
                }
                if(keyup('9') &&_canin(X-1,Y-4)&&_canin(X-1,Y+6)){
                    X--;//向左微调
                }
                if(keyup('0')&& _canin(X+10,Y-4)&&_canin(X+10,Y+6)){
                    X++;//向右微调
                }
                if (keydown('D') && _canin(X+10,Y-4)&&_canin(X+10,Y+6)) {
                    X++; //向右走
                    LR = 1;
                }
                if (keydown('W') &&!(_canin(X,Y-6)&&_canin(X+9,Y-6))) {
                    jumps = 18; //跳跃(判断)
                }
                
                if(jumps>0||_canin(X,Y-5)&&_canin(X+9,Y-5)){
                    if(jumps>0)
                        for(int i=1;i<=jumps/6;Y++,i++){
                            if(!(_canin(X,Y+14)&&_canin(X+9,Y+14))){
                                Y-=3;
                                jumps=0;
                                break;
                            }
                        }
                    else{
                        for(int i=1;i<=jumps/-6;Y--,i++){
                            if(!(_canin(X,Y-5)&&_canin(X+9,Y-5))){
                                Y++;
                                break;
                            }
                        }
                    }
                    while(!(_canin(X,Y-5)&&_canin(X+9,Y-5))){
                        Y++;
                    }
                    jumps--;
                } else     {
                    jumps=0;
                }
                if(keydown('G')){
                    if(world[(X+5)/10][Y/10]==27){
                        X=(X+5)/10*10;
                        Y=Y/10*10+5;
                        on_car=1;
                    }
                }
            }else{//矿车部分
                if(keydown('W')) {
                    jumps = 18;
                    on_car=0;
                }
                if ((keydown('A')||keyup('9'))

                &&((world[(X-5)/10][(Y-5)/10]==26||
                world[(X-5)/10][(Y-5)/10]==27)
                &&_canin((X-5),Y+5)||

                (world[(X-5)/10][(Y-5)/10]==28&&
                world[(X-5)/10][(Y+5)/10]==26&&
                _canin((X-5),Y+10))

                ||(world[(X+5)/10][(Y-15)/10]==29&&
                world[(X-5)/10][(Y-15)/10]==26&&
                _canin((X-5),Y-5)))){
                    if(world[(X-5)/10][(Y-5)/10]==26){
                        world[X/10][(Y-5)/10]--;
                        world[(X-5)/10][(Y-5)/10]++;
                    }else if(world[(X-5)/10][(Y-5)/10]==28){
                        world[X/10][(Y-5)/10]--;
                        world[(X-5)/10][(Y+5)/10]++;
                        Y+=10;
                    }else if(world[(X+5)/10][(Y-15)/10]==29){
                        world[X/10][(Y-5)/10]--;
                        world[(X-5)/10][(Y-15)/10]++;
                        Y-=10;
                    }
                    
                    X-=10; //向左走
                    LR = 0;
                }
                if ((keydown('D')||keyup('0'))
                
                &&((world[(X+10)/10][(Y-5)/10]==26||
                world[(X+10)/10][(Y-5)/10]==27)
                &&_canin(X+10,Y+5)||

                (world[(X+10)/10][(Y-5)/10]==29&&
                world[(X+10)/10][(Y+5)/10]==26&&
                _canin((X+10),Y+10))

                ||(world[(X+5)/10][(Y-15)/10]==28&&
                world[(X+10)/10][(Y-15)/10]==26&&
                _canin((X+10),Y-5)))){
                    if(world[(X+10)/10][(Y-5)/10]==26){
                        world[X/10][(Y-5)/10]--;
                        world[(X+10)/10][(Y-5)/10]++;
                    }else if(world[(X+10)/10][(Y-5)/10]==29){
                        world[X/10][(Y-5)/10]--;
                        world[(X+10)/10][(Y+5)/10]++;
                        Y+=10;
                    }else if(world[(X+5)/10][(Y-15)/10]==28){
                        world[X/10][(Y-5)/10]--;
                        world[(X+10)/10][(Y-15)/10]++;
                        Y-=10;
                    }
                    X+=10; //向右走
                    LR = 1;
                }
            }
            {//挖掘测试
                bool flag=0;
                int*m;
                if(keyup(' ')){
                
                        jianzao=!jianzao;
                }
                if(keydown('H')){
                    cnt['h']++;
                    if(cnt['h']%5==2){
                        m=&world[(X+15)/10][Y/10];
                        flag=1;
                    }
                }
                if(keydown('Y')){
                    cnt['y']++;
                    if(cnt['y']%5==2){

                    m=&world[(X+15)/10][(Y+10)/10];    flag=1;}
                }
                if(keydown('6')){
                    cnt['6']++;
                    if(cnt['6']%5==2){

                    m=&world[(X+15)/10][(Y+20)/10];    flag=1;}
                }
                if(keydown('N')){
                    cnt['n']++;
                    if(cnt['n']%5==2){

                    m=&world[(X+15)/10][(Y-10)/10];    flag=1;}
                }
                if(keydown('F')){
                    cnt['f']++;
                    if(cnt['f']%5==2){

                    m=&world[(X-5)/10][Y/10];flag=1;}
                }
                  if(keydown('R')){
                      cnt['r']++;
                    if(cnt['r']%5==2){

                    m=&world[(X-5)/10][(Y+10)/10];flag=1;}
                }
                if(keydown('4')){
                      cnt['4']++;
                    if(cnt['4']%5==2){

                    m=&world[(X-5)/10][(Y+20)/10];flag=1;}
                }
                if(keydown('V')){
                      cnt['v']++;
                    if(cnt['v']%5==2){

                    m=&world[(X-5)/10][(Y-10)/10];flag=1;}
                }
                if(keydown('5')){
                    cnt['5']++;
                    if(cnt['5']%5==2)
                       if(LR==0){
                        m=&world[X/10][(Y+20)/10];
                        flag=1;
                    }else{
                        m=&world[(X+9)/10][(Y+20)/10];
                        flag=1;
                    }
                }
                if(keydown('B')){
                    cnt['b']++;
                    if(cnt['b']%5==2)
                    if(LR==0){
                        m=&world[X/10][(Y-10)/10];
                        flag=1;
                    }else{
                        m=&world[(X+9)/10][(Y-10)/10];
                        flag=1;
                    }
                }
                if(flag==1){
                    int&k=*m;
                    if(k!=0&&k!=4&&!jianzao&&k!=27){
                        if(m==wab){
                            wat--;
                        }else{
                            int p1=pointer1,p2=pointer2;
                            if(bag.size()!=0)
                            wat=check_time(k,bag[p2*20+p1].id);
                            else
                            wat=check_time(k,0);
                            wab=m;
                        }
                        if(wat<=0){
                            for(int i=0;i<bag.size();i++){
                                if(bag[i].id==k){
                                    bag[i].num++;
                                    goto gt;
                                }
                            }
                            bag.push_back({k,1});
                            gt:;
                            k=0;
                        }
                        
                    }else if((k==0||k==26)&&jianzao){
                        int p1=pointer1,p2=pointer2;
                        if(bag.size()>p2*20+p1&&k==0){
                            k=bag[p2*20+p1].id;
                            bag[p2*20+p1].num--;
                            if(bag[p2*20+p1].num==0){
                                bag.erase(bag.begin()+p2*20+p1);
                            }
                        }
                        if(bag.size()>p2*20+p1&&k==26
                        &&bag[p2*20+p1].id==25){
                            k=27;
                            bag[p2*20+p1].num--;
                            if(bag[p2*20+p1].num==0){
                                bag.erase(bag.begin()+p2*20+p1);
                            }
                        }
                    }else if(!jianzao&&k==27){
                        k=26;
                        for(int i=0;i<bag.size();i++){
                            if(bag[i].id==25){
                                bag[i].num++;
                                goto gt27;
                            }
                        }
                        bag.push_back({25,1});
                        gt27:;
                    }
                }

            }
            if(keyup('T')){
                if(LR==0){
                    LR=1;
                }else{
                    LR=0;
                }
            }
            if(keyup('E')){
            
                    if(bag[pointer1+pointer2*20].id!=12&&
                    bag[pointer1+pointer2*20].id!=15){
                        pointer3=0;
                        mode=1;
                    }else if(bag[pointer1+pointer2*20].id==12){
                        pointer3=0;
                        mode=2;
                    }else if(bag[pointer1+pointer2*20].id==15){
                        pointer3=0;
                        mode=3;
                    }

            }
        }
        else if(mode==1){//合成部分
            if(keyup('E')){
                    cnt['e']=0;
                    mode=0;
            }
            if(keyup(' ')){
                if(check(crafta[pointer3]))
                            Craft(crafta[pointer3]);
            }
            if(keydown('I')){
                cnt['i']++;
                    if(cnt['i']%9==8){
                        pointer3--;
                        if(pointer3<0){
                            pointer3=0;
                        }
                    }
            }
            if(keydown('K')){
                cnt['k']++;
                    if(cnt['k']%9==8){
                        pointer3++;
                        if(pointer3>=crafta.size()){
                            pointer3=crafta.size()-1;
                        }
                    }
            }
        }
        else if(mode==2){//合成部分2
            if(keyup('E')){
            
                    mode=0;
            }
            if(keyup(' ')){
                if(check(craftb[pointer3]))
                        Craft(craftb[pointer3]);
            }
            if(keydown('I')){
                cnt['i']++;
                    if(cnt['i']%9==8){
                        pointer3--;
                        if(pointer3<0){
                            pointer3=0;
                        }
                    }
            }
            if(keydown('K')){
                cnt['k']++;
                    if(cnt['k']%9==8){
                        pointer3++;
                        if(pointer3>=craftb.size()){
                            pointer3=craftb.size()-1;
                        }
                    }
            }
        }else if(mode==3){//合成部分3
            if(keyup('E')){
                mode=0;
            }
            if(keyup(' ')){
                        if(check(craftc[pointer3])){
                            Craft(craftc[pointer3]);
                        }
            }
            if(keydown('I')){
                cnt['i']++;
                    if(cnt['i']%9==8){
                        pointer3--;
                        if(pointer3<0){
                            pointer3=0;
                        }
                    }
            }
            if(keydown('K')){
                cnt['k']++;
                    if(cnt['k']%9==8){
                        pointer3++;
                        if(pointer3>=craftc.size()){
                            pointer3=craftc.size()-1;
                        }
                    }
            }
        }
        {//背包测试
            if (keydown('O') ) {
                cnt['o']++;

            }
            if (keydown('P') ) {
                cnt['p']++;

            }

            if(cnt['p']%8==7){
                pointer1++;
                cnt['p']++;
                if(pointer1>19){
                    pointer1=0;
                    pointer2++;
                    if(pointer2*20>=bag.size()){
                        pointer2=0;
                        pointer1=0;
                    }
                }
            }
            if(cnt['o']%8==7){
                cnt['o']++;
                pointer1--;
                if(pointer1<0){
                    pointer1=19;
                    pointer2--;
                    if(pointer2<0){
                        pointer2=0;
                    }
                }
            }
        }
        if(keydown('Z')){
            ofstream fout(xs.c_str());
            for(int i=1;i<=CgDu;i++){
                for(int j=1;j<=256;j++){
                    fout<<world[i][j]<<" ";
                }
            }
            for(int i=1;i<=CgDu;i++){
                for(int j=1;j<=256;j++){
                    fout<<unLight[i][j]<<" ";
                }
            }
            fout<<X<<" "<<Y<<" ";
            for(int i=0;i<bag.size();i++){
                fout<<bag[i].id<<" "<<bag[i].num<<" ";
            }
            return 0;
        }
        Sleep(10);
    }
    return 0;
}

新增矿车,镐子,修复部分bug

之所以叫2.0-是因为新bug很多

陈俊霖在2022-10-16 13:36:50追加了内容

挖掘不能用rtyfgh定位了,用的是456ryfhvbn定位,t转身,g上矿车

CdDu是长度的意思,如果卡崩了,试试把这一行换掉,换成1000

陈俊霖在2022-10-17 08:23:03追加了内容

试试这个能不能点进去(我用的是本工作室成员的洛谷而非我自己的)

https://www.luogu.com.cn/paste/wazfuzt4

小心卡崩!


0
已采纳
熊潇然
熊潇然
初级启示者
初级启示者

BUG:TG两个键没法挖

0
0
杨家瑞
杨家瑞
新手光能
新手光能

**UG TG没法挖 一点也没有1.0好啊

而且画质也变了,但是是什么时候出生物???

0
陈俊霖
陈俊霖
新手天翼
新手天翼

顶~

4左上5上6右上r左中上y右中上f左中下h右中下v左下b正下n右下t转身g上矿车9左微调0右微调挖掘速度被减慢平均5倍,用钻石镐等镐子可以加快速度

画质可以自己改

0
陈俊霖
陈俊霖
新手天翼
新手天翼

代码有bug,是没有能力;有bug不说,是过错——当背包太满时,有可能会数据丢失!

0
薛乘志
薛乘志
初级启示者
初级启示者

一个建议:

craft now_craft;
now_craft.id1=6;    now_craft.num1=1;
now_craft.id2=0;    now_craft.num2=0;
now_craft.id3=0;    now_craft.num3=0;
now_craft.id4=11;    now_craft.num4=4;
crafta.push_back(now_craft);

你不累吗?改成:

crafta.push_back(craft{6, 1, 0, 0, 0, 0, 11, 4});

 

0
0
0
熊潇然
熊潇然
初级启示者
初级启示者

@薛乘志 你的画质要把眼睛看瞎了!

 

0
我要回答