Mohamed El Mokhtar Messaoudi (Dumberbytheminute)
New member Username: Dumberbytheminute
Post Number: 12 Registered: 11-2008
| | Posted on Sunday, June 23, 2013 - 12:52 am: | |
Hi. I am devising a simple game involving one player and 4 pieces, 3 of wich (A,B,and C) lack moves of their own but are controlled by the 4th (D). A link (Scan) with 2 dummy ends (Start and Finish), run through all of the board's cells. The hyper-basic task I am trying to script is for D to run along Scan,and to completely and randomly fill the board with A,B,or C,over and over again. The macro -needed as template for more elaborate moves- proved to be unbelievably hard to code. The best I could come up with is this (or minor variations on the same): (define Fill (mark ;D sits initially on Start (while (on-board? Scan) Scan (create $1)) back add)); $1 refering to A,B,Or C in (piece (name D) (image Player "D.bmp"); a green dot (moves (move-type Filling) (Fill A) (Fill B) (Fill C))) which is fast, but within any one cycle all the board is predictably filled with the one same piece type. Replacing (create $1) by (add A B C) generates too many moves, as it should. Replacing it with (Random), defined as (create $1) and summoned by (move-type Randomizing) (Random A)(Random B)(Random C), just won't do, come parse time. Replacing it with (add-partial Randomizing) is even worse, as ZoG's parser deems A, B, and C unknown. I can't fathom why. The following I could do with if it were not ever so slow, and foremost if any bunch of further conditions inserted in lieu of (create $1) were not absolutely ignored: (define Fill ((if (position? Finish) (create D Start) add else (create $1) Scan (add-partial Filling) ))) Of course, I am doing some pretty stupid mistake; I just can't pinpoint it. Could you? Thanks for any help. |