Develop a database schema to store details of a games matches between players. And write a Python module that uses the PostgreSQL database to keep track of players and matches in a game tournament.This game tournament uses the Swiss system for pairing up players in each round: players are not eliminated, and each player should be paired with another player with the same number of wins, or as close as possible.
- Download python on your computer;
- Download the following files: tournament.py, tournament_test.py and tournament.sql;
- Install the vagrant virtual machine on your computer.
- tournament.py : The python implementation of the swiss tournament.
- tournament.sql : SQL code that creates a tournament database with well designed tables and views.
- tournament_test.py : Contains some test cases for tournament.py.
- To run the Vagrant Virtual Machine, in the terminal use the command 'vagrant up' followed by 'vagrant ssh'. Once you have executed the vagrant ssh command, you can execute the command 'cd /vagrant' to change the directory to the folders where you store the downloaded module files;
- To build and access the tournament database, type 'psql' in the command line followed by '\i tournament.sql';
- To quit psql, type '\q' int the command line;
- Then in the terminal, type 'python tournament_test.py' to run the tests for the module tournament.py.
vagrant@vagrant-ubuntu-trusty-32:/vagrant/tournament$ python tournament_test.py
- Old matches can be deleted.
- Player records can be deleted.
- After deleting, countPlayers() returns zero.
- After registering a player, countPlayers() returns 1.
- Players can be registered and deleted.
- Newly registered players appear in the standings with no matches.
- After a match, players have updated standings.
- After one match, players with one win are paired.
- OMW is implemented correctly
- Success! All tests pass!
If you have any issues about this, please let me know. My email address is [email protected].