Pelita is an "Actor-based Toolkit for Interactive Language Education in Python", or put simply: it is a Pac-Man like game. The game was created for an Advanced Scientific Python summer school, and we are going to use it as well.
In the last weeks of this semester, I will ask you to work in team and code a player for this game. The last Tuesday of the semester will be "Pelita contest day", where all teams will play against each other in a friendly competition.
The specific objectives of this exercise are:
As you are going to see, it is possible to write simple to (very) complex strategies for your players. You should not try to develop the "best" strategy from scratch but rather advance in smaller steps. Also, you should know when to stop: I don't expect you to create the best players ever, nor do I expect you to spend all your time on this. Try to avoid bugs, try to develop simple but clever players, and have fun!
The Pelita game is not graded and the outcome of the contest has no influence whatsoever on your final grade: we are using this game to spend the last couple of weeks doing something different with our programming skills.
The Pelita developers write it this way:
We expect you to try out the techniques, and evaluate what is feasible and what not, what helps you being more efficient at writing reliable code, and what feels like a hindrance instead. By doing this in the group we expect you to profit from the experience of other students, and, by explaining to other students your own experiences, to become more aware of what is it that you already master and what is it that you still have to learn.
Write tests for the part of your code which are testable, decide what parts you can test, what parts you should test, what parts you must test, and also what parts can not be tested.
The idea of the group project is not to write the most powered bots! Remember that and don't get carried away by the competition :)
A final remark: someone wrote to me on the semester evaluation that they did not participate in Pelita because: "I am not into computer games at all" (quote). I don't really care if you don't want to invest time in the game, but this argument really is a bad one: Pelita may be a computer game, but the true game here is to use coding to build something that moves and does stuff (a little bit like legos ;).
We will go into more details about the game next week. For this week, I'm only asking you to get the game to work in your laptop (if you are using the university computers, just make sure that the game runs for you by starting at "Download the demo players and test the game").
In your conda environment, install pelita with:
$ pip install pelita
Note: users of conda on macOS, please watch out for bug https://github.com/ContinuumIO/anaconda-issues/issues/11165. If this occurs, do a conda install tk=8.6.7
before running Pelita. This is only needed on macOS!
To run your first game, simply call $ pelita
from the command line!
Fortunately, you won't have to start from scratch: you have access to a number of simple "demo players", each illustrating a possible "strategy" for your own player.
Download the demo players from this repository: https://github.com/ASPP/pelita_template
Unzip the file somewhere where you will find it again, and from the command line and in the pelita_template
folder, type:
$ python -m pytest
You should see an output similar to:
[c7071047@zid-desk pelita_template]$ python -m pytest
============================= test session starts ==============================
platform linux -- Python 3.7.3, pytest-5.3.0, py-1.8.0, pluggy-0.12.0
rootdir: /home/c7071047/Documents/pelita_template
collected 16 items
test_demo01_stopping.py ... [ 18%]
test_demo02_random.py .. [ 31%]
test_demo03_smartrandom.py .... [ 56%]
test_demo04_basic_attacker.py ... [ 75%]
test_demo05_basic_defender.py ... [ 93%]
test_demo09_polite_random.py . [100%]
============================== 16 passed in 1.35s ==============================
You are now ready to go!
The documentation of the game is displayed in the pelita template repository: https://github.com/ASPP/pelita_template. Skim through the first sections of the documentation, until "unit testing".
Now:
Back to the table of contents.