DOS Roots Lab

Roulette, Rebuilt from 1995

This remake recreates one of my early Turbo Pascal projects as a browser terminal artifact, preserving the prompt-driven loop and the original bet-and-bank structure.

Run DOS Remake

The remake keeps command-first betting flow with Enter-driven prompts.

Commands: O/E/H/L/G bet mode, whole-dollar wager, 0-36 guess for G, Y/N replay, RESET restart.

P4CBF.EXE - Roulette (1995)
 
R:\>

Original Program Intent

P4CBF.PAS was a school-era exercise in structured Pascal: typed input, random number generation, branch-heavy payout logic, and persistent bank state.

The original ran in a text DOS console and asked the player to repeatedly bet, spin, and decide whether to continue.

Original Pascal Logic

From P4CBF.PAS (Turbo Pascal, 1995)

1) Bank Initialization

var
   Bank:real;
...
Bank:=1000;

2) Spin Generation (0 to 36)

procedure DoSpin(var Num:integer);
begin
   randomize;
   Num:=random(37);
end;

3) Win/Loss Branching

case Choice of
'O','o' : if Num mod 2=0 then
          Youlose(Bank,Bet)
          else YouWin(Bank,Bet);
'G','g' : if Num=Guess then
          YouWinBig(Bank,Bet)
          else YouLose(Bank,Bet);
end;
View longer 1995 source excerpt
procedure AdjustMoney(var Bank:real;Choice:char;Num,Guess:integer;Bet:real);
begin
  case Choice of
  'O','o' : if Num mod 2=0 then
            Youlose(Bank,Bet)
            else YouWin(Bank,Bet);
  'E','e' : if Num mod 2=0 then
            YouWin(Bank,Bet)
            else YouLose(Bank,Bet);
  'H','h' : if Num >=19 then
            YouWin(Bank,Bet)
            else YouLose(Bank,Bet);
  'L','l' : if Num >=19 then
            YouLose(Bank,Bet)
            else YouWin(Bank,Bet);
  'G','g' : if Num=Guess then
            YouWinBig(Bank,Bet)
            else YouLose(Bank,Bet);
  end;
end;

procedure SpinOnce(var Bank:real);
var
   Bet:real;
   Num:integer;
   Guess:integer;
   Choice:char;
   Choice2:char;
begin
  repeat
    GetBet(Bank,Choice,Guess,Bet);
    DoSpin(Num);
    AdjustMoney(Bank,Choice,Num,Guess,Bet);
    writeln('You still have $',Bank:2:2,' left!');
    readln(Choice2);
  until (Bank<=0) or (Choice2='N') or (Choice2='n');
end;

Developer Notes

What Stayed True

  • Starting bank of 1000 and spin range of 0 through 36.
  • Core bet modes: odd, even, high, low, exact number.
  • Payout model preserved: even money and 36:1 exact-number wins.

What Changed for Web

  • Browser DOS shell keeps terminal feel while improving readability.
  • Validation guardrails ensure legal bet amounts and number ranges.
  • RESET instantly replays the startup sequence without page reload.