#C8.txt, Feb. 18, 2013, thinkless games (with at most one option) #With two procedures (RollLoadedDie, and RandGame1) that we didn't #have time to do in class (because I messed up) #(note that NuGame1(n) has been shortened) Help:=proc(): print(` Games1(n), P1(n,x), NuGames1(n), RandGame1(n) `): end: #Games1(n): the set of games of size n where always #always there is at most one option: Games1:=proc(n) local Ga,m, S1,s1, S2, s2: #every game is [L,R] let Size(L)=m option remember: if n=0 then RETURN({}): fi: if n=1 then RETURN({[{},{}]}): fi: S1:=Games1(n-1): Ga:={seq([{}, {s1}], s1 in S1), seq([{s1},{}], s1 in S1)}: for m from 1 to n-2 do S1:=Games1(m): S2:=Games1(n-1-m): Ga:=Ga union { seq(seq( [ {s1}, {s2}], s1 in S1), s2 in S2)}: od: Ga: end: #The number of positive, negative, zero and fuzzy #thinkless games of size n P1:=proc(n,x) local S,s: S:=Games1(n): add( x[WhatKind(s)], s in S): end: #NuGames1(n): the number of games of size n where always #there is at most one option: NuGames1:=proc(n) local m: #every game is [L,R] let Size(L)=m option remember: if n=0 then RETURN(1): fi: add(NuGames1(m)*NuGames1(n-1-m),m=0..n-1): end: #RollLD(L): Given a Loaded die, L, rolls it, try: #RollLD([1,3,2]); RollLD:=proc(L) local i,r,N: N:=convert(L,`+`): r:=rand(1..N)(): for i from 1 to nops(L) while convert([op(1..i,L)],`+`)