Eleven is card game where the player remove cards that eith sums up to 11 or form a card combination of J,Q,K
- Find a pair (A-10) that sums up to 11.
- Or find a J, Q, K together.
- Suits doesnot matter
- Invalid selections are rejected
- Wins when all cards are removed from the deck.
- Loses when no valid set found to remove.
- The game starts with a shuffled deck of 52 cards
- Nine cards are dealt face-up on the table
- Players can select a valid match from the table to remove
- Valid Moves: a. A pair from A through 10 that sums up to 11. Example, 8 + 3, Ace + 10 b. A set of J, Q, K together
- Once user selects the cards, system checks if its valid
- If valid, then the selected cards are removed from the table
- New cards are dealt from the deck o replace removed cads
- Repeat until you win or lose
- Win: All cards are removed from deck and table
- Lose: No legal moves on the rable
- Card.cs: Represents a single card with value and suit
- Deck.cs: Represents and manages the deck of cards with shuffle() and deal() methods
- Table.cs: Manages the cards displayed on the table with remove() and replaced() methods. Also, displays the table with DisplayTable().
- GameController.cs: Controls and game logic with StartGame(), submitSelection(), validateSelection() and checkEndState() methods.
- Program.cs: Main entry point for the console application
I primarily used Claude AI for AI assistance
-
C# syntax I had to look up for some C# synatx like "Main(string[] args)"
-
Debugging I was having constant issues with reading inputs. string input = Console.ReadLine(); (Converting null literal or possible null value to non-nullable type.) I was able to resolve the problem with string input = Console.ReadLine() ?? ""; ?? operator means "if null, use empty string instead."
Submitted By: Chime Lhamo Gurung