Skip to content

Commit

Permalink
Updaetd packages
Browse files Browse the repository at this point in the history
  • Loading branch information
EluciusFTW committed Dec 17, 2023
1 parent 7743c1b commit a971b13
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 50 deletions.
2 changes: 1 addition & 1 deletion src/CardGames.Core.French/CardGames.Core.French.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="EluciusFTW.CardGames.Core" Version="2.0.0" />
<PackageReference Include="EluciusFTW.CardGames.Core" Version="2.0.4" />
<PackageReference Include="Nerdbank.GitVersioning" Version="3.6.133">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.13.1" />
<PackageReference Include="BenchmarkDotNet" Version="0.13.11" />
</ItemGroup>

<ItemGroup>
Expand Down
51 changes: 22 additions & 29 deletions src/CardGames.Poker.CLI/Program.cs
Original file line number Diff line number Diff line change
@@ -1,36 +1,29 @@
using CardGames.Poker.CLI.Simulation;
using Spectre.Console.Cli;

namespace CardGames.Poker.CLI;

internal static class Program
var app = new CommandApp();
app.Configure(configuration =>
{
private static void Main(string[] args)
configuration.SetApplicationName("poker-cli");
configuration.AddBranch<SimulationSettings>("sim", sim =>
{
var app = new CommandApp();
app.Configure(configuration =>
{
configuration.SetApplicationName("poker-cli");
configuration.AddBranch<SimulationSettings>("sim", sim =>
{
sim
.AddCommand<StudSimulationCommand>("stud-hi")
.WithAlias("7cs-hi")
.WithAlias("stud")
.WithDescription("Runs a 7-card Stud hi simulation.");
sim
.AddCommand<StudSimulationCommand>("stud-hi")
.WithAlias("7cs-hi")
.WithAlias("stud")
.WithDescription("Runs a 7-card Stud hi simulation.");

sim
.AddCommand<HoldemSimulationCommand>("holdem")
.WithAlias("nlh")
.WithAlias("lhe")
.WithDescription("Runs a Holdem simulation.");

sim
.AddCommand<HoldemSimulationCommand>("holdem")
.WithAlias("nlh")
.WithAlias("lhe")
.WithDescription("Runs a Holdem simulation.");
sim
.AddCommand<OmahaSimulationCommand>("omaha")
.WithAlias("plo")
.WithDescription("Runs an Omaha simulation.");
});
});

sim
.AddCommand<OmahaSimulationCommand>("omaha")
.WithAlias("plo")
.WithDescription("Runs an Omaha simulation.");
});
});
app.Run(args);
}
}
app.Run(args);
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ namespace CardGames.Poker.Simulations.Holdem;
public class CommunityCardGamePlayer
{
public string Name { get; init; }

public IReadOnlyCollection<Card> GivenHoleCards { get; init; }

public IReadOnlyCollection<Card> DealtHoleCards { get; set; }

public IEnumerable<Card> Cards => GivenHoleCards.Concat(DealtHoleCards);
}
6 changes: 3 additions & 3 deletions src/CardGames.Poker/Simulations/Holdem/HoldemSimulation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace CardGames.Poker.Simulations.Holdem;
public class HoldemSimulation
{
private FrenchDeckDealer _dealer;
private IList<HoldemPlayer> _players = new List<HoldemPlayer>();
private readonly List<HoldemPlayer> _players = new();
private IReadOnlyCollection<Card> _flop = new List<Card>();
private Card _turn;
private Card _river;
Expand Down Expand Up @@ -68,14 +68,14 @@ private HoldemSimulationResult Play(int nrOfHands)
return new HoldemSimulationResult(nrOfHands, results.ToList());
}

private IDictionary<string, HoldemHand> PlayHand()
private Dictionary<string, HoldemHand> PlayHand()
{
_dealer.Shuffle();
RemoveKnownCardsFromDeck();
DealMissingHoleCards();
var communityCards = DealCommunityCards();

return _players.ToDictionary(player => player.Name, p => new HoldemHand(p.Cards.ToList(), communityCards));
return _players.ToDictionary(player => player.Name, player => new HoldemHand(player.Cards.ToList(), communityCards));
}

private IReadOnlyCollection<Card> DealCommunityCards()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="NSubstitute" Version="4.2.2" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="NSubstitute" Version="5.1.0" />
<PackageReference Include="xunit" Version="2.6.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
10 changes: 5 additions & 5 deletions src/Tests/CardGames.Core.Tests/CardGames.Core.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="NSubstitute" Version="4.2.2" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="NSubstitute" Version="5.1.0" />
<PackageReference Include="xunit" Version="2.6.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
10 changes: 5 additions & 5 deletions src/Tests/CardGames.Poker.Tests/CardGames.Poker.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="NSubstitute" Version="4.2.2" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="NSubstitute" Version="5.1.0" />
<PackageReference Include="xunit" Version="2.6.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
3 changes: 3 additions & 0 deletions src/Tests/CardGames.Poker.Tests/Hands/HoldemHandTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ public class HoldemHandTests
{
[Theory]
[InlineData("2s 5d", "8d Js Kc 5c 5h", HandType.Trips)]
[InlineData("2s 6d", "5d Js Kc 5c 5h", HandType.Trips)]
[InlineData("2s 2d", "8d Js Kc 5c 5h", HandType.TwoPair)]
[InlineData("Qs 2d", "8d Js Qc 5c 5h", HandType.TwoPair)]
[InlineData("Qs 5d", "8d Js Qc 2c 5h", HandType.TwoPair)]
[InlineData("2s 2d", "5d Js Kc 5c 5h", HandType.FullHouse)]
[InlineData("2s 2h", "5d Jh Kh 6h 5h", HandType.Flush)]
[InlineData("2s 2c", "7h Jh Kh 6h 5h", HandType.Flush)]
Expand Down

0 comments on commit a971b13

Please sign in to comment.