Skip to content

A small Obliteration game written using Java for a single player vs AI.

Notifications You must be signed in to change notification settings

hannz88/Obliteration_Game_Java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Obliteration Game

forthebadge forthebadge forthebadge

Introduction

This is a Obliteration game I wrote using Java. For more information about the game, have a look at here.

Table of Content

Where

To play the game, simply click on this link. It'll bring you to a repl page. Click on the Not yet run button or the play button and follow the prompts.

How to play

1. Set the desired width

At the very beginning, you'll be prompted to enter the desired width of the board. The board here is a square so it will be nxn. Key in under promt and press enter.

Desired width of board

2. Set a character to represent player

Next, you'll be asked to set a SINGLE alpha-numerical character to represent you the player on the board.

Key in characters to represent players

3. Announcing the details

Here, you'll be informed of the size of the board you chosen, the character that represents you and the character that represents the computer...along with "Link start-o!" (Anyone gets the reference to SAO?). Then, the state of the board will be printed. In the example below, the board was 10x10, the player's character is "e" and the computer's character is "x". In most IDEs, the player's character should show up as blue and the computer's as yellow. In the repl link, the colour looks a bit weird.

Announcing the details of the game

4. Playing the game

Player will start first. The player will be asked to enter the row followed by the column they intend to dominate. The immediate neighbour surrounding the coordinate will be converted to the player's territory if they are still not dominated. In the example below, the player has chosen row 1, column 1. The choice is echoed, followed by a representation of the board.

Entering coordinates

The computer will then take its turn and print out the board. The computer's territory will be in yellow and denoted by the computer's chosen character.

The board after the computer make a decision

5. How is the winner decided?

The aim of the game is to be the last person to dominate the board. So, whoever plays the last turn will be declared the winner. If the computer wins, you should see a version of the following picture printed out. And when the player wins? You get a cookie 😆

The T1000

Relationship diagram

If you're interested in how the classes are related to each other, here's a diagram that summarised the relationships!

Relationship diagram of the classes

Have fun! And if you have any suggestion for improvements, I'm all ears!

About

A small Obliteration game written using Java for a single player vs AI.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages