The goal of this project was to write a Python module using the PostgreSQL database to keep track of players and matches in a game tournament that uses the Swiss Pairings System in each round. That means that players are not eliminated and each player should be paired with another player with the same number of wins, or as close as possible.
I defined the database schema and wrote the code to use it inside the project template that was given.
The project runs inside a Virtual Machine with Vagrant.
This is the fourth project submission for Udacity Full Stack Web Developer Nanodegree Program.
In order to run and make changes to this project, you'll need:
To run this project, make sure you have both Virtual Box and Vagrant installed on your machine. Also download this project to your local machine.
First of all, open the terminal
- Start the Virtual Machine:
cd project/vagrant
to get inside Vagrant project machine directoryvagrant up
to start Vagrantvagrant ssh
to start Ubuntu Machinecd /vagrant/tournament
to get inside project directory
- Create and connect to database:
psql
to start PostgreSQL\i tournament.sql
to run the sql script that creates all the tables and views\d
to see the elements creates
- Run the python script for testing:
\q
to exit PostgreSQLpython tournament_test.py
to run the script
Use the command psql tournament
to connect directly to the database again.
The files of the project are all inside the tournament folder. The other files are for the vagrant and virtual machine.
Understanding the project files:
tournament.py
This is the database module.
tournament.sql
This is the database schema with SQL commands. The script to create the database.
tournament_test.py
This is the test module. It contains all the functions to test the database module.