system "Humble variation2 v1"
{
 Instructions:
}
method "main"
begin
    while starting a new session
    begin
        call "Initialize";
        exit;
    end

    call "Determine Win";

    copy last number to record "last number" layout;

    if Record "last number" layout has hit between 2 & 15 spins
    and flag "1st Bet" is false
    begin
        //we found the 1st duplicate in the last 15 spins

        //now get its neighbor on both sides.
        Locate Number Right 0 gaps of Last Number to record "Right Neighbor 1" Layout;
        Locate Number Left  0 gaps of Last Number to record "Left Neighbor 1" Layout;
        duplicate record "last number" record"Last number 2 Bet"
        //tell the system we are betting on the 1st set of numbers
        set flag "1st Bet" to true;
    end

    call "Make Bet";
end

method "Make Bet"
begin
    if flag "1st Bet" is true
    begin
        put 100% record"Progression"data on record "Right Neighbor 1" layout;
        put 100% record"Progression"data on record "Left Neighbor 1"  layout;
        put 100% record"Progression"data on  record"Last number 2 Bet" layout;
    end
end

method "Determine Win"
begin
    if Any Inside Bet has won each time
    begin
        call "Initialize";
        Exit;
    end

    if Any Inside Bet has lost each time
    begin
        if flag "1st Bet" is true
        begin
            add 1 record "Progression"data index
            if record "Progression"data index > record "Progression"data count
            begin
                put 1 record "Progression"data index
            end
        end
    end
end


method "Initialize"
begin
    // Set your PROGRESSION HERE
    set list of [1,1,1,1,1,1,2,2,2,2]record"Progression"data
    clear record "Right Neighbor 1" layout;
    clear record "Left Neighbor 1"  layout;
    set flag "1st Bet" to false;
end
