Posted by Anonymous on Wed 11th Jul 11:00
download | new post
- using System;
- using System.Collections.Generic;
- using System.Text;
- using System.Collections;
- namespace JokersWorld
- {
- class Cards
- {
- private int m_CardsInHand = 0;
- public void ShuffleWithHold()
- {
- for ( int i = 1; i < 6; i ++)
- {
- if ((bool)m_CardsToHold[i] == true)
- m_CardsInHand += 1;
- else
- {
- m_Cards[m_CurrentCards[i-1]] = false;
- m_CurrentCards.Remove(m_CurrentCards[i-1]);
- }
- }
- }
- public int PopForHold()
- {
- if (m_CardsInHand != 5)
- {
- int card = rnd.Next(52);
- while (Convert.ToBoolean(m_Cards[card]) == true)
- {
- card = rnd.Next(52);
- }
- m_Cards[card] = true;
- m_CurrentCards.Add(card);
- m_CardsInHand += 1;
- m_CardsToHold[m_CardsInHand] = false;
- return card;
- }
- return 0;
- }
- public void Shuffle()
- {
- for (int i = 0; i < 53; i++)
- {
- m_Cards[i] = false;
- }
- m_CardsInHand = 0;
- }
- public void Trigger(int pos)
- {
- m_CardsToHold[pos] = !(bool)m_CardsToHold[pos];
- }
- public int Pop()
- {
- if (m_CardsInHand != 5)
- {
- int card = rnd.Next(52);
- while ( Convert.ToBoolean(m_Cards[card]) == true )
- {
- card = rnd.Next(52);
- }
- m_Cards[card] = true;
- m_CurrentCards.Add(card);
- m_CardsInHand += 1;
- m_CardsToHold[m_CardsInHand] = false;
- return card;
- }
- return 0;
- }
- public string GetName(int Card)
- {
- string CardName = "";
- if (Card < 13) CardName = "Hjärter ";
- else if (Card < 26 && Card > 12) CardName = "Ruter ";
- else if (Card < 39 && Card > 25) CardName = "Klöver ";
- else if (Card < 52 && Card > 38) CardName = "Spader ";
- else if (Card == 52) CardName = "Joker";
- if (Card != 52)
- {
- bool Small = true;
- switch (Card)
- {
- case 0:
- case 13:
- case 26:
- case 39:
- CardName += "Ess";
- Small = false;
- break;
- case 10 :
- case 23 :
- case 36 :
- case 49 :
- CardName += "Knekt";
- Small = false;
- break;
- case 11:
- case 24:
- case 37:
- case 50:
- CardName += "Dam";
- Small = false;
- break;
- case 12:
- case 25:
- case 38:
- case 51:
- CardName += "Kung";
- Small = false;
- break;
- }
- if (Small)
- {
- switch (Card)
- {
- case 1:
- case 14:
- case 27:
- case 40:
- CardName += "2";
- break;
- case 2:
- case 15:
- case 28:
- case 41:
- CardName += "3";
- break;
- case 3:
- case 16:
- case 29:
- case 42:
- CardName += "4";
- break;
- case 4:
- case 17:
- case 30:
- case 43:
- CardName += "5";
- break;
- case 5:
- case 18:
- case 31:
- case 44:
- CardName += "6";
- break;
- case 6:
- case 19:
- case 32:
- case 45:
- CardName += "7";
- break;
- case 7:
- case 20:
- case 33:
- case 46:
- CardName += "8";
- break;
- case 8:
- case 21:
- case 34:
- case 47:
- CardName += "9";
- break;
- case 9:
- case 22:
- case 35:
- case 48:
- CardName += "10";
- break;
- }
- }
- }
- return CardName;
- }
- }
- }
Submit a correction or amendment below. (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.