Script Library: 1238 scripts
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Archive version of: trictrac.r ... version: 2 ... notchent 10-Nov-2013

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" ""
    b: tog "2" ""
    c: tog "3" ""
    d: tog "4" ""
    e: tog "5" ""
    f: tog "6" ""
    g: tog "7" ""
    h: tog "8" ""
    i: tog "9" ""
    j: tog "10" ""
    k: tog "11" ""
    l: tog "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]]
]