system "Oscars_Grind"
{
Oscar's grind - bets are made on Even money layouts
The layout is selected by the User when a New Session has started

When even or ahead, make a 5 unit flat bet
For each loss, keep bet the same as the last
For each win, make the same bet again + 1 unit - not to exceed loss of +1 unit
}
method "main"
begin
    While Starting a New Session
    begin
        Clear Record "Layout number" data;
        Clear Record "Baseline (high bankroll)" data;
        Clear Record "Amount behind (if any)" data;
        Clear Record "Layout selected" data;
        Put 5 on Record "Bet amount" data;
        Call "Input Layout";
        Call "Setup Layout";
    end

    //Keep track of high bankroll
    While Bankroll > Record "Baseline (high bankroll)" data
    begin
        Put 100% of Bankroll on Record "Baseline (high bankroll)" data;
    end
    
    //Calculate amount behind from high bankroll
    Put 100% of Record "Baseline (high bankroll)" data on Record "Amount behind (if any)" data;
    Subtract 100% of Bankroll on Record "Amount behind (if any)" data;
    Put 100% of the last Record "Layout selected" layout on Record "Layout selected" layout;
    Put 100% of Record "Layout selected" layout on Record "Bet amount" data;
    
    While Record "Layout selected" layout has won each time
    And  Record "Amount behind (if any)" data > 0
    And  Record "Amount behind (if any)" data < Record "Bet amount" data
    begin
        Put 100% of Record "Amount behind (if any)" data on Record "Layout selected" layout;
        Put 100% of Record "Layout selected" layout on Record "Bet amount" data;
    end
    
    While Record "Layout selected" layout has won each time
    And  Record "Amount behind (if any)" data > 0
    begin
        Add 1  on Record "Layout selected" layout;
    end
    
    While Record "Bet amount" data = 0
    Or Record "Amount behind (if any)" data <= 0
    begin
        Put 5  on Record "Layout selected" layout;
        Put 100% of Record "Layout selected" layout on Record "Bet amount" data;
    end
end

method "Input Layout"
begin
    Input Dropdown "Make a Layout Selection

              1:=Even
              2:=Odd
              3:=Red
              4:=Black
              5:=High (19-36)
              6:=Low (1-18)" to
              Record "Layout number" data;
end

method "Setup Layout"
begin
    While Record "Layout number" data = 1
    begin
        Copy Even to the Record "Layout selected" layout;
    end
    Else
    begin
        While Record "Layout number" data = 2
        begin
            Copy Odd to the Record "Layout selected" layout;
        end
        Else
        begin
            While Record "Layout number" data = 3
            begin
                Copy Red to the Record "Layout selected" layout;
            end
            Else
            begin
                While Record "Layout number" data = 4
                begin
                    Copy Black to the Record "Layout selected" layout;
                end
                Else
                begin
                    While Record "Layout number" data = 5
                    begin
                        Copy high to the Record "Layout selected" layout;
                    end
                    Else
                    begin
                        While Record "Layout number" data = 6
                        begin
                            Copy low to the Record "Layout selected" layout;
                        end
                    end
                end
            end
        end
    end
end
