2008-12-23 17:24:31 +00:00
|
|
|
/***************************************************************************
|
|
|
|
|
* Copyright (C) 2008 by Lothar May *
|
|
|
|
|
* *
|
|
|
|
|
* This file is part of pokerth_console. *
|
|
|
|
|
* pokerth_console is free software: you can redistribute it and/or *
|
|
|
|
|
* modify it under the terms of the GNU Affero General Public License *
|
|
|
|
|
* as published by the Free Software Foundation, either version 3 of *
|
|
|
|
|
* the License, or (at your option) any later version. *
|
|
|
|
|
* *
|
|
|
|
|
* pokerth_console is distributed in the hope that it will be useful, *
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
|
* GNU General Public License for more details. *
|
|
|
|
|
* *
|
|
|
|
|
* You should have received a copy of the *
|
|
|
|
|
* GNU Affero General Public License along with pokerth_console. *
|
|
|
|
|
* If not, see <http://www.gnu.org/licenses/>. *
|
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
|
|
using System;
|
2008-12-23 14:24:37 +00:00
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
2008-12-23 17:24:31 +00:00
|
|
|
using pokerth_lib;
|
2008-12-23 14:24:37 +00:00
|
|
|
|
|
|
|
|
namespace pokerth_console
|
|
|
|
|
{
|
2008-12-23 17:24:31 +00:00
|
|
|
class ConsoleCallback : pokerth_lib.ICallback
|
2008-12-23 14:24:37 +00:00
|
|
|
{
|
|
|
|
|
public void InitDone()
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("Init successful.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void JoinedGame(string name)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("Successfully joined game \"{0}\".", name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void GameStarted(List<string> players)
|
|
|
|
|
{
|
|
|
|
|
string outPlayers = "";
|
|
|
|
|
foreach (string s in players)
|
|
|
|
|
{
|
|
|
|
|
if (outPlayers.Length != 0)
|
|
|
|
|
outPlayers += ", ";
|
|
|
|
|
outPlayers += s;
|
|
|
|
|
}
|
2008-12-23 23:29:18 +00:00
|
|
|
Console.WriteLine("Game was started. Players: {0}.", outPlayers);
|
2008-12-23 14:24:37 +00:00
|
|
|
}
|
|
|
|
|
|
2008-12-24 23:22:23 +00:00
|
|
|
public void HandStarted(int[] cards)
|
2008-12-23 14:24:37 +00:00
|
|
|
{
|
2008-12-24 23:22:23 +00:00
|
|
|
Console.WriteLine("\nNew hand. Your cards: {0}, {1}.",
|
|
|
|
|
Log.CardToString(cards[0]),
|
|
|
|
|
Log.CardToString(cards[1]));
|
2008-12-23 14:24:37 +00:00
|
|
|
}
|
|
|
|
|
|
2008-12-24 23:22:23 +00:00
|
|
|
public void SmallBlind(string name, uint blind)
|
2008-12-23 22:30:02 +00:00
|
|
|
{
|
2008-12-24 23:22:23 +00:00
|
|
|
Console.WriteLine("{0} posts small blind (${1}).", name, blind);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void BigBlind(string name, uint blind)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("{0} posts big blind (${1}).", name, blind);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void MyTurn(Hand.State state, uint highestSet, uint minimumRaise, uint money)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("\n--> {0}: Your turn. Highest set: ${1}. Minimum raise: ${2}. Cash: ${3}.",
|
|
|
|
|
Log.StateToString(state), highestSet, minimumRaise, money);
|
2008-12-23 22:30:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void PlayersTurn(Hand.State state, string player)
|
|
|
|
|
{
|
2008-12-24 23:22:23 +00:00
|
|
|
Console.WriteLine("\n{0}: {1}'s turn.",
|
2008-12-23 22:30:02 +00:00
|
|
|
Log.StateToString(state),
|
|
|
|
|
player);
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-24 23:22:23 +00:00
|
|
|
public void ActionDone(string name, Hand.Action action, uint curBet)
|
2008-12-23 22:30:02 +00:00
|
|
|
{
|
2008-12-24 23:22:23 +00:00
|
|
|
Console.WriteLine("{0} {1}.", name, Log.ActionToString(action, curBet));
|
2008-12-23 22:30:02 +00:00
|
|
|
}
|
|
|
|
|
|
2008-12-24 23:22:23 +00:00
|
|
|
public void ShowFlopCards(int[] cards)
|
2008-12-23 23:29:18 +00:00
|
|
|
{
|
2008-12-24 23:22:23 +00:00
|
|
|
Console.WriteLine("\n--- Flop --- [{0}, {1}, {2}]",
|
|
|
|
|
Log.CardToString(cards[0]),
|
|
|
|
|
Log.CardToString(cards[1]),
|
|
|
|
|
Log.CardToString(cards[2]));
|
2008-12-23 23:29:18 +00:00
|
|
|
}
|
|
|
|
|
|
2008-12-24 23:22:23 +00:00
|
|
|
public void ShowTurnCards(int[] cards)
|
2008-12-23 23:29:18 +00:00
|
|
|
{
|
2008-12-24 23:22:23 +00:00
|
|
|
Console.WriteLine("\n--- Turn --- [{0}, {1}, {2}, {3}]",
|
|
|
|
|
Log.CardToString(cards[0]),
|
|
|
|
|
Log.CardToString(cards[1]),
|
|
|
|
|
Log.CardToString(cards[2]),
|
|
|
|
|
Log.CardToString(cards[3]));
|
2008-12-23 23:29:18 +00:00
|
|
|
}
|
|
|
|
|
|
2008-12-24 23:22:23 +00:00
|
|
|
public void ShowRiverCards(int[] cards)
|
2008-12-23 23:29:18 +00:00
|
|
|
{
|
2008-12-24 23:22:23 +00:00
|
|
|
Console.WriteLine("\n--- River --- [{0}, {1}, {2}, {3}, {4}]",
|
|
|
|
|
Log.CardToString(cards[0]),
|
|
|
|
|
Log.CardToString(cards[1]),
|
|
|
|
|
Log.CardToString(cards[2]),
|
|
|
|
|
Log.CardToString(cards[3]),
|
|
|
|
|
Log.CardToString(cards[4]));
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-25 16:46:38 +00:00
|
|
|
public void EndOfHandShowCards(string name, int[] cards, int cardsValue, bool allIn)
|
2008-12-24 23:22:23 +00:00
|
|
|
{
|
2008-12-25 16:46:38 +00:00
|
|
|
Console.WriteLine("{0} {1} [{2}, {3}] - {4}",
|
|
|
|
|
name,
|
|
|
|
|
allIn ? "has" : "shows",
|
|
|
|
|
Log.CardToString(cards[0]),
|
|
|
|
|
Log.CardToString(cards[1]),
|
|
|
|
|
Log.CardsValueToString(cardsValue));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void PlayerWins(string name, uint moneyWon)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("{0} wins ${1}.", name, moneyWon);
|
2008-12-23 23:29:18 +00:00
|
|
|
}
|
|
|
|
|
|
2008-12-23 14:24:37 +00:00
|
|
|
public void Error(string message)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("Error: " + message);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|