资源简介
常玩的过河益智小游戏,通过控制台接收用户输入实现,逻辑不是很复杂,希望大家来搞
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace 过河
{
class Program
{
static List left_people = new List();
static List right_people = new List();
static List boat_people = new List();
static List all_people = new List();
static string[] boatOk = new string[] { “警察“ “爸爸“ “妈妈“ };
static void Main(string[] args)
{
bool isLeft = true;
bool isRepit = true;
string input = ““;
InitPeople();
while (true)
{
do
{
if (isRepit)
{
Show();
while (true)
{
OnBoat(isLeft);
if (Check() == false)
{
OutBoat();
}
else
{
break;
}
}
if (isLeft)
{
Reduce(left_people);
Add(right_people);
if (CheckSuccess(left_people) && CheckSuccess(right_people))
{
OutBoat();
isLeft = false;
}
else
{
Console.WriteLine(“游戏失败是否重来,Y:是,N:否“);
input = Console.ReadLine();
break;
}
}
else
{
Reduce(right_people);
Add(left_people);
if (CheckSuccess(left_people) && CheckSuccess(right_people))
{
OutBoat();
isLeft = true;
}
else
{
Console.WriteLine(“游戏失败是否重来,Y:是,N:否“);
input = Console.ReadLine();
break;
}
}
}
} while (input ==“Y“);
left_people.AddRa
评论
共有 条评论