system "Playing_Roulette_as_a_Business_System"

{System taken from a book titled "Playing Roulette as a Business"
 by R.J. Smart
 This is his first system example which bets on numbers that are run consecutively
 together on an American Wheel.

 The betting progression uses a smooth easy progression: 1,1,1,2,4,6,8,16,32
 It takes advantage of the sucker bet (0,00,1,2,3) which pays 6:1.
}
method "main"
begin
    While Starting a New Session
    begin
        Call "Initialize";
        Call "Select Input Information";
        Call "Make Bets";
        exit;
    end
    
    Call "Determine Win";
    Call "Determine Loss";
    Call "Check Bankroll";
    Call "Check Win Goal";
    Call "Check Loss Goal";
    Call "Check Sequences";
    Call "Make Bets";
end

method "Determine Loss"
begin
    While Line(1-00) has lost each time
    And  Line(7-12) has lost each time
    And  Line(25-30) has lost each time
    begin
        Add 1 on Record "Progression list" data index;
        Call "Check Progression";
    end
end

method "Determine Win"
begin
    While Line(1-00) has won each time
    Or Line(7-12) has won each time
    Or Line(25-30) has won each time
    begin
        Put 1 on Record "Progression list" data index;
    end
end

method "Check Bankroll"
begin
    Put 100 % of Record "Progression list" data on Record "Temp Storage" data;
    Multiply 3 on Record "Temp Storage" data;
    
    While Bankroll < Record "Temp Storage" data 
    begin
        Display "Bankroll has been depleted. Session will End";
        Stop Session;
    end
end

method "Check Progression"
begin
    While Record "Progression list" data index> 10
    begin
        Display "Maximum Betting Progression Exceeded.  Session will End";
        Stop Session;
    end
end

method "Check Sequences"
begin
    While Record "Total number of Sequences" data >= Record "Number of Sequences" data
    And  Record "Number of Sequences" data not = 0
    begin
        Display "Maximum Number of Sequences Exceeded.  Session will End";
        Stop Session;
    end
end

method "Check Win Goal"
begin
    While Bankroll >= Record "Total Win Goal Balance" data
    And  Record "Win Goal" data not = 0
    begin
        Add 1 on Record "Total number of Sequences" data;
        Put 100 % of Bankroll on Record "Total Win Goal Balance" data;
        Add 100 % of Record "Win Goal" data on Record "Total Win Goal Balance" data;
    end
end

method "Check Loss Goal"
begin
    While Bankroll <= Record "Total Loss Goal Balance" data
    And  Record "Loss Goal" data not = 0
    begin
        Add 1 on Record "Total number of Sequences" data;
        Put 100 % of Bankroll on Record "Total Loss Goal Balance" data;
        Subtract 100 % of Record "Loss Goal" data on Record "Total Loss Goal Balance" data;
    end
end

method "Make Bets"
begin
    Put 100 % of Record "Progression list" data on Line(1-00);
    Put 100 % of Record "Progression list" data on Line(7-12);
    Put 100 % of Record "Progression list" data on Line(25-30);
    
    //if minimum unit is greater than 1, then adjust bet
    if Record "Minimum Unit" data > 1 then
    begin
        Multiply 100% of record "Minimum Unit" data to Line(1-00);
        Multiply 100% of record "Minimum Unit" data to Line(7-12);
        Multiply 100% of record "Minimum Unit" data to Line(25-30);
    end
end

method "Select Input Information"
begin
    put 100% of bankroll on record "Starting Bankroll" data;
    
    Group
    begin
        Display "This is played on American Wheel only.
                  
                  Session will END when one of the following has occurred:
                  
                  1. Total Sequences met.
                  2. Maximum Progression bet reached.
                  3. Bankroll is depleted.";

        Input Data "What is your starting Bankroll?" to Record "Starting Bankroll" data;
        Input Data "How many Sequences for this Session?
                  Note: 0 = unlimited sequences." to Record "Number of Sequences" data;
        Input Data "What is your starting Bet Unit?" to Record "Minimum Unit" data;
        Input Data "What is your WIN goal for each Sequence?
                  0=unlimited win goal" to Record "Win Goal" data;
        Input Data "What is your Loss goal for each Sequence?
                  0=until Bankroll is gone" to Record "Loss Goal" data;
    end
    
    Put 100 % of Record "Starting Bankroll" data on Bankroll;
    Put 100 % of Record "Starting Bankroll" data on Record "Total Loss Goal Balance" data;
    Put 100 % of Record "Starting Bankroll" data on Record "Total Win Goal Balance" data;
    Add 100 % of Record "Win Goal" data on Record "Total Win Goal Balance" data;
    Subtract 100 % of Record "Loss Goal" data on Record "Total Loss Goal Balance" data;
end

method "Initialize"
begin
    Load Double Wheel;
    set list [1,1,1,2,4,5,8,16,32] to Record "Progression list" data;
    Put 1 on Record "Progression list" data;
    Clear Record "Win amount above starting Bankroll" data;
    Clear Record "Target Win goal before Session Ends" data;
    Clear Record "Starting Bankroll" data;
    Clear Record "Win Goal" data;
    Clear Record "Loss Goal" data;
    Clear Record "Minimum Unit" data;
    Clear Record "Number of Sequences" data;
    Clear Record "Total Win Goal Balance" data;
    Clear Record "Total Loss Goal Balance" data;
    Clear Record "Total number of Sequences" data;
    Clear Record "Temp Storage" data;
    Set Flag "Session Ended" to false;
end
