Toin Coss

This tries to see what the highest ammount of times you can flip and get heads/tails out of 100, it tries 100 times :stuck_out_tongue:

set ammount to 100
set headcountmax to 0
set tailcountmax to 0
set headcountmin to ammount
set tailcountmin to ammount
repeat 100 times
	set headcount to 0
	set tailcount to 0
	repeat ammount times
		set Flip to some item of {"Heads", "Tails"}
		if Flip = "Heads" then
			set headcount to headcount + 1
		else
			set tailcount to tailcount + 1
		end if
		if headcount > headcountmax then
			set headcountmax to headcount
		end if
		if tailcount > tailcountmax then
			set tailcountmax to tailcount
		end if
	end repeat
end repeat
set InTheEnd to "Heads High: " & headcountmax & "
Tail High: " & tailcountmax

Interesting routine, Ugrax. :slight_smile:

This modified version may be a bit faster:

set headcountmax to 0
set tailcountmax to 0
tell {true, false} to repeat 100 times
	set headcount to 0
	set tailcount to 0
	repeat 100 times
		if some item then
			set headcount to headcount + 1
		else
			set tailcount to tailcount + 1
		end if
	end repeat
	if headcount > headcountmax then set headcountmax to headcount
	if tailcount > tailcountmax then set tailcountmax to tailcount
end repeat
"Heads High: " & headcountmax & "
Tails High: " & tailcountmax