private void button1_Click(object sender, EventArgs e) { listBox1.Items.Clear(); THand[] Hands = new THand[4]; for (int i = 0; i < Hands.Length; i++) Hands[i] = new THand(listBox1); TDeck myDeck = new TDeck(); myDeck.shuffle(); myDeck.Deal(Hands); for (int i = 0; i < Hands.Length; i++) { Hands[i].SortHand(); Hands[i].DispayHand(); } }
// creates the deck and deals out the 4 hands from the deck. private void button1_Click(object sender, EventArgs e) { TDeck myDeck = new TDeck(); // create and initialise a new TDeck THand[] myHand = new THand[HANDS]; // create and initialse a THand array listBox1.Items.Clear(); // clear the listBox myDeck.Shuffle(); // shuffle the deckArray // create the 4 handArrays, sort the handArrays and display them for (int i = 0; i < HANDS; i++) { myHand[i] = myDeck.dealHand(i); myHand[i].sortHand(); myHand[i].printHand(listBox1); } }
// creates the deck and deals out the 4 hands from the deck. private void button1_Click(object sender, EventArgs e) { TDeck myDeck = new TDeck(); // create and initialise a new TDeck THand[] myHand = new THand[HANDS]; // create and initialse a THand array listBox1.Items.Clear(); // clear the listBox myDeck.Shuffle(); // shuffle the deckArray // create the 4 handArrays, sort the handArrays and display them for (int i = 0; i < HANDS; i++) { myHand[i] = myDeck.dealHand(i); myHand[i].sortHand(); myHand[i].printHand(listBox1); } }
private void button1_Click(object sender, EventArgs e) { listBox1.Items.Clear(); THand[] Hands = new THand[4]; String[] names = { "North:", "South:", "East:", "West:" }; for (int i = 0; i < Hands.Length; i++) Hands[i] = new THand(listBox1); TDeck myDeck = new TDeck(); myDeck.shuffle(); myDeck.Deal(Hands); for (int i = 0; i < Hands.Length; i++) { Hands[i].SortHand(); //parses in name to display hand Hands[i].DispayHand(names[i]); } }
private void button1_Click(object sender, EventArgs e) { listBox1.Items.Clear(); THand[] Hands = new THand[4]; for (int i = 0; i < Hands.Length; i++) { Hands[i] = new THand(listBox1); } TDeck myDeck = new TDeck(); myDeck.shuffle(); myDeck.Deal(Hands); for (int i = 0; i < Hands.Length; i++) { Hands[i].SortHand(); Hands[i].DispayHand(); } }
private void button1_Click(object sender, EventArgs e) { listBox1.Items.Clear(); THand[] Hands = new THand[4]; String[] names = { "North:", "South:", "East:", "West:" }; for (int i = 0; i < Hands.Length; i++) { Hands[i] = new THand(listBox1); } TDeck myDeck = new TDeck(); myDeck.shuffle(); myDeck.Deal(Hands); for (int i = 0; i < Hands.Length; i++) { Hands[i].SortHand(); //parses in name to display hand Hands[i].DispayHand(names[i]); } }
/* * pre - takes in an integer * post - returns a THand */ // create a handArray from the TCards in the deckArray public THand dealHand(int mySeat) { seat s = seat.NORTH; // default needed for some reason THand hand; // THand handler?? TCard[] handArray = new TCard[HANDSIZE]; // determine the seat/position. North, South ,East or West switch (mySeat) { case 0: s = seat.NORTH; break; case 1: s = seat.EAST; break; case 2: s = seat.SOUTH; break; case 3: //AJD Changed to WEST from South s = seat.WEST; break; } //int blah = (int)seat.North; // just playing // create a new THand for (int i = 0; i < HANDSIZE; i++) { handArray[i] = deckArray[i + (mySeat * HANDSIZE)]; } hand = new THand(handArray, s); return hand; }
/* * pre - takes in an integer * post - returns a THand */ // create a handArray from the TCards in the deckArray public THand dealHand(int mySeat) { seat s = seat.NORTH; // default needed for some reason THand hand; // THand handler?? TCard[] handArray = new TCard[HANDSIZE]; // determine the seat/position. North, South ,East or West switch (mySeat) { case 0: s = seat.NORTH; break; case 1: s = seat.EAST; break; case 2: s = seat.SOUTH; break; case 3: s = seat.SOUTH; break; } //int blah = (int)seat.North; // just playing // create a new THand for (int i = 0; i < HANDSIZE; i++) { handArray[i] = deckArray[i + (mySeat * HANDSIZE)]; } hand = new THand(handArray, s); return(hand); } // end dealhand method
public void Deal(THand[] Hands) { int HandNum = 0; int CardNum = 0; TCard[] TempHand = new TCard[CARDSPERSUIT]; for (int i = 0; i < Cards.Length; i++) { Hands[HandNum].cards[CardNum] = Cards[i]; CardNum++; if ((i + 1) % CARDSPERSUIT == 0) { CardNum = 0; HandNum++; } } }