Thread: Minesweeper adjacent mines with one dimensional array?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Feb 2013
    Location
    Sweden
    Posts
    171

    Question Minesweeper adjacent mines with one dimensional array?

    So I've searched around the internet for a way to check for adjacent mines. And a lot of algorithms for it do exist out there. The thing is
    that all of the solutions that I've encountered for the algorithm is using a two dimensional array while I want to use a one dimensional array.

    I will create my array and initialize 10 mines at random positions. Then I want to count the mines around these squares that are initialized to 0.

    So the solutions out there for two dimensional arrays work, but how would I go with a one dimensional array?

    Also consider that I don't take in x and y coordinates in the function that creates the board.

    So I would need some tips or refering for who to do this.
    Thanks in advance!

    Research links:
    Simple Minesweeper [C] -- Kinda eh..

    Implementation of Minesweeper Game - GeeksforGeeks
    Last edited by DecoratorFawn82; 10-05-2018 at 02:09 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 5
    Last Post: 06-19-2017, 04:46 AM
  2. Assigning One dimensional array to two dimensional array
    By lightning_star in forum C Programming
    Replies: 1
    Last Post: 03-19-2014, 09:44 PM
  3. Replies: 12
    Last Post: 09-02-2013, 07:50 PM
  4. Replies: 4
    Last Post: 09-02-2013, 11:19 AM
  5. Land Mines
    By vasanth in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 02-19-2003, 12:00 PM

Tags for this Thread