system "MrMajik_Money_Mgmt_System"
{
 MrMajik's Money Management Strategy
}
method "main"
begin
    While Starting a New Session
    begin
        Call "Initialize";
        Call "Input Data";
        Call "Setup Layout";
        Call "Setup selected Units";
        Call "Do Bet";
        Exit;
    end
    
    Call "Check Win";
    Call "Do Bet";
end

method "Do Bet"
begin
    Put 100% of Record "Progression" data on Record "Actual Bet" data;
    Multiply By 100 % of Record "Press Mulitplier" data on Record "Actual Bet" data;
    Put 100% of Record "Actual Bet" data on Record "Current Layout to Bet" layout;
end

method "Check Win"
begin
    While Record "Current Layout to Bet" layout has won each time
    begin
        Call "Check Count";
        Return;
    end
    
    While Record "Current Layout to Bet" layout has lost each time
    begin
        Put 0 on Record "Win count" data;
        Put 1 on Record "Press Mulitplier" data;
        Call "Check Progression";
        Return;
    end
end

method "Check Count"
begin
    While Record "Win count" data = 0
    begin
        Add 1 on Record "Win count" data;
        Put 2 on Record "Press Mulitplier" data;
    end
    Else
    begin
        Put 0 on Record "Win count" data;
        Put 1 on Record "Progression" Data index;
        Put 1 on Record "Press Mulitplier" data;
    end
    
    Return;
end

method "Check Progression"
begin
    While Record "Progression" data <= record "Progression" data count
    begin
        Add 1 on Record "Progression" Data index;
    end
    Else
    begin
        Put 0 on Record "Win count" data;
        Put 1 on Record "Progression" Data index;
    end
    
    Return;
end

method "Setup Layout"
begin
    If Record "Current Layout to Bet" data = 1
    begin
        Copy Even to the Record "Current Layout to Bet" layout;
    end
    Else
    begin
        If Record "Current Layout to Bet" data = 2
        begin
            Copy Odd to the Record "Current Layout to Bet" layout;
        end
        Else
        begin
            If Record "Current Layout to Bet" data = 3
            begin
                Copy Red to the Record "Current Layout to Bet" layout;
            end
            Else
            begin
                If Record "Current Layout to Bet" data = 4
                begin
                    Copy Black to the Record "Current Layout to Bet" layout;
                end
                Else
                begin
                    If Record "Current Layout to Bet" data = 5
                    begin
                        Copy high to the Record "Current Layout to Bet" layout;
                    end
                    Else
                    begin
                        If Record "Current Layout to Bet" data = 6
                        begin
                            Copy low to the Record "Current Layout to Bet" layout;
                        end
                    end
                end
            end
        end
    end
end

method "Setup selected Units"
begin
    If Record "Minimum Bet" data = 1
    begin
        set list [1,2,3,4,5,6,8,11,15,20,26,35] to record "Progression" data;
        return;
    end

    If Record "Minimum Bet" data = 5
    begin
        set list [5,7,9,12,16,22,29,39,52,69,92,123] to
                                                    record "Progression" data;
        return;
    end

    If Record "Minimum Bet" data = 10
    begin
        set list [10,14,18,24,32,43,57,76,102,136,181,241] to
                                                    record "Progression" data;
    end
end

method "Input Data"
begin
    Group
    begin
        Input Dropdown "What Table Layout do you want to use?
                  
                  1:=European Layout
                  2:=American Layout" to Record "Table layout" data;
        Input Dropdown "Make a Layout Selection
                  
                  1:=Even
                  2:=Odd
                  3:=Red
                  4:=Black
                  5:=High (19-36)
                  6:=Low (1-18)" to Record "Current Layout to Bet" data;
        Input Data "Enter your starting Bankroll." to
                                                Record "Starting Bankroll" data;
        Input Dropdown "Minimum Bet
                  
                  1:=1 unit
                  5:=5 units
                  10:=10 units" to Record "Minimum Bet" data;
    end
    
    Put 100% of Record "Starting Bankroll" data on Bankroll;
    
    While Record "Table layout" data = 1
    begin
        Load Single Wheel;
    end
    Else
    begin
        Load Double Wheel;
    end
end

method "Initialize"
begin
    Clear Record "Progression" data;
    Clear Record "Win count" data;
    Clear Record "Table layout" data;
    Clear Record "Minimum Bet" data;
    Clear Record "Current Layout to Bet" data;
    Clear Record "Starting Bankroll" data;
    Clear Record "Press Mulitplier" data;
    Clear Record "Actual Bet" data;
    Put 1 on Record "Progression" Data index;
    Put 1 on Record "Press Mulitplier" data;
end


