system "Pivot_System" { Pivot System showing how to use the Layout field in the data record. Plus this system will show how to build a list of Numbers that have shown and how to determine how many times the number came up to find a Pivot number } method "main" begin While Starting a New Session begin Clear All Records; Clear Record "Storage List" data; Clear Record "Last Spin Number" data; Clear Record "Pivot Number" data; Put 1 on Record "Units to bet" data; Put 0 on Record "# of times Bets have been placed" data; Set Flag "Pivot Found" to false; call "Reset"; exit; end //If the Pivot number has won, then reset Pivot number and look for another one While Flag "Pivot Found" is True And Record "Pivot Number" layout has won each time begin Call "Reset Pivot Number"; call "Reset"; exit; end Copy last Number to the Record "Last Spin Number" layout; Call "Find Number"; if flag "Found Number" is True begin Add 1 on Record "Storage List" Data; end else begin set max on record "Storage List" layout index; Add 1 on Record "Storage List" Layout index; Add 1 on Record "Storage List" Data; Copy record "Last Spin Number" layout to the Record "Storage List" layout; end While Flag "Pivot Found" is False begin Call "Determine Pivot Number"; if flag "Pivot Found" is true begin call "Make Bet"; end end Else begin Call "Make Bet"; end call "Reset"; end method "Reset" begin put 1 on record "Storage List" data index; Set Flag "Found Number" to False; end //Reset Pivot number it has hit the last time. //Then start looking for another Pivot number method "Reset Pivot Number" begin Copy Store Record "Pivot Number" layout to the Record "Last Spin Number" layout; Set Flag "Found Number" to False; Call "Find Number"; While Flag "Found Number" is True begin Put 0 on Record "Storage List" Data; end Set Flag "Pivot Found" to False; end //Find the number that came up in the list. //if it is there, set flag "Found Number" to True. method "Find Number" begin Put 1 on Record "Storage List" Layout index; Put 1 on Record "Storage List" Data index; Set Flag "Found Number" to False; Loop until record "Storage List" layout index > record "Storage List" layout count begin if record "Last Spin Number" layout = record "Storage List" layout begin Set Flag "Found Number" to True; return; end //keep the index pointers in sync. add 1 to record "Storage List" layout index; add 1 to record "Storage List" data index; end end //Determine pivot number - first number that came up more than once is the //Pivot number. method "Determine Pivot Number" begin Put 1 on Record "Storage List" Data index; Put 0 on Record "# of times Bets have been placed" data; Loop until record "Storage List" data index > record "Storage List" data count begin if record "Storage List" data > 1 begin put 100% of record "Storage List" data index to record "Storage List" layout index; Copy record "Storage List" layout to the Record "Pivot Number" layout; Set Flag "Pivot Found" to True; Return; end add 1 to record "Storage List" data index; end end //Make the Bet - on Pivot Number method "Make Bet" begin While Record "# of times Bets have been placed" data < 36 begin Add 1 on Record "# of times Bets have been placed" data; Put 100% of Record "Units to bet" data on Record "Pivot Number" layout; Return; end Else begin Clear record "Storage List" layout; Clear record "Storage List" data; Set Flag "Pivot Found" to false; call "Reset"; exit; end end