コード例 #1
0
        /// <summary>Main Program</summary>
        public static void Main(string[] args)
        {
            // create puzzle
            Puzzle puzzle = new Puzzle(7);

            // create Deck
            Deck deck = new Deck();
            IEnumerable<PlayingCard> shuffledDeck = deck.Shuffle();

            // add cards to puzzle
            foreach (PlayingCard card in shuffledDeck.Take<PlayingCard>(7)) {
                puzzle.Add(card);
            }

            // lets show the puzzle, compuute the best hand, and show that
            Console.WriteLine("Puzzle cards: " + puzzle.ToString());

            PokerHand bestHand = puzzle.GetBestHandPossible();

            Console.WriteLine("Best hand: " + bestHand.ToString() );
            Console.WriteLine("Score: " + bestHand.ScoreHand() );
        }
コード例 #2
0
        /// <summary>Creates a GUI with a specified number of cards showing.</summary>
        /// <param name="cardsToDisplay">Number of Cards in the Puzzle</param>
        public Window1(int cardsToDisplay)
        {
            // Initialize Data Structures
            _numCardsToDisplay = cardsToDisplay;
            _selected = new BitArray(_numCardsToDisplay);
            _puzzle = new Puzzle(_numCardsToDisplay);
            _images = new List<Image>();
            _chks = new List<CheckBox>();
            _deck = new Deck();
            _disabled = false;

            // Create/Draw Components
            InitializeComponent();
            CreateGUIObjects();
            this.Width = (100 * _numCardsToDisplay) + 50; // 25px padding both sides

            // Run the Game
            RestartPuzzle();
        }