Giter Club home page Giter Club logo

cards_game_brex's Introduction

Card Game Challenge - Brex

Context

You have a card game where each card has a color and an acquisition cost in gems. The card colors can be: G (Green), B (Blue), R (Red), Y (Yellow), P (Purple). The acquisition cost is represented by pairs of numbers and letters indicating the required quantity of gems of each color.

Example of a Card

  • Top right corner: G

  • Bottom left corner: 1R2G3B (1 red gem, 2 green gems, 3 blue gems)

    +-------------+
    |           G |
    |             |
    |             |
    |             |
    |             |
    |             |
    | 1R2G3B      |
    +-------------+
    

Requirements

  • The player has a balance of gems and a deck of cards.
  • The gem balance and the deck of cards are independent.

Challenges

  1. Function can_purchase: Develop a function/method can_purchase that checks if a player can purchase a card based on their available gem balance.

  2. Function purchase: Develop a function/method purchase that deducts the gem balance of the player when purchasing a card and adds the card to the player's deck, provided they have sufficient balance.

Instructions to Run the Project

Prerequisites

  • Ensure you have Docker installed on your system.
  • Ensure you have Docker Compose installed on your system.

Running the tests with docker

  1. Clone the Repository

  2. Build the Docker Image: Build the Docker image using Docker Compose:

    docker compose build
  3. Run the the tests in Docker Container: Run the Docker container using Docker Compose:

    docker compose up

Running the tests with cargo

All tests:

cargo test

Specific tests:

cargo test --test <test_name>

Generating docs

cargo doc --open

cards_game_brex's People

Contributors

ismaelpamplona 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.