Skip to content

caseymerrill/flip7

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

12 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽด Flip 7 - CLI Edition

A command-line implementation of the exciting press-your-luck card game Flip 7 by Eric Olsen. Push your luck, collect cards, and be the first to reach 200 points!

๐ŸŽฏ Game Objective

Be the first player to score 200 or more points by collecting cards across multiple rounds. But beware - draw duplicate number cards and you'll bust, losing all points for that round!

๐Ÿƒ How to Play

Basic Rules

  • Each round, players are dealt cards one at a time, face up
  • On your turn, choose to:
    • Hit - Draw another card (risk vs. reward)
    • Stay - Bank your current points and exit the round
  • Bust if you draw a duplicate number card (lose all round points)
  • Flip 7 if you collect 7 different number cards (15 bonus points + round ends)

Card Types

๐Ÿ”ข Number Cards (0-12)

  • Worth their face value in points
  • The deck contains as many of each number as the number itself
    • 12 copies of "12", 11 copies of "11", down to 1 copy of "0"

โšก Action Cards

  • โ„๏ธ Freeze - Forces a player to stay and bank their points
  • ๐ŸŽฒ Flip Three - Forces a player to draw 3 cards in succession
  • ๐Ÿ†˜ Second Chance - Automatically goes to the player who drew it (unless they already have one), allows avoiding a bust once by discarding a duplicate

๐ŸŽฏ Modifier Cards

  • +2, +4, +6, +8, +10 - Add points to your number card total
  • ร—2 - Doubles your number card total (before adding other modifiers)

Scoring

  1. Add up your number cards
  2. Apply ร—2 multiplier if you have one
  3. Add any +point modifier cards
  4. Add 15 bonus points for Flip 7

๐Ÿš€ Installation & Setup

Prerequisites

  • Go 1.19 or higher

Build and Run

# Clone or download the project
git clone <repository-url>
cd flip7

# Build the game
go build .

# Run the game
./flip7

# Run with debug mode (choose cards manually)
./flip7 -debug

Quick Start

# Normal game
go run .

# Debug mode
go run . -debug

Game Modes

  • Mixed Mode: Human and computer players together
  • AI-Only Mode: Watch computer players battle (0 human players)
  • Debug Mode: Manually choose every card drawn

๐ŸŽฎ Gameplay Example

๐ŸŽด Welcome to Flip 7!
Press your luck and flip your way to 200 points!

How many players? (3-8): 3
Enter name for Player 1: Alice
Enter name for Player 2: Bob  
Enter name for Player 3: Charlie

๐ŸŽฎ Starting Flip 7! First to 200 points wins!

==================================================
๐ŸŽฏ ROUND 1
==================================================
Dealer: Alice

๐Ÿƒ Dealing initial cards...
   Bob draws [7]
   Charlie draws [9]
   Alice draws [10]

๐Ÿ‘ค Bob:
   Numbers: [7]

๐ŸŽฏ Bob, do you want to (H)it or (S)tay? h
   Bob draws [ร—2]
๐Ÿ‘ค Bob:
   Numbers: [7]
   Modifiers: [ร—2]

๐ŸŽฏ Bob, do you want to (H)it or (S)tay? h
   Bob draws [3]
๐Ÿ‘ค Bob:
   Numbers: [7] [3]
   Modifiers: [ร—2]

๐ŸŽฏ Bob, do you want to (H)it or (S)tay? s
   Bob stays with 20 points

๐Ÿ“Š Calculating round scores...
----------------------------------------
Bob: 20 points this round (Total: 20)
Charlie: 9 points this round (Total: 9)
Alice: 10 points this round (Total: 10)
----------------------------------------

๐ŸŽฒ Strategy Tips

  1. Know the odds - Higher numbers have more copies, increasing bust risk
  2. The zero card is safe - only one copy in the deck, can't cause a bust
  3. Second Chance cards are powerful - they automatically go to whoever draws them (unless they already have one), so save them for the right moment
  4. Risk vs. reward - Push your luck for higher scores, but know when to stay
  5. Modifier cards can multiply your score - but you need number cards first

๐Ÿ—๏ธ Project Structure

flip7/
โ”œโ”€โ”€ main.go          # Entry point
โ”œโ”€โ”€ game.go          # Main game logic and flow
โ”œโ”€โ”€ card.go          # Card types and definitions
โ”œโ”€โ”€ deck.go          # Deck management and shuffling
โ”œโ”€โ”€ player.go        # Player state and hand management
โ”œโ”€โ”€ go.mod           # Go module file
โ””โ”€โ”€ README.md        # This file

๐Ÿ› ๏ธ Development

Code Organization

  • Card System: Flexible card types with proper game logic
  • Player Management: State tracking, scoring, and hand display
  • Game Engine: Turn management, action card handling, and round flow
  • CLI Interface: User input validation and game state display

Debug Mode

The game includes a debug mode for testing and development:

./flip7 -debug

In debug mode, you can manually choose which card to draw each turn:

  • Cards are organized by type (Number, Action, Modifier)
  • Shows how many of each card type are available
  • Perfect for testing specific scenarios like Flip 7, action card interactions, etc.

Example debug card selection:

๐Ÿ› DEBUG: Choose a card to draw:
Available cards (94 total):

Number Cards:
  1) [0] (1 available)
  2) [1] (1 available)
  3) [2] (2 available)
  ...

Action Cards:
  14) โ„๏ธ FREEZE (3 available)
  15) ๐ŸŽฒ FLIP 3 (3 available)
  16) ๐Ÿ†˜ 2ND CHANCE (3 available)

Modifier Cards:
  17) [+2] (1 available)
  18) [+4] (1 available)
  ...

Enter choice (1-22): 

๐Ÿค– Computer Players

The game supports computer players with different AI strategies:

AI Strategies

  • Conservative: Plays it safe, stays early with lower scores
  • Aggressive: Takes big risks, pushes for higher scores
  • Adaptive: Adjusts strategy based on game state and other players
  • Chaotic: Unpredictable decisions for fun and variety

AI-Only Mode

You can create games with zero human players to:

  • Test different AI strategies against each other
  • Watch entertaining computer battles
  • Study optimal play patterns
  • Let the game run hands-free

Example AI-only setup:

How many players total? (2-8): 4
How many human players? (0-4): 0

Computer Player 1: Conservative โ†’ "Cautious Carl"
Computer Player 2: Aggressive โ†’ "Bold Bob" 
Computer Player 3: Adaptive โ†’ "Smart Sam"
Computer Player 4: Chaotic โ†’ "Wild Will"

๐ŸŽฎ Starting AI-only Flip 7 with 4 computer players!
๐Ÿฟ Sit back and watch the AIs battle it out!

Key Features Implemented

  • โœ… Full Flip 7 rules implementation
  • โœ… All 3 action card types with proper interactions
  • โœ… Modifier cards with correct scoring
  • โœ… Second Chance mechanics
  • โœ… Deck management with reshuffling
  • โœ… Input validation and error handling
  • โœ… Visual game state display
  • โœ… Winner detection
  • โœ… Computer players with AI strategies
  • โœ… AI-only mode (watch computers play)
  • โœ… Debug mode for manual card selection

๐Ÿ“„ License

This is an implementation of the card game Flip 7 designed by Eric Olsen and published by The Op Games (2024). This CLI version is created for educational and entertainment purposes.

๐ŸŽ‰ Credits

  • Original Game: Flip 7 by Eric Olsen (The Op Games, 2024)
  • CLI Implementation: Built with Go
  • Inspiration: Love for press-your-luck games and terminal interfaces

Have fun flipping your way to victory! ๐ŸŽดโœจ

About

Play Flip7

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages