system "untitled"
{
  List of Commands (Condition and Action statements)
  Press 'F2' to start the list.  After each keyword, pressing 'F2' again
  will result in statement completion.

  For example: Put 5 units on (press 'F2' here will give you a list of layouts)

  Autocompletion Templates
  Press 'F6' to bring up a dialog box showing a list of autocompletion templates
  that are defined by you.  Some pre-built templates are also include.  To make
  changes to these templates, select 'Options/Editor Options (Ctrl-F3) and then
  select the Auto Completion' tab.  To add templates to the system editor, press 'F6'
  or type the template name (i.e. fstart) and press 'Ctrl-J' key.

  For help on any keyword, condition, action or identifiers, press 'F1' after
  you mouse-click on the word.

  This comment section has been created using Auto Completion.
  The name is called "default".  To make modifications, select 'Options/Editor Options
  (Ctrl-F3) and then select the Auto Completion' tab.
}
method "main"
begin
// section 1: do this once
while starting new session
begin
call "init"
exit
end

// section 2: do the tracking
track last number for 1 time record"last#"layout
track last number for 6 times record"last6#"layout

add 100% net record"total loss"data
if record"total loss"data > 0
begin
put 0 record"total loss"data
end

//eliminate numbers above 6 bets
clear record"temp1"layout
clear record"temp2"data
put 1 record"play"layout index
loop until record"play"layout index > record"play"layout count
begin
put 100% record"play"layout index record"#spins"data index
if record"#spins"data < 6
begin
copy record"play"layout record"temp1"layout
add 1 record"temp1"layout index
put 100% record"#spins"data record"temp2"data
add 1 record"temp2"data index
end
add 1 record"play"layout index
end
duplicate record"temp1" record"play"
duplicate record"temp2" record"#spins"

if record"play"layout count < 1 and flag "return" true
begin
set flag "session ended" true
end
// section 3: act on a loss

// section 4:act on a win
if net > 0
begin
if record"I6"data = 2 //2. Remove the number from betting
begin
clear record"temp1"layout
clear record"temp2"data
put 1 record"play"layout index
loop until record"play"layout index > record"play"layout count
begin
put 100% record"play"layout index record"#spins"data index
if record"play"layout not = record"last#"layout
begin
copy record"play"layout record"temp1"layout
add 1 record"temp1"layout index
put 100% record"#spins"data record"temp2"data
add 1 record"temp2"data index
end
add 1 record"play"layout index
end
duplicate record"temp1" record"play"
duplicate record"temp2" record"#spins"
end
else
begin
//1. Keep betting the number
end
end

if flag "session ended" true
begin
set flag "session ended" false
set flag "return" false

if record"I4"data = 1 //Requalification is performed:1. From scratch on newly generated spins
begin
clear record"last6#"layout
set flag "clear" false
end
else
begin
//Requalification is performed:2. On the last 6 spins
end
set flag "qualified"false
exit
end

if flag "qualified" false
begin
if record"I3"data = 1 //Requalification:1. Erases all previously qualified numbers
begin
clear record"play"layout
clear record"#spins"data
end
if record"I3"data = 2
begin
//Requalification:2. Keeps all previously qualified numbers
end

if record"I1"data = 1 //The method qualifies as soon as 1. A single number hits twice in no more then 6 spins
begin
call "get repeaters"
if record"repeaters"layout count > 0
begin
put 1 record"play"layout index
loop until record"play"layout index > record"play"layout count
begin
add 1 record"play"layout index
end
put 1 record"repeaters"layout index
if record"repeaters"layout is not found in record"play"layout
begin
copy record"repeaters"layout record"play"layout
put 100% record"play"layout index record"#spins"data index
put 0 record"#spins"data
end
set flag "qualified" true
clear record"last6#"layout
end
end
if record"I1"data = 2 //The method qualifies as soon as 2. Take the last 6 spins and take all repeaters
begin
if record"last6#"layout count = 6
begin
call "get repeaters"
if record"repeaters"layout count > 0
begin
put 1 record"play"layout index
loop until record"play"layout index > record"play"layout count
begin
add 1 record"play"layout index
end
put 1 record"repeaters"layout index
loop until record"repeaters"layout index > record"repeaters"layout count
begin
if record"repeaters"layout is not found in record"play"layout
begin
copy record"repeaters"layout record"play"layout
put 100% record"play"layout index record"#spins"data index
put 0 record"#spins"data
add 1 record"play"layout index
end
add 1 record"repeaters"layout index
end
set flag "qualified" true
end
end
end
end

if flag "qualified" true
begin
if record"I2"data = 1 // "During a session:1. continue qualifying for new repeaters"
begin
set flag "qualified" false
end
end

//bet
if record"play"layout count > 0
begin
set flag "return" true
call "get bet amount"
put 100% record"bet unit"data record"play"layout list

put 1 record"#spins"data index
loop until record"#spins"data index > record"#spins"data count
begin
add 1 record"#spins"data
add 1 record"#spins"data index
end
end

end

// subroutines
method "init"
begin
clear record"play"layout
clear record"#spins"data
group

begin
display "6 repeater"
display "-----------------------------------"
input dropdown "The method qualifies as soon as:
1:= A single number hits twice in no more then 6 spins
2:= Take the last 6 spins and take all repeaters" record"I1"data
input dropdown "During a session:
1:= continue qualifying for new repeaters
2:= don't continue qualifying for new repeaters" record"I2"data
input dropdown "After a session requalification is performed:
1:= From scratch on newly generated spins
2:= On the last 6 spins" record"I4"data
display "A number is bet on for a maximum of 6 spins at all times"
input dropdown "After a hit:
1:= Don't remove the number from betting
2:= Remove the number from betting" record"I6"data
display "Session ends, When there are no qualified numbers left"
input dropdown "Progression or Flat
1:= Progression
2:= Flat bet only" to record "bet option" data
end

set flag "qualified" false
set flag "clear" false
set flag "return" false
put 0 record"total loss"data
end

method "get bet amount"
begin
//determine amount of numbers to play
put 0 record"amount of numbers active"data
put 1 record"play"layout index
loop until record"play"layout index = record"play"layout count
begin
add 1 record"amount of numbers active"data
add 1 record"play"layout index
end
//calculate bet
put 100% record"total loss"data record"count"data
put 0 record"bet unit"data
loop until record"count"data > 0
begin
subtract 100% record"amount of numbers active"data record"count"data
add 36 record"count"data
if record "bet option" data = 1 begin add 1 record "bet unit" data end
if record "bet option" data = 2 begin put 1 record "bet unit" data end
end
end

method "get repeaters"
begin
clear record"repeaters"layout
put 1 record"last6#"layout index
loop until record"last6#"layout index = record"last6#"layout count
begin
add 1 record"last6#"layout index
end
loop until record"last6#"layout index = 0
begin
if record"last6#"layout is not found in record"repeaters"layout
begin
set flag "repeater" false
put 100% record"last6#"layout index record"save"data
copy record"last6#"layout record"ref"layout

put 1 record"last6#"layout index
loop until record"last6#"layout index = record"last6#"layout count
begin
add 1 record"last6#"layout index
end
loop until record"last6#"layout index = 0
begin
if record"ref"layout = record"last6#"layout
begin
if flag "repeater" true
begin
if record"ref"layout is not found record"repeaters"layout
begin
copy record"ref"layout record"repeaters"layout
add 1 record"repeaters"layout index
set flag "repeater" false
end
end
else
begin
set flag "repeater" true
end
end
subtract 1 record"last6#"layout index
end

put 100% record"save"data record"last6#"layout index
end
subtract 1 record"last6#"layout index
end
end
