Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a recursive method that counts the number of mines on a grid. A mine is defined as a contiguous collection of X's (connected horizontally

Write a recursive method that counts the number of mines on a grid. A mine is defined as a contiguous collection of X's (connected horizontally and vertically).

Recursive method = A method calls its self.

Assignment name: MS count the Mines

Using JAVA Language..

Input

Max dimensions of the array

Distribution of mines on the array

Output

The number of mines and the layout of the grid showing the locations of the mines.

Requirements checklist:

Documented source code (include any assumptions you make)

image text in transcribed

Input File (in.txt) The format of the input file is as follows: First line is the dimensions of the grid.. Then the grid containing 1s for the creatures and Os for the spaces. The file terminates by 0 0 xXX xXX X. Output File (out.txt) Experiment # 1 Number of Mines: 1 01110 Experiment #2 Number of Mines: 3 00001 0222 0 30000

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions