system "Moch Even Money ver. alpha 1"
{
*************************************
System based on Ion Saliu's theories
        www.saliu.com
        on the VIP Lounge
      Roulette Extreme Code
      by Moch on 2007-01-26
*************************************


}
method "main" begin
    // start up
    while starting new session begin
        Clear all records
        call "Init"
        call "WheelType"
        exit
    end

    // count spins
    add 1 record"TotalSpins" data

    // act on a loss
    if net < 0 begin
        add 1 record"Progression"data index
        if record"Progression"data index>record"Progression"data count begin
            put 1 record"Progression"data index
        end
        if number 0 hit each or number 00 hit each begin // alters the bet scheme, start from scratch
            if flag "LLsBet" true begin
                put 0 record"LLs"data
                set flag "LLsBet" false
            end
            if flag "WsBet" true begin
                put 0 record"Ws"data
                set flag "WsBet" false
            end
        end
    end

    // act on a win
    if net > 0 begin
        put 1 record"Progression"data index
        set flag "qualified" false
    end

    if record"TrackOptions"data = 1 or record"TrackOptions"data = 3 begin
        call "Track LLs"
    end
    if record"TrackOptions"data = 2 or record"TrackOptions"data = 3 begin
        call "Track Ws"
    end

    // act when not qualified
    if flag "qualified" false begin
        if flag "WsBet" true or flag "LLsBet" true begin
            copy red record"BetLayout"layout
            set flag "qualified" true
        end
    end

    // act when  qualified
    if flag "qualified" true begin
        if flag "BetWarning" true begin
            Display "Time to bet !"
        end
        put 100% record"Progression"data record"BetLayout"layout list
        set flag "qualified" false
    end
    clear record"BetLayout"layout
end

// Methods
method "Track Ws" begin
    // reset on a win
    if net > 0 begin
        put 0 record"Ws"data
    end
    set flag "WsBet" false
    //track
    if red hit exactly 1 times in a row begin // consecutive
        add 1 record"Ws"data
    end
    if red hit more than 1 times in a row begin // not consecutive
        put 0 record"Ws"data
    end
    // not consecutive, zeroes disrupt most of the time
    // TO-DO: Red-0-Red is a valid combination ???
    if number 0 hit each or number 00 hit each begin
        put 0 record"Ws"data
    end
    if record"Ws"data > record"SetsOfWs"data begin
        if red hit exactly 1 time in a row begin
            set flag "WsBet" true
        end
    end
end

method "Track LLs" begin
    // reset on a win
    if net > 0 begin
        put 0 record"LLs"data
    end
    set flag "LLsBet" false
    // track
    track last red-black for 3 spins to record"RBR"layout
    if record"LLs"data < record"SetsOfLLs"data begin
        if black hit at least 2 times in a row begin // consecutive
            add 1 record"LLs"data
        end
        if list[red,black,red]has a pattern match record"RBR"layout begin
            put 0 record"LLs"data
        end
    end

    if record"LLs"data > record"SetsOfLLs"data begin
        if red hit at least 1 times begin
            add 1 record"LLs"data
        end
    end
    if number 0 hit each or number 00 hit each begin
        put 0 record"LLs"data
    end
    if record"LLs"data >= record"SetsOfLLs"data begin
        if black hit at least 1 times in a row begin
            set flag "LLsBet" true
        end
    end

end

method "Init" begin
    set list [1,2,4,8,16,32,64,128,256,512] record"Progression"data
    // defaults
    put 1 record"Spins"data
    put 0 record"TotalSpins"data
    put 2 record"SetsOfLLs"data
    put 2 record"SetsOfWs"data
    // Input
    group begin
        display "System ...."
        display "by moch, based on Ion Saliu's theories"
        display "for even money bets. This version works with Red&Black"
        display "00 - compatible (hi talesman :)"
        input dropdown " Wheel Type ?
            1:= Single Zero
            2:= Double Zero " record"Wheel"data
        input dropdown " Tracking options
            1:= Track LLs only
            2:= Track Ws only
            3:= Both simultaneously" record"TrackOptions"data
        input data "Bet after(x)set of LLs" record"SetsOfLLs"data
        input data "Bet after(x)set of Ws" record"SetsOfWs"data

        input checkbox "Warn me if is time to bet" flag "BetWarning"
    end
    // flags
    set flag "qualified" false
    set flag "LLsBet" false
    set flag "WsBet" false
    set flag "Continue" false
    set flag "Continue1" false
    // assign
end

method "WheelType" begin
    if record"Wheel"data=1 begin
        Load Single Wheel
    end
    else begin
        Load Double Wheel
    end
end
