Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Newbie question

From: jelinem1:nationwide at: 3-Aug-2001 13:53

; Using the approach you've given, I'd define words for the red and black squares, since they are used twice each, like thus: blksqu: [ box black 50x50 ] redsqu: [ box red 50x50 ] ; then say: append mylayout blksqu append mylayout redsqu ; Not anymore "REBOL", really, just eliminating repeated literals. To stretch the idea you could say: blksqu: [ box black 50x50 ] redsqu: [ box red 50x50 ] blk-red: load reform [redsqu blksqu] red-blk: load reform [blksqu redsqu] mylayout: [across space 0x0] loop 4 [ append mylayout load reform [red-blk red-blk red-blk red-blk 'return] append mylayout load reform [blk-red blk-red blk-red blk-red 'return] ] view layout mylayout ; I don't know of another way to "flatten" a list of blocks other than using "load reform". Convoluted in that I may as well be using strings in the definition of blksqu and redsqu instead of blocks of words. I wouldn't say this is any better than the more straight-forward method you provided. {Michael} Carl Youngblood <[cyoungbl--legato--com]> Sent by: [rebol-bounce--rebol--com] 08/03/01 12:37 PM Please respond to rebol-list T To: [rebol-list--rebol--com] cc: bcc: Subject: [REBOL] Newbie question Hello. I decided that as my first experience with REBOL, I want to create a simple chess game. I'm in the process of creating the chess board. Here is the code I'm using: mylayout: [ across space 0x0 ] loop 4 [ loop 4 [ append mylayout [ box red 50x50 ] append mylayout [ box black 50x50 ] ] append mylayout 'return loop 4 [ append mylayout [ box black 50x50 ] append mylayout [ box red 50x50 ] ] append mylayout 'return ] view layout mylayout This works, but can somebody tell me if this is the "REBOL way" of doing things? Is there a more efficient way of accomplishing the same thing? Thanks, Carl Youngblood