├── README.md ├── final-empty.php ├── final.php ├── index.html ├── play.php ├── round-empty.php └── template.php /README.md: -------------------------------------------------------------------------------- 1 | # JeoPHPardy 2 | 3 | This is a simple PHP/Javascript Jeopardy-like board that I've used to run some trivia games in the PHP community. 4 | 5 | It has suited my needs well, along with my [Wireless Eggspert buzzer system](http://www.amazon.com/Educational-Insights-Wireless-Eggspert-2-4G/dp/B001ZMZK7A/), and I've had requests that I publish the source, so that they could use it as well. I can't offer any guarantees that it'll work though, since I have put absolutely no work into making it work anywhere but on my computer and for my needs. 6 | 7 | If you end up using it and making any improvements, please consider sending me a PR. 8 | 9 | ## Requirements 10 | 11 | This is what I used to develop/run the game. It may work in other browsers or operating systems, but I have not tested it anywhere but my laptop. 12 | 13 | - Mac OS X Mavericks 14 | - Google Chrome (up-to-date) 15 | - PHP 5.4+ w/ built-in PHP server 16 | - Fonts (download, install, and license yourself) 17 | - [ITC Korinna Bold](http://www.fontpalace.com/font-details/Korinna+Bold/) 18 | - [Gyparody](http://www.1001fonts.com/gyparody-font.html) 19 | 20 | ## Features 21 | 22 | - Supports 5 categories 23 | - Supports 5 question levels (e.g., 200, 400, 600, 800, 1000) 24 | - Questions are loaded from a PHP array 25 | - Base score can be configured, so that Double Jeopardy rounds can be scheduled 26 | - Scoreboard with 6 players 27 | - Players can be named 28 | - On question screen, players can be given points (or have points taken away) 29 | by clicking on their name (or shift+clicking for negative). There is also a 30 | skull button which is used to reveal the answer if no player gets it correct. 31 | - There is one Daily Double randomly assigned to one of the $800 or $1000 32 | dollar questions. 33 | - Final Jeopardy is supported, but is a separate file. 34 | 35 | ## Limitations 36 | 37 | - There is always 6 players 38 | - There is always 1 Daily Double 39 | - I wrote this code quickly, and I'm not very good with JavaScript. 40 | - Don't refresh the page 41 | - Final Jeopardy is a separate file and does not hook into the scores at all. 42 | - No music or sound effects 43 | 44 | ## How to use 45 | 46 | First you must create a round using `empty-round.php` as a template. It looks 47 | like this: 48 | 49 | ```php 50 | 200, // Change this to adjust point values 52 | 'categories' => [ 53 | [ 54 | 'name' => 'xx', // e.g., Potent Potables 55 | 'questions' => [ 56 | [ 57 | 'question' => 'xx', //e.g., This is my name. 58 | 'answer' => 'xx', //e.g., What is Jeremy? 59 | ], 60 | [ 61 | 'question' => 'xx', 62 | 'answer' => 'xx', 63 | ], 64 | [ 65 | 'question' => 'xx', 66 | 'answer' => 'xx', 67 | ], 68 | [ 69 | 'question' => 'xx', 70 | 'answer' => 'xx', 71 | ], 72 | [ 73 | 'question' => 'xx', 74 | 'answer' => 'xx', 75 | ], 76 | ] 77 | ], 78 | // Repeated for each category... 79 | ``` 80 | 81 | Next, make sure `play.php` is set to load your round. 82 | 83 | ```php 84 | $game = include 'my-round.php'; 85 | include 'template.php'; 86 | ``` 87 | 88 | Then, start a PHP server in the directory containing the index.html, and go to 89 | it in your browser. Yay! 90 | 91 | ## Final Jeopardy 92 | 93 | To setup final jeopardy, create a file similar to my-round.php using final-empty.php as a template. 94 | Then load it up in final.php by referencing it: 95 | 96 | ```php 97 | $game = include 'my-final.php'; 98 | ``` 99 | 100 | Finally, load up final.php in your browser and click anywhere in the screen 101 | to proceed from category through to thanks. 102 | 103 | ## License 104 | 105 | The MIT License (MIT) 106 | 107 | Copyright (c) 2014 Jeremy Lindblom 108 | 109 | Permission is hereby granted, free of charge, to any person obtaining a copy 110 | of this software and associated documentation files (the "Software"), to deal 111 | in the Software without restriction, including without limitation the rights 112 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 113 | copies of the Software, and to permit persons to whom the Software is 114 | furnished to do so, subject to the following conditions: 115 | 116 | The above copyright notice and this permission notice shall be included in 117 | all copies or substantial portions of the Software. 118 | 119 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 120 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 121 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 122 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 123 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 124 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 125 | THE SOFTWARE. 126 | -------------------------------------------------------------------------------- /final-empty.php: -------------------------------------------------------------------------------- 1 | 'Hint to give before wagering', 5 | 'question' => 'Final JeoPHPary answer', 6 | 'answer' => 'Correct question', 7 | 'thanks' => 'Thanks!', 8 | ]; 9 | -------------------------------------------------------------------------------- /final.php: -------------------------------------------------------------------------------- 1 | 11 | 12 | 13 | HTTP Jeoparody 14 | 28 | 29 | 36 | 37 | $text) : ?> 38 | 39 | 40 | 41 | 42 |
43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | PHP Jeoparody 5 | 55 | 56 |
57 |

PHP Jeoparody

58 |

by Jeremy Lindblom (@jeremeamia)

59 | Jeoparody 60 | Final Jeoparody 61 |
62 | 63 | -------------------------------------------------------------------------------- /play.php: -------------------------------------------------------------------------------- 1 | 200, 3 | 'categories' => [ 4 | [ 5 | 'name' => 'xx', 6 | 'questions' => [ 7 | [ 8 | 'question' => 'xx', 9 | 'answer' => 'xx', 10 | ], 11 | [ 12 | 'question' => 'xx', 13 | 'answer' => 'xx', 14 | ], 15 | [ 16 | 'question' => 'xx', 17 | 'answer' => 'xx', 18 | ], 19 | [ 20 | 'question' => 'xx', 21 | 'answer' => 'xx', 22 | ], 23 | [ 24 | 'question' => 'xx', 25 | 'answer' => 'xx', 26 | ], 27 | ] 28 | ], 29 | [ 30 | 'name' => 'xx', 31 | 'questions' => [ 32 | [ 33 | 'question' => 'xx', 34 | 'answer' => 'xx', 35 | ], 36 | [ 37 | 'question' => 'xx', 38 | 'answer' => 'xx', 39 | ], 40 | [ 41 | 'question' => 'xx', 42 | 'answer' => 'xx', 43 | ], 44 | [ 45 | 'question' => 'xx', 46 | 'answer' => 'xx', 47 | ], 48 | [ 49 | 'question' => 'xx', 50 | 'answer' => 'xx', 51 | ], 52 | ] 53 | ], 54 | [ 55 | 'name' => 'xx', 56 | 'questions' => [ 57 | [ 58 | 'question' => 'xx', 59 | 'answer' => 'xx', 60 | ], 61 | [ 62 | 'question' => 'xx', 63 | 'answer' => 'xx', 64 | ], 65 | [ 66 | 'question' => 'xx', 67 | 'answer' => 'xx', 68 | ], 69 | [ 70 | 'question' => 'xx', 71 | 'answer' => 'xx', 72 | ], 73 | [ 74 | 'question' => 'xx', 75 | 'answer' => 'xx', 76 | ], 77 | ] 78 | ], 79 | [ 80 | 'name' => 'xx', 81 | 'questions' => [ 82 | [ 83 | 'question' => 'xx', 84 | 'answer' => 'xx', 85 | ], 86 | [ 87 | 'question' => 'xx', 88 | 'answer' => 'xx', 89 | ], 90 | [ 91 | 'question' => 'xx', 92 | 'answer' => 'xx', 93 | ], 94 | [ 95 | 'question' => 'xx', 96 | 'answer' => 'xx', 97 | ], 98 | [ 99 | 'question' => 'xx', 100 | 'answer' => 'xx', 101 | ], 102 | ] 103 | ], 104 | [ 105 | 'name' => 'xx', 106 | 'questions' => [ 107 | [ 108 | 'question' => 'xx', 109 | 'answer' => 'xx', 110 | ], 111 | [ 112 | 'question' => 'xx', 113 | 'answer' => 'xx', 114 | ], 115 | [ 116 | 'question' => 'xx', 117 | 'answer' => 'xx', 118 | ], 119 | [ 120 | 'question' => 'xx', 121 | 'answer' => 'xx', 122 | ], 123 | [ 124 | 'question' => 'xx', 125 | 'answer' => 'xx', 126 | ], 127 | ] 128 | ], 129 | ] 130 | ]; -------------------------------------------------------------------------------- /template.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | HTTP Jeoparody 5 | 38 | 39 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 125 | 126 | 127 | 128 | 129 |
$
130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 |
QUESTION
Player 1Player 2Player 3Player 4Player 5Player 6
145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 |
Player 1Player 2Player 3
$0$0$0
Player 4Player 5Player 6
$0$0$0
168 | 169 | 170 | 171 | 172 | 173 | 176 | 177 |
Daily Double
174 | $0 175 |
178 | 179 | --------------------------------------------------------------------------------