Skip to content

Instantly share code, notes, and snippets.

@miere
Last active November 15, 2022 05:43
Show Gist options
  • Save miere/f6b10b0e1ef433f6cf14 to your computer and use it in GitHub Desktop.
Save miere/f6b10b0e1ef433f6cf14 to your computer and use it in GitHub Desktop.
A nice game to practice OOP

Blind Warrior I

An easy to dev game to practice SOLID and other Clean Architecture Principles. In this game, only a few features will be implemented.

Description

Blind Warrior is a command line game. It tells a history where a blind warrior named ZISKA. Some day, during his daily morning coffee at the Queen Sophia's Cafeteria, the entire city was invaded by the army of the German Empire. A noble hero does not flee without a fight: Ziska took a weapon and starts to fight against all enemies.

The Game Interface

The game will have no input options. Here what it will do:

  • the player will start the game
  • the game will create the player
  • the game will create the enemies
  • the game will auto start the game
  • the game will play all rounds until face the "game over conditions"

What the game should output to the user:

  • Which character the player are fight with
  • What was the fight final result: who wins/loose and remaning player health
  • At the end of game should be printed:
    • the reason of the end of game
    • how many enemies was killed

Game Rules

  • All Ziska actions in the game are played by the computer
  • Ziska will attack every people he finds on his way
  • Ziska could use any weapon, whereas this weapon could not took more than 39% of an enemy health/life
  • Enemies could have any weapon, whereas this weapon could not took more than 59% of an enemy health/life
  • All weapon have no usage limit ( unlimited weapon ammo cheat turned on :P )
  • Citizens have no weapon or its weapon could not hurt Ziska
  • The characters Ziska will fight should be shufled before the game starts
  • The game is a survivor: no life recharge for Ziska until the end of game.

The game starts with Ziska, the citizens and the army enemies with their respectives weapons. So, Ziska fight ( one-by-one ) with every one he finds in the city. The game finishes when found one of the "game over conditions".

Game Over Conditions

The game will be considered finished when:

  • There's no enemies to kill
  • Ziska is dead ( has no health/life available )
  • Ziska killed an innocent citizen.

Considerations about the game development

This is team practice, rather than a solo endevour. The scope of this game is so simple that one can make it in a few minutes with 100% of test coverage. However, based on my experience applying this challenge to different teams, it is unberably hard to coordinate and finish when the team is bigger than 3 memebers.

Ideally, this challenge must respect all Lean Architecture principles. However, the bare minumim requirements would be as follows:

  • The entire software should respect the 4 rules of Simple Design from Ken Beck.
  • Classes should respect the Law of Demeter
  • Methods should have no more than 10 lines
  • Classes should respect the Single Responsibility Principle
  • It must be possible to run with a single ( and simple ) command
  • It must be possible to build the game with a single ( and simple ) command
@miere
Copy link
Author

miere commented May 9, 2014

I've started a game scope to teach my friends and company collegues some OOP principles. That's the first scope of 5. I hope it helps anybody else.

@jklemm
Copy link

jklemm commented Sep 5, 2014

Sure! Nice scope, it's the core idea to game development.

@delitescere
Copy link

Maybe update the link of Kent's rules (as it's gone now) to https://www.martinfowler.com/bliki/BeckDesignRules.html

@miere
Copy link
Author

miere commented Apr 6, 2020

Done, @delitescere. Thanks for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment