种瓜模拟器0.0.9大更新
2026-08-18 11:00:12
发布于:广东
种瓜模拟器0.0.9更新完成啦,这是我原创代码,未进过我的同意,禁止转载,仅供复制游玩
注:代码有一些C++ 新版本代码,如果用老版DEV-C++ 请升级GCC,否则会报错
我的GCC:

#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
const int N = 2e5 + 10;
int lu = 3;//Language语言,1.简体中文 2.繁体中文 3.English
bool flag = false,flag2 = false;//flag收瓜时自动补种 falg2成熟时自动收瓜
void clean() {
#ifdef _WIN32
system("cls");
#else
system("clear");
#endif
}
void await(double ms) {
#ifdef _WIN32
Sleep(ms*1000);
#else
usleep(ms * 1000*1000);
#endif
}
void Refresh(char melon_field[],int &seed,int &money){
clean();
int tm = 1;
for(int i = 1;i <= 5;i++){
for(int j = 1;j <= 5;j++){
if(melon_field[tm] == '.'){
melon_field[tm] = 'Y';
}else if(melon_field[tm] == 'Y'){
melon_field[tm] = 'O';
}else if(melon_field[tm] == 'O'){
melon_field[tm] = 'Q';
}else if(melon_field[tm] == 'Q'){
if(flag2){
money += 8;
melon_field[tm] = '#';
if(flag){
if(seed > 0){
melon_field[tm] = '.';
seed--;
}
}
}
}
tm++;
}
}
}
void play_melon_field(char melon_field[],int money,int seed){
while(true){
if(lu == 1){
cout << "=========瓜 田=========\n";//简体中文
}else if(lu == 2){
cout << "=========瓜 田=========\n";//繁體中文
}else{
cout << "======melon field======\n";//English
}
if(lu == 1){
cout << "钱:" << money << " 种子:" << seed << "\n";//简体中文
}else if(lu == 2){
cout << "錢:" << money << " 種子:" << seed << "\n";//繁體中文
}else{
cout << "money:" << money << " seed:" << seed << "\n";//English
}
int tm = 1;//临时变量,是输出的第几个瓜
for(int i = 1;i <= 5;i++){
for(int j = 1;j <= 5;j++){
cout << melon_field[tm];
tm++;
}
cout << "\n";
}
cout << "\n";
cout.flush();
int op;
if(lu == 1){
cout << "1.种瓜\n2.收瓜\n3.买种子\n4.退出\n5.刷新\n请输入指令(只需输入对应数字即可)>>>";//简体中文
}else if(lu == 2){
cout << "1.種瓜\n2.收瓜\n3.買種子\n4.退出\n5.刷新\n請輸入指令(只需輸入對應數字即可)>>>";//繁體中文
}else{
cout << "1.Plant melons\n2.Harvest melons\n3.Buy seeds\n4.Exit\n5.Refresh\nPlease enter the command(Just enter the corresponding number)>>>";//English
}
cout.flush();
cin >> op;
while(op > 5 || op < 1){
clean();
if(lu == 1){
cout << "请输入1-5的数字";
}else if(lu == 2){
cout << "請輸入1-5的數字";
}else{
cout << "Please enter a number from 1 to 5";
}
cout.flush();
await(5);
clean();
cin >> op;
}
if(op == 1){
int x,y;
if(lu == 1){
cout << "请输入x坐标(从1~5)\n>>>";//简体中文
}else if(lu == 2){
cout << "請輸入x座標(從1~5)\n>>>";//繁體中文
}else{
cout << "Please enter the x coordinate (from 1 to 5)\n>>>";//English
}
cout.flush();
cin >> x;
while(x > 5 || x < 1){
clean();
if(lu == 1){
cout << "请输入1-5的数字";
}else if(lu == 2){
cout << "請輸入1-5的數字";
}else{
cout << "Please enter a number from 1 to 5";
}
cout.flush();
await(5);
clean();
if(lu == 1){
cout << "请输入x坐标(从1~5)\n>>>";//简体中文
}else if(lu == 2){
cout << "請輸入x座標(從1~5)\n>>>";//繁體中文
}else{
cout << "Please enter the x coordinate (from 1 to 5)\n>>>";//English
}
cout.flush();
cin >> x;
}
if(lu == 1){
cout << "请输入y坐标(从1~5)\n>>>";//简体中文
}else if(lu == 2){
cout << "請輸入y座標(從1~5)\n>>>";//繁體中文
}else{
cout << "Please enter the y coordinate (from 1 to 5)\n>>>";//English
}
cout.flush();
cin >> y;
while(y > 5 || y < 1){
clean();
if(lu == 1){
cout << "请输入1-5的数字";
}else if(lu == 2){
cout << "請輸入1-5的數字";
}else{
cout << "Please enter a number from 1 to 5";
}
cout.flush();
await(5);
clean();
if(lu == 1){
cout << "请输入y坐标(从1~5)\n>>>";//简体中文
}else if(lu == 2){
cout << "請輸入y座標(從1~5)\n>>>";//繁體中文
}else{
cout << "Please enter the y coordinate (from 1 to 5)\n>>>";//English
}
cout.flush();
cin >> y;
}
if(seed <= 0){
if(lu == 1){
cout << "没有种子了,请购买种子";//简体中文
}else if(lu == 2){
cout << "沒有種子了,請購買種子";//繁體中文
}else{
cout << "No seeds left,please buy seeds";//English
}
}else{
seed--;
melon_field[(x - 1) * 5 + y] = '.';
clean();
}
}
if(op == 2){
int x,y;
if(lu == 1){
cout << "请输入x坐标(从1~5)\n>>>";//简体中文
}else if(lu == 2){
cout << "請輸入x座標(從1~5)\n>>>";//繁體中文
}else{
cout << "Please enter the x coordinate (from 1 to 5)\n>>>";//English
}
cout.flush();
cin >> x;
while(x > 5 || x < 1){
clean();
if(lu == 1){
cout << "请输入1-5的数字";
}else if(lu == 2){
cout << "請輸入1-5的數字";
}else{
cout << "Please enter a number from 1 to 5";
}
cout.flush();
await(5);
clean();
if(lu == 1){
cout << "请输入x坐标(从1~5)\n>>>";//简体中文
}else if(lu == 2){
cout << "請輸入x座標(從1~5)\n>>>";//繁體中文
}else{
cout << "Please enter the x coordinate (from 1 to 5)\n>>>";//English
}
cout.flush();
cin >> x;
}
if(lu == 1){
cout << "请输入y坐标(从1~5)\n>>>";//简体中文
}else if(lu == 2){
cout << "請輸入y座標(從1~5)\n>>>";//繁體中文
}else{
cout << "Please enter the y coordinate (from 1 to 5)\n>>>";//English
}
cout.flush();
cin >> y;
while(y > 5 || y < 1){
clean();
if(lu == 1){
cout << "请输入1-5的数字";
}else if(lu == 2){
cout << "請輸入1-5的數字";
}else{
cout << "Please enter a number from 1 to 5";
}
cout.flush();
await(5);
clean();
if(lu == 1){
cout << "请输入y坐标(从1~5)\n>>>";//简体中文
}else if(lu == 2){
cout << "請輸入y座標(從1~5)\n>>>";//繁體中文
}else{
cout << "Please enter the y coordinate (from 1 to 5)\n>>>";//English
}
cout.flush();
cin >> y;
}
if(melon_field[(x - 1) * 5 + y] == 'Q') {
melon_field[(x - 1) * 5 + y] = '#';
money += 10;
if(flag){
if(seed > 0){
melon_field[(x - 1) * 5 + y] = '.';
seed--;
}
}
}
clean();
}
if(op == 3){
if(lu == 1){
cout << "请输入购买数量\n>>>";//简体中文
}else if(lu == 2){
cout << "請輸入購買數量\n>>>";//繁體中文
}else{
cout << "Please enter the purchase quantity\n>>>";//English
}
int sum = 0;
cin >> sum;
if(sum * 5 > money){
if(lu == 1){
cout << "\n钱不够了";//简体中文
}else if(lu == 2){
cout << "\n錢不夠了";//繁體中文
}else{
cout << "\nNot enough money";//English
}
await(3);
clean();
}else{
if(lu == 1){
cout << "\n购买成功";//简体中文
}else if(lu == 2){
cout << "\n購買成功";//繁體中文
}else{
cout << "\nPurchase successful";//English
}
seed += sum;
money -= sum * 5;
await(3);
clean();
}
}
if(op == 4){
string save_code = "";
for(int i = 1;i <= 25;i++){
if(melon_field[i] == '#') save_code += '0';
else if(melon_field[i] == '.') save_code += '1';
else if(melon_field[i] == 'Y') save_code += '2';
else if(melon_field[i] == 'O') save_code += '3';
else if(melon_field[i] == 'Q') save_code += '4';
}
save_code += "|";
save_code += to_string(money);
save_code += "|";
save_code += to_string(seed);
save_code += "#";
if(lu == 1){
cout << "\n你的存档码:"<<save_code;
}else if(lu == 2){
cout << "\n你的存檔碼:"<<save_code;
}else{
cout << "\nYour save code:"<<save_code;
}
await(5);
cout.flush();
return;
}
if(op == 5){
Refresh(melon_field,seed,money);
}
}
}
void open_melon_field(){//打开程序
char melon_field[30];
int money = 0,seed = 0;
string cin_save_code;
if(lu == 1){
cout << "请输入存档码\n>>>";//简体中文
}else if(lu == 2){
cout << "請輸入存檔碼\n>>>";//繁體中文
}else{
cout << "Please enter the save code\n>>>";//English
}
cin >> cin_save_code;
int tm = 1;
for(int i = 0;i < 25;i++){
if(cin_save_code[i] == '0'){
melon_field[i+1] = '#';
}else if(cin_save_code[i] == '1'){
melon_field[i+1] = '.';
}else if(cin_save_code[i] == '2'){
melon_field[i+1] = 'Y';
}else if(cin_save_code[i] == '3'){
melon_field[i+1] = 'O';
}else if(cin_save_code[i] == '4'){
melon_field[i+1] = 'Q';
}
tm++;
}
while(cin_save_code[tm] != '|'){
money *= 10;
money += cin_save_code[tm] - '0';
tm++;
}
tm++;
while(cin_save_code[tm] != '#'){
seed *= 10;
seed += cin_save_code[tm] - '0';
tm++;
}
clean();
play_melon_field(melon_field,money,seed);
return;
}
void new_melon_field(){//新建程序
char melon_field[30];
int money = 500,seed = 25;
for(int i = 1;i <= 25;i++){
melon_field[i] = '#';
}
play_melon_field(melon_field,money,seed);
return;
}
void Language_Settings(){//语言设置
clean();
if(lu == 1){
cout << "1.简体中文\n2.繁體中文\n3.English\n请输入指令(只需输入对应的数字)>>>";
}else if(lu == 2){
cout << "1.简体中文\n2.繁體中文\n3.English\n請輸入指令 (只需輸入對應的數字)>>>";
}else{
cout << "1.简体中文\n2.繁體中文\n3.English\nPlease enter the command (Just enter the corresponding number)>>>";
}
cout.flush();
int luop;
cin >> luop;
if(luop == 1){
lu = 1;
}else if(luop == 2){
lu = 2;
}else{
lu = 3;
}
clean();
return;
}
void Settings(){
clean();
int op;
if(lu == 1){
cout << "1.语言\n2.瓜田\n3.图鉴\n其他.返回\n";//简体中文
}else if(lu == 2){
cout << "1.語言\n2.瓜田\n3.圖鑑\n其他.返回\n";//繁體中文
}else{
cout << "1.Language\n2.Melon field\n3.Picture album / Illustrated guide\nOther.Return\n";//English
}
if(lu == 1){
cout << "请输入指令>>>";//简体中文
}else if(lu == 2){
cout << "請輸入指令>>>";//繁體中文
}else{
cout << "Please enter the command>>>";//English
}
cin >> op;
if(op == 1){
Language_Settings();
return;
}else if(op == 2){
clean();
if(flag){
if(lu == 1){
cout << "1.收瓜时自动补种:开\n";
}else if(lu == 2){
cout << "1.收瓜時自動補種:開\n";
}else{
cout << "1.This function has not been implemented yet:On\n";
}
}else if(!flag){
if(lu == 1){
cout << "1.收瓜时自动补种:关\n";
}else if(lu == 2){
cout << "1.收瓜時自動補種:關\n";
}else{
cout << "1.This function has not been implemented yet:Off\n";
}
}
if(flag2){
if(lu == 1){
cout << "2.成熟时自动收瓜:开\n";
}else if(lu == 2){
cout << "2.成熟時自動收瓜:開\n";
}else{
cout << "2.Auto-harvest melons when ripe: On\n";
}
}else if(!flag2){
if(lu == 1){
cout << "2.成熟时自动收瓜:关\n";
}else if(lu == 2){
cout << "2.成熟時自動收瓜:關\n";
}else{
cout << "2.Auto-harvest melons when ripe:Off\n";
}
}
if(lu == 1){
cout << "其他.返回\n";//简体中文
}else if(lu == 2){
cout << "其他.返回\n";//繁體中文
}else{
cout << "Other.Return\n";//English
}
int ifelse;
if(lu == 1){
cout << "请输入指令>>>";//简体中文
}else if(lu == 2){
cout << "請輸入指令>>>";//繁體中文
}else{
cout << "Please enter the command>>>";//English
}
cin >> ifelse;
if(ifelse == 1){
if(flag){
flag = false;
}else if(!flag){
flag = true;
}
}
if(ifelse == 2){
if(flag2){
flag2 = false;
}else if(!flag2){
flag2 = true;
}
}else{
clean();
return;
}
cout.flush();
clean();
return;
}else if(op == 3){
clean();
if(lu == 1){
cout << "# -> 空地\n. -> 种子\nY -> 西瓜苗\nO -> 生西瓜\nQ -> 西瓜\n";//简体中文
}else if(lu == 2){
cout << "# -> 空地\n. -> 種子\nY -> 西瓜苗\nO -> 生西瓜\nQ -> 西瓜\n";//繁體中文
}else{
cout << "# -> Vacant land\n. -> Seed\nY -> Watermelon seedlings\nO -> Unripe watermelon\nQ -> Watermelon\n";//English
}
string t;
if(lu == 1){
cout << "输入任意内容并回车返回>>>";//简体中文
}else if(lu == 2){
cout << "輸入任意內容並回車返回>>>";//繁體中文
}else{
cout << "Enter any content and press Enter to return>>>";//English
}
cin >>t;
clean();
return;
}else{
clean();
return;
}
}
void Main_Interface(){//主界面程序
while(true){
if(lu == 1){
cout << "欢迎来到种瓜模拟器\n=============\n1.打开\n2.新建\n3.设置\n4.返回\n请输入指令(只需输入对应的数字)>>>";
}else if(lu == 2){
cout << "歡迎來到種瓜模擬器\n=============\n1.開啟\n2.新增\n3.設置\n4.返回\n請輸入指令(只需輸入對應的數字)>>>";
}else{
cout << "Welcome to the Melon Growing Simulator\n=============\n1.Open\n2.New\n3.Settings\n4.Return\nPlease enter the command(Just enter the corresponding number)>>>";
}
cout.flush();
int op;
cin >> op;
while(op < 1 ||op > 4){
clean();
if(lu == 1){
cout << "请输入1-4的数字";
}else if(lu == 2){
cout << "請輸入1-4的數字";
}else{
cout << "Please enter a number from 1 to 4";
}
cout.flush();
await(5);
clean();
if(lu == 1){
cout << "欢迎来到种瓜模拟器\n=============\n1.打开\n2.新建\n3.语言\n4.返回\n请输入指令(只需输入对应的数字)>>>";
}else if(lu == 2){
cout << "歡迎來到種瓜模擬器\n=============\n1.開啟\n2.新增\n3.語言\n4.返回\n請輸入指令(只需輸入對應的數字)>>>";
}else{
cout << "Welcome to the Melon Growing Simulator\n=============\n1.Open\n2.New\n3.Language\n4.Return\nPlease enter the command(Just enter the corresponding number)>>>";
}
cout.flush();
cin >> op;
await(5);
}
if(op == 1){
clean();
open_melon_field();
clean();
}else if(op == 2){
clean();
new_melon_field();
cout.flush();
await(5);
clean();
}else if(op == 3){
Settings();
}else if(op == 4){
clean();
if(lu == 1){
cout << "再见";
}else if(lu == 2){
cout << "再見";
}else{
cout << "Goodbye";
}
break;
}
}
}
signed main(){
Main_Interface();
return 0;
}
欢迎你们报告BUG
全部评论 2
- 置顶
正在火速更新1.0.0
昨天 来自 广东
00.0.9是571行代码
昨天 来自 广东
0
1111111111111111111111111|1840|95#
我的存档码昨天 来自 广东
0





















有帮助,赞一个