In this post I’m sharing with you the first game I ever programmed using Python. It is quite simple and there’s unfortunately no graphical user interface (I’ve been too lazy to built it…). What this means is that if you want to run the program , there’ll be no executable (.exe) file to do so. I’ll explain it better further ahead. The game consists of a tiny set of rules:
• Each player adopts the role of a protein activator or inhibitor
• Activated proteins are RED and inactivated proteins are GREEN
• Proteins can reverse the state of different-colored proteins, if the latter are framed by the former
• The goal of the game is to get the highest possible number of active or inactive proteins, i.e, to reverse the color/state of the highest amount of proteins of the opponent. This gives the final scoring points.
• The game ends when there are no more possible moves for a player.
I thought about sharing this with you, because I believe some of you might be interested in this sort of things and because I’m pretty proud of this tiny accomplishment. Also, it’s a pretty nice game to play if you’re really really bored. Below I will share a link to a google drive containing two files: 1) a python (.py) file and 2) a pdf file containing an explanation on how to run the game.
If you’re interested in playing the game this is how you do it: first, make sure you have a unix operating system available (e.g., ubuntu, debian). If not, I think I may be able to change it to run on Windows, but I’m a bit lazy to do so and I loathe Windows at the moment. After this step, create a folder and place the python file inside it > Open a command line terminal (in ubuntu you press ctrl + alt + t, for example) > write cd [path to file] (e.g., cd /home/Documents/python_game. Please, take into account this is a relative path and it will depend on how YOU have named the folder!).
Now you should be inside the folder containing the file. To run the game you must have Python 2.7 installed (don’t install newer versions, because they changed some useless things and it probably won’t run). After you’ve installed Python just write in the command prompt python moriarty_final.py. Don’t forget you need to be inside the folder that contains the file!
Now you can enjoy the game, by playing against the computer (I coded it to be pretty smart and I have a hard time beating it myself even though I know what the algorithm is doing so, good luck ahah) or against another player in the same computer =)
I hope you’re able to set it up, but if not and if you’re interested in this, please write me and I’ll try to help you out ^_^
Here is the link: https://drive.google.com/open?id=0B2szTQBTbCutZ0tYX0dkdVI4NkE