public virtual void selectCard(Sevens field) { if (isGameOut) { return; } if (!field.checkPlayNext(this, passes)) { field.gameOver(this); field.view(); Console.WriteLine($"{name} GameOver...\n"); return; } Console.WriteLine($"【{name}】Cards: {deck.Count} Pass: {passes}"); var items = new List <string>(deck.Select(v => v.name)); if (0 < passes) { items.Add("PS:" + passes); } for (;;) { var cursor = SelectCursors.SelectCursor(items); if (0 < passes && items.Count - 1 == cursor) { passes--; field.view(); Console.WriteLine($"残りパスは{passes}回です。\n"); break; } else if (field.tryUseCard(this, deck[cursor])) { field.view(); Console.WriteLine($"俺の切り札!! >「{items[cursor]}」\n"); if (deck.Count == 0) { Console.WriteLine($"{name} Congratulations!!\n"); field.gameClear(this); } break; } else { Console.WriteLine("そのカードは出せないのじゃ…\n"); continue; } } }
public override void selectCard(Sevens field) { if (isGameOut) { return; } if (!field.checkPlayNext(this, passes)) { field.gameOver(this); field.view(); Console.WriteLine($"{name}> もうだめ...\n"); return; } Console.WriteLine($"【{name}】Cards: {deck.Count} Pass: {passes}"); var items = new List <string>(deck.Select(v => v.name)); if (0 < passes) { items.Add("PS:" + passes); } Console.Write("考え中...\r"); System.Threading.Thread.Sleep(1000); var passCharge = 0; for (;;) { var cursor = TrumpDeck.rand.Next(items.Count); if (0 < passes && items.Count - 1 == cursor) { if (passCharge < 3) { passCharge++; continue; } passes--; Console.WriteLine($"パスー (残り{passes}回)\n"); break; } else if (field.tryUseCard(this, deck[cursor])) { Console.WriteLine($"これでも食らいなっ >「{items[cursor]}」\n"); if (deck.Count == 0) { Console.WriteLine($"{name}> おっさき~\n"); field.gameClear(this); } break; } else { continue; } } }
static void Main() { for (var i = 0; i < 100; i++) { Console.WriteLine(); } Console.WriteLine(@" /---------------------------------------/ / 七並べ / /---------------------------------------/ "); var trp = new TrumpDeck(); trp.shuffle(); var p = new List <SevensPlayer>(); var pid = 0; if (!AUTO_MODE) { Console.Write("NAME[Player]: "); var playerName = Console.ReadLine(); if (playerName == "") { playerName = "Player"; } p.Add(new SevensPlayer(pid, playerName, PASSES_NUMBER)); pid++; } for (var i = 0; i < PLAYER_NUMBER - (AUTO_MODE?0:1); i++) { p.Add(new SevensAIPlayer(pid, $"CPU {i+1}", PASSES_NUMBER)); pid++; } for (var i = 0; i < trp.count; i++) { p[i % PLAYER_NUMBER].addCard(trp.draw()); } foreach (var v in p) { v.sortDeck(); } var field = new Sevens(p.Select(v => (Player)v).ToList()); for (;;) { field.view(); foreach (var v in p) { v.selectCard(field); if (field.checkGameEnd()) { goto selectLoop; } } } selectLoop: field.view(); field.result(); Console.ReadLine(); }