Hi, I need help writing a program in C# to record winning hands and have it to deal out chips to player profiles after the final round. I also need help with creating a function to list the types of winning hands and how often they occurred. I’ve been stuck on these for a while now and this is my only option. Any help is grateful. Thank you!
this is my code
GAME.CS////////////////
using System;
using System.Collections.Generic;
namespace Poker_Tournament_App
{
class Game
{
int Id{get; set;}
string WinningHand{get; set;}
bool FinalRoundGame{get; set;}
List<Player> players = new List<Player>();
public Game()
{
Id = 404;
WinningHand = "";
FinalRoundGame = false;
}
//Initialize without players
public Game(int inId, string inWinningHand, bool inFinalRoundGame)
{
Id = inId;
WinningHand = inWinningHand;
FinalRoundGame = inFinalRoundGame;
}
//Initialize with player(s)
public Game(int inId, string inWinningHand, bool inFinalRoundGame, List<Player> inPlayers)
{
Id = inId;
WinningHand = inWinningHand;
FinalRoundGame = inFinalRoundGame;
addPlayers(inPlayers);
}
public void addPlayers(List<Player> inPlayers)
{
players.AddRange(inPlayers);
}
}
}
END///////////
PLAYER.CS///////////////
using System;
using System.Collections.Generic;
namespace Poker_Tournament_App
{
class Player
{
public string name {get; set;}
public DateTime dateJoined {get; set;} //new DateTime(year, month, day)
public DateTime birthday {get; set;} //new DateTime(year, month, day)
public string hometown {get; set;}
public int rankChips {get; set;} //new DateTime(year, month, day)
Dictionary<string, int> winningHandCount = new Dictionary<string, int>();
public Player()
{
name = "";
dateJoined = new DateTime(1900, 01, 01);
birthday = new DateTime(1900, 01, 01);
hometown = "";
rankChips = 0;
}
public Player(string inName, DateTime inDateJoined, DateTime inBirthday, string inHometown, int inRankChips)
{
name = inName;
dateJoined = inDateJoined;
birthday = inBirthday;
hometown = inHometown;
rankChips = inRankChips;
}
public void updateWinningHandCount(string inHandType)
{
if(winningHandCount.ContainsKey(inHandType))
{
winningHandCount[inHandType] = winningHandCount[inHandType] + 1;
}
else
{
winningHandCount.Add(inHandType, 1);
}
}
}
}
END///////////////////////
PROGRAM.CS/////////////
using System;
namespace Poker_Tournament_App
{
class Program
{
public static void Main (string args) {
string selection;
Console.WriteLine("Select an option:\n ");
Console.WriteLine("1: Tournaments");
Console.WriteLine("2: Players");
Console.WriteLine("3: Overall Stats");
Console.WriteLine("4: Save & Quit");
selection = Console.ReadLine();
if (selection == "1")
{
Console.WriteLine("Tournaments.");
}
else if(selection == "2")
{
Console.WriteLine("Players.");
}
else if(selection == "3")
{
Console.WriteLine("Overall Stats.");
}
else if(selection == "4")
{
Console.WriteLine("Byeeeeeeeeeeeeeee");
}
}
}
}
END/////////////////
TOURNAMENT.CS/////////////
using System;
namespace Poker_Tournament_App
{
class Tournament
{
public string Name{get; set;}
public string Location{get; set;}
public int MaxPlayers{get; set;}
DateTime _tournamentDate;
public DateTime TournamentDate
{
get
{
return this._tournamentDate;
}
set
{
this._tournamentDate = value.Date;
}
}
public Tournament()
{
Name = "";
TournamentDate = new DateTime(1900, 01, 01);
Location = "";
MaxPlayers = 0;
}
public Tournament(string inName, DateTime inDate, string inLocation, int inMaxPlayers)
{
Name = inName;
TournamentDate = inDate;
Location = inLocation;
MaxPlayers = inMaxPlayers;
}
public override string ToString()
{
string printString = "";
printString += "\nName:\t\t" + Name;
printString += "\nDate:\t\t" + TournamentDate.ToString("d");
printString += "\nLocation:\t" + Location;
printString += "\nMax Players:" + MaxPlayers;
return printString;
}
}
}
END///////////////////