Advertisement
Guest User

Untitled

a guest
Jan 28th, 2015
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.37 KB | None | 0 0
  1. #540
  2.  
  3. &cmd`join #540=+wjoin:@nspemit %#=[u(dat`prefix)]You have joined the 'Wits and Wagers'. If there a round in progress, you'll have to wait for the next round to bid and place an answer. ; @nsoemit %#=[u(dat`prefix)]%N has joined the game. ; &dat`players %VC=[inc(0[xget(%VC,dat`players)])]
  4.  
  5. &cmd`start #540=+wstart:@remit %L=Welcome to Wits and Wagers! A Mu*tulaized board game for M*U*S*H! If you're unsure how to play, please take a moment to read '+wRules'. Get Ready for your first question in… ; @trigger %VC/start-pageantry
  6.  
  7.  
  8.  
  9.  
  10. &start-pageantry #540=@remit %L=%R3…%R ; @wait 1=@remit %L=%R2…%R ; @wait 2=@remit %L=%R1…%R ; @wait 3=@trigger %VC/loop`question
  11.  
  12.  
  13.  
  14.  
  15. &dat`prefix #540=Wits and Wagers:%B
  16.  
  17.  
  18. &vc #540=#540
  19. &vd #540=#623
  20.  
  21. &loop`question #540=[setq(number,remove(rand(lnum(xget(%Vd,total))),[xget(%Vc,dat`asked)]))][attrib_set(%VC/dat`asked,%Q<number>%B[xget(%VC/dat`asked)])][setq(length,strlen([before(xget(%VD,q`%Q<number>),:)]))] ; @include #540/loop`question2
  22.  
  23. &loop`question2 #540=\[Wits\] and \[Wagers\][repeat(sub(%Q<length>,10),_)]%RQuestion: [before(xget(%VD,q`%Q<number>),:)]%R[repeat(add(9,%Q<length>),-)][attrib_set(%VC/dat`answer,[after(xget(%VD`q%Q<number>),:)]Submit Your Answers! '+wsubmit *'
  24.  
  25. &cmd`submit #540=$+wsubmit *:@assert isint(%0)=@nspemit %#=[xget(%VC,dat`prefix)]Please use an integer. ; {@nspemit [xget(%VC,dat`prefix)]You have submitted your answer, '%0'. You can change it, until the end of the [xget(%VC,dat`grace)] seconds grace period after the last player submits their answer. ; @include #540/loop`submit2}
  26.  
  27.  
  28. &loop`submit2 #540=&dat`submit %VC=[if(element(xget(%VC,dat`submit),*%#,%B),replace(xget(%VC,dat`submit),element(xget(%VC,dat`submit),*%#,%B),%0:%#,%B),[xget(%VC,dat`submit)]%B%0:%#)] ; @break eq(items(xget(%VC,dat`submit),%B),xget(%VC,dat`players))={@remit %L=[xget(%VC,dat`prefix)]All Players have submitted their answers. The [xget(%VC,dat`grace)] seconds grace period begins. ; @wait xget(%VC,dat`grace)=@trigger %VC/loop`show.table}
  29.  
  30. &dat`grace #540=60
  31.  
  32. &loop`show.table #540=
  33.  
  34. @break eq(items([setr(0,unique([setr(1,sort(xget(%VC,dat`submit),n,%B))],n))],%B),xget(dat`players))=[step(#540/loop`show.table2, >Least#:Default [unique(sort(xget(%VC,dat`submit),n,%B),n)],5,%B,%r)] ;
  35.  
  36. iter(setdiff(%Q0,%Q1,%B,n),element(%Q0,[before(%i0,:)]*,%B)
  37.  
  38. More then 2 Players may have the same answer, how do you display that
  39.  
  40.  
  41. &ufun`card #540=[switch(%0,*Default,Default,left(name(before(%0,:)),8))]%R%R[after(%0,:)]
  42.  
  43. &ufun`main.row #540=[step(#540/loop`show.table2, >Least#:Default [unique(sort(xget(%VC,dat`submit),n,%B),n)],5,%B,%r)]
  44.  
  45. &loop`show.table2 #540=[align(3 -10 3,,+-----+%R[u(fun`card,%0)]%R+-----+,,+)][align(3 -10 3,,
  46.  
  47. &dat`pay.out #540=2|3 3|3 2 3|4 3 3 4|4 3 2 3 4|5 4 3 3 4 5|5 4 3 2 3 4 5|6 5 4 3 3 4 5 6|6 5 4 3 2 3 4 5 6|7 6 5 4 3 3 3 4 5 6|7 6 5 4 3 2 3 4 5 6 7|8 7 6 5 4 3 3 4 5 6 7 8|8 7 6 5 4 3 2 3 4 5 6 7 8|9 8 7 6 5 4 3 3 4 5 6 7 8 9|9 8 7 6 5 4 3 2 3 4 5 6 7 8 9|10 9 8 7 6 5 4 3 3 4 5 6 6 7 8 9 10|10 9 8 7 6 5 4 3 2 3 4 5 6 7 8 9 10 10|11 10 9 8 7 6 5 4 3 3 4 5 6 7 8 9 10 11|11 10 9 8 7 6 5 4 3 2 3 4 5 6 7 8 9 10 11|12 11 10 9 8 7 6 5 4 3 3 4 5 6 7 8 9 10 11
  48.  
  49.  
  50.  
  51. +----------+
  52. + Na me +
  53. + +
  54. + 23 +
  55. +----------+
  56. + Pays +
  57. + 2 to 1 +
  58.  
  59. ceil(fdiv(XXXX,2))
  60.  
  61. if(mod(xget(%VC,dat`players),2),positive,negative)
  62.  
  63. question database
  64. &total #623=63
  65. &qu`1 #623=
  66. question:answer
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement