The instructions for this project were simply to choose one of the ideas from the list and implement it. I chose minesweeper and this is my attempt to do that. I spent some time playing the original and tried to mimic its behavior as closely as possible in a text-based format. I would appreciate any and all comments on my implementation, but please bear in mind that this was an assignment for a CS101 course! My strategy was to create two classes: one for the master game board that would be populated at the beginning of the game with the locations of the mines, and another to manage the user board. A user_board object takes a game_board object as an argument to its constructor, and holds all of the choices that the user makes throughout the game. This is the board that is displayed to the screen. This was also my first time using GitHub for version control, I’m hoping that the link works properly.
This is awesome man! you’ve done well, I downloaded and had a little play, it ran smoothly with just the one exception of: 'clear' is not recognized as an internal or external command, operable program or batch file
showing up after every command, but besides that, the layout and the code looks good.
Unfortunately, I can’t even remember how to play minesweeper it’s been decades since I’ve played it, but kind of made me want to pick it back up again. Good job! I hope you’ll give us some feedback on my blackjack game.
Hey thanks for giving the game a try. Can I ask what platform and terminal you played it on? The clear command was giving me trouble. I’m on windows and that command seems to work for the git bash terminal but not for the terminal in vs code. Ill revisit that issue later today and take a look at your blackjack game too!
When I was trying to figure out how to do screen clearing, I came across this:
from os import system, name
def clear():
# for windows
if name == 'nt':
_ = system('cls')
# for mac and linux(here, os.name is 'posix')
else:
_ = system('clear')
I’ve been meaning to try to find out why it uses underscore in _ = system('cls')
I had originally done something similar, but found that ‘cls’ worked for the vs code terminal but not the git bash terminal, where ‘clear’ was required. I’m still not sure if there’s a universal way to handle this or if I have to choose the terminal and set the game up to be played there?
I tried it out in windows terminal from the Microsoft power tools pack, it’s similar to powershell. I had vs code but I thought it be just as easy load up in that, I’ll give it a try in a different terminal and see how it goes. Still some excellent coding though! I’ll be picking it apart later to see how you did things haha