Concordia University Department of Computer Science and Software Engineering
Advanced program design with C++ COMP 345 — Fall 2022
Project Description
All assignments (3) will be about the development of different parts of a project. Thus, every assignment will build upon code developed in the previous assignments. You are expected to work in teams of 5 for every assignment.
Copyright By PowCoder代写 加微信 powcoder
Problem statement
The specific project for this semester consists in building a simple ¡°Risk¡± computer game. The developed program will have to be compatible with the rules and map files and the command-line play of the ¡°Warzone¡± version of Risk, which can be found at: https://www.warzone.com/. A Warzone game setup consists of a connected graph map representing a world map, where each node is a territory and each edge represents adjacency between territories. Two or more players can play by placing armies on territories they own, from which they can attack adjacent territories to conquer them. The objective of the game is to conquer all territories on the map.
The game map is a connected graph where each node represents a territory owned by one of the players. Edges between the nodes represent adjacency between territories. The map is divided into subgraphs that represent continents. A continent is a connected subgraph of the map graph, and every territory belongs to one and only one continent. Each continent is given a control value (a ¡°bonus¡± in Warzone terminology) that determines the number of armies per turn that is given to a player that controls all of it. During game play, every territory belongs to one and only one player and contains zero or more armies that belong to the player owning the territory. In your implementation, it will be expected that the game can be played on any connected graph that is defined by the user before play, saved as a text file representation, and loaded by the game during play.
The game consists of 5 different phases, in which specific actions are happening. In each phase, there are possible transitions to other phases, which are all triggered by specific conditions. The bulk of the action in the game are happening in the main game phase which consists of the reinforcement phase, the orders issuing phase, and the orders execution phase, that execute in a closed cycle until the entire map is controlled by a single player, at which point the game ends. Every iteration is the main game phase is called a turn. In every turn, a round robin mode of execution is used to go through every player in each of the sub-phases of the main game phase.
Startup Phase The game starts by the startup phase, where the number of players is determined, then all the territories are randomly and somehow evenly assigned to the players. Once the startup phase is done, the game goes to the main play phase that consists of the reinforcement phase, the orders issuing phase, and the orders execution phase.
Reinforcement Phase At the beginning of every turn, every player is given a number of armies that are placed in their reinforcement pool. The number of armies given depends on the number of territories they own (# of territories owned divided by 3, rounded down). If the player owns all the territories of an entire continent, the player is given a number of armies corresponding to the continent¡¯s control bonus value. In any case, the minimal number of reinforcement armies for any player is 3. Once the reinforcement phase is done
Orders Issuing Phase: Each player, in round-robin turn order, gives one of their orders, or signify that they don¡¯t have any more orders to issue this turn. Once all the players have signified that they don¡¯t have any more orders for this turn, the game switches to the orders execution phase (see below). Note that the orders only have an effect on the game when they are executed. Issuing an order is simply to signify the intention to execute an order.
The possible orders are listed below, along with all the parameters (underlined) that the player must specify to issue the order:
deploy: advance:
bomb: blockade: airlift: negotiate:
put a certain number of army units on a target territory
move a certain number of army units from one territory (source territory) to another territory (target territory)
destroy half of the army units located on a target territory. This order can only be issued if a player has the bomb card in their hand.
triple the number of army units on a target territory and make it a neutral territory. This order can only be issued if a player has the blockade card in their hand.
advance a certain number of army units from one from one territory (source territory) to another territory (target territory). This order can only be issued if a player has the airlift card in their hand. prevent attacks between the current player and another target player until the end of the turn. This order can only be issued if a player has the diplomacy card in their hand.
Orders Execution Phase: The game goes over each player in a round-robin fashion and executes one of the orders that the player had previously issued, and executes it. The execution of the orders have the following effects on the game:
deploy: advance:
move a certain number of army units from the current player¡¯s reinforcement pool to one of the current player¡¯s territories.
move a certain number of army units from one of the current player¡¯s territories (source) to another territory (target) that is adjacent to the source territory. If the target territory belongs to the current player, the armies are moved from the source territory to the target territory. If the target territory belongs to another player, an attack happens between the two territories. An attack is simulated by the following battle simulation mechanism: First, the attacking player decides how many armies in the source territory are involved in the attack. Then, each attacking army unit involved has 60% chances of destroying one defending army. At the same time, each defending army unit has 70% chances of destroying one attacking army unit. If all the army units on the target territory are destroyed as a result of the battle, the remaining army units left from the attacking army units from the source territory are moved to the target territory and the target territory now belongs to the player that declared the advance order, i.e. the player has conquered this territory. In any given turn, a player receives a card if they conquered at least one territory during this turn.
destroy half of the army units located on an opponent¡¯s territory that is adjacent to one of the current player¡¯s territories.
triple the number of army units on one of the current player¡¯s territories and make it a neutral territory.
advance a certain number of army units from one of the current player¡¯s territories to any another territory.
prevent attacks between the current player and the player targeted by the negotiate order until the end of the turn.
bomb: blockade: airlift: negotiate:
Once all the orders of all the players have been executed, the game switches back to the reinforcement phase. During the orders execution phase, at any time a player does not control at least one territory, that player is removed from the game. If only one player remains, the game switches to the end phase.
End Phase: The player that won the game is announced and some statistics about the game are displayed. The user is asked whether they want to play another game. If they answer yes, the game switches to the startup phase. If the user answers no, the program stops executing.
References
Domination game maps
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com