r/learnpython • u/JarnePl • Jun 18 '20
Python projects for beginners
Hi! I just learned basic python syntax (watched a 4 hour long python tutorial playlist while also doing it myself), what would be some good beginner projects/ programs that i’d be able to make, and second of all, what can i learn next to become better at python?
449
Upvotes
13
u/dogs_like_me Jun 18 '20
You seem to be describing an algorithm for playing minesweeper. I'm talking about programming minesweeper. The game. This entails:
building a lattice of 'cell' objects, which will probably need attributes like n_neighboring_bombs, is_visible, is_flagged, is_bomb....
Visiting an empty cell should trigger a cascade which reveals all adjacent empty neighbors and the boundary non-empty neighbors (where 'non-empty' means it is bordering at least one bomb, so contains a numeric value). Probably wanna implement this as a graph traversal.
"double-clicking" a revealed, unflagged cell, should reveal it's neighbors, potentially triggering a cascade as above.
appropriately testing win/lose conditions.
possibly maintaining a database of high scores
possibly maintaining a database of save states
possibly presenting the user with a running timer
presenting a visual representation of the board
possibly representing the game with a proper GUI (native? webapp?)
...
There's really a lot you can do here. I like to use minesweeper as an exercise to get a tour of language features when I'm learning new tooling. I've coded it up in at least three languages now, two or three different ways just in python.