explicitClick to confirm you are 18+

Coding Munchkin to learn Python

BunjamanDec 21, 2019, 12:50:04 PM
thumb_up22thumb_downmore_vert


Introduction

As I've posted about earlier, through my education in Business Economics and IT, I'm learning to code Python. In case you don't know what Python is, it's basically just another coding language that some say is the easiest to learn. My semester is essentially up, apart from the semester exam, which has given me a bit of spare time to get ahead for the next semester. Of course that's not the reason I'm doing this, I actually do want to become better at coding so I might actually get to use it in the future.
I figured the best way to learn to code is to have a goal in mind. For example in our prep for the exam we needed to code an app, I single-handedly did that and I learned so much from it. But I think I can learn even more if it's a thing I'm a) passionate about and b) not constrained by some arbitrary rules. To me, this project will become my playground to explore different aspects of coding. 
I picked one of my favorite board games to turn into a "video game" using Python, Munchkin. Of course the game I picked should be simple as I'm still just a beginner. The game itself is quite simple: You have cards in your hand, taken from two piles, chests and door cards. You knock on the door, if it's a monster you fight it, if you are more powerful you, defeat it, you get the loot and on to the next player. This is of course a rather simplified version of what the game actually is. If you don't know the game you can click here to see a group of people playing it (the same I used as the banner for this blog)

Progress

This part I will update whenever I've made progress. I think this blog post will work as a timeline to quickly get an overview of the progress I'm making, and then there will be a new full blog for each entry where I address the updates. I use my date code, sorry if that confuses you but it's dd-mm-yyyy 

The beginning (21-12-2019)

I don't know much about a good workflow in Python, or how others do it. I know I could draw some UML diagrams but I frankly just wanted to get started with something. I've hashed out the basic idea of how I think it's going to work. To view full click here.

Snippet of the code from the first day

Leveling up and winning the game (23-12-2019)
A simple yet more complicated than I anticipated task to make you level up when defeating a monster and once level 10 is hit you win the game and the program ends. To view full click here.

The code that gave me a lot of trouble