資源簡(jiǎn)介
常玩的過(guò)河益智小游戲,通過(guò)控制臺(tái)接收用戶(hù)輸入實(shí)現(xiàn),邏輯不是很復(fù)雜,希望大家來(lái)搞
代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.Linq;
using?System.Text;
using?System.Threading.Tasks;
namespace?過(guò)河
{
????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(“游戲失敗是否重來(lái),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(“游戲失敗是否重來(lái),Y:是,N:否“);
????????????????????????????????????input?=?Console.ReadLine();
????????????????????????????????????break;
????????????????????????????????}
????????????????????????????}
????????????????????????}
????????????????????}?while?(input?==“Y“);
????????????????????left_people.AddRa
評(píng)論
共有 條評(píng)論