Code Monkey home page Code Monkey logo

multiplayer-card-game's Introduction

Multiplayer Card Game

This is a multiplayer card game implemented in Golang that supports up to 4 players and different types of cards, including number cards and action cards. The game follows the rules described below:

Rules

  1. Each player starts with a hand of 5 cards drawn from a standard deck of 52 cards.
  2. The game starts with a discard pile, which initially contains one card drawn from the deck.
  3. Players take turns playing cards from their hand, following the following rules: i) A player can only play a card if it matches either the suite or the rank of the top card on the discard pile. ii) If a player has an action card (Ace, King, Queen, or Jack), they can play it to trigger a special action (see below).
  4. If a player cannot play a card, they must draw a card from the draw pile. If the draw pile is empty, the game ends in a draw and no player is declared a winner.
  5. The game ends when one player runs out of cards, and that player is declared the winner.

Action Cards

The game includes the following action cards:

Ace (A): Skip the next player in turn. King (K): Reverse the sequence of players who play next. Queen (Q): Add 2 cards to the draw pile. The next player must draw these cards and cannot play a Queen from their hand on that turn, even if available. Jack (J): Add 4 cards to the draw pile. The next player must draw these cards and cannot play a Jack from their hand on that turn, even if available.

Note that action cards are not stackable, i.e., if a Queen or Jack is played, the next player must draw the specified number of cards and cannot play another Queen or Jack from their hand on that turn, even if available.

How to Run

To run the game, follow these steps:

  1. Clone the repository to your local machine.
  2. Ensure that you have Golang installed on your machine.
  3. Open a terminal and navigate to the directory where the repository is cloned.
  4. Run the "go mod tidy" command to ensure you have all the required modules present.
  5. Run the "go build" command to ensure the binary is made, and the build is done.
  6. Run the main game file using the go run command: go run main.go.
  7. Follow the on-screen instructions to play the game. Use the keyboard to input your choices during the game.
  8. Enjoy the multiplayer card game with your friends!

Contributing

If you would like to contribute to the game, feel free to submit a pull request. Please make sure to follow the coding standards and include appropriate comments in your code. Also, update the README.md file with any necessary changes.

License

This project is licensed under the MIT License, which allows for free use, modification, and distribution of the code. However, please acknowledge the original authors if you use or modify this project for your own purposes.

multiplayer-card-game's People

Contributors

amancooks08 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.