Original source downloaded from Vintage Basic
Conversion to Perl
This conversion consists of three files in 75_Roulette/perl/:
roulette.plis the port of the BASIC to Perl;roulette-test.tis a Perl test for correctness of display and payout;make-roulette-test.plgenerates 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.