View script | License | Download script | History | Other scripts by: notchent |
3-May 7:27 UTC
[0.037] 10.863k
[0.037] 10.863k
Archive version of: trictrac.r ... version: 1 ... notchent 8-Nov-2013Amendment note: new script || Publicly available? Yes REBOL [ title: "Tric Trac" date: 7-Nov-2013 file: %trictrac.r author: Nick Antonaccio purpose: { A quick implementation of a simple board game. Created with a student as a tutorial example. } ] random/seed now/time view center-face layout [ backdrop white across style tog toggle green 50x100 [ sum: 0 show face foreach bttn [a b c d e f g h i j k l] [ do rejoin [ {if not find } bttn {/text "(" [sum: sum + to-integer } bttn {/text]} ] ] if not find u/text "(" [u/text: rejoin ["(" u/text ")"] show u] t/text: form sum show t ] a: tog "1" "(1)" b: tog "2" "(2)" c: tog "3" "(3)" d: tog "4" "(4)" e: tog "5" "(5)" f: tog "6" "(6)" g: tog "7" "(7)" h: tog "8" "(8)" i: tog "9" "(9)" j: tog "10" "(10)" k: tog "11" "(11)" l: tog "12" "(12)" return u: btn 690x50 font-size 20 red "Roll" [ face/text: (form (1 + random 11)) show face ] return t: text bold "Total" text "Save" [write %trictrac t/text] text "Previous High" [attempt [alert read %trictrac]] ] |