Git Product home page Git Product logo

super_trumps's Introduction

Super Trumps

Superhero top-trumps.

Installation

  1. Run bundle install
  2. Ensure that the super_trumps script is executable, with chmod +x super_trumps if necessary
  3. Play the game with ./super_trumps

Description of the gameplay in term of our code entities

A game has:

  • 2 Players. Player 1 is the human being and Player 2 is the computer ('The Machine').

  • one deck of Cards

  • many Turns.

Each Card has:

  • a #character such as 'Catwoman' or 'Wonder Woman'

  • a number of attributes such as agility or fighting_skills, each of which has a numeric value

Each Player has:

  • a 'hand', the cards in her current possession

  • a #current_card, being the one which is currently in play, i.e. it is top of the stack, face up.

A Turn is when:

  • the winner of the previous turn is the current 'challenger'

  • this challenger reviews the attributes of her current_card and #battles_with(attribute) the chosen attribute. e.g. my current card is Wonder Woman and I decide to battle with her agility value of 72.

  • the player with the highest value in the attribute under challenge is the winner and wins his opponent's card. e.g. Catwoman's agility turns out to be 83, so in this case 'The Machine' is the winner and I have to give up my Wonder Woman card.

Overview of code execution

The game is the 'main' element of this program. Its lifecycle is:

  1. created with name of the human known as player_1
  2. imports cards
  3. shuffles pack
  4. deals cards
  5. goes into a loop of Turns until a winner emerges
  6. shows the leader board of known players with their total scores (a win is worth 5 points)

super_trumps's People

Contributors

edavey avatar

Watchers

 avatar James Cloos avatar

Forkers

theozaurus

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.