srt@aerospace.aero.org (Scott "TCB" Turner) (07/12/89)
This posting contains some diffs to add the following things to Greed 2.0: (1) Modify -p to only highlight the target square. I find the other version incredibly annoying. (2) Adds -o to start in the "origin" position (1,1). Any game with a random start configuration ought to give you the ability to start in the "best" configuration, since you can just keep trying the game until you get a good configuration. (3) Adds -h to put "holes" in the game board. As it stands, Greed has a fairly simple strategy. Putting "holes" in the board forces the user to have to think a bit more. (4) Mod to allow more than one argument on the command line, i.e., you can say "greed -h -o -p". I leave it up to Matthew which if any of these mods to save for the "official" version of the game. -- Scott Turner 94c94,95 < register val = 1; --- > register val = 1, i, argn = 0; > int holes = 0, origin = 0; 99,101c100,102 < if (argc == 2) { < if (strlen(argv[1]) != 2 || argv[1][0] != '-') usage(); < switch(argv[1][1]) { --- > while (++argn < argc) { > if (strlen(argv[argn]) != 2 || argv[argn][0] != '-') usage(); > switch(argv[argn][1]) { 107a109,114 > case 'h': > holes = 1; > break; > case 'o': > origin = 1; > break; 111c118 < } else if (argc > 2) usage(); --- > }; 131c138,151 < y = rnd(22)-1; x = rnd(79)-1; --- > > if (holes) > for(i=0;i<20;i++) { > y = rnd(22)-1; > x = rnd(79)-1; > grid[y][x] = 0; > mvaddch(y, x, '#'); > }; > > if (origin) { > y = x = 0; > } else { > y = rnd(22)-1; x = rnd(79)-1; > }; 274a295,299 > if (on) { > standout(); > } else { > standend(); > }; 287,297c312,313 < register j=y, i=x, d=grid[y+dy][x+dx]; < if (on) standout(); < else standend(); < do { < j += dy; < i += dx; < move(j, i); < mvaddch(j, i, inch()); < } while (--d); < if (!on) standout(); < } --- > mvaddch(j,i,inch()); > }; 298a315 > standend();