|Sebastian Lohff 936c98da86 Buttonserver (Telnet Buttons!)||5 years ago|
|extra||5 years ago|
|questions||6 years ago|
|.gitignore||6 years ago|
|Readme.md||5 years ago|
|buttonreader.py||5 years ago|
|config.py||6 years ago|
|game.py||5 years ago|
|gamestate.py||6 years ago|
|music.py||6 years ago|
|player.py||6 years ago|
|question.py||5 years ago|
|seopardy.conf.dist||6 years ago|
|seopardy.py||5 years ago|
|video.py||5 years ago|
|windows.py||5 years ago|
Seopardy is an implementation of the game “Jeopardy” and a reimplementation/clone of the software “beopardy”, mostly known for being used in the Chaos Communication Congress Hacker-Jeopardy.
To run this software you need:
To play a game I recommend:
The game needs questions to run the game. A question file is a yaml-file containing either all questions or a link to the respective files containing said questions.
The top-level question file contains two keys:
Name: Round 2 Sections: - test.q - cpu.q - extra/foo.q - xkcd.q
A question file containing sections can contain an arbitrary number of sections. Each section needs to have exactly five questions. A question can have the following keys:
Five Types of question are supported:
- Section: Test Questions: - Name: Question 1 Question: This text is displayed Answer: This is never displayed, only for you to remember the answer Type: Text - Name: Question 2 Question: path/to/test.png Answer: Bar Type: Image ...
To prevent you from losing the current gamestate in case of a crash, seopardy saves its interal state as a yaml file after each question. You can specify a directory where the gamestates are stored in the config file and load a state with the --gamestate parameter.
To get the input from a button (aka “the outside world”) into the game, two classes are available:
Fifo creates a fifo in your local filesystem, first argument being the path to where the fifo should be created. To emit a button press you can simply write an ASCII-number into the fifo, corresponding to the player which pressed a button. All other characters are ignored.
Serial reads from a serial device using pyserial. Parameters are path to the device, baudrate (default 9600), parity (default N) and stop-bits (default 1). As with the fifo, an ASCII-number for the player which pressed a button is expected. All other characters are ignored.
Writing an own class for player input should be fairly easy. Within its own thread the class can do whatever it wants (including blocking I/O). When it wants to signal a button was pressed it just needs to emit a ButtonEvent. An input class has two functions which are called while a question is on display:
buzzersOpen(isOpen) is called, when the question is first displayed,
when the question is reopened after a false answer, when the question is
closed after either a correct answer or no answer at all or when a
button for an unknown player was submitted.
playerGotQuestion(playerNo) is called, whenever a player pressed
their button and got the turn to answer. Note that no extra
buzzersOpen(False)) event is sent, when a button