Coding Practice - The Pit Fighters

For this exercise, you will create a two-player game where each player has five fighters who must battle in a pit arena with a select number of weapons.


Each player gets to name five fighters who will be randomly chosen to battle with a randomly chosen fighter from the other team. Although the fighters are chosen at random, the player can select the weapon their fighter will use. The weapon selection will determine the results of the battle.

The weapons to select from are:

  • Crossbow

  • Spear

  • Sword and Shield

  • Warhammer

  • Dagger

Battle Set Up

  • Before every battle, each player is shown their remaining fighters.

  • A fighter from each team is randomly chosen.

  • Each player will choose the weapon for their fighter will use

  • This choice needs to be private for each player.

  • Invalid selections must be handled.

  • Once the players have selected their weapons, the battle begins

Battle Results

Your application will determine the results of the battle based on the weapons that were selected. The following table shows you which weapon wins in a pairing.

When a fighter dies, they are no longer eligible for battle.

End Game

When a player runs out of fighters, they have lost the game. Make sure there is a message telling them so.

Ask the players if they want to play again. If they do, restart the game with a new batch of fighters. If they don’t, exit the application.

Final Instructions

Coding is supposed to be fun, so get creative and have a good time with this. Share your GitHub link when your done so I can see what you came up with.

110 views0 comments

Recent Posts

See All