1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
| #include "deck.h"
#include "poker.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef GList Deck;
typedef enum { HEART, SPADE, DIAMOND, CLUB } ESuit;
typedef enum { SUIT, RANK, RANK_ACE_LOW } ESortOrder;
typedef struct
{
ESuit suit;
gint rank;
int coul;
} Card;
typedef struct
{
Deck *table;
Deck *princ;
Deck **hands;
int nhands;
} Pouet;
Pouet deal_main (Pouet partie)
{
gint rank, suit;
int i,j,k;
Card *c;
partie->princ = deck_new();
k=0;
for (i=0; i<partie->nhands; i++)
{
printf ("main %d\n", i);
for (j=0; j<2; j++)
{
partie->hands[i] = deck_new();
c = deck_get_nth (partie.princ, k);
(*partie)->hands[i] = deck_add_card(partie.hands[i], c);
deck_print(partie.hands[i]);
k++;
}
}
return partie;
}
Deck *deal_flop (Deck *table, Deck *princ)
{
gint rank, suit;
int i,j,k;
Card *c;
for (i=0; i<2; i++)
{
princ=deck_pop_card(princ, &c);
table = deck_add_card(table, c);
}
return table;
}
Deck *deal_turn (Deck *table, Deck *princ)
{
gint rank, suit;
int i,j,k;
Card *c;
princ = deck_pop_card(princ, &c);
table = deck_add_card(table, c);
return table;
}
Deck *deal_river (Deck *table, Deck *princ)
{
gint rank, suit;
int i,j,k;
Card *c;
princ = deck_pop_card(princ, &c);
table = deck_add_card(table, c);
return table;
}
struct Pouet *round (struct Pouet *partie)
{
int i;
Card *c;
partie->princ = deck_new();
partie->princ = deck_fill(partie->princ);
partie->princ = deck_shuffle(partie->princ);
partie.table = deck_new();
for (i=0; i<partie.nhands; i++)
{
hands[nhands] = deck_new();
deal_main(partie);
printf ("main %d\n",i);
deck_print(hands[nhands]);
}
for (i=0; i<(nhands*2); i++) princ = deck_pop_card(princ, &c);
deal_flop(table, princ);
for (i=0; i<3; i++) princ = deck_pop_card(princ, &c);
deal_turn(table, princ);
princ = deck_pop_card(princ, &c);
deal_river(table, princ);
princ = deck_pop_card(princ, &c);
}
int stat(struct Deal *partie)
{
int prof=1000;
int tablo_gagn[nhands][prof];
for (prof=0; prof<1000; prof++)
{
if (deck_count(table)==0)
{
deal_flop();
deal_turn();
deal_river();
hand_compare();
tablo_gagn[][]=1;
}
}
}
int main (int argc, char *argv[])
{
Pouet *partie;
gint rank, suit;
int i,j,k;
partie->nhands = 9;
partie->princ = deck_new();
partie->princ = deck_fill(partie->princ);
partie->princ = deck_shuffle(partie->princ);
/*
* The following code was added by Glade to create one of each component
* (except popup menus), just so that you see something after building
* the project. Delete any components that you don't want shown initially.
*/
/*deroul(8);*/
deal_main(&partie);
for (i=0;i<partie.nhands;i++) deck_print(partie->hands[i]);
return 0;
} |
Partager