Codingassignmenthelper | Home Codingassignmenthelper | University

NIT2112 Object Oriented Programming

Victoria University

Assignment :

Marks : The assignment is worth 15% of the total unit mark.

You are to work with a partner, 2 students per group is the maximum. Group must submit for both students, only one copy of the assignment. Submission details are at the end of this document.
The assignment is composed of two parts.

Problem Description

You are being asked to code the Mine Puzzle game where the coal miners (the coloured circles in the diagram below) walk from the lift on the left of the long, narrow underground tunnel to the coal face on the right. In the middle of the tunnel there is a small square cave with a space to fit one person only. A blue group of miners walking from the lift towards the coal face meet in the middle of the tunnel orange group of miners walking back towards the lift. The tunnel is too narrow for the miners to pass each other. You are the only player in the game which begins by computer randomly selecting one to four miners for each group, for example, the diagram shows four blue and three orange miners.
Image1

Miners can move back a short distance but not all the way to the lift or to the coal face, just far enough for the first or last miner to enter the cave. Only the miner from either end of the combined miner group can enter the cave and conversely, the miner in the cave can only join miners in the tunnel at either end of queue. The miner group nearest the cave always stops at the approach edge of the cave.

The challenge for the player is to work out how the two groups of miners can pass each other in the tunnel, in a least number of moves. Player (user) solves the puzzle by instructing the computer to move the miners according to the game’s rules.

Part 1

Create a Command Line Interface (CLI) application MinePuzzleCLI that prints to the screen a mine tunnel with random number of blue and random number orange miners. You will need to do two tasks :
Design and create a class to represent the tunnel with the appropriate attributes and methods. Write the MineTunnel constructor. Write a method choosing a random number of miners (one to four per group). Write four methods to move the miners to right, left of the cave and to enter or leave cave. Write other methods as required. Write a class to provide Command Line interface that will allow the user to play the puzzle game. A sample of a dialogue (menu) follows:
To Continue Click Here > NIT2112 Object Oriented Programming.pdf
Codingassignmenthelper | Home Codingassignmenthelper | Home