GithubHelp home page GithubHelp logo

risk's People

Contributors

benrs avatar dylanfernandes avatar pbgnz avatar philippe229 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

pbgnz

risk's Issues

Verify that hand exchange follows game rules

Check project handout

  • A player receives a card at the end of his turn if he successfully conquered at least one country during his turn.
  • If a player holds five cards during his reinforcement phase, he must exchange three of them for armies.

Create Abstract Class to Support AI

Description
Integrate polymorphism to player class to support AI

Acceptance Criteria

  • Create abstract class Player with methods to be defined in derived class
  • Convert current player class to human which implements player
  • Create computer class for AI which implements player

Part 2: New Strategies

(Extension of Part1 of Assignment 3) Add 2 more computer strategies (you should then have a total of 4 different computer strategies). These strategies must be designed so that they have a chance to win the game (e.g. the “benevolent” strategy in assignment 3 cannot win a game).

  • A Random Computer Player Strategy that reinforces random a random country, attacks a random number
    of times a random country, and fortifies a random country, all following the standard rules for each phase,
  • A Cheater Computer Player Strategy whose reinforce() method doubles the number of armies on all its
    countries, whose attack() method automatically conquers all the neighbors of all its countries, and whose
    fortify() method doubles the number of armies on its countries that have neighbors that belong to other
    players.

Part 3: Tournament

A tournament starts with the user choosing M = 1 to 5 different maps, P = 2 to 4 different computer players strategies, G = 1 to 5 games to be played on each map, D = 10 to 50 maximum number of turns for each game. A tournament is then automatically played by playing G games on each of the M different maps between the chosen computer player strategies. In order to minimize run completion time, each game should be declared a draw after D turns. Once started, the tournament plays all the games automatically without user interaction. At the end of the tournament, a report of the results should be displayed, e.g.

M: Map1, Map2, Map3
P: Aggressive, Benevolent, Random, Cheater.
G: 4
D: 30

Game 1 Game 2 Game 3 Game 4
Map 1 Agressive Random Cheater Cheater
Map 2 Cheater Draw Cheater Aggressive
Map 3 Cheater Agressive Cheater Draw

Deck/Hand

Create the Deck and Hand class and everything needed by it, this includes the DeckAndHandDriver.

Dice

Create the Dice class and everything needed by it, this includes the DiceDriver.

Player

Create the Player class and everything needed by it, this includes the PlayerDriver.

Part 3: Game Statistics Observer

Using the Observer design pattern, implement a view that displays some useful statistics about the game, the minimum being a “players world domination view” that shows using some kind of bar graph depicting what percentage of the world is currently being controlled by each player.

This should dynamically be updated as the map state changes and be visible at all times during game play.

Game play: main game loop

Provide a group of C++ classes that implements the main game loop following the official rules of the game of
Risk. During the main game loop, proceeding in a round-robin fashion as setup in the startup phase, every player
is given the opportunity to do each of the following actions during their turn:

  1. Reinforcements phase
  2. Attack phase
  3. Fortification phase
    This loop shall continue until only one player controls all the countries in the map, at which point a winner is
    announced and the game ends. You must deliver a driver that demonstrates that 1) every player gets turns in a
    round-robin fashion and that their reinforcement(), attack() and fortification() methods are called 2) the
    game ends when a player controls all the countries (the driver should explicitly give all the countries to one player,
    i.e. no real code for battles needs to be executed).

Game play: startup phase

Provide a group of C++ classes that implements the startup phase following the official rules of the game of Risk.
This phase is composed of the following sequence:

  1. The order of play of the players in the game is determined randomly.
  2. All countries in the map are randomly assigned to players one by one in a round-robin fashion.
  3. Players are given a number of armies (A), to be placed one by one in a round-robin fashion on some of
    the countries that they own, where A is:
     If 2 players, A=40
     If 3 players, A=35
     If 4 players, A=30
     If 5 players, A=25
     If 6 players, A=20
    You must deliver a driver that demonstrates that 1) all countries in the map have been assigned to one and only
    one player; 2) all players have eventually placed the right number of armies on their own countries after army
    placement is over.

Game Start

Provide a group of C++ classes that implement a user interaction mechanism to start the game by allowing the
player to 1) select a map from a list of map files as stored in a directory 2) select the number of players in the
game (2-6 players). The code should then use the map loader to load the selected map, create all the players,
assign dice rolling facilities to the players, create a deck of cards, and assign an empty hand of cards to each
player. You must deliver a driver that demonstrates that 1) different valid maps can be loaded and their validity is
verified (i.e. it is a connected graph, etc), and invalid maps are rejected without the program crashing; 2) the right
number of players is created, a deck with the right number of cards is created.

Map

Create the Map class and everything needed by it, this includes the MapDriver.

Refactor Game Phases for to Support AI

Description
Modify phases to support AI. AI will send data to phase method and receive data from phase method. Remove output when player type is AI.

Acceptance Criteria

  • Refactor Attack
  • Refactor Fortification
  • Refactor Reinforcement
  • Support Phase Observer

Additional Information
dependant on issue #38

Part 2: Phase Observer

Using the Observer design pattern, implement a view that displays information happening in the current phase.

It should first display a header showing what player and what phase is currently being played, e.g. “Player 3: Attack phase” or “Player 1: Fortification phase” Then it should display important information related to what is happening in this phase, which should be different depending on what phase is being played.

This should dynamically be updated as the game goes through different players/phases and be visible at all times during game play.
Additional Information
dependant on issue #39

Main game loop: reinforcement phase

Provide a group of C++ classes that implement the reinforcement phase following the official rules of the game of
Risk. In the reinforcement phase, the player gets a number of armies (A) to place on its countries, where A is:
 Number of countries owned on the map, divided by 3 (rounded down), with a minimum of 3.
 Continent-control value of all continents totally controlled by that player.
 Armies resulting in card exchange, if possible. If a player owns more than 5 cards, it must exchange
cards (exchanging cards should be done inside the Hand’s exchange() method).
The player must then place all these armies on some of the countries it owns, as it sees fit (for now, it does not
matter which). You must deliver a driver that demonstrates that 1) a player receives the right number of armies in
the reinforcement phase (showing different cases); 2) the player has effectively placed this exact number of new
armies somewhere on the map by the end of the reinforcement phase.

Part 1: Game Statistics Observer Decorator

(Extension of Part 3 of Assignment 3) Using the Observer design pattern, implement a view that displays some useful statistics about the game as it is being played. This should dynamically be updated as various aspect of the game state changes and be visible at all times during game play. Using the Decorator pattern, provide different decorators that add more information to be displayed on the Basic (undecorated) Game Statistics Observer:

  1. Basic (undecorated) Game Statistics Observer: Display the turn number, update the view every time a
    new turn starts.
  2. Player Domination Observer Decorator: Display the percentage of countries owned by each player,
    update the view when any player conquers a country.
  3. Player Hands Observer Decorator: Display the cards owned by every player, update the view when any
    player’s hand is changing.
  4. Continent Control Observer Decorator: Display what player controls each continent, update the view
    when any continent becomes controlled by a player, or when a player loses control of a continent.

You must be able to demonstrate that the Basic (undecorated) Game Statistics Observer is available at all times during play and updates the view when the turn number increases. Before the beginning of every turn, the user should be given the opportunity to add one or more Decorators (2, 3, or 4) above, which should result in the Observer to show more information and be notified as instructed above for each Decorator. Each Decorator (2,3,4) should not be used more than once. The user should also be allowed to remove Decorators. The user should be allowed to specify that it does not want to add/remove Decorators in the future, after which the user shall not be prompted anymore at the beginning of every turn.

Map Loader

Create the Map Loader class and everything needed by it, this includes the MapLoaderDriver.

Main game loop: attack phase

Provide a group of C++ classes that implement the attack phase following the official rules of the game of Risk. In
this phase, the player is allowed to declare a series of attacks to try to gain control of additional countries, and
eventually control the entire map. The attack phase follows the following loop:
 The player decides if it will attack or not. If not, the attack phase is over.
 The player selects one of its countries to attack from, and one of the neighbors of this country to attack
(i.e. the attacked country belongs to another player). The attacking country must have at least 2 armies
on it.
 The attacker and defender players choose the number of dice to roll for their attack/defense. The attacker
is allowed 1 to 3 dice, with the maximum number of dice being the number of armies on the attacking
country, minus one. The defender is allowed 1 to 2 dice, with the maximum number of dice being the
number of armies on the defending country.
 The dice are rolled for each player and sorted, then compared pair-wise. For each pair, the player with
the lowest roll loses one army. If the pair is equal, the attacker loses an army.
 If the attacked country runs out of armies, it has been defeated. The defending country now belongs to
the attacking player. The attacker is allowed to move a number of armies from the attacking country to the
attacked country, in the range [1 to (number of armies on attacking country -1)].
 The player is allowed to initiate any number of attacks per turn, including 0.
You must deliver a driver that demonstrates that 1) only valid attacks can be declared (i.e. valid attacker/attacked
country); 2) only valid number of dice can be chosen by the attacker/defender; 3) given known dice values, that
the right number of armies are deducted on the attacker/defender; 4) the attacker is allowed to initiate multiple
attacks, until it declares that it does not want to attack anymore.

Part 1: Player Strategy Pattern

Using the Strategy design pattern, implement different kinds of players that make different decisions during the reinforcement, attack, and fortification phases.

The kinds of players are:
(1) human player that requires user interaction to make decisions,
(2) an aggressive computer player that focuses on attack (reinforces its strongest country, then always attack with it until it cannot attack anymore, then fortifies in order to maximize aggregation of forces in one country),
(3) a benevolent computer player that focuses on protecting its weak countries (reinforces its weakest countries, never attacks, then fortifies in order to move armies to weaker countries).

Additional Information
dependant on issue #38 and #39

Main game loop: fortification phase

Provide a group of C++ classes that implement the fortification phase following the official rules of the game of
Risk. In the fortification phase, the player is allowed to move a number of armies (X) from one of its countries (the
3
source country) to one of its neighbors that it also owns (the target country). X must be in the range [1 to (number
of armies on the source country - 1)]. You must deliver a driver that demonstrates that 1) only valid countries can
be selected as source/target; 2) only a valid number of armies can be moved; 3) the right number of armies is
effectively moved.

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.