; begin Linear Pachinko
;
;!
; I'm setting up an array of all possible occurences. I've
; put the length of the original string in an extra field,
; because that saves me a variable. The use of the other
; fields will be explained later.
; I'm looping from 3 to 9 because of the linear result in
; the calculation ($c/4). this will return the following
; range: 0, 1, 1, 1, 1, 2, 2.
; In the first run I'm splitting on floor parts. they don't
; have any value (the calculation 100/($c/4) will result in
; 0 (see range above) and I don't want them back in the
; string, so they will be replaced with an empty var ($h).
; When I've removed the floor parts, the only remaining
; possibilities are the ones that are in the array $o.
; The second run I'm splitting on holes. They always have a
; 100% value, so the calculation will be 100/1 and this is
; added to the total $s. Because the variable $h is now
; filled with an x, all the holes will be replaced with an x.
; the x-es in the split line represent the left and Right
; exits so they will be included in the next evaluations.
; The third to fifth fields in $o are 100% values so they
; are also added to the total. The sixth and seventh fields
; are 50% values, so the calculation results in 2 which gives
; 100/2 = 50.
; After each calculation of $s I generate a $a, but this is
; just done because of shortness of code. Only after the
; seventh run is $s complete and will the calculation
; $s / $o[7] ($o[7] being the original length of the string)
; result in the correct return value.
; This explains why I can do without the floor parts. After
; all, if it's not a 100% or a 50% hit, it must be a 0% hit
; (ie a floor part).
Function a($)
dim $c, $h, $s, $o
$o = _, '.', 'x/', '\x', 'x|x', 'x|', '|x', $^0
For $c = 3 to 9
$ = Split(x+$+x, $o[$c-3])
$s = $s + UBound($) * 100/($c/4)
$a = $s / $o[7]
$ = Join($, $h)
$h = x
EndFunction
;!
;!
; end Linear Pachinko