' This example shows a method of recording rolls on a checkstack and
' keeping track of roll counts within desired intervals of rolls.
' We're going to use:
' csn0 to record the dice total of each of the last 50 rolls
' cs1 to track then number of 7's within the last 18 rolls
' cs2 to track the number of horn rolls with the last 12 rolls
' csn0 is a string which we're going to build by adding two characters for
' each roll. For example here are six rolls: 10 9 5 8 712.
' If desired, we could easily record more or fewer rolls than 50 and/or change it
' to record die1 and die2 of each roll instead of the dice total.
' In order to find a specific roll we're going to use the mid$ function to
' extract the desired two characters from the string.
' So for example, roll #3 in the six roll string above is comprised of the
' 5th and 6th characters. An easy way to find the starting position (which
' is needed for the mid$ function) is to multiply the roll number by 2 and
' subtract 1. So for roll #3 the starting position is 3*2-1 = 5
' In order to track the number of 7's with the last 18 rolls we could count
' through all 18 rolls after each new roll. However, it would be quicker and
' easier to add 7's as they enter the interval and subtract them as they exit
' the interval. The same is true for tracking the horn numbers.
' Once we have the counts for the tracked numbers, we can use them for whatever
' we want, such as to make bets. So as an example let's:
' lay the 4 and 10 whenever there are 3 or more 7's in 18 rolls
' bet the Horn whenever there are 2 or more horn numbers in 12 rolls
'
If Beginning new session Then csn0 = space$(100) : GoTo "End" EndIf
: "Adjust roll counts" :
' reduce the count of tracked rolls that are exiting the roll interval
If val(mid$(csn0, 35, 2)) = 7 Then '<--- 35 is the starting position of roll #18
subtract 1 from cs1.7sin18
EndIf
If val(mid$(csn0, 23, 2)) = any(2, 3, 11, 12) Then '<--- 23 is the starting position of roll #12
subtract 1 from cs2.hornsin12
EndIf
' increase the count of tracked rolls that are entering the roll interval
If dice total = 7 Then
Add 1 to cs1.7sin18
ElseIf dice total = any(2, 3, 11, 12) Then
Add 1 to cs2.hornsin12
EndIf
: "Adjust roll record" :
' add the most recent roll to left side of the string and
' crop the total length to 50 rolls. Since each roll is 2 characters,
' there will be 100 characters total.
csn0 = right$(" " & dice total, 2) & left$(csn0, 98)
: "Make bets" :
If cs1.7sin18 >= 3 Then
bet $25 on Lay4, Lay10
Else
take down Lay4, Lay10
EndIf
If cs2.hornsin12 >= 2 Then
bet $4 on Horn
Else
take down Horn
EndIf
: "End" :