Develop a database schema to store details of a games matches between players.
Then write a Python module to rank the players and pair them up in matches in a tournament.
tournament.py
Contains the implementation for the Swiss tournament
tournament.sql
Contains the SQL queries to create the database, tables and views
tournament_test.py
Contains the test cases for tournament.py
- Start Vagrant
- Open Terminal or cmd and browse to the vagrant folder
- Type
vagrant up
- SSH in to the vagrant VM
- In the same terminal type
vagrant ssh
- Change to the correct folder
- Type
cd /vagrant/tournament
- Open PSQL and run the tournament.sql
- type
psql
- type
psql -f tournament.sql
in terminal to import the tournament database - type
\q
to quit out of PSQL - Run the tests
- In the terminal type
python tournament_test.py
Success! All tests pass!
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.
Success! All tests pass!