Help20:=proc(): print(` RDG(n,p), CGG(n,S), LaG(G) , NimV(N), Ch(v), NimG(N) , RDGs(n,p,k) `): end: #RDG(n,p): A random directed graph with no cycles RDG:=proc(n,p) local ra,a,b,L,Nei,i,j: if n=1 then RETURN([{}]): fi: a:=numer(p): b:=denom(p): ra:=rand(1..b): L:=[]: for i from 1 to n do Nei:={}: for j from i+1 to n do if ra()<=a then Nei:=Nei union {j}: fi: od: L:=[op(L),Nei]: od: L: end: #CGG(n,S): inputs a positive inetger n and a set of positive integers S outputs the game-graph with n+1 vertices, #where the outgoing neighbors of i are seq(i-s, s in S) intersect positive integer CGG:=proc(n,S) local i,s,Ne,T,i1: T[0]:={}: for i from 1 to n do Ne:={}: for s in S do if i-s>=0 then Ne:=Ne union {i-s}: fi: od: T[i]:=Ne: od: subs({seq(i1=i1+1,i1=0..n)},[seq(T[i],i=0..n)]): end: #LaG(G): given a directed graph with n vertices and w/o cycles outputs the 0-1 vector indicating whether it it is winning or losing. Try: #Lag(CGG(10,{1,2,3})): LaG:=proc(G) local n,AL,T,i,NYL,i1,j: n:=nops(G): AL:={}: for i from 1 to n do if G[i]={} then T[i]:=0: AL:=AL union {i}: fi: od: if AL={} then print(`There is no sink`): RETURN(FAIL): fi: while nops(AL){} do od: if i=nops(NYL)+1 then RETURN(FAIL): fi: i:=NYL[i]: if member(0,{seq(T[j],j in G[i])}) then T[i]:=1: else T[i]:=0: fi: AL:=AL union {i}: od: [seq(T[i],i=1..n)]: end: #NimV(N): The list of positions of Nim with initial pile sizes N NimV:=proc(N) local k,i,S,j: option remember: k:=nops(N): if k=0 then RETURN([[]]): fi: S:=NimV([op(1..k-1,N)]): [seq(seq([i,op(S[j])],j=1..nops(S)),i=0..N[k])]: end: #Ch(v): all the positions reachable from a position v in Nim Ch:=proc(v) local i,j: {seq(seq(v-[0$(i-1),j,0$(nops(v)-i)],j=1..v[i]),i=1..nops(v))}: end: #NimG(N): The Nim graph with nops(N) pilies of sizes N[1],...N[nops(N)] NimG:=proc(N) local V,i,C,S,s,T: V:=NimV(N): for i from 1 to nops(V) do T[V[i]]:=i: od: C:=[]: for i from 1 to nops(V) do S:=Ch(V[i]): C:=[op(C),{seq(T[s], s in S)}]: od: C,V: end: #RDGs(n,p,k): A random directed graph with no cycles and k sinks, at the end RDGs:=proc(n,p,k) local ra,a,b,L,Nei,i,j: if n