3 pointsby dawidg814 hours ago2 comments
  • DenisDolya18 minutes ago
    Nice start, but right now the program exits immediately because after selecting difficulty you just return from main. You never call initBoard() or displayBoard(), and there is no game loop (input -> update -> render). So there is no actual game yet.

    bombMap is filled with rand()%2, which means ~50% of tiles are mines and the `mines` variable is basically unused. That’s not Minesweeper, that’s Russian roulette. Better: clear bombMap first, then place exactly `mines` mines randomly without duplicates.

    tileMap is int, but you print it with putchar(). Zero prints nothing, so your board is mostly invisible. Either store ASCII chars ('#', '.', '', '1'..'8') or map numbers to chars when printing.

    Utils.hpp include guard is broken: you have #ifndef but no #define. So the guard does nothing. Add #define or use #pragma once.

    Utils::catchReturn() always returns 0, so errors are swallowed. You print “sending further” and then… don’t send anything further. Just return renum.

    In editDiff(), custom values are not validated. Width/height should be 1..32, mines < wh. Otherwise you can overflow your arrays.

    Also this line looks wrong: std::cout << Game::boardWidth; boardWidth is not static, and printing it there does nothing useful.

    Main advice: first make a minimal playable version: - select difficulty - initBoard() - displayBoard() - simple input loop - win/lose check

    No UI polish, no docs, just make it playable first. Then iterate.

    Just focus on making one complete working path instead of half-implemented features.

  • dawidg814 hours ago
    Hello.

    I make a implementation of minesweeper game in C++. I give link of the repository. Help with the project is appreciated, thank you.

    The minesweeper is not yet finished, I have only written basic functions for initializing and displaying the game. However none of these functions have been called anywhere in the code so far: if you choose difficulty in the executable, the program will immidiately exit.

    There is also documentation in progress. Any help with the documentation and/or source code will be appreciated.

    This is all about this project for now. I have other repositories on my GitHub account but I guess that minesweeper is the easiest one to be written for now. Other projects like Voxelint (supposed to be an SDL voxel renderer) are mostly abandoned for now because they are too hard to be written and implemented. I'm still kind of a beginner in C++ language.

    See you.

    dawidg81