Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C Code - Using only 2D Array and Strings Skeleton Code: // minesweeper.c #include #define MINE '*' // a mine-filled square #define L1_ROWS 8 //

C Code - Using only 2D Array and Strings

image text in transcribed

image text in transcribed

image text in transcribed

 Skeleton Code: // minesweeper.c #include  #define MINE '*' // a mine-filled square #define L1_ROWS 8 // number of rows for level-1 grid #define L1_COLS 8 // number of columns for level-1 grid #define L2_ROWS 12 // number of rows for level-2 grid #define L2_COLS 16 // number of columns for level-2 grid #define L3_ROWS 16 // number of rows for level-3 grid #define L3_COLS 30 // number of columns for level-3 grid int main(void) { int level, rows, cols; int rows_limit[3] = {L1_ROWS, L2_ROWS, L3_ROWS}; int cols_limit[3] = {L1_COLS, L2_COLS, L3_COLS}; scanf("%d ", &level); rows = rows_limit[level-1]; cols = cols_limit[level-1]; return 0; } // Read the grid for minefield void scan_mines(char grid[][L3_COLS+1], int rows) { int r; for (r=0; r 

Test Cases: http://www.comp.nus.edu.sg/~cs1010/practice/2017s1/Practice-S08P06/testdata/

Practice S08P06: Minesweeper Week of release: Week 9 Objectives: 2D array, string Task statement Minesweeper is a computer game whose objective for the player is to clear a minefield without detonating a mine. The player is presented with a grid of squares (Figure 1) under which some contain mines, and some do not. For a square that is safe (mine-free), it contains an integer value (0 to 8) indicating the number of mines surrounding it. New Game Expert 7 1121211 13 17 1 2121 2 1 2 11 12 11 Figure 1. A Minesweeper game in progress A player clicks on a square to turn it over. If it contains a mine, the game ends and all the mines revealed (Figure 2). The game also ends when the player turned over all safe squares. Usually, a square that contains O (no mine around it) is simply displayed as a blank square

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

Recommended Textbook for

Business Process Driven Database Design With Oracle PL SQL

Authors: Rajeev Kaula

1st Edition

1795532386, 978-1795532389

More Books

Students also viewed these Databases questions

Question

What is management growth? What are its factors

Answered: 1 week ago