Flipping bits game: Difference between revisions
Content added Content deleted
m (→{{header|REXX}}: elided a character from the REXX section header.) |
m (→{{header|REXX}}: added a seed (for the RANDOM function) to make the game repeatable.) |
||
Line 3,478: | Line 3,478: | ||
<br>program simpler). A fair amount of coding was added to check for a legal "move". |
<br>program simpler). A fair amount of coding was added to check for a legal "move". |
||
<lang rexx>/*REXX program presents a "flipping bit" puzzle. The user can solve via it via C.L. */ |
<lang rexx>/*REXX program presents a "flipping bit" puzzle. The user can solve via it via C.L. */ |
||
parse arg N u . |
parse arg N u seed . /*get optional arguments from the C.L. */ |
||
if N=='' | N=="," then N=3 |
if N=='' | N=="," then N=3 /*Size given? Then use default of 3.*/ |
||
if u=='' | u=="," then u=N |
if u=='' | u=="," then u=N /*the number of bits initialized to ON.*/ |
||
if datatype(seed, 'W') then call random ,,seed /*is there a seed (for repeatability?) */ |
|||
col@= 'a b c d e f g h i j k l m n o p q r s t u v w x y z' /*literal for column id.*/ |
col@= 'a b c d e f g h i j k l m n o p q r s t u v w x y z' /*literal for column id.*/ |
||
cols=space(col@, 0); upper cols /*letters to be used for the columns. */ |
cols=space(col@, 0); upper cols /*letters to be used for the columns. */ |