Giter Club home page Giter Club logo

soen-6441-adv-programming-warzone-game's Introduction

Warzone Game

This is a Java based Command Line implementation of popular "Risk" game, 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/. The program was developed as requirement to complete Concordia University's course SOEN-6441 Advance Software Engineering and Practices.

Authors (GitHub Username and Email ID)

Documentation

For detailed information on architecture, Code Implementations etc, Please checkout ./documentation directory

soen-6441-adv-programming-warzone-game's People

Contributors

avneet-kaur avatar bshah5 avatar jhanvi0905 avatar pulkitkkr avatar zalakpatel315 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

soen-6441-adv-programming-warzone-game's Issues

Aggressive Player Behavior

An aggressive computer player strategy that focuses on centralization of forces and then attack, i.e. it deploys on its strongest
country, then always attack with its strongest country, then moves its armies in order to maximize aggregation of forces in one
country.

Adapter Pattern Refactoring

  • Refactor your code to use the Adapter pattern to enable the application to read/write from/to a file using the “conquest” game map format (http://www.windowsgames.co.uk/conquest_maps.html). The application should be able to decide to use either the original
    “domination” file reader or the “conquest” file reader adapter when a file is opened, depending on the file type. When a map file is saved, the user should be given the option as to which file format to use as output. At any point in time, only one of the original file
    reader or the adapter should be instantiated.

  • Saving a map using the either of the game map formats. Loading a map from an existing map file in either format, then editing the
    map, or create a new map from scratch.

GamePlay Start-Up Phase

  • loadmap filename (For Now use a warzone map file and assume it is already valid until Map-Editor Validator is finalized)
  • Should Handle Following Commands ( Use The Utility)
gameplayer -add playername -remove playername
  • Should handle assign country using the following command:
gameplayer assigncountries

Command Pattern Implementation

Refactor your code to use the Command pattern to implement the Orders. The Command class must be the Order class, the
Invoker Class is the Player, and the Client class is the GameEngine. The orders are created as the player executes its
issue_order() method, and the orders are executed when the GameEngine gets the Player’s orders from the Players using the
next_order() method, then executes the orders by calling the execute() method of the Order.

State Pattern Refactoring and command handling

Refactor your code to use the State pattern to implement the phases of the application, including the phases in the map editor,
and the game play). The game play phase must be divided into the following phases: startup, issue order, and order execution
phases. The context class of the State pattern must be you GameEngine class and the State class must be a new class named
Phase

Random Player Behavior

• A random computer player strategy that deploys on a random country, attacks random neighboring countries, and moves armies
randomly between its countries.

Map Editor Edit & Save Features

  • Should handle all of the following commands:
editcontinent -add continentID continentvalue -remove continentID
editcountry -add countryID continentID -remove countryID
editneighbor -add countryID neighborcountryID -remove countryID neighborcountryID
  • If editing a previously created map, create a [filename]_temp.txt file (per session) & make changes on that.... and then at the end of saving, tell user You will be overriding a file.

  • If someones try to edit file and TEMP file already exists, tell user, You are already creating a map, Do you want to continue or discard it.

  • Store the name of TEMP file in ApplicationConstants

Random Cards Assignment to players logic

All Players have a hand of cards. Players start with no cards. Every turn, if a Player conquered at least one Country in their turn,
they receive one random card (i.e. maximum one card per Player per turn).

Cheater Player Behavior

A cheater computer player strategy whose issueOrder() method conquers all the immediate neighboring enemy countries, and
then doubles the number of armies on its countries that have enemy neighbors. Note that in order to achieve this, the cheater’s
strategy implementation will still be called when the issueOrder() method, but will not end up creating orders, but rather implement
the above-stated behavior by directly affecting the map during the order creation phase

Neutral Player Creation.

In case of blockade implementation

  • Check if Game state has player with name "Neutral"
  • If Yes get player, get its countries owned and add the country you want to make Neutral to the player's existing list of countries.
  • If No player with "Neutral" name exists in state, make a new player with name, add the country you want to make Neutral.
  • Verify advance order on Neutral country.

Game Save/Load

Game Save/Load: As a game is being played, allow the user to save the game in progress to a file, and allow the user to load the
game in exactly the same state as saved.
Game save/load commands:
savegame filename (see below)
loadgame filename (see below)

Strategy Pattern

  • Refactor your current user-driven player code so that the implementation of the Player’s issueOrder() method’s behavior is using the Strategy pattern. Then, during the main development phase, implement different computer player behaviors using the Strategy pattern, where the strategies provide varying behavior that support the Player class to expose varying behavior when executing the issueOrders() method

  • Implementation of the human, aggressive, benevolent, random, and cheater behaviors. The aggressive, benevolent, random, and cheater players automatically make decisions and create orders without any kind of user interaction. The human player is relying on user commands to make decisions and create orders.

Create Command Validation & Extraction Utility

  • Should have a method getRootCommand which returns the main command:
    ex:
    getRootCommand On:
editcontinent -add continentID continentvalue -remove continentID

will give editcontinent

  • Should Have a Method, getOperationAndValues

getOperationAndValues on the following will return a List/HashMap

editcontinent -add continentID continentvalue -ad ContinentID continentValue -remove continentID

Output:

[
 ["add", [arg1, arg2]],
 ["add", [arg1, arg2]],
 ["Remove", [arg1, arg2]],
]

Benevolent Player Behavior

A benevolent computer player strategy that focuses on protecting its weak countries (deploys on its weakest country, never
attacks, then moves its armies in order to reinforce its weaker country).

Main game loop

Loop over each player for the assign reinforcements, issue orders and execute orders main game loop phases

Map Editor Show Map

  • While the user is running edit commands, We should be able to show a snapshot of the map at that moment (It can be a valid map or invalid too, Just a snapshot of what the user has done till that moment)
  • Another method to show a validated map after the user saves the map file, It will show a GRID/Matrix showing the connectedness of All nodes(Country). Further, Show All continents with the countries it has and show the name of all countries

Order Acceptance logic refactoring

  • Accept multiple order commands including showmap.
  • Post showmap, game should ask same player to give order command also.
  • Checking what commands are allowed at that stage for player.
  • Entry and Exit conditions of issue order and execute order.

Tournament Mode

Tournament Mode: When the game starts, provide an option for a Tournament Mode (see “Tournament” below). The tournament
should proceed without any user interaction and show the results of the tournament at the end.
Tournament game play commands:
tournament -M listofmapfiles -P listofplayerstrategies -G numberofgames -D maxnumberofturns

Single Game Mode

Single game mode: Game starts by user selection of a user-saved map file, then loads the map as a connected graph. User
chooses the number and behavior of players (see Player Behavior Strategies below). The game proceeds until one of the players
has conquered the whole map. If no human player is selected, the game proceeds fully automatically without any user interaction.

Accept Player Behavior Logic

Add Command Support

  • Utility for User Command Input
  • Configuring Single Execution Session for each runtime command

Observer Pattern Implementation

Implementation of a game log file using the Observer pattern. For every action taken during the game (e.g. a command is
executed, or an order is issued or executed), a LogEntryBuffer object is filled with information about the effect of the action. The
LogEntryBuffer class should be an Observable. There should be a corresponding Observer that writes the content of the
LogEntryBuffer to a log file when it is changed. The end result should be that the user can clearly see all the actions that happened
during a game by looking at the file. The log file should clearly identify every phase of the game.

Refactoring Targets

List of refactoring issues to be added here

  1. GameEngineController name change
  2. Map Service refactoring to include generic logic of edit country, continents, neighbors
  3. Throwing invalid map or invalid command custom exceptions at the places where simple print statements were given in case of command having logical or syntactical errors.
  4. Refactored assigncountries commands logic in a way that assign countries, assign armies, issue and execution of orders logic will be in separate methods rather than in a single long and complex method.

Map Editor Load & Validate

  • Should be able to open a file by specifying the name
  • Should load a warzone file and run all validations on it

Add Continuous Integration & Delivery

  • Should Run JUnit Suites
  • Should Check if Project compiles successfully
  • Should Check if all Methods & Classes have JavaDocs
  • Ensure Coding Standards are followed (Research)

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.