Files
Martin Thoma e64fb6795c MAINT: Apply pre-commit
Remove byte-order-marker pre-commit check as there would be
many adjustments necessary
2022-03-05 09:29:23 +01:00
..
2022-01-11 17:00:28 -05:00
2022-01-11 17:00:28 -05:00
2022-03-05 09:29:23 +01:00

Original source downloaded from Vintage Basic

Conversion to Perl

This conversion consists of three files in 75_Roulette/perl/:

  • roulette.pl is the port of the BASIC to Perl;
  • roulette-test.t is a Perl test for correctness of display and payout;
  • make-roulette-test.pl generates roulette-test.t from roulette.bas.

The ported version of the game numbers the slots from 0 rather than 1, and uses a dispatch table to figure out the payout.

The Perl test loads roulette.pl and verifies the Perl slot display and payout logic against the BASIC for all combinations of slots and bets. If any tests fail that fact will be noted at the end of the output.

The test code is generated by reading the BASIC, retaining only the slot display and payout logic (based on line numbers), and wrapping this in code that generates all combinations of bet and spin result. The result is run, and the result is captured and parsed to produce roulette-test.t. make-roulette-test.pl has some command-line options that may be of interest. --help will display the documentation.