A redevelopment of Noisy's original code.
MotoGO Bidding is intentionally built as a small, traditional PHP application.
The project favours explicit, easy-to-follow code over frameworks and architectural abstraction. Where practical, each page consists of one PHP file and one corresponding Mustache template. Reusable behaviour is kept in small application classes, SQL remains explicit, and external Composer dependencies are kept to a minimum.
When choosing between two reasonable implementations, prefer the one that can be understood by reading the relevant PHP file and template from top to bottom.
Modern security practices are still expected; simplicity should not come at the expense of security.
For each event:
- Each player must bid on exactly three riders.
- A bid may be any whole number of points, including zero.
- The total of a player's three bids cannot exceed their current balance.
- The highest bid for a rider wins that rider.
- If two or more players tie for the highest bid, they all win that rider.
- Only winning bids are deducted from a player's balance. Losing bids cost nothing.
- Players may change their bids while bidding remains open.
- Bids are hidden from other players until bidding is resolved. Winning bids are then visible to everyone.
- Bidding closes at a lockout time selected for the event.
After bidding closes, the total points pool for the event is calculated from all winning bids:
points pool = sum of all winning bids + number of winning bids
Each winning bid therefore adds one new point to the game economy.
For example, if two players both make a winning bid of 5 points on the same rider, both winning bids are included in the pool:
5 + 5 + 2 = 12 points
The points pool is distributed according to the finishing positions of the riders won by players.
| Position | Payout |
|---|---|
| 1st | 23% |
| 2nd | 18% |
| 3rd | 15% |
| 4th | 12% |
| 5th | 11% |
| 6th | 8% |
| 7th | 7% |
| 8th | 6% |
Only riders finishing in the top eight receive a payout.
Fractional payouts are rounded up to the next whole point.
Payout percentages are based on actual race finishing positions. If no player wins a rider finishing in a payout position, that share of the points pool is not distributed. Unused points are not carried forward or redistributed. Only the first eight payout positions receive points.
If multiple players tie for the highest bid on the same rider, each tied bid is a winning bid:
- Each winning bid is deducted from its player's balance.
- Each winning bid is included separately when calculating the points pool.
- Each winning bidder receives the full payout percentage for the rider's finishing position.
For example, if two players jointly win a rider that finishes first, each receives 23% of the points pool.
A rider finishing second still pays 18%, regardless of how many players jointly won the first-place rider.
Each player's payout is rounded up to the next whole point. Total payouts may exceed the points pool when multiple players win the same rider.
Install the prerequisites of PHP, SQLite, and Composer.
# update the machine
sudo apt-get update && sudo apt-get -y upgrade
# install php and sqllite and composer
sudo apt install php-cli php-sqlite3 sqlite3 composer
# optional GUI SQLite browser
sudo apt install sqlitebrowserClone the repo.
git clone https://github.com/eggplantpasta/motogp.git
cd motogpRun the scripts that install the defined dependencies via composer, create local config files based on the examples, and start the local PHP server.
bin/install-local.sh
bin/serve-local.shGo to the website homepage.
This project supports both application-level and OS-level log rotation.
- App-level rotation (Monolog):
Configure
log.daysin yourconfig/app.ini.
[log]
path = "{{ROOT_DIR}}/var/log/app.log"
level = "info"
days = 30- OS-level rotation (logrotate):
Install the provided config for
php_error.log:
sudo cp bin/logrotate-motogp.conf /etc/logrotate.d/motogp
sudo logrotate -d /etc/logrotate.d/motogpThe default policy in bin/logrotate-motogp.conf rotates daily, keeps 30 days, and compresses older php_error.log files.
Note: app logs are date-rotated by Monolog (app-YYYY-MM-DD.log) using log.days.
The repository includes configuration for the formatting and static-analysis tools used during development.
When the repository is opened in VS Code, install the extensions suggested by .vscode/extensions.json. The workspace settings in .vscode/settings.json configure formatting on save for PHP, JavaScript, and Mustache templates, and enable PHPStan using the project configuration.
The recommended extensions include:
- PHP CS Fixer for PHP formatting;
- PHPStan for PHP static analysis;
- Mustache language support;
- Prettier for JS and Mustache formatting
- SQLite support; and
- EditorConfig support.
Prettier is used as the formatter for JavaScript and Mustache files.
PHP development tools are installed through Composer; JavaScript and Mustache development tools are installed through npm:
composer install
npm installBefore committing a significant change, the useful verification pass is:
composer format-check
composer analyse
npm run format-checkBuilt using PHP, SQLite, vanilla JavaScript, Mustache templates, and semantic HTML.
Made pretty using Pico CSS, Lucide Icons, Font Awesome, and Michroma from Google Fonts.