Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This reveals the radial upwards
- while (countMine == 0 && row - k >= 0 && row - k < SIZE && k < SIZE ) {
- minefield[row - k][col] = VISIBLE_SAFE;
- if (count_mines(row - k - 1, col, SQUARE_SIZE_REVEAL, minefield) != 0) {
- minefield[row - k][col] = VISIBLE_SAFE;
- }
- countMine = count_mines(row - k, col, SQUARE_SIZE_REVEAL, minefield);
- k++;
- }
- k = 0;
- countMine = count_mines(row + k, col, SQUARE_SIZE_REVEAL, minefield);
- // This reveals the radial downwards.
- while (countMine == 0 && row + k >= 0 && row + k < SIZE && k < SIZE ) {
- minefield[row + k][col] = VISIBLE_SAFE;
- if (count_mines(row + k + 1, col, SQUARE_SIZE_REVEAL, minefield) != 0) {
- minefield[row + k][col] = VISIBLE_SAFE;
- }
- countMine = count_mines(row + k, col, SQUARE_SIZE_REVEAL, minefield);
- k++;
- }
- k = 0;
- countMine = count_mines(row , col - k, SQUARE_SIZE_REVEAL, minefield);
- // This reveals the radial to the left.
- while (countMine == 0 && col - k >= 0 && col - k < SIZE && k < SIZE ) {
- minefield[row][col - k] = VISIBLE_SAFE;
- if (count_mines(row , col - k - 1, SQUARE_SIZE_REVEAL, minefield) != 0) {
- minefield[row][col - k] = VISIBLE_SAFE;
- }
- countMine = count_mines(row , col - k, SQUARE_SIZE_REVEAL, minefield);
- k++;
- }
- k = 0;
- countMine = count_mines(row , col + k, SQUARE_SIZE_REVEAL, minefield);
- // This reveals the radial to the right.
- while (countMine == 0 && col + k >= 0 && col + k < SIZE && k < SIZE ) {
- minefield[row][col + k] = VISIBLE_SAFE;
- if (count_mines(row , col + k + 1, SQUARE_SIZE_REVEAL, minefield) != 0) {
- minefield[row][col + k] = VISIBLE_SAFE;
- }
- countMine = count_mines(row , col + k, SQUARE_SIZE_REVEAL, minefield);
- k++;
- }
- k = 0;
- countMine = count_mines(row - k, col + k, SQUARE_SIZE_REVEAL, minefield);
- // This reveals the radial to top right diagonal.
- while (countMine == 0 && col + k >= 0 && col + k < SIZE && k < SIZE
- && row - k >= 0 && row - k < SIZE) {
- minefield[row - k][col + k] = VISIBLE_SAFE;
- if (count_mines(row - k - 1, col + k + 1, SQUARE_SIZE_REVEAL, minefield) != 0) {
- minefield[row - k][col + k] = VISIBLE_SAFE;
- }
- countMine = count_mines(row - k, col + k, SQUARE_SIZE_REVEAL, minefield);
- k++;
- }
- k = 0;
- countMine = count_mines(row - k , col - k, SQUARE_SIZE_REVEAL, minefield);
- // This reveals the radial to top left diagonal.
- while (countMine == 0 && col - k >= 0 && col - k < SIZE && k < SIZE
- && row - k >= 0 && row - k < SIZE) {
- minefield[row - k][col - k] = VISIBLE_SAFE;
- if (count_mines(row - k - 1 , col - k - 1, SQUARE_SIZE_REVEAL, minefield) != 0) {
- minefield[row - k][col - k] = VISIBLE_SAFE;
- }
- countMine = count_mines(row - k, col - k, SQUARE_SIZE_REVEAL, minefield);
- k++;
- }
- k = 0;
- countMine = count_mines(row + k , col - k, SQUARE_SIZE_REVEAL, minefield);
- // This reveals the radial to bottom left diagonal.
- while (countMine == 0 && col - k >= 0 && col - k < SIZE && k < SIZE
- && row + k >= 0 && row + k < SIZE) {
- minefield[row + k][col - k] = VISIBLE_SAFE;
- if (count_mines(row + k + 1 , col - k - 1, SQUARE_SIZE_REVEAL, minefield) != 0) {
- minefield[row + k][col - k] = VISIBLE_SAFE;
- }
- countMine = count_mines(row + k, col - k, SQUARE_SIZE_REVEAL, minefield);
- k++;
- }
- k = 0;
- countMine = count_mines(row + k , col + k, SQUARE_SIZE_REVEAL, minefield);
- // This reveals the radial to bottom right diagonal.
- while (countMine == 0 && col + k >= 0 && col + k < SIZE && k < SIZE
- && row + k >= 0 && row + k < SIZE) {
- minefield[row + k][col + k] = VISIBLE_SAFE;
- if (count_mines(row + k + 1 , col + k + 1, SQUARE_SIZE_REVEAL, minefield) != 0) {
- minefield[row + k][col + k] = VISIBLE_SAFE;
- }
- countMine = count_mines(row + k, col + k, SQUARE_SIZE_REVEAL, minefield);
- k++;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement