The project consists of one source code file, which is provided here
- Renamed the project to
BattleField
. - Renamed the main class
Program
toEntryPoint
. - All classes are in their own .cs file
- All logic moved to Battlefield.Logic class library
- Removed all unneeded empty lines
- Inserted empty lines according to C# formatting guidelines
- Inserted curlu braces afer each loop and conditional statement
- Split the lines containing several statements into several simple lines
- Character casing: variables and fields made camelCase; types, methods and constatnts made PascalCase.
- Formatted all other elements of the source code according to the best practices introduced in C# formatting guidelines
- ..
- all indexers renamed for better understanding
- chinese strings translated to english
- all shlyokavca variable and method names renamed
MinFieldSize = 5
MaxFieldSize = 20
MinimumPercentageOfBombs = 15
many local constants
explosion patterns moved to classes as readonly fields
Game
- starting facadeConsoleEngine
- the only enginePlayer
- yes, player - we have many - e.g. 2 😃Field
- the playfieldCell
- each cell of the playfieldCoordinates
- structure holding x and y coordinatesConsoleInput
- self exlainatoryConsoleOutput
- see above- `All bombs are classes too
- many supporting abstracts and interfaces
- in Engine
Start
- argument - current player, calling update method and finishing the game when soUpdate
- argument - current player, a player's turn
- in Player
TakeAShot
- getting input coordinates and shooting at battlefield
- in Field
ToString
FillFieldWithEmptyCells
- self explainatoryPlaceBombs
- see aboveExplode
- getting coordinates and some conditional stuff - the mechanism of the shooting - returns number of bombs detonated
- Moved method
GenerateRandomNumber(int start, int end)
to separate classRandomUtils
. - validations moved to separate class
Validators
- not all of them
- multiple players - e.g. 2
- chain reaction - single chain (eternal isn't suitable here)
- explosion inversion - self explainatory
- 3 new kinds of bombs
- input changed to take chess style coordinates
- abstract explosion method taking any mines - if have time to implement
- Creational
- Simple factory - creating bombs
- Singleton - the bombs
- Lazy loading - the singleton bombs
- Prototype - cloning bombs for chain reaction
- Structural
- Facade - Game.Initiate method - creating all needed for the game and starting it
- Decorator - decorating bombs with InvertExplosion method
- Composite - composing composite bomb for chain reaction
- Behavioral
- Startegy - getting the explosion pattern from the proper bomb
- Template - the Update method
- State or Command - to shoot in some way according to state of the player - wont have time to implement it