CardFramework.avalonia 1.5.8

There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package CardFramework.avalonia --version 1.5.8
                    
NuGet\Install-Package CardFramework.avalonia -Version 1.5.8
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CardFramework.avalonia" Version="1.5.8" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CardFramework.avalonia" Version="1.5.8" />
                    
Directory.Packages.props
<PackageReference Include="CardFramework.avalonia" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CardFramework.avalonia --version 1.5.8
                    
#r "nuget: CardFramework.avalonia, 1.5.8"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CardFramework.avalonia@1.5.8
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CardFramework.avalonia&version=1.5.8
                    
Install as a Cake Addin
#tool nuget:?package=CardFramework.avalonia&version=1.5.8
                    
Install as a Cake Tool

Framework di numerone in avalonia per la realizzazione di giochi di carte equi. La codebase è in .net, con l'aggiunta di un resourcedictionary da passare. Il resource dictionary deve includere 4 campi: bastoni, coppe, spade e denari da tradurre dall'italiano nella lingua desiderata, i 4 semi dei mazzi francesi, ovviamente tradottti. Il codice di apertura deve essere:

o = LeggiOpzioni();
briscolaDaPunti = o.briscolaDaPunti;

e = new ElaboratoreCarteBriscola(briscolaDaPunti, 0, 39, 40);
m = new Mazzo(e);

m.SetNome(o.nomeMazzo);
Carta.Inizializza(path dei mazzi, m, numerocarte, new org.altervista.numerone.framework.briscola.CartaHelper(e.GetCartaBriscola), "bastoni", "coppe", "denari", "spade", "fiori", "quadri", "cuori", "picche");

if (o.nomeMazzo == "Napoletano")
{
  asset = AssetLoader.Open(new Uri($"avares://{Assembly.GetEntryAssembly().GetName().Name}/Assets/retro_carte_pc.png"));
  cartaCpu.Source = new Bitmap(asset);
}
else
  try
      {
          cartaCpu.Source = new Bitmap(System.IO.Path.Combine(System.IO.Path.Combine(System.IO.Path.Combine(App.path, "Mazzi"), m.GetNome()), "retro carte pc.png"));
      }
      catch (Exception ex)
      {
         asset = AssetLoader.Open(new Uri($"avares://{Assembly.GetEntryAssembly().GetName().Name}/Assets/retro_carte_pc.png"));
         cartaCpu.Source = new Bitmap(asset);
      }
g = new Giocatore(new GiocatoreHelperUtente(), o.NomeUtente, dimensionemano);
switch (o.livello) {
      case 1: helper = new GiocatoreHelperCpu0(ElaboratoreCarteBriscola.GetCartaBriscola()); break;
      case 2: helper = new GiocatoreHelperCpu1(ElaboratoreCarteBriscola.GetCartaBriscola()); break;
      default: helper = new GiocatoreHelperCpu2(ElaboratoreCarteBriscola.GetCartaBriscola()); break;
}
cpu = new Giocatore(helper, o.NomeCpu, dimensionemano);
briscola = Carta.GetCarta(ElaboratoreCarteBriscola.GetCartaBriscola());
for (UInt16 i = 0; i < dimensionemano; i++)
{
  g.AddCarta(m);
  cpu.AddCarta(m);
}
Utente0.Source = g.GetImmagine(0);
Utente1.Source = g.GetImmagine(1);
Utente2.Source = g.GetImmagine(2);
....
Cpu0.Source = cartaCpu.Source;
Cpu1.Source = cartaCpu.Source;
Cpu2.Source = cartaCpu.Source;
....

una volta fatto questo, in carta si avrà un vettore di numerocarte elementi, in g e cpu si avrà un vettore di dimensionemano elementi corrispondenti alle prime 2*dimensionemano carte del mazzo, che saranno riempite con addcarta. Quando addcarta restituisce un IndexOutOfRangeException exception si avrà la fine del mazzo. Utente0-dimensionemano sono le Image XAML corrispondenti alle carte del giocatore, mentre Cpu0-dimensionemano sono le Image corrispondenti alle carte della cpu. Oggi il poker si fissa sul seme "primo di mano".

Se avete un gioco di carte sul piatto, il modo di agire dei giocatori professionisti è quello di crearsi mentalmente il grafo di presa. Mi spiego: per la scopa in mano ho un 8, è prendibile tramite 7+1 e 6+2, entrambi vanno bene. Vanno messi in un grafo e va così scomposto l'8, per poi prendere sulla base del piatto quello che consuma il maggior numero di carte del piatto stesso. Quindi se ho 8 e 10 e posso prendere più carte che con l'8 invece che col 10, va giocato l'8.

Come ottenere

https://www.nuget.org/packages/CardFramework.avalonia

Donazioni

https://numerone.altervista.org/donazioni.php

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.6.0-preview3 96 4/21/2026
1.5.8 46 6/6/2026
1.5.7 139 4/25/2026
1.5.6 109 4/15/2026
1.5.5.2 117 5/11/2026
1.5.5.1 102 5/11/2026 1.5.5.1 is deprecated.
1.5.5 119 3/29/2026
1.5.4 132 2/13/2026
1.5.3 197 1/14/2026
1.5.2 278 12/19/2025
1.5.1 188 11/15/2025
1.5.0 240 11/15/2025 1.5.0 is deprecated because it has critical bugs.
1.4.19 290 9/19/2025
1.4.18 219 9/10/2025
1.4.17 305 9/10/2025 1.4.17 is deprecated.
1.4.16 230 7/10/2025
1.4.15 398 6/10/2025
1.4.14 253 6/5/2025
1.4.13 289 4/8/2025
1.4.12 276 4/8/2025
Loading failed

Recompiled with dotnet 10.0.8 and avalonia 12.0.4