From 88001492142be07a49016a8cf7eff78171d59f64 Mon Sep 17 00:00:00 2001 From: Mark Murray Date: Mon, 21 Oct 2002 07:40:27 +0000 Subject: [PATCH] Deorbit complete. We dont build these anymore, so into the attic they go. --- games/adventure/Makefile | 20 - games/adventure/adventure.6 | 58 - games/adventure/crc.c | 140 -- games/adventure/done.c | 146 -- games/adventure/glorkz | 1815 ---------------------- games/adventure/hdr.h | 221 --- games/adventure/init.c | 226 --- games/adventure/io.c | 557 ------- games/adventure/main.c | 586 ------- games/adventure/save.c | 195 --- games/adventure/setup.c | 122 -- games/adventure/subr.c | 862 ---------- games/adventure/vocab.c | 178 --- games/adventure/wizard.c | 156 -- games/arithmetic/Makefile | 8 - games/arithmetic/arithmetic.6 | 104 -- games/arithmetic/arithmetic.c | 393 ----- games/atc/BUGS | 4 - games/atc/Makefile | 17 - games/atc/atc.6 | 589 ------- games/atc/def.h | 82 - games/atc/extern.c | 79 - games/atc/extern.h | 63 - games/atc/games/Game_List | 5 - games/atc/games/Killer | 21 - games/atc/games/crossover | 14 - games/atc/games/default | 21 - games/atc/games/easy | 15 - games/atc/games/game_2 | 22 - games/atc/grammar.y | 390 ----- games/atc/graphics.c | 425 ----- games/atc/include.h | 86 - games/atc/input.c | 670 -------- games/atc/lex.l | 69 - games/atc/list.c | 120 -- games/atc/log.c | 297 ---- games/atc/main.c | 338 ---- games/atc/pathnames.h | 39 - games/atc/struct.h | 113 -- games/atc/tunable.c | 60 - games/atc/tunable.h | 48 - games/atc/update.c | 421 ----- games/backgammon/Makefile | 5 - games/backgammon/backgammon/Makefile | 15 - games/backgammon/backgammon/backgammon.6 | 198 --- games/backgammon/backgammon/extra.c | 257 --- games/backgammon/backgammon/main.c | 571 ------- games/backgammon/backgammon/move.c | 556 ------- games/backgammon/backgammon/text.c | 137 -- games/backgammon/backgammon/version.c | 45 - games/backgammon/common_source/allow.c | 113 -- games/backgammon/common_source/back.h | 127 -- games/backgammon/common_source/board.c | 181 --- games/backgammon/common_source/check.c | 162 -- games/backgammon/common_source/fancy.c | 752 --------- games/backgammon/common_source/init.c | 103 -- games/backgammon/common_source/odds.c | 117 -- games/backgammon/common_source/one.c | 173 --- games/backgammon/common_source/save.c | 186 --- games/backgammon/common_source/subs.c | 483 ------ games/backgammon/common_source/table.c | 312 ---- games/backgammon/teachgammon/Makefile | 15 - games/backgammon/teachgammon/data.c | 319 ---- games/backgammon/teachgammon/teach.c | 178 --- games/backgammon/teachgammon/ttext1.c | 188 --- games/backgammon/teachgammon/ttext2.c | 199 --- games/backgammon/teachgammon/tutor.c | 161 -- games/backgammon/teachgammon/tutor.h | 63 - games/battlestar/Makefile | 20 - games/battlestar/battlestar.6 | 165 -- games/battlestar/battlestar.c | 102 -- games/battlestar/com1.c | 262 ---- games/battlestar/com2.c | 307 ---- games/battlestar/com3.c | 321 ---- games/battlestar/com4.c | 390 ----- games/battlestar/com5.c | 349 ----- games/battlestar/com6.c | 238 --- games/battlestar/com7.c | 274 ---- games/battlestar/cypher.c | 436 ------ games/battlestar/dayfile.c | 1209 -------------- games/battlestar/dayobjs.c | 142 -- games/battlestar/externs.h | 361 ----- games/battlestar/fly.c | 307 ---- games/battlestar/getcom.c | 103 -- games/battlestar/globals.c | 223 --- games/battlestar/init.c | 145 -- games/battlestar/misc.c | 68 - games/battlestar/nightfile.c | 1181 -------------- games/battlestar/nightobjs.c | 104 -- games/battlestar/parse.c | 113 -- games/battlestar/pathnames.h | 36 - games/battlestar/room.c | 234 --- games/battlestar/save.c | 183 --- games/battlestar/words.c | 210 --- games/bs/Makefile | 9 - games/bs/bs.6 | 43 - games/bs/bs.c | 1246 --------------- games/canfield/Makefile | 5 - games/canfield/canfield/Makefile | 18 - games/canfield/canfield/canfield.6 | 118 -- games/canfield/canfield/canfield.c | 1810 --------------------- games/canfield/canfield/pathnames.h | 37 - games/canfield/cfscores/Makefile | 8 - games/canfield/cfscores/cfscores.c | 160 -- games/cribbage/Makefile | 19 - games/cribbage/cards.c | 151 -- games/cribbage/crib.c | 633 -------- games/cribbage/cribbage.6 | 130 -- games/cribbage/cribbage.h | 116 -- games/cribbage/cribbage.n | 226 --- games/cribbage/cribcur.h | 57 - games/cribbage/deck.h | 86 - games/cribbage/extern.c | 72 - games/cribbage/instr.c | 90 -- games/cribbage/io.c | 604 ------- games/cribbage/pathnames.h | 38 - games/cribbage/score.c | 373 ----- games/cribbage/support.c | 362 ----- games/dm/Makefile | 10 - games/dm/dm.8 | 110 -- games/dm/dm.c | 357 ----- games/dm/dm.conf.5 | 100 -- games/dm/pathnames.h | 39 - games/fish/Makefile | 9 - games/fish/fish.6 | 85 - games/fish/fish.c | 466 ------ games/fish/fish.instr | 29 - games/fish/pathnames.h | 37 - games/hack/COPYRIGHT | 6 - games/hack/Makefile | 46 - games/hack/Makequest | 196 --- games/hack/OWNER | 2 - games/hack/Original_READ_ME | 61 - games/hack/READ_ME | 92 -- games/hack/alloc.c | 48 - games/hack/config.h | 140 -- games/hack/data | 232 --- games/hack/date.h | 2 - games/hack/def.edog.h | 12 - games/hack/def.eshk.h | 24 - games/hack/def.flag.h | 42 - games/hack/def.func_tab.h | 16 - games/hack/def.gen.h | 15 - games/hack/def.gold.h | 12 - games/hack/def.mkroom.h | 26 - games/hack/def.monst.h | 61 - games/hack/def.obj.h | 48 - games/hack/def.objclass.h | 60 - games/hack/def.objects.h | 288 ---- games/hack/def.permonst.h | 25 - games/hack/def.rm.h | 53 - games/hack/def.trap.h | 27 - games/hack/def.wseg.h | 14 - games/hack/hack.6 | 152 -- games/hack/hack.Decl.c | 44 - games/hack/hack.apply.c | 440 ------ games/hack/hack.bones.c | 96 -- games/hack/hack.c | 801 ---------- games/hack/hack.cmd.c | 303 ---- games/hack/hack.do.c | 489 ------ games/hack/hack.do_name.c | 292 ---- games/hack/hack.do_wear.c | 337 ---- games/hack/hack.dog.c | 416 ----- games/hack/hack.eat.c | 462 ------ games/hack/hack.end.c | 643 -------- games/hack/hack.engrave.c | 307 ---- games/hack/hack.fight.c | 359 ----- games/hack/hack.fix | 113 -- games/hack/hack.h | 161 -- games/hack/hack.invent.c | 864 ---------- games/hack/hack.ioctl.c | 57 - games/hack/hack.lev.c | 286 ---- games/hack/hack.main.c | 502 ------ games/hack/hack.makemon.c | 199 --- games/hack/hack.mfndpos.h | 12 - games/hack/hack.mhitu.c | 364 ----- games/hack/hack.mklev.c | 744 --------- games/hack/hack.mkmaze.c | 137 -- games/hack/hack.mkobj.c | 151 -- games/hack/hack.mkshop.c | 275 ---- games/hack/hack.mon.c | 854 ---------- games/hack/hack.monst.c | 80 - games/hack/hack.o_init.c | 162 -- games/hack/hack.objnam.c | 550 ------- games/hack/hack.options.c | 204 --- games/hack/hack.pager.c | 408 ----- games/hack/hack.potion.c | 387 ----- games/hack/hack.pri.c | 661 -------- games/hack/hack.read.c | 541 ------- games/hack/hack.rip.c | 82 - games/hack/hack.rumors.c | 64 - games/hack/hack.save.c | 239 --- games/hack/hack.search.c | 134 -- games/hack/hack.sh | 14 - games/hack/hack.shk.c | 988 ------------ games/hack/hack.shknam.c | 141 -- games/hack/hack.steal.c | 204 --- games/hack/hack.termcap.c | 280 ---- games/hack/hack.timeout.c | 63 - games/hack/hack.topl.c | 193 --- games/hack/hack.track.c | 39 - games/hack/hack.trap.c | 451 ------ games/hack/hack.tty.c | 346 ----- games/hack/hack.u_init.c | 358 ----- games/hack/hack.unix.c | 390 ----- games/hack/hack.vault.c | 260 ---- games/hack/hack.version.c | 16 - games/hack/hack.wield.c | 100 -- games/hack/hack.wizard.c | 192 --- games/hack/hack.worm.c | 184 --- games/hack/hack.worn.c | 66 - games/hack/hack.zap.c | 643 -------- games/hack/help | 132 -- games/hack/hh | 55 - games/hack/makedefs.c | 226 --- games/hack/pathnames.h | 39 - games/hack/rnd.c | 33 - games/hack/rumors | 505 ------ games/hangman/Makefile | 14 - games/hangman/endgame.c | 90 -- games/hangman/extern.c | 78 - games/hangman/getguess.c | 114 -- games/hangman/getword.c | 80 - games/hangman/hangman.6 | 51 - games/hangman/hangman.h | 92 -- games/hangman/main.c | 84 - games/hangman/pathnames.h | 36 - games/hangman/playgame.c | 65 - games/hangman/prdata.c | 63 - games/hangman/prman.c | 60 - games/hangman/prword.c | 54 - games/hangman/setup.c | 78 - games/larn/COPYRIGHT | 6 - games/larn/Fixed.Bugs | 216 --- games/larn/Makefile | 79 - games/larn/OWNER | 3 - games/larn/README | 148 -- games/larn/bill.c | 157 -- games/larn/config.c | 47 - games/larn/create.c | 464 ------ games/larn/data.c | 652 -------- games/larn/datfiles/larn.help | 140 -- games/larn/datfiles/larnmaze | 288 ---- games/larn/datfiles/larnopts | 12 - games/larn/diag.c | 314 ---- games/larn/display.c | 435 ------ games/larn/fortune.c | 91 -- games/larn/global.c | 622 -------- games/larn/header.h | 442 ------ games/larn/help.c | 88 -- games/larn/holidays | 66 - games/larn/io.c | 920 ----------- games/larn/larn.6 | 159 -- games/larn/main.c | 883 ----------- games/larn/monster.c | 1394 ----------------- games/larn/moreobj.c | 373 ----- games/larn/movem.c | 313 ---- games/larn/nap.c | 121 -- games/larn/object.c | 808 ---------- games/larn/pathnames.h | 41 - games/larn/regen.c | 93 -- games/larn/savelev.c | 48 - games/larn/scores.c | 654 -------- games/larn/signal.c | 151 -- games/larn/store.c | 695 --------- games/larn/tok.c | 221 --- games/mille/Makefile | 13 - games/mille/comp.c | 483 ------ games/mille/end.c | 158 -- games/mille/extern.c | 177 --- games/mille/init.c | 258 --- games/mille/mille.6 | 378 ----- games/mille/mille.c | 172 -- games/mille/mille.h | 269 ---- games/mille/misc.c | 263 ---- games/mille/move.c | 576 ------- games/mille/print.c | 177 --- games/mille/roll.c | 60 - games/mille/save.c | 179 --- games/mille/types.c | 82 - games/mille/varpush.c | 93 -- games/phantasia/COPYRIGHT | 24 - games/phantasia/Makefile | 41 - games/phantasia/OWNER | 6 - games/phantasia/README | 82 - games/phantasia/fight.c | 1693 -------------------- games/phantasia/gamesupport.c | 725 --------- games/phantasia/include.h | 18 - games/phantasia/interplayer.c | 1211 --------------- games/phantasia/io.c | 439 ------ games/phantasia/macros.h | 16 - games/phantasia/main.c | 1303 ---------------- games/phantasia/map.c | 160 -- games/phantasia/misc.c | 1708 -------------------- games/phantasia/monsters.asc | 100 -- games/phantasia/pathnames.h | 52 - games/phantasia/phantasia.6 | 1225 --------------- games/phantasia/phantdefs.h | 139 -- games/phantasia/phantglobs.c | 113 -- games/phantasia/phantglobs.h | 85 - games/phantasia/phantstruct.h | 124 -- games/phantasia/setup.c | 268 ---- games/piano/Makefile | 9 - games/piano/README | 12 - games/piano/piano.6 | 62 - games/piano/piano.c | 167 -- games/pig/Makefile | 7 - games/pig/pig.6 | 49 - games/pig/pig.c | 131 -- games/quiz/Makefile | 16 - games/quiz/datfiles/africa | 43 - games/quiz/datfiles/america | 27 - games/quiz/datfiles/areas | 124 -- games/quiz/datfiles/arith | 45 - games/quiz/datfiles/asia | 41 - games/quiz/datfiles/babies | 21 - games/quiz/datfiles/bard | 228 --- games/quiz/datfiles/chinese | 12 - games/quiz/datfiles/collectives | 105 -- games/quiz/datfiles/ed | 84 - games/quiz/datfiles/elements | 103 -- games/quiz/datfiles/europe | 44 - games/quiz/datfiles/flowers | 45 - games/quiz/datfiles/greek | 7 - games/quiz/datfiles/inca | 12 - games/quiz/datfiles/index | 32 - games/quiz/datfiles/latin | 157 -- games/quiz/datfiles/locomotive | 11 - games/quiz/datfiles/midearth | 10 - games/quiz/datfiles/morse | 26 - games/quiz/datfiles/mult | 99 -- games/quiz/datfiles/murders | 25 - games/quiz/datfiles/poetry | 184 --- games/quiz/datfiles/posneg | 50 - games/quiz/datfiles/pres | 38 - games/quiz/datfiles/province | 14 - games/quiz/datfiles/seq-easy | 14 - games/quiz/datfiles/seq-hard | 15 - games/quiz/datfiles/sexes | 26 - games/quiz/datfiles/sov | 42 - games/quiz/datfiles/spell | 2 - games/quiz/datfiles/state | 50 - games/quiz/datfiles/trek | 19 - games/quiz/datfiles/ucc | 127 -- games/quiz/pathnames.h | 37 - games/quiz/quiz.6 | 120 -- games/quiz/quiz.c | 384 ----- games/quiz/quiz.h | 65 - games/quiz/rxp.c | 318 ---- games/rain/Makefile | 9 - games/rain/rain.6 | 57 - games/rain/rain.c | 148 -- games/robots/Makefile | 19 - games/robots/extern.c | 79 - games/robots/flush_in.c | 55 - games/robots/init_field.c | 122 -- games/robots/main.c | 196 --- games/robots/make_level.c | 93 -- games/robots/move.c | 305 ---- games/robots/move_robs.c | 156 -- games/robots/pathnames.h | 36 - games/robots/play_level.c | 119 -- games/robots/query.c | 65 - games/robots/rnd_pos.c | 71 - games/robots/robots.6 | 142 -- games/robots/robots.h | 107 -- games/robots/score.c | 189 --- games/rogue/CHANGES | 53 - games/rogue/Makefile | 20 - games/rogue/USD.doc/Makefile | 10 - games/rogue/USD.doc/rogue.me | 836 ---------- games/rogue/hit.c | 460 ------ games/rogue/init.c | 346 ----- games/rogue/inventory.c | 778 ---------- games/rogue/level.c | 885 ----------- games/rogue/machdep.c | 555 ------- games/rogue/main.c | 89 -- games/rogue/message.c | 385 ----- games/rogue/monster.c | 882 ----------- games/rogue/move.c | 651 -------- games/rogue/object.c | 789 ---------- games/rogue/pack.c | 579 ------- games/rogue/pathnames.h | 36 - games/rogue/play.c | 302 ---- games/rogue/random.c | 147 -- games/rogue/ring.c | 340 ---- games/rogue/rogue.6 | 115 -- games/rogue/rogue.h | 474 ------ games/rogue/room.c | 658 -------- games/rogue/save.c | 445 ------ games/rogue/score.c | 588 ------- games/rogue/spec_hit.c | 538 ------- games/rogue/throw.c | 326 ---- games/rogue/trap.c | 287 ---- games/rogue/use.c | 622 -------- games/rogue/zap.c | 410 ----- games/sail/Makefile | 19 - games/sail/assorted.c | 278 ---- games/sail/dr_1.c | 468 ------ games/sail/dr_2.c | 280 ---- games/sail/dr_3.c | 350 ----- games/sail/dr_4.c | 69 - games/sail/dr_5.c | 97 -- games/sail/dr_main.c | 112 -- games/sail/driver.h | 38 - games/sail/externs.h | 310 ---- games/sail/game.c | 91 -- games/sail/globals.c | 511 ------ games/sail/lo_main.c | 95 -- games/sail/machdep.h | 46 - games/sail/main.c | 112 -- games/sail/misc.c | 237 --- games/sail/parties.c | 80 - games/sail/pathnames.h | 36 - games/sail/pl_1.c | 139 -- games/sail/pl_2.c | 158 -- games/sail/pl_3.c | 280 ---- games/sail/pl_4.c | 133 -- games/sail/pl_5.c | 259 --- games/sail/pl_6.c | 200 --- games/sail/pl_7.c | 473 ------ games/sail/pl_main.c | 249 --- games/sail/player.h | 123 -- games/sail/sail.6 | 897 ----------- games/sail/sync.c | 429 ----- games/sail/version.c | 42 - games/snake/Makefile | 5 - games/snake/snake/Makefile | 23 - games/snake/snake/move.c | 693 --------- games/snake/snake/pathnames.h | 37 - games/snake/snake/snake.6 | 113 -- games/snake/snake/snake.c | 902 ----------- games/snake/snake/snake.h | 83 - games/snake/snscore/Makefile | 8 - games/snake/snscore/snscore.c | 125 -- games/trek/DOC/read_me.nr | 252 --- games/trek/DOC/things | 10 - games/trek/DOC/trekmanual.nr | 896 ----------- games/trek/Makefile | 18 - games/trek/USD.doc/Makefile | 10 - games/trek/USD.doc/spell.ok | 72 - games/trek/USD.doc/trek.me | 950 ----------- games/trek/abandon.c | 161 -- games/trek/attack.c | 192 --- games/trek/autover.c | 81 - games/trek/capture.c | 132 -- games/trek/cgetc.c | 48 - games/trek/check_out.c | 74 - games/trek/checkcond.c | 108 -- games/trek/compkl.c | 116 -- games/trek/computer.c | 347 ----- games/trek/damage.c | 95 -- games/trek/damaged.c | 71 - games/trek/dcrept.c | 103 -- games/trek/destruct.c | 114 -- games/trek/dock.c | 148 -- games/trek/dumpgame.c | 167 -- games/trek/dumpme.c | 92 -- games/trek/dumpssradio.c | 89 -- games/trek/events.c | 467 ------ games/trek/externs.c | 102 -- games/trek/getcodi.c | 72 - games/trek/getpar.c | 301 ---- games/trek/getpar.h | 45 - games/trek/help.c | 161 -- games/trek/impulse.c | 84 - games/trek/initquad.c | 156 -- games/trek/kill.c | 231 --- games/trek/klmove.c | 186 --- games/trek/lose.c | 89 -- games/trek/lrscan.c | 111 -- games/trek/main.c | 241 --- games/trek/move.c | 237 --- games/trek/nova.c | 145 -- games/trek/out.c | 60 - games/trek/phaser.c | 373 ----- games/trek/play.c | 114 -- games/trek/ram.c | 105 -- games/trek/ranf.c | 59 - games/trek/rest.c | 84 - games/trek/schedule.c | 177 --- games/trek/score.c | 108 -- games/trek/setup.c | 308 ---- games/trek/setwarp.c | 68 - games/trek/shield.c | 147 -- games/trek/snova.c | 162 -- games/trek/srscan.c | 194 --- games/trek/systemname.c | 71 - games/trek/torped.c | 251 --- games/trek/trek.6 | 91 -- games/trek/trek.h | 382 ----- games/trek/utility.c | 161 -- games/trek/visual.c | 105 -- games/trek/warp.c | 186 --- games/trek/win.c | 93 -- games/wargames/Makefile | 8 - games/wargames/wargames.6 | 51 - games/wargames/wargames.c | 46 - games/worm/Makefile | 10 - games/worm/worm.6 | 66 - games/worm/worm.c | 332 ---- games/worms/Makefile | 9 - games/worms/worms.6 | 67 - games/worms/worms.c | 344 ---- games/wump/Makefile | 9 - games/wump/pathnames.h | 37 - games/wump/wump.6 | 111 -- games/wump/wump.c | 859 ---------- games/wump/wump.info | 41 - 509 files changed, 115054 deletions(-) delete mode 100644 games/adventure/Makefile delete mode 100644 games/adventure/adventure.6 delete mode 100644 games/adventure/crc.c delete mode 100644 games/adventure/done.c delete mode 100644 games/adventure/glorkz delete mode 100644 games/adventure/hdr.h delete mode 100644 games/adventure/init.c delete mode 100644 games/adventure/io.c delete mode 100644 games/adventure/main.c delete mode 100644 games/adventure/save.c delete mode 100644 games/adventure/setup.c delete mode 100644 games/adventure/subr.c delete mode 100644 games/adventure/vocab.c delete mode 100644 games/adventure/wizard.c delete mode 100644 games/arithmetic/Makefile delete mode 100644 games/arithmetic/arithmetic.6 delete mode 100644 games/arithmetic/arithmetic.c delete mode 100644 games/atc/BUGS delete mode 100644 games/atc/Makefile delete mode 100644 games/atc/atc.6 delete mode 100644 games/atc/def.h delete mode 100644 games/atc/extern.c delete mode 100644 games/atc/extern.h delete mode 100644 games/atc/games/Game_List delete mode 100644 games/atc/games/Killer delete mode 100644 games/atc/games/crossover delete mode 100644 games/atc/games/default delete mode 100644 games/atc/games/easy delete mode 100644 games/atc/games/game_2 delete mode 100644 games/atc/grammar.y delete mode 100644 games/atc/graphics.c delete mode 100644 games/atc/include.h delete mode 100644 games/atc/input.c delete mode 100644 games/atc/lex.l delete mode 100644 games/atc/list.c delete mode 100644 games/atc/log.c delete mode 100644 games/atc/main.c delete mode 100644 games/atc/pathnames.h delete mode 100644 games/atc/struct.h delete mode 100644 games/atc/tunable.c delete mode 100644 games/atc/tunable.h delete mode 100644 games/atc/update.c delete mode 100644 games/backgammon/Makefile delete mode 100644 games/backgammon/backgammon/Makefile delete mode 100644 games/backgammon/backgammon/backgammon.6 delete mode 100644 games/backgammon/backgammon/extra.c delete mode 100644 games/backgammon/backgammon/main.c delete mode 100644 games/backgammon/backgammon/move.c delete mode 100644 games/backgammon/backgammon/text.c delete mode 100644 games/backgammon/backgammon/version.c delete mode 100644 games/backgammon/common_source/allow.c delete mode 100644 games/backgammon/common_source/back.h delete mode 100644 games/backgammon/common_source/board.c delete mode 100644 games/backgammon/common_source/check.c delete mode 100644 games/backgammon/common_source/fancy.c delete mode 100644 games/backgammon/common_source/init.c delete mode 100644 games/backgammon/common_source/odds.c delete mode 100644 games/backgammon/common_source/one.c delete mode 100644 games/backgammon/common_source/save.c delete mode 100644 games/backgammon/common_source/subs.c delete mode 100644 games/backgammon/common_source/table.c delete mode 100644 games/backgammon/teachgammon/Makefile delete mode 100644 games/backgammon/teachgammon/data.c delete mode 100644 games/backgammon/teachgammon/teach.c delete mode 100644 games/backgammon/teachgammon/ttext1.c delete mode 100644 games/backgammon/teachgammon/ttext2.c delete mode 100644 games/backgammon/teachgammon/tutor.c delete mode 100644 games/backgammon/teachgammon/tutor.h delete mode 100644 games/battlestar/Makefile delete mode 100644 games/battlestar/battlestar.6 delete mode 100644 games/battlestar/battlestar.c delete mode 100644 games/battlestar/com1.c delete mode 100644 games/battlestar/com2.c delete mode 100644 games/battlestar/com3.c delete mode 100644 games/battlestar/com4.c delete mode 100644 games/battlestar/com5.c delete mode 100644 games/battlestar/com6.c delete mode 100644 games/battlestar/com7.c delete mode 100644 games/battlestar/cypher.c delete mode 100644 games/battlestar/dayfile.c delete mode 100644 games/battlestar/dayobjs.c delete mode 100644 games/battlestar/externs.h delete mode 100644 games/battlestar/fly.c delete mode 100644 games/battlestar/getcom.c delete mode 100644 games/battlestar/globals.c delete mode 100644 games/battlestar/init.c delete mode 100644 games/battlestar/misc.c delete mode 100644 games/battlestar/nightfile.c delete mode 100644 games/battlestar/nightobjs.c delete mode 100644 games/battlestar/parse.c delete mode 100644 games/battlestar/pathnames.h delete mode 100644 games/battlestar/room.c delete mode 100644 games/battlestar/save.c delete mode 100644 games/battlestar/words.c delete mode 100644 games/bs/Makefile delete mode 100644 games/bs/bs.6 delete mode 100644 games/bs/bs.c delete mode 100644 games/canfield/Makefile delete mode 100644 games/canfield/canfield/Makefile delete mode 100644 games/canfield/canfield/canfield.6 delete mode 100644 games/canfield/canfield/canfield.c delete mode 100644 games/canfield/canfield/pathnames.h delete mode 100644 games/canfield/cfscores/Makefile delete mode 100644 games/canfield/cfscores/cfscores.c delete mode 100644 games/cribbage/Makefile delete mode 100644 games/cribbage/cards.c delete mode 100644 games/cribbage/crib.c delete mode 100644 games/cribbage/cribbage.6 delete mode 100644 games/cribbage/cribbage.h delete mode 100644 games/cribbage/cribbage.n delete mode 100644 games/cribbage/cribcur.h delete mode 100644 games/cribbage/deck.h delete mode 100644 games/cribbage/extern.c delete mode 100644 games/cribbage/instr.c delete mode 100644 games/cribbage/io.c delete mode 100644 games/cribbage/pathnames.h delete mode 100644 games/cribbage/score.c delete mode 100644 games/cribbage/support.c delete mode 100644 games/dm/Makefile delete mode 100644 games/dm/dm.8 delete mode 100644 games/dm/dm.c delete mode 100644 games/dm/dm.conf.5 delete mode 100644 games/dm/pathnames.h delete mode 100644 games/fish/Makefile delete mode 100644 games/fish/fish.6 delete mode 100644 games/fish/fish.c delete mode 100644 games/fish/fish.instr delete mode 100644 games/fish/pathnames.h delete mode 100644 games/hack/COPYRIGHT delete mode 100644 games/hack/Makefile delete mode 100644 games/hack/Makequest delete mode 100644 games/hack/OWNER delete mode 100644 games/hack/Original_READ_ME delete mode 100644 games/hack/READ_ME delete mode 100644 games/hack/alloc.c delete mode 100644 games/hack/config.h delete mode 100644 games/hack/data delete mode 100644 games/hack/date.h delete mode 100644 games/hack/def.edog.h delete mode 100644 games/hack/def.eshk.h delete mode 100644 games/hack/def.flag.h delete mode 100644 games/hack/def.func_tab.h delete mode 100644 games/hack/def.gen.h delete mode 100644 games/hack/def.gold.h delete mode 100644 games/hack/def.mkroom.h delete mode 100644 games/hack/def.monst.h delete mode 100644 games/hack/def.obj.h delete mode 100644 games/hack/def.objclass.h delete mode 100644 games/hack/def.objects.h delete mode 100644 games/hack/def.permonst.h delete mode 100644 games/hack/def.rm.h delete mode 100644 games/hack/def.trap.h delete mode 100644 games/hack/def.wseg.h delete mode 100644 games/hack/hack.6 delete mode 100644 games/hack/hack.Decl.c delete mode 100644 games/hack/hack.apply.c delete mode 100644 games/hack/hack.bones.c delete mode 100644 games/hack/hack.c delete mode 100644 games/hack/hack.cmd.c delete mode 100644 games/hack/hack.do.c delete mode 100644 games/hack/hack.do_name.c delete mode 100644 games/hack/hack.do_wear.c delete mode 100644 games/hack/hack.dog.c delete mode 100644 games/hack/hack.eat.c delete mode 100644 games/hack/hack.end.c delete mode 100644 games/hack/hack.engrave.c delete mode 100644 games/hack/hack.fight.c delete mode 100644 games/hack/hack.fix delete mode 100644 games/hack/hack.h delete mode 100644 games/hack/hack.invent.c delete mode 100644 games/hack/hack.ioctl.c delete mode 100644 games/hack/hack.lev.c delete mode 100644 games/hack/hack.main.c delete mode 100644 games/hack/hack.makemon.c delete mode 100644 games/hack/hack.mfndpos.h delete mode 100644 games/hack/hack.mhitu.c delete mode 100644 games/hack/hack.mklev.c delete mode 100644 games/hack/hack.mkmaze.c delete mode 100644 games/hack/hack.mkobj.c delete mode 100644 games/hack/hack.mkshop.c delete mode 100644 games/hack/hack.mon.c delete mode 100644 games/hack/hack.monst.c delete mode 100644 games/hack/hack.o_init.c delete mode 100644 games/hack/hack.objnam.c delete mode 100644 games/hack/hack.options.c delete mode 100644 games/hack/hack.pager.c delete mode 100644 games/hack/hack.potion.c delete mode 100644 games/hack/hack.pri.c delete mode 100644 games/hack/hack.read.c delete mode 100644 games/hack/hack.rip.c delete mode 100644 games/hack/hack.rumors.c delete mode 100644 games/hack/hack.save.c delete mode 100644 games/hack/hack.search.c delete mode 100644 games/hack/hack.sh delete mode 100644 games/hack/hack.shk.c delete mode 100644 games/hack/hack.shknam.c delete mode 100644 games/hack/hack.steal.c delete mode 100644 games/hack/hack.termcap.c delete mode 100644 games/hack/hack.timeout.c delete mode 100644 games/hack/hack.topl.c delete mode 100644 games/hack/hack.track.c delete mode 100644 games/hack/hack.trap.c delete mode 100644 games/hack/hack.tty.c delete mode 100644 games/hack/hack.u_init.c delete mode 100644 games/hack/hack.unix.c delete mode 100644 games/hack/hack.vault.c delete mode 100644 games/hack/hack.version.c delete mode 100644 games/hack/hack.wield.c delete mode 100644 games/hack/hack.wizard.c delete mode 100644 games/hack/hack.worm.c delete mode 100644 games/hack/hack.worn.c delete mode 100644 games/hack/hack.zap.c delete mode 100644 games/hack/help delete mode 100644 games/hack/hh delete mode 100644 games/hack/makedefs.c delete mode 100644 games/hack/pathnames.h delete mode 100644 games/hack/rnd.c delete mode 100644 games/hack/rumors delete mode 100644 games/hangman/Makefile delete mode 100644 games/hangman/endgame.c delete mode 100644 games/hangman/extern.c delete mode 100644 games/hangman/getguess.c delete mode 100644 games/hangman/getword.c delete mode 100644 games/hangman/hangman.6 delete mode 100644 games/hangman/hangman.h delete mode 100644 games/hangman/main.c delete mode 100644 games/hangman/pathnames.h delete mode 100644 games/hangman/playgame.c delete mode 100644 games/hangman/prdata.c delete mode 100644 games/hangman/prman.c delete mode 100644 games/hangman/prword.c delete mode 100644 games/hangman/setup.c delete mode 100644 games/larn/COPYRIGHT delete mode 100644 games/larn/Fixed.Bugs delete mode 100644 games/larn/Makefile delete mode 100644 games/larn/OWNER delete mode 100644 games/larn/README delete mode 100644 games/larn/bill.c delete mode 100644 games/larn/config.c delete mode 100644 games/larn/create.c delete mode 100644 games/larn/data.c delete mode 100644 games/larn/datfiles/larn.help delete mode 100644 games/larn/datfiles/larnmaze delete mode 100644 games/larn/datfiles/larnopts delete mode 100644 games/larn/diag.c delete mode 100644 games/larn/display.c delete mode 100644 games/larn/fortune.c delete mode 100644 games/larn/global.c delete mode 100644 games/larn/header.h delete mode 100644 games/larn/help.c delete mode 100644 games/larn/holidays delete mode 100644 games/larn/io.c delete mode 100644 games/larn/larn.6 delete mode 100644 games/larn/main.c delete mode 100644 games/larn/monster.c delete mode 100644 games/larn/moreobj.c delete mode 100644 games/larn/movem.c delete mode 100644 games/larn/nap.c delete mode 100644 games/larn/object.c delete mode 100644 games/larn/pathnames.h delete mode 100644 games/larn/regen.c delete mode 100644 games/larn/savelev.c delete mode 100644 games/larn/scores.c delete mode 100644 games/larn/signal.c delete mode 100644 games/larn/store.c delete mode 100644 games/larn/tok.c delete mode 100644 games/mille/Makefile delete mode 100644 games/mille/comp.c delete mode 100644 games/mille/end.c delete mode 100644 games/mille/extern.c delete mode 100644 games/mille/init.c delete mode 100644 games/mille/mille.6 delete mode 100644 games/mille/mille.c delete mode 100644 games/mille/mille.h delete mode 100644 games/mille/misc.c delete mode 100644 games/mille/move.c delete mode 100644 games/mille/print.c delete mode 100644 games/mille/roll.c delete mode 100644 games/mille/save.c delete mode 100644 games/mille/types.c delete mode 100644 games/mille/varpush.c delete mode 100644 games/phantasia/COPYRIGHT delete mode 100644 games/phantasia/Makefile delete mode 100644 games/phantasia/OWNER delete mode 100644 games/phantasia/README delete mode 100644 games/phantasia/fight.c delete mode 100644 games/phantasia/gamesupport.c delete mode 100644 games/phantasia/include.h delete mode 100644 games/phantasia/interplayer.c delete mode 100644 games/phantasia/io.c delete mode 100644 games/phantasia/macros.h delete mode 100644 games/phantasia/main.c delete mode 100644 games/phantasia/map.c delete mode 100644 games/phantasia/misc.c delete mode 100644 games/phantasia/monsters.asc delete mode 100644 games/phantasia/pathnames.h delete mode 100644 games/phantasia/phantasia.6 delete mode 100644 games/phantasia/phantdefs.h delete mode 100644 games/phantasia/phantglobs.c delete mode 100644 games/phantasia/phantglobs.h delete mode 100644 games/phantasia/phantstruct.h delete mode 100644 games/phantasia/setup.c delete mode 100644 games/piano/Makefile delete mode 100644 games/piano/README delete mode 100644 games/piano/piano.6 delete mode 100644 games/piano/piano.c delete mode 100644 games/pig/Makefile delete mode 100644 games/pig/pig.6 delete mode 100644 games/pig/pig.c delete mode 100644 games/quiz/Makefile delete mode 100644 games/quiz/datfiles/africa delete mode 100644 games/quiz/datfiles/america delete mode 100644 games/quiz/datfiles/areas delete mode 100644 games/quiz/datfiles/arith delete mode 100644 games/quiz/datfiles/asia delete mode 100644 games/quiz/datfiles/babies delete mode 100644 games/quiz/datfiles/bard delete mode 100644 games/quiz/datfiles/chinese delete mode 100644 games/quiz/datfiles/collectives delete mode 100644 games/quiz/datfiles/ed delete mode 100644 games/quiz/datfiles/elements delete mode 100644 games/quiz/datfiles/europe delete mode 100644 games/quiz/datfiles/flowers delete mode 100644 games/quiz/datfiles/greek delete mode 100644 games/quiz/datfiles/inca delete mode 100644 games/quiz/datfiles/index delete mode 100644 games/quiz/datfiles/latin delete mode 100644 games/quiz/datfiles/locomotive delete mode 100644 games/quiz/datfiles/midearth delete mode 100644 games/quiz/datfiles/morse delete mode 100644 games/quiz/datfiles/mult delete mode 100644 games/quiz/datfiles/murders delete mode 100644 games/quiz/datfiles/poetry delete mode 100644 games/quiz/datfiles/posneg delete mode 100644 games/quiz/datfiles/pres delete mode 100644 games/quiz/datfiles/province delete mode 100644 games/quiz/datfiles/seq-easy delete mode 100644 games/quiz/datfiles/seq-hard delete mode 100644 games/quiz/datfiles/sexes delete mode 100644 games/quiz/datfiles/sov delete mode 100644 games/quiz/datfiles/spell delete mode 100644 games/quiz/datfiles/state delete mode 100644 games/quiz/datfiles/trek delete mode 100644 games/quiz/datfiles/ucc delete mode 100644 games/quiz/pathnames.h delete mode 100644 games/quiz/quiz.6 delete mode 100644 games/quiz/quiz.c delete mode 100644 games/quiz/quiz.h delete mode 100644 games/quiz/rxp.c delete mode 100644 games/rain/Makefile delete mode 100644 games/rain/rain.6 delete mode 100644 games/rain/rain.c delete mode 100644 games/robots/Makefile delete mode 100644 games/robots/extern.c delete mode 100644 games/robots/flush_in.c delete mode 100644 games/robots/init_field.c delete mode 100644 games/robots/main.c delete mode 100644 games/robots/make_level.c delete mode 100644 games/robots/move.c delete mode 100644 games/robots/move_robs.c delete mode 100644 games/robots/pathnames.h delete mode 100644 games/robots/play_level.c delete mode 100644 games/robots/query.c delete mode 100644 games/robots/rnd_pos.c delete mode 100644 games/robots/robots.6 delete mode 100644 games/robots/robots.h delete mode 100644 games/robots/score.c delete mode 100644 games/rogue/CHANGES delete mode 100644 games/rogue/Makefile delete mode 100644 games/rogue/USD.doc/Makefile delete mode 100644 games/rogue/USD.doc/rogue.me delete mode 100644 games/rogue/hit.c delete mode 100644 games/rogue/init.c delete mode 100644 games/rogue/inventory.c delete mode 100644 games/rogue/level.c delete mode 100644 games/rogue/machdep.c delete mode 100644 games/rogue/main.c delete mode 100644 games/rogue/message.c delete mode 100644 games/rogue/monster.c delete mode 100644 games/rogue/move.c delete mode 100644 games/rogue/object.c delete mode 100644 games/rogue/pack.c delete mode 100644 games/rogue/pathnames.h delete mode 100644 games/rogue/play.c delete mode 100644 games/rogue/random.c delete mode 100644 games/rogue/ring.c delete mode 100644 games/rogue/rogue.6 delete mode 100644 games/rogue/rogue.h delete mode 100644 games/rogue/room.c delete mode 100644 games/rogue/save.c delete mode 100644 games/rogue/score.c delete mode 100644 games/rogue/spec_hit.c delete mode 100644 games/rogue/throw.c delete mode 100644 games/rogue/trap.c delete mode 100644 games/rogue/use.c delete mode 100644 games/rogue/zap.c delete mode 100644 games/sail/Makefile delete mode 100644 games/sail/assorted.c delete mode 100644 games/sail/dr_1.c delete mode 100644 games/sail/dr_2.c delete mode 100644 games/sail/dr_3.c delete mode 100644 games/sail/dr_4.c delete mode 100644 games/sail/dr_5.c delete mode 100644 games/sail/dr_main.c delete mode 100644 games/sail/driver.h delete mode 100644 games/sail/externs.h delete mode 100644 games/sail/game.c delete mode 100644 games/sail/globals.c delete mode 100644 games/sail/lo_main.c delete mode 100644 games/sail/machdep.h delete mode 100644 games/sail/main.c delete mode 100644 games/sail/misc.c delete mode 100644 games/sail/parties.c delete mode 100644 games/sail/pathnames.h delete mode 100644 games/sail/pl_1.c delete mode 100644 games/sail/pl_2.c delete mode 100644 games/sail/pl_3.c delete mode 100644 games/sail/pl_4.c delete mode 100644 games/sail/pl_5.c delete mode 100644 games/sail/pl_6.c delete mode 100644 games/sail/pl_7.c delete mode 100644 games/sail/pl_main.c delete mode 100644 games/sail/player.h delete mode 100644 games/sail/sail.6 delete mode 100644 games/sail/sync.c delete mode 100644 games/sail/version.c delete mode 100644 games/snake/Makefile delete mode 100644 games/snake/snake/Makefile delete mode 100644 games/snake/snake/move.c delete mode 100644 games/snake/snake/pathnames.h delete mode 100644 games/snake/snake/snake.6 delete mode 100644 games/snake/snake/snake.c delete mode 100644 games/snake/snake/snake.h delete mode 100644 games/snake/snscore/Makefile delete mode 100644 games/snake/snscore/snscore.c delete mode 100644 games/trek/DOC/read_me.nr delete mode 100644 games/trek/DOC/things delete mode 100644 games/trek/DOC/trekmanual.nr delete mode 100644 games/trek/Makefile delete mode 100644 games/trek/USD.doc/Makefile delete mode 100644 games/trek/USD.doc/spell.ok delete mode 100644 games/trek/USD.doc/trek.me delete mode 100644 games/trek/abandon.c delete mode 100644 games/trek/attack.c delete mode 100644 games/trek/autover.c delete mode 100644 games/trek/capture.c delete mode 100644 games/trek/cgetc.c delete mode 100644 games/trek/check_out.c delete mode 100644 games/trek/checkcond.c delete mode 100644 games/trek/compkl.c delete mode 100644 games/trek/computer.c delete mode 100644 games/trek/damage.c delete mode 100644 games/trek/damaged.c delete mode 100644 games/trek/dcrept.c delete mode 100644 games/trek/destruct.c delete mode 100644 games/trek/dock.c delete mode 100644 games/trek/dumpgame.c delete mode 100644 games/trek/dumpme.c delete mode 100644 games/trek/dumpssradio.c delete mode 100644 games/trek/events.c delete mode 100644 games/trek/externs.c delete mode 100644 games/trek/getcodi.c delete mode 100644 games/trek/getpar.c delete mode 100644 games/trek/getpar.h delete mode 100644 games/trek/help.c delete mode 100644 games/trek/impulse.c delete mode 100644 games/trek/initquad.c delete mode 100644 games/trek/kill.c delete mode 100644 games/trek/klmove.c delete mode 100644 games/trek/lose.c delete mode 100644 games/trek/lrscan.c delete mode 100644 games/trek/main.c delete mode 100644 games/trek/move.c delete mode 100644 games/trek/nova.c delete mode 100644 games/trek/out.c delete mode 100644 games/trek/phaser.c delete mode 100644 games/trek/play.c delete mode 100644 games/trek/ram.c delete mode 100644 games/trek/ranf.c delete mode 100644 games/trek/rest.c delete mode 100644 games/trek/schedule.c delete mode 100644 games/trek/score.c delete mode 100644 games/trek/setup.c delete mode 100644 games/trek/setwarp.c delete mode 100644 games/trek/shield.c delete mode 100644 games/trek/snova.c delete mode 100644 games/trek/srscan.c delete mode 100644 games/trek/systemname.c delete mode 100644 games/trek/torped.c delete mode 100644 games/trek/trek.6 delete mode 100644 games/trek/trek.h delete mode 100644 games/trek/utility.c delete mode 100644 games/trek/visual.c delete mode 100644 games/trek/warp.c delete mode 100644 games/trek/win.c delete mode 100644 games/wargames/Makefile delete mode 100644 games/wargames/wargames.6 delete mode 100644 games/wargames/wargames.c delete mode 100644 games/worm/Makefile delete mode 100644 games/worm/worm.6 delete mode 100644 games/worm/worm.c delete mode 100644 games/worms/Makefile delete mode 100644 games/worms/worms.6 delete mode 100644 games/worms/worms.c delete mode 100644 games/wump/Makefile delete mode 100644 games/wump/pathnames.h delete mode 100644 games/wump/wump.6 delete mode 100644 games/wump/wump.c delete mode 100644 games/wump/wump.info diff --git a/games/adventure/Makefile b/games/adventure/Makefile deleted file mode 100644 index b5a1b723634e..000000000000 --- a/games/adventure/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -# @(#)Makefile 8.1 (Berkeley) 6/12/93 -# $FreeBSD$ - -PROG= adventure -SRCS= main.c init.c done.c save.c subr.c vocab.c wizard.c io.c data.c crc.c -MAN= adventure.6 -HIDEGAME=hidegame -CLEANFILES=data.c setup setup.o - -WARNS?= 2 - -build-tools: setup - -data.c: glorkz setup - ./setup ${.CURDIR}/glorkz > data.c - -setup: setup.o - ${CC} -static ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} - -.include diff --git a/games/adventure/adventure.6 b/games/adventure/adventure.6 deleted file mode 100644 index a6735850aaa4..000000000000 --- a/games/adventure/adventure.6 +++ /dev/null @@ -1,58 +0,0 @@ -.\" Copyright (c) 1991, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" The game adventure was originally written in Fortran by Will Crowther -.\" and Don Woods. It was later translated to C and enhanced by Jim -.\" Gillogly. This code is derived from software contributed to Berkeley -.\" by Jim Gillogly at The Rand Corporation. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" 3. All advertising materials mentioning features or use of this software -.\" must display the following acknowledgement: -.\" This product includes software developed by the University of -.\" California, Berkeley and its contributors. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" @(#)adventure.6 8.1 (Berkeley) 5/31/93 -.\" $FreeBSD$ -.\" -.Dd May 31, 1993 -.Dt ADVENTURE 6 -.Os -.Sh NAME -.Nm adventure -.Nd an exploration game -.Sh SYNOPSIS -.Nm -.Op saved-file -.Sh DESCRIPTION -The object of the game is to locate and explore Colossal Cave, find the -treasures hidden there, and bring them back to the building with you. -The program is self-descriptive to a point, but part of the game is to -discover its rules. -.Pp -To terminate a game, enter -.Dq quit ; -to save a game for later resumption, enter -.Dq suspend . diff --git a/games/adventure/crc.c b/games/adventure/crc.c deleted file mode 100644 index 3c48d8645b74..000000000000 --- a/games/adventure/crc.c +++ /dev/null @@ -1,140 +0,0 @@ -/*- - * Copyright (c) 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * James W. Williams of the University of Maryland. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)crc.c 8.1 (Berkeley) 5/31/93"; -static char ORIGINAL_sccsid[] = "@(#)crc.c 5.2 (Berkeley) 4/4/91"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include -#include "hdr.h" - -const u_long crctab[] = { - 0x7fffffff, - 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, - 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, - 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, - 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, - 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, 0x646ba8c0, - 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, - 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, - 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, - 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, - 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, 0xc8d75180, - 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f, - 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, - 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106, - 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, - 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, - 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, 0x6b6b51f4, - 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, - 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, - 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, - 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, - 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, - 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, - 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, - 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, 0x5edef90e, - 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, - 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, - 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, - 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, - 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, 0x8708a3d2, - 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, - 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, - 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, - 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, - 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, - 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79, - 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, - 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28, - 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, - 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, - 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, 0x95bf4a82, - 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, - 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, - 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, - 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, - 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, - 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, - 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, - 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, 0xbdbdf21c, - 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, - 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, - 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d -}; - -/* - * crc -- - * Compute a POSIX.2 checksum. This routine modified by Jim Gillogly - * to work on sequential data rather than on a file. Initial call to - * crc_start initializes the sum, and subsequent calls to crc update - * it. - */ - -u_long crcval; -u_int step; - -void -crc_start(void) -{ - crcval = step = 0; -} - -/* Process nr bytes at a time; ptr points to them */ -u_long -crc(const char *ptr, size_t nr) -{ - int i; - const char *p; - - while (nr > 0) - for (p = ptr; nr--; ++p) - { - if (!(i = crcval >> 24 ^ *p)) - { - i = step++; - if (step >= sizeof(crctab)/sizeof(crctab[0])) - step = 0; - } - crcval = (crcval << 8) ^ crctab[i]; - } - return crcval & 0xffffffff; /* Mask to 32 bits. */ -} diff --git a/games/adventure/done.c b/games/adventure/done.c deleted file mode 100644 index 61c2dece8142..000000000000 --- a/games/adventure/done.c +++ /dev/null @@ -1,146 +0,0 @@ -/*- - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * The game adventure was originally written in Fortran by Will Crowther - * and Don Woods. It was later translated to C and enhanced by Jim - * Gillogly. This code is derived from software contributed to Berkeley - * by Jim Gillogly at The Rand Corporation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)done.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -/* Re-coding of advent in C: termination routines */ - -#include -#include -#include "hdr.h" - -int -score(void) /* sort of like 20000 */ -{ int scor,i; - mxscor=scor=0; - for (i=50; i<=maxtrs; i++) - { if (ptext[i].txtlen==0) continue; - k=12; - if (i==chest) k=14; - if (i>chest) k=16; - if (prop[i]>=0) scor += 2; - if (place[i]==3&&prop[i]==0) scor += k-2; - mxscor += k; - } - scor += (maxdie-numdie)*10; - mxscor += maxdie*10; - if (!(scorng||gaveup)) scor += 4; - mxscor += 4; - if (dflag!=0) scor += 25; - mxscor += 25; - if (closng) scor += 25; - mxscor += 25; - if (closed) - { if (bonus==0) scor += 10; - if (bonus==135) scor += 25; - if (bonus==134) scor += 30; - if (bonus==133) scor += 45; - } - mxscor += 45; - if (place[magzin]==108) scor++; - mxscor++; - scor += 2; - mxscor += 2; - for (i=1; i<=hntmax; i++) - if (hinted[i]) scor -= hints[i][2]; - return(scor); -} - -/* entry=1 means goto 13000 */ /* game is over */ -/* entry=2 means goto 20000 */ /* 3=19000 */ -void -done(int entry) -{ int i,sc; - if (entry==1) mspeak(1); - if (entry==3) rspeak(136); - printf("\n\n\nYou scored %d out of a ",(sc=score())); - printf("possible %d using %d turns.\n",mxscor,turns); - for (i=1; i<=clsses; i++) - if (cval[i]>=sc) - { speak(&ctext[i]); - if (i==clsses-1) - { printf("To achieve the next higher rating"); - printf(" would be a neat trick!\n\n"); - printf("Congratulations!!\n"); - exit(0); - } - k=cval[i]+1-sc; - printf("To achieve the next higher rating, you need"); - printf(" %d more point",k); - if (k==1) printf(".\n"); - else printf("s.\n"); - exit(0); - } - printf("You just went off my scale!!!\n"); - exit(0); -} - - -void -die(int entry) /* label 90 */ -{ int i; - if (entry != 99) - { rspeak(23); - oldlc2=loc; - } - if (closng) /* 99 */ - { rspeak(131); - numdie++; - done(2); - } - yea=yes(81+numdie*2,82+numdie*2,54); - numdie++; - if (numdie==maxdie || !yea) done(2); - place[water]=0; - place[oil]=0; - if (toting(lamp)) prop[lamp]=0; - for (i=100; i>=1; i--) - { if (!toting(i)) continue; - k=oldlc2; - if (i==lamp) k=1; - drop(i,k); - } - loc=3; - oldloc=loc; -} diff --git a/games/adventure/glorkz b/games/adventure/glorkz deleted file mode 100644 index c65c8fd383ca..000000000000 --- a/games/adventure/glorkz +++ /dev/null @@ -1,1815 +0,0 @@ -1 -1 You are standing at the end of a road before a small brick building. -1 Around you is a forest. A small stream flows out of the building and -1 down a gully. -2 You have walked up a hill, still in the forest. The road slopes back -2 down the other side of the hill. There is a building in the distance. -3 You are inside a building, a well house for a large spring. -4 You are in a valley in the forest beside a stream tumbling along a -4 rocky bed. -5 You are in open forest, with a deep valley to one side. -6 You are in open forest near both a valley and a road. -7 At your feet all the water of the stream splashes into a 2-inch slit -7 in the rock. Downstream the streambed is bare rock. -8 You are in a 20-foot depression floored with bare dirt. Set into the -8 dirt is a strong steel grate mounted in concrete. A dry streambed -8 leads into the depression. -9 You are in a small chamber beneath a 3x3 steel grate to the surface. -9 A low crawl over cobbles leads inward to the west. -10 You are crawling over cobbles in a low passage. There is a dim light -10 at the east end of the passage. -11 You are in a debris room filled with stuff washed in from the surface. -11 A low wide passage with cobbles becomes plugged with mud and debris -11 here, but an awkward canyon leads upward and west. A note on the wall -11 says "Magic word XYZZY". -12 You are in an awkward sloping east/west canyon. -13 You are in a splendid chamber thirty feet high. The walls are frozen -13 rivers of orange stone. An awkward canyon and a good passage exit -13 from east and west sides of the chamber. -14 At your feet is a small pit breathing traces of white mist. An east -14 passage ends here except for a small crack leading on. -15 You are at one end of a vast hall stretching forward out of sight to -15 the west. There are openings to either side. Nearby, a wide stone -15 staircase leads downward. The hall is filled with wisps of white mist -15 swaying to and fro almost as if alive. A cold wind blows up the -15 staircase. There is a passage at the top of a dome behind you. -16 The crack is far too small for you to follow. -17 You are on the east bank of a fissure slicing clear across the hall. -17 The mist is quite thick here, and the fissure is too wide to jump. -18 This is a low room with a crude note on the wall. The note says, -18 "You won't get it up the steps". -19 You are in the Hall of the Mountain King, with passages off in all -19 directions. -20 You are at the bottom of the pit with a broken neck. -21 You didn't make it. -22 The dome is unclimbable. -23 You are at the west end of the Twopit Room. There is a large hole in -23 the wall above the pit at this end of the room. -24 You are at the bottom of the eastern pit in the Twopit Room. There is -24 a small pool of oil in one corner of the pit. -25 You are at the bottom of the western pit in the Twopit Room. There is -25 a large hole in the wall about 25 feet above you. -26 You clamber up the plant and scurry through the hole at the top. -27 You are on the west side of the fissure in the Hall of Mists. -28 You are in a low N/S passage at a hole in the floor. The hole goes -28 down to an E/W passage. -29 You are in the south side chamber. -30 You are in the west side chamber of the Hall of the Mountain King. -30 A passage continues west and up here. -31 >$< -32 You can't get by the snake. -33 You are in a large room, with a passage to the south, a passage to the -33 west, and a wall of broken rock to the east. There is a large "Y2" on -33 a rock in the room's center. -34 You are in a jumble of rock, with cracks everywhere. -35 You're at a low window overlooking a huge pit, which extends up out of -35 sight. A floor is indistinctly visible over 50 feet below. Traces of -35 white mist cover the floor of the pit, becoming thicker to the right. -35 Marks in the dust around the window would seem to indicate that -35 someone has been here recently. Directly across the pit from you and -35 25 feet away there is a similar window looking into a lighted room. A -35 shadowy figure can be seen there peering back at you. -36 You are in a dirty broken passage. To the east is a crawl. To the -36 west is a large passage. Above you is a hole to another passage. -37 You are on the brink of a small clean climbable pit. A crawl leads -37 west. -38 You are in the bottom of a small pit with a little stream, which -38 enters and exits through tiny slits. -39 You are in a large room full of dusty rocks. There is a big hole in -39 the floor. There are cracks everywhere, and a passage leading east. -40 You have crawled through a very low wide passage parallel to and north -40 of the Hall of Mists. -41 You are at the west end of Hall of Mists. A low wide crawl continues -41 west and another goes north. To the south is a little passage 6 feet -41 off the floor. -42 You are in a maze of twisty little passages, all alike. -43 You are in a maze of twisty little passages, all alike. -44 You are in a maze of twisty little passages, all alike. -45 You are in a maze of twisty little passages, all alike. -46 Dead end -47 Dead end -48 Dead end -49 You are in a maze of twisty little passages, all alike. -50 You are in a maze of twisty little passages, all alike. -51 You are in a maze of twisty little passages, all alike. -52 You are in a maze of twisty little passages, all alike. -53 You are in a maze of twisty little passages, all alike. -54 Dead end -55 You are in a maze of twisty little passages, all alike. -56 Dead end -57 You are on the brink of a thirty foot pit with a massive orange column -57 down one wall. You could climb down here but you could not get back -57 up. The maze continues at this level. -58 Dead end -59 You have crawled through a very low wide passage parallel to and north -59 of the Hall of Mists. -60 You are at the east end of a very long hall apparently without side -60 chambers. To the east a low wide crawl slants up. To the north a -60 round two foot hole slants down. -61 You are at the west end of a very long featureless hall. The hall -61 joins up with a narrow north/south passage. -62 You are at a crossover of a high N/S passage and a low E/W one. -63 Dead end -64 You are at a complex junction. A low hands and knees passage from the -64 north joins a higher crawl from the east to make a walking passage -64 going west. There is also a large room above. The air is damp here. -65 You are in Bedquilt, a long east/west passage with holes everywhere. -65 To explore at random select north, south, up, or down. -66 You are in a room whose walls resemble Swiss cheese. Obvious passages -66 go west, east, NE, and NW. Part of the room is occupied by a large -66 bedrock block. -67 You are at the east end of the Twopit Room. The floor here is -67 littered with thin rock slabs, which make it easy to descend the pits. -67 There is a path here bypassing the pits to connect passages from east -67 and west. There are holes all over, but the only big one is on the -67 wall directly over the west pit where you can't get to it. -68 You are in a large low circular chamber whose floor is an immense slab -68 fallen from the ceiling (Slab Room). East and west there once were -68 large passages, but they are now filled with boulders. Low small -68 passages go north and south, and the south one quickly bends west -68 around the boulders. -69 You are in a secret N/S canyon above a large room. -70 You are in a secret N/S canyon above a sizable passage. -71 You are in a secret canyon at a junction of three canyons, bearing -71 north, south, and SE. The north one is as tall as the other two -71 combined. -72 You are in a large low room. Crawls lead north, SE, and SW. -73 Dead end crawl. -74 You are in a secret canyon which here runs e/w. It crosses over a -74 very tight canyon 15 feet below. If you go down you may not be able -74 to get back up. -75 You are at a wide place in a very tight N/S canyon. -76 The canyon here becomes too tight to go further south. -77 You are in a tall E/W canyon. A low tight crawl goes 3 feet north and -77 seems to open up. -78 The canyon runs into a mass of boulders -- dead end. -79 The stream flows out through a pair of 1 foot diameter sewer pipes. -79 It would be advisable to use the exit. -80 You are in a maze of twisty little passages, all alike. -81 Dead end -82 Dead end -83 You are in a maze of twisty little passages, all alike. -84 You are in a maze of twisty little passages, all alike. -85 Dead end -86 Dead end -87 You are in a maze of twisty little passages, all alike. -88 You are in a long, narrow corridor stretching out of sight to the -88 west. At the eastern end is a hole through which you can see a -88 profusion of leaves. -89 There is nothing here to climb. Use "up" or "out" to leave the pit. -90 You have climbed up the plant and out of the pit. -91 You are at the top of a steep incline above a large room. You could -91 climb down here, but you would not be able to climb up. There is a -91 passage leading back to the north. -92 You are in the Giant Room. The ceiling here is too high up for your -92 lamp to show it. Cavernous passages lead east, north, and south. On -92 the west wall is scrawled the inscription, "Fee fie foe foo" [sic]. -93 The passage here is blocked by a recent cave-in. -94 You are at one end of an immense north/south passage. -95 You are in a magnificent cavern with a rushing stream, which cascades -95 over a sparkling waterfall into a roaring whirlpool which disappears -95 through a hole in the floor. Passages exit to the south and west. -96 You are in the Soft Room. The walls are covered with heavy curtains, -96 the floor with a thick pile carpet. Moss covers the ceiling. -97 This is the Oriental Room. Ancient oriental cave drawings cover the -97 walls. A gently sloping passage leads upward to the north, another -97 passage leads SE, and a hands and knees crawl leads west. -98 You are following a wide path around the outer edge of a large cavern. -98 Far below, through a heavy white mist, strange splashing noises can be -98 heard. The mist rises up through a fissure in the ceiling. The path -98 exits to the south and west. -99 You are in an alcove. A small NW path seems to widen after a short -99 distance. An extremely tight tunnel leads east. It looks like a very -99 tight squeeze. An eerie light can be seen at the other end. -100 You're in a small chamber lit by an eerie green light. An extremely -100 narrow tunnel exits to the west. A dark corridor leads ne. -101 You're in the Dark-Room. A corridor leading south is the only exit. -102 You are in an arched hall. A coral passage once continued up and east -102 from here, but is now blocked by debris. The air smells of sea water. -103 You're in a large room carved out of sedimentary rock. The floor and -103 walls are littered with bits of shells embedded in the stone. A -103 shallow passage proceeds downward, and a somewhat steeper one leads -103 up. A low hands and knees passage enters from the south. -104 You are in a long sloping corridor with ragged sharp walls. -105 You are in a cul-de-sac about eight feet across. -106 You are in an anteroom leading to a large passage to the east. Small -106 passages go west and up. The remnants of recent digging are evident. -106 A sign in midair here says "Cave under construction beyond this point. -106 Proceed at own risk. [Witt construction company]" -107 You are in a maze of twisty little passages, all different. -108 You are at Witt's End. Passages lead off in *all* directions. -109 You are in a north/south canyon about 25 feet across. The floor is -109 covered by white mist seeping in from the north. The walls extend -109 upward for well over 100 feet. Suspended from some unseen point far -109 above you, an enormous two-sided mirror is hanging parallel to and -109 midway between the canyon walls. (The mirror is obviously provided -109 for the use of the dwarves, who as you know, are extremely vain.) A -109 small window can be seen in either wall, some fifty feet up. -110 You're at a low window overlooking a huge pit, which extends up out of -110 sight. A floor is indistinctly visible over 50 feet below. Traces of -110 white mist cover the floor of the pit, becoming thicker to the left. -110 Marks in the dust around the window would seem to indicate that -110 someone has been here recently. Directly across the pit from you and -110 25 feet away there is a similar window looking into a lighted room. A -110 shadowy figure can be seen there peering back at you. -111 A large stalactite extends from the roof and almost reaches the floor -111 below. You could climb down it, and jump from it to the floor, but -111 having done so you would be unable to reach it to climb back up. -112 You are in a little maze of twisting passages, all different. -113 You are at the edge of a large underground reservoir. An opaque cloud -113 of white mist fills the room and rises rapidly upward. The lake is -113 fed by a stream, which tumbles out of a hole in the wall about 10 feet -113 overhead and splashes noisily into the water somewhere within the -113 mist. The only passage goes back toward the south. -114 Dead end -115 You are at the northeast end of an immense room, even larger than the -115 Giant Room. It appears to be a repository for the "Adventure" -115 program. Massive torches far overhead bathe the room with smoky -115 yellow light. Scattered about you can be seen a pile of bottles (all -115 of them empty), a nursery of young beanstalks murmuring quietly, a bed -115 of oysters, a bundle of black rods with rusty stars on their ends, and -115 a collection of brass lanterns. Off to one side a great many dwarves -115 are sleeping on the floor, snoring loudly. A sign nearby reads: "Do -115 not disturb the dwarves!" An immense mirror is hanging against one -115 wall, and stretches to the other end of the room, where various other -115 sundry objects can be glimpsed dimly in the distance. -116 You are at the southwest end of the Repository. To one side is a pit -116 full of fierce green snakes. On the other side is a row of small -116 wicker cages, each of which contains a little sulking bird. In one -116 corner is a bundle of black rods with rusty marks on their ends. A -116 large number of velvet pillows are scattered about on the floor. A -116 vast mirror stretches off to the northeast. At your feet is a large -116 steel grate, next to which is a sign which reads, "Treasure Vault. -116 Keys in Main Office." -117 You are on one side of a large, deep chasm. A heavy white mist rising -117 up from below obscures all view of the far side. A SW path leads away -117 from the chasm into a winding corridor. -118 You are in a long winding corridor sloping out of sight in both -118 directions. -119 You are in a secret canyon which exits to the north and east. -120 You are in a secret canyon which exits to the north and east. -121 You are in a secret canyon which exits to the north and east. -122 You are on the far side of the chasm. A ne path leads away from the -122 chasm on this side. -123 You're in a long east/west corridor. A faint rumbling noise can be -123 heard in the distance. -124 The path forks here. The left fork leads northeast. A dull rumbling -124 seems to get louder in that direction. The right fork leads southeast -124 down a gentle slope. The main corridor enters from the west. -125 The walls are quite warm here. From the north can be heard a steady -125 roar, so loud that the entire cave seems to be trembling. Another -125 passage leads south, and a low crawl goes east. -126 You are on the edge of a breath-taking view. Far below you is an -126 active volcano, from which great gouts of molten lava come surging -126 out, cascading back down into the depths. The glowing rock fills the -126 farthest reaches of the cavern with a blood-red glare, giving every- -126 thing an eerie, macabre appearance. The air is filled with flickering -126 sparks of ash and a heavy smell of brimstone. The walls are hot to -126 the touch, and the thundering of the volcano drowns out all other -126 sounds. Embedded in the jagged roof far overhead are myriad twisted -126 formations composed of pure white alabaster, which scatter the murky -126 light into sinister apparitions upon the walls. To one side is a deep -126 gorge, filled with a bizarre chaos of tortured rock which seems to -126 have been crafted by the devil himself. An immense river of fire -126 crashes out from the depths of the volcano, burns its way through the -126 gorge, and plummets into a bottomless pit far off to your left. To -126 the right, an immense geyser of blistering steam erupts continuously -126 from a barren island in the center of a sulfurous lake, which bubbles -126 ominously. The far right wall is aflame with an incandescence of its -126 own, which lends an additional infernal splendor to the already -126 hellish scene. A dark, foreboding passage exits to the south. -127 You are in a small chamber filled with large boulders. The walls are -127 very warm, causing the air in the room to be almost stifling from the -127 heat. The only exit is a crawl heading west, through which is coming -127 a low rumbling. -128 You are walking along a gently sloping north/south passage lined with -128 oddly shaped limestone formations. -129 You are standing at the entrance to a large, barren room. A sign -129 posted above the entrance reads: "Caution! Bear in room!" -130 You are inside a barren room. The center of the room is completely -130 empty except for some dust. Marks in the dust lead away toward the -130 far end of the room. The only exit is the way you came in. -131 You are in a maze of twisting little passages, all different. -132 You are in a little maze of twisty passages, all different. -133 You are in a twisting maze of little passages, all different. -134 You are in a twisting little maze of passages, all different. -135 You are in a twisty little maze of passages, all different. -136 You are in a twisty maze of little passages, all different. -137 You are in a little twisty maze of passages, all different. -138 You are in a maze of little twisting passages, all different. -139 You are in a maze of little twisty passages, all different. -140 Dead end --1 End -2 -1 You're at end of road again. -2 You're at hill in road. -3 You're inside building. -4 You're in valley. -5 You're in forest. -6 You're in forest. -7 You're at slit in streambed. -8 You're outside grate. -9 You're below the grate. -10 You're in Cobble Crawl. -11 You're in Debris Room. -13 You're in Bird Chamber. -14 You're at top of small pit. -15 You're in Hall of Mists. -17 You're on east bank of fissure. -18 You're in Nugget of Gold Room. -19 You're in Hall of Mt King. -23 You're at west end of Twopit Room. -24 You're in east pit. -25 You're in west pit. -33 You're at "Y2". -35 You're at window on pit. -36 You're in dirty passage. -39 You're in Dusty Rock room. -41 You're at west end of Hall of Mists. -57 You're at brink of pit. -60 You're at east end of Long Hall. -61 You're at west end of Long Hall. -64 You're at Complex Junction. -66 You're in Swiss Cheese room. -67 You're at east end of Twopit Room. -68 You're in Slab Room. -71 You're at junction of three secret canyons. -74 You're in secret E/W canyon above tight canyon. -88 You're in narrow corridor. -91 You're at steep incline above large room. -92 You're in Giant Room. -95 You're in cavern with waterfall. -96 You're in Soft Room. -97 You're in Oriental Room. -98 You're in Misty Cavern. -99 You're in Alcove. -100 You're in Plover Room. -101 You're in Dark-Room. -102 You're in Arched Hall. -103 You're in Shell Room. -106 You're in Anteroom. -108 You're at Witt's End. -109 You're in Mirror Canyon. -110 You're at window on pit. -111 You're at top of stalactite. -113 You're at Reservoir. -115 You're at NE end. -116 You're at SW end. -117 You're on SW side of chasm. -118 You're in sloping corridor. -122 You're on NE side of chasm. -123 You're in corridor. -124 You're at fork in path. -125 You're at junction with warm walls. -126 You're at Breath-taking View. -127 You're in Chamber of Boulders. -128 You're in limestone passage. -129 You're in front of barren room. -130 You're in Barren Room. --1 -3 -1 2 2 44 29 -1 3 3 12 19 43 -1 4 5 13 14 46 30 -1 5 6 45 43 -1 8 63 -2 1 2 12 7 43 45 30 -2 5 6 45 46 -3 1 3 11 32 44 -3 11 62 -3 33 65 -3 79 5 14 -4 1 4 12 45 -4 5 6 43 44 29 -4 7 5 46 30 -4 8 63 -5 4 9 43 30 -5 50005 6 7 45 -5 6 6 -5 5 44 46 -6 1 2 45 -6 4 9 43 44 30 -6 5 6 46 -7 1 12 -7 4 4 45 -7 5 6 43 44 -7 8 5 15 16 46 -7 595 60 14 30 -8 5 6 43 44 46 -8 1 12 -8 7 4 13 45 -8 303009 3 19 30 -8 593 3 -9 303008 11 29 -9 593 11 -9 10 17 18 19 44 -9 14 31 -9 11 51 -10 9 11 20 21 43 -10 11 19 22 44 51 -10 14 31 -11 303008 63 -11 9 64 -11 10 17 18 23 24 43 -11 12 25 19 29 44 -11 3 62 -11 14 31 -12 303008 63 -12 9 64 -12 11 30 43 51 -12 13 19 29 44 -12 14 31 -13 303008 63 -13 9 64 -13 11 51 -13 12 25 43 -13 14 23 31 44 -14 303008 63 -14 9 64 -14 11 51 -14 13 23 43 -14 150020 30 31 34 -14 15 30 -14 16 33 44 -15 18 36 46 -15 17 7 38 44 -15 19 10 30 45 -15 150022 29 31 34 35 23 43 -15 14 29 -15 34 55 -16 14 1 -17 15 38 43 -17 312596 39 -17 412021 7 -17 412597 41 42 44 69 -17 27 41 -18 15 38 11 45 -19 15 10 29 43 -19 311028 45 36 -19 311029 46 37 -19 311030 44 7 -19 32 45 -19 35074 49 -19 211032 49 -19 74 66 -20 0 1 -21 0 1 -22 15 1 -23 67 43 42 -23 68 44 61 -23 25 30 31 -23 648 52 -24 67 29 11 -25 23 29 11 -25 724031 56 -25 26 56 -26 88 1 -27 312596 39 -27 412021 7 -27 412597 41 42 43 69 -27 17 41 -27 40 45 -27 41 44 -28 19 38 11 46 -28 33 45 55 -28 36 30 52 -29 19 38 11 45 -30 19 38 11 43 -30 62 44 29 -31 524089 1 -31 90 1 -32 19 1 -33 3 65 -33 28 46 -33 34 43 53 54 -33 35 44 -33 159302 71 -33 100 71 -34 33 30 55 -34 15 29 -35 33 43 55 -35 20 39 -36 37 43 17 -36 28 29 52 -36 39 44 -36 65 70 -37 36 44 17 -37 38 30 31 56 -38 37 56 29 11 -38 595 60 14 30 4 5 -39 36 43 23 -39 64 30 52 58 -39 65 70 -40 41 1 -41 42 46 29 23 56 -41 27 43 -41 59 45 -41 60 44 17 -42 41 29 -42 42 45 -42 43 43 -42 45 46 -42 80 44 -43 42 44 -43 44 46 -43 45 43 -44 43 43 -44 48 30 -44 50 46 -44 82 45 -45 42 44 -45 43 45 -45 46 43 -45 47 46 -45 87 29 30 -46 45 44 11 -47 45 43 11 -48 44 29 11 -49 50 43 -49 51 44 -50 44 43 -50 49 44 -50 51 30 -50 52 46 -51 49 44 -51 50 29 -51 52 43 -51 53 46 -52 50 44 -52 51 43 -52 52 46 -52 53 29 -52 55 45 -52 86 30 -53 51 44 -53 52 45 -53 54 46 -54 53 44 11 -55 52 44 -55 55 45 -55 56 30 -55 57 43 -56 55 29 11 -57 13 30 56 -57 55 44 -57 58 46 -57 83 45 -57 84 43 -58 57 43 11 -59 27 1 -60 41 43 29 17 -60 61 44 -60 62 45 30 52 -61 60 43 -61 62 45 -61 100107 46 -62 60 44 -62 63 45 -62 30 43 -62 61 46 -63 62 46 11 -64 39 29 56 59 -64 65 44 70 -64 103 45 74 -64 106 43 -65 64 43 -65 66 44 -65 80556 46 -65 68 61 -65 80556 29 -65 50070 29 -65 39 29 -65 60556 45 -65 75072 45 -65 71 45 -65 80556 30 -65 106 30 -66 65 47 -66 67 44 -66 80556 46 -66 77 25 -66 96 43 -66 50556 50 -66 97 72 -67 66 43 -67 23 44 42 -67 24 30 31 -68 23 46 -68 69 29 56 -68 65 45 -69 68 30 61 -69 331120 46 -69 119 46 -69 109 45 -69 113 75 -70 71 45 -70 65 30 23 -70 111 46 -71 65 48 -71 70 46 -71 110 45 -72 65 70 -72 118 49 -72 73 45 -72 97 48 72 -73 72 46 17 11 -74 19 43 -74 331120 44 -74 121 44 -74 75 30 -75 76 46 -75 77 45 -76 75 45 -77 75 43 -77 78 44 -77 66 45 17 -78 77 46 -79 3 1 -80 42 45 -80 80 44 -80 80 46 -80 81 43 -81 80 44 11 -82 44 46 11 -83 57 46 -83 84 43 -83 85 44 -84 57 45 -84 83 44 -84 114 50 -85 83 43 11 -86 52 29 11 -87 45 29 30 -88 25 30 56 43 -88 20 39 -88 92 44 27 -89 25 1 -90 23 1 -91 95 45 73 23 -91 72 30 56 -92 88 46 -92 93 43 -92 94 45 -93 92 46 27 11 -94 92 46 27 23 -94 309095 45 3 73 -94 611 45 -95 94 46 11 -95 92 27 -95 91 44 -96 66 44 11 -97 66 48 -97 72 44 17 -97 98 29 45 73 -98 97 46 72 -98 99 44 -99 98 50 73 -99 301 43 23 -99 100 43 -100 301 44 23 11 -100 99 44 -100 159302 71 -100 33 71 -100 101 47 22 -101 100 46 71 11 -102 103 30 74 11 -103 102 29 38 -103 104 30 -103 114618 46 -103 115619 46 -103 64 46 -104 103 29 74 -104 105 30 -105 104 29 11 -105 103 74 -106 64 29 -106 65 44 -106 108 43 -107 131 46 -107 132 49 -107 133 47 -107 134 48 -107 135 29 -107 136 50 -107 137 43 -107 138 44 -107 139 45 -107 61 30 -108 95556 43 45 46 47 48 49 50 29 30 -108 106 43 -108 626 44 -109 69 46 -109 113 45 75 -110 71 44 -110 20 39 -111 70 45 -111 40050 30 39 56 -111 50053 30 -111 45 30 -112 131 49 -112 132 45 -112 133 43 -112 134 50 -112 135 48 -112 136 47 -112 137 44 -112 138 30 -112 139 29 -112 140 46 -113 109 46 11 109 -114 84 48 -115 116 49 -116 115 47 -116 593 30 -117 118 49 -117 233660 41 42 69 47 -117 332661 41 -117 303 41 -117 332021 39 -117 596 39 -118 72 30 -118 117 29 -119 69 45 11 -119 653 43 7 -120 69 45 -120 74 43 -121 74 43 11 -121 653 45 7 -122 123 47 -122 233660 41 42 69 49 -122 303 41 -122 596 39 -122 124 77 -122 126 28 -122 129 40 -123 122 44 -123 124 43 77 -123 126 28 -123 129 40 -124 123 44 -124 125 47 36 -124 128 48 37 30 -124 126 28 -124 129 40 -125 124 46 77 -125 126 45 28 -125 127 43 17 -126 125 46 23 11 -126 124 77 -126 610 30 39 -127 125 44 11 17 -127 124 77 -127 126 28 -128 124 45 29 77 -128 129 46 30 40 -128 126 28 -129 128 44 29 -129 124 77 -129 130 43 19 40 3 -129 126 28 -130 129 44 11 -130 124 77 -130 126 28 -131 107 44 -131 132 48 -131 133 50 -131 134 49 -131 135 47 -131 136 29 -131 137 30 -131 138 45 -131 139 46 -131 112 43 -132 107 50 -132 131 29 -132 133 45 -132 134 46 -132 135 44 -132 136 49 -132 137 47 -132 138 43 -132 139 30 -132 112 48 -133 107 29 -133 131 30 -133 132 44 -133 134 47 -133 135 49 -133 136 43 -133 137 45 -133 138 50 -133 139 48 -133 112 46 -134 107 47 -134 131 45 -134 132 50 -134 133 48 -134 135 43 -134 136 30 -134 137 46 -134 138 29 -134 139 44 -134 112 49 -135 107 45 -135 131 48 -135 132 30 -135 133 46 -135 134 43 -135 136 44 -135 137 49 -135 138 47 -135 139 50 -135 112 29 -136 107 43 -136 131 44 -136 132 29 -136 133 49 -136 134 30 -136 135 46 -136 137 50 -136 138 48 -136 139 47 -136 112 45 -137 107 48 -137 131 47 -137 132 46 -137 133 30 -137 134 29 -137 135 50 -137 136 45 -137 138 49 -137 139 43 -137 112 44 -138 107 30 -138 131 43 -138 132 47 -138 133 29 -138 134 44 -138 135 45 -138 136 46 -138 137 48 -138 139 49 -138 112 50 -139 107 49 -139 131 50 -139 132 43 -139 133 44 -139 134 45 -139 135 30 -139 136 48 -139 137 29 -139 138 46 -139 112 47 -140 112 45 11 --1 -4 -2 road -2 hill -3 enter -4 upstr -5 downs -6 fores -7 forwa -7 conti -7 onwar -8 back -8 retur -8 retre -9 valle -10 stair -11 out -11 outsi -11 exit -11 leave -12 build -12 house -13 gully -14 strea -15 rock -16 bed -17 crawl -18 cobbl -19 inwar -19 insid -19 in -20 surfa -21 null -21 nowhe -22 dark -23 passa -23 tunne -24 low -25 canyo -26 awkwa -27 giant -28 view -29 upwar -29 up -29 u -29 above -29 ascen -30 d -30 downw -30 down -30 desce -31 pit -32 outdo -33 crack -34 steps -35 dome -36 left -37 right -38 hall -39 jump -40 barre -41 over -42 acros -43 east -43 e -44 west -44 w -45 north -45 n -46 south -46 s -47 ne -48 se -49 sw -50 nw -51 debri -52 hole -53 wall -54 broke -55 y2 -56 climb -57 look -57 exami -57 touch -57 descr -58 floor -59 room -60 slit -61 slab -61 slabr -62 xyzzy -63 depre -64 entra -65 plugh -66 secre -67 cave -69 cross -70 bedqu -71 plove -72 orien -73 caver -74 shell -75 reser -76 main -76 offic -77 fork -1001 keys -1001 key -1002 lamp -1002 headl -1002 lante -1003 grate -1004 cage -1005 wand -1005 rod -1006 wand -1006 rod (must be next object after "real" rod) -1007 steps -1008 bird -1009 door -1010 pillo -1010 velve -1011 snake -1012 fissu -1013 table -1014 clam -1015 oyste -1016 magaz -1016 issue -1016 spelu -1016 "spel -1017 dwarf -1017 dwarv -1018 knife -1018 knive -1019 food -1019 ratio -1020 bottl -1020 jar -1021 water -1021 h2o -1022 oil -1023 mirro -1024 plant -1024 beans -1025 plant (must be next object after "real" plant) -1026 stala -1027 shado -1027 figur -1028 axe -1029 drawi -1030 pirat -1031 drago -1032 chasm -1033 troll -1034 troll (must be next object after "real" troll) -1035 bear -1036 messa -1037 volca -1037 geyse (same as volcano) -1038 machi -1038 vendi -1039 batte -1040 carpe -1040 moss -1050 gold -1050 nugge -1051 diamo -1052 silve -1052 bars -1053 jewel -1054 coins -1055 chest -1055 box -1055 treas -1056 eggs -1056 egg -1056 nest -1057 tride -1058 vase -1058 ming -1058 shard -1058 potte -1059 emera -1060 plati -1060 pyram -1061 pearl -1062 rug -1062 persi -1063 spice -1064 chain -2001 carry -2001 take -2001 keep -2001 catch -2001 steal -2001 captu -2001 get -2001 tote -2002 drop -2002 relea -2002 free -2002 disca -2002 dump -2003 say -2003 chant -2003 sing -2003 utter -2003 mumbl -2004 unloc -2004 open -2005 nothi -2006 lock -2006 close -2007 light -2007 on -2008 extin -2008 off -2009 wave -2009 shake -2009 swing -2010 calm -2010 placa -2010 tame -2011 walk -2011 run -2011 trave -2011 go -2011 proce -2011 conti -2011 explo -2011 goto -2011 follo -2011 turn -2012 attac -2012 kill -2012 slay -2012 fight -2012 hit -2012 strik -2013 pour -2014 eat -2014 devou -2015 drink -2016 rub -2017 throw -2017 toss -2018 quit -2019 find -2019 where -2020 inven -2020 inv -2021 feed -2022 fill -2023 blast -2023 deton -2023 ignit -2023 blowu -2024 score -2025 fee -2025 fie -2025 foe -2025 foo -2025 fum -2026 brief -2027 read -2027 perus -2028 break -2028 shatt -2028 smash -2029 wake -2029 distu -2030 suspe -2030 pause -2030 save -2031 hours -3001 fee -3002 fie -3003 foe -3004 foo -3005 fum -3050 sesam -3050 opens -3050 abra -3050 abrac -3050 shaza -3050 hocus -3050 pocus -3051 help -3051 ? -3064 tree -3064 trees -3066 dig -3066 excav -3068 lost -3069 mist -3079 fuck -3139 stop -3142 info -3142 infor -3147 swim --1 -5 -1 Set of keys -000 There are some keys on the ground here. -2 Brass lantern -000 There is a shiny brass lamp nearby. -100 There is a lamp shining nearby. -3 *Grate -000 The grate is locked. -100 The grate is open. -4 Wicker cage -000 There is a small wicker cage discarded nearby. -5 Black rod -000 A three foot black rod with a rusty star on an end lies nearby. -6 Black rod -000 A three foot black rod with a rusty mark on an end lies nearby. -7 *Steps -000 Rough stone steps lead down the pit. -100 Rough stone steps lead up the dome. -8 Little bird in cage -000 A cheerful little bird is sitting here singing. -100 There is a little bird in the cage. -9 *Rusty door -000 The way north is barred by a massive, rusty, iron door. -100 The way north leads through a massive, rusty, iron door. -10 Velvet pillow -000 A small velvet pillow lies on the floor. -11 *Snake -000 A huge green fierce snake bars the way! -100 >$< (Chased away) -12 *Fissure -000 >$< -100 A crystal bridge now spans the fissure. -200 The crystal bridge has vanished! -13 *Stone tablet -000 A massive stone tablet embedded in the wall reads: -000 "Congratulations on bringing light into the Dark-Room!" -14 Giant clam >grunt!< -000 There is an enormous clam here with its shell tightly closed. -15 Giant oyster >groan!< -000 There is an enormous oyster here with its shell tightly closed. -100 Interesting. There seems to be something written on the underside of -100 The oyster. -16 "Spelunker Today" -000 There are a few recent issues of "Spelunker Today" magazine here. -19 Tasty food -000 There is food here. -20 Small bottle -000 There is a bottle of water here. -100 There is an empty bottle here. -200 There is a bottle of oil here. -21 Water in the bottle -22 Oil in the bottle -23 *Mirror -000 >$< -24 *Plant -000 There is a tiny little plant in the pit, murmuring "Water, water, ..." -100 The plant spurts into furious growth for a few seconds. -200 There is a 12-foot-tall beanstalk stretching up out of the pit, -200 bellowing "WATER!! WATER!!" -300 The plant grows explosively, almost filling the bottom of the pit. -400 There is a gigantic beanstalk stretching all the way up to the hole. -500 You've over-watered the plant! It's shriveling up! It's, it's... -25 *Phony plant (seen in twopit room only when tall enough) -000 >$< -100 The top of a 12-foot-tall beanstalk is poking out of the west pit. -200 There is a huge beanstalk growing out of the west pit up to the hole. -26 *Stalactite -000 >$< -27 *Shadowy figure -000 The shadowy figure seems to be trying to attract your attention. -28 Dwarf's axe -000 There is a little axe here. -100 There is a little axe lying beside the bear. -29 *Cave drawings -000 >$< -30 *Pirate -000 >$< -31 *Dragon -000 A huge green fierce dragon bars the way! -100 Congratulations! You have just vanquished a dragon with your bare -100 hands! (Unbelievable, isn't it?) -200 The body of a huge green dead dragon is lying off to one side. -32 *Chasm -000 A rickety wooden bridge extends across the chasm, vanishing into the -000 mist. A sign posted on the bridge reads, "Stop! Pay troll!" -100 The wreckage of a bridge (and a dead bear) can be seen at the bottom -100 of the chasm. -33 *Troll -000 A burly troll stands by the bridge and insists you throw him a -000 treasure before you may cross. -100 The troll steps out from beneath the bridge and blocks your way. -200 >$< (Chased away) -34 *Phony troll -000 The troll is nowhere to be seen. -35 >$< (Bear uses rtext 141) -000 There is a ferocious cave bear eying you from the far end of the room! -100 There is a gentle cave bear sitting placidly in one corner. -200 There is a contented-looking bear wandering about nearby. -300 >$< (Dead) -36 *Message in second maze -000 There is a message scrawled in the dust in a flowery script, reading: -000 "This is not the maze where the pirate leaves his treasure chest." -37 *Volcano and/or geyser -000 >$< -38 *Vending machine -000 There is a massive vending machine here. The instructions on it read: -000 "Drop coins here to receive fresh batteries." -39 Batteries -000 There are fresh batteries here. -100 Some worn-out batteries have been discarded nearby. -40 *Carpet and/or moss -000 >$< -50 Large gold nugget -000 There is a large sparkling nugget of gold here! -51 Several diamonds -000 There are diamonds here! -52 Bars of silver -000 There are bars of silver here! -53 Precious jewelry -000 There is precious jewelry here! -54 Rare coins -000 There are many coins here! -55 Treasure chest -000 The pirate's treasure chest is here! -56 Golden eggs -000 There is a large nest here, full of golden eggs! -100 The nest of golden eggs has vanished! -200 Done! -57 Jeweled trident -000 There is a jewel-encrusted trident here! -58 Ming vase -000 There is a delicate, precious, Ming vase here! -100 The vase is now resting, delicately, on a velvet pillow. -200 The floor is littered with worthless shards of pottery. -300 The Ming vase drops with a delicate crash. -59 Egg-sized emerald -000 There is an emerald here the size of a plover's egg! -60 Platinum pyramid -000 There is a platinum pyramid here, 8 inches on a side! -61 Glistening pearl -000 Off to one side lies a glistening pearl! -62 Persian rug -000 There is a Persian rug spread out on the floor! -100 The dragon is sprawled out on a Persian rug!! -63 Rare spices -000 There are rare spices here! -64 Golden chain -000 There is a golden chain lying in a heap on the floor! -100 The bear is locked to the wall with a golden chain! -200 There is a golden chain locked to the wall! --1 -6 -1 Somewhere nearby is Colossal Cave, where others have found fortunes in -1 treasure and gold, though it is rumored that some who enter are never -1 seen again. Magic is said to work in the cave. I will be your eyes -1 and hands. Direct me with commands of 1 or 2 words. I should warn -1 you that I look at only the first five letters of each word, so you'll -1 have to enter "northeast" as "ne" to distinguish it from "north". -1 (Should you get stuck, type "help" for some general hints. For -1 information on how to end your adventure, etc., type "info".) -1 - - - -1 This program was originally developed by Will Crowther. Most of the -1 features of the current program were added by Don Woods. Address -1 complaints about the UNIX version to Jim Gillogly (jim@rand.org). -2 A little dwarf with a big knife blocks your way. -3 A little dwarf just walked around a corner, saw you, threw a little -3 axe at you (which missed), cursed, and ran away. -4 There is a threatening little dwarf in the room with you! -5 One sharp nasty knife is thrown at you! -6 None of them hit you! -7 One of them gets you! -8 A hollow voice says "Plugh". -9 There is no way to go that direction. -10 I am unsure how you are facing. Use compass points or nearby objects. -11 I don't know in from out here. Use compass points or name something -11 in the general direction you want to go. -12 I don't know how to apply that word here. -13 I don't understand that! -14 I'm game. Would you care to explain how? -15 Sorry, but I am not allowed to give more detail. I will repeat the -15 long description of your location. -16 It is now pitch dark. If you proceed you will likely fall into a pit. -17 If you prefer, simply type w rather than west. -18 Are you trying to catch the bird? -19 The bird is frightened right now and you cannot catch it no matter -19 what you try. Perhaps you might try later. -20 Are you trying to somehow deal with the snake? -21 You can't kill the snake, or drive it away, or avoid it, or anything -21 like that. There is a way to get by, but you don't have the necessary -21 resources right now. -22 Do you really want to quit now? -23 You fell into a pit and broke every bone in your body! -24 You are already carrying it! -25 You can't be serious! -26 The bird was unafraid when you entered, but as you approach it becomes -26 disturbed and you cannot catch it. -27 You can catch the bird, but you cannot carry it. -28 There is nothing here with a lock! -29 You aren't carrying it! -30 The little bird attacks the green snake, and in an astounding flurry -30 drives the snake away. -31 You have no keys! -32 It has no lock. -33 I don't know how to lock or unlock such a thing. -34 It was already locked. -35 The grate is now locked. -36 The grate is now unlocked. -37 It was already unlocked. -38 You have no source of light. -39 Your lamp is now on. -40 Your lamp is now off. -41 There is no way to get past the bear to unlock the chain, which is -41 probably just as well. -42 Nothing happens. -43 Where? -44 There is nothing here to attack. -45 The little bird is now dead. Its body disappears. -46 Attacking the snake both doesn't work and is very dangerous. -47 You killed a little dwarf. -48 You attack a little dwarf, but he dodges out of the way. -49 With what? Your bare hands? -50 Good try, but that is an old worn-out magic word. -51 I know of places, actions, and things. Most of my vocabulary -51 describes places and is used to move you there. To move, try words -51 like forest, building, downstream, enter, east, west, north, south, -51 up, or down. I know about a few special objects, like a black rod -51 hidden in the cave. These objects can be manipulated using some of -51 the action words that I know. Usually you will need to give both the -51 object and action words (in either order), but sometimes I can infer -51 the object from the verb alone. Some objects also imply verbs; in -51 particular, "inventory" implies "take inventory", which causes me to -51 give you a list of what you're carrying. The objects have side -51 effects; for instance, the rod scares the bird. Usually people having -51 trouble moving just need to try a few more words. Usually people -51 trying unsuccessfully to manipulate an object are attempting something -51 beyond their (or my!) capabilities and should try a completely -51 different tack. To speed the game you can sometimes move long -51 distances with a single word. For example, "building" usually gets -51 you to the building from anywhere above ground except when lost in the -51 forest. Also, note that cave passages turn a lot, and that leaving a -51 room to the north does not guarantee entering the next from the south. -51 Good luck! -52 It misses! -53 It gets you! -54 OK -55 You can't unlock the keys. -56 You have crawled around in some little holes and wound up back in the -56 main passage. -57 I don't know where the cave is, but hereabouts no stream can run on -57 the surface for long. I would try the stream. -58 I need more detailed instructions to do that. -59 I can only tell you what you see as you move about and manipulate -59 things. I cannot tell you where remote things are. -60 I don't know that word. -61 What? -62 Are you trying to get into the cave? -63 The grate is very solid and has a hardened steel lock. You cannot -63 enter without a key, and there are no keys nearby. I would recommend -63 looking elsewhere for the keys. -64 The trees of the forest are large hardwood oak and maple, with an -64 occasional grove of pine or spruce. There is quite a bit of under- -64 growth, largely birch and ash saplings plus nondescript bushes of -64 various sorts. This time of year visibility is quite restricted by -64 all the leaves, but travel is quite easy if you detour around the -64 spruce and berry bushes. -65 Welcome to Adventure!! Would you like instructions? -66 Digging without a shovel is quite impractical. Even with a shovel -66 progress is unlikely. -67 Blasting requires dynamite. -68 I'm as confused as you are. -69 Mist is a white vapor, usually water, seen from time to time in -69 caverns. It can be found anywhere but is frequently a sign of a deep -69 pit leading down to water. -70 Your feet are now wet. -71 I think I just lost my appetite. -72 Thank you, it was delicious! -73 You have taken a drink from the stream. The water tastes strongly of -73 minerals, but is not unpleasant. It is extremely cold. -74 The bottle of water is now empty. -75 Rubbing the electric lamp is not particularly rewarding. Anyway, -75 nothing exciting happens. -76 Peculiar. Nothing unexpected happens. -77 Your bottle is empty and the ground is wet. -78 You can't pour that. -79 Watch it! -80 Which way? -81 Oh dear, you seem to have gotten yourself killed. I might be able to -81 help you out, but I've never really done this before. Do you want me -81 to try to reincarnate you? -82 All right. But don't blame me if something goes wr...... -82 --- Poof!! --- -82 You are engulfed in a cloud of orange smoke. Coughing and gasping, -82 you emerge from the smoke and find.... -83 You clumsy oaf, you've done it again! I don't know how long I can -83 keep this up. Do you want me to try reincarnating you again? -84 Okay, now where did I put my orange smoke?.... >poof!< -84 Everything disappears in a dense cloud of orange smoke. -85 Now you've really done it! I'm out of orange smoke! You don't expect -85 me to do a decent reincarnation without any orange smoke, do you? -86 Okay, if you're so smart, do it yourself! I'm leaving! -90 >>> Messages 81 thru 90 are reserved for "obituaries". <<< -91 Sorry, but I no longer seem to remember how it was you got here. -92 You can't carry anything more. You'll have to drop something first. -93 You can't go through a locked steel grate! -94 I believe what you want is right here with you. -95 You don't fit through a two-inch slit! -96 I respectfully suggest you go across the bridge instead of jumping. -97 There is no way across the fissure. -98 You're not carrying anything. -99 You are currently holding the following: -100 It's not hungry (it's merely pinin' for the fjords). Besides, you -100 have no bird seed. -101 The snake has now devoured your bird. -102 There's nothing here it wants to eat (except perhaps you). -103 You fool, dwarves eat only coal! Now you've made him *really* mad!! -104 You have nothing in which to carry it. -105 Your bottle is already full. -106 There is nothing here with which to fill the bottle. -107 Your bottle is now full of water. -108 Your bottle is now full of oil. -109 You can't fill that. -110 Don't be ridiculous! -111 The door is extremely rusty and refuses to open. -112 The plant indignantly shakes the oil off its leaves and asks, "water?" -113 The hinges are quite thoroughly rusted now and won't budge. -114 The oil has freed up the hinges so that the door will now move, -114 although it requires some effort. -115 The plant has exceptionally deep roots and cannot be pulled free. -116 The dwarves' knives vanish as they strike the walls of the cave. -117 Something you're carrying won't fit through the tunnel with you. -117 You'd best take inventory and drop something. -118 You can't fit this five-foot clam through that little passage! -119 You can't fit this five-foot oyster through that little passage! -120 I advise you to put down the clam before opening it. >strain!< -121 I advise you to put down the oyster before opening it. >wrench!< -122 You don't have anything strong enough to open the clam. -123 You don't have anything strong enough to open the oyster. -124 A glistening pearl falls out of the clam and rolls away. Goodness, -124 this must really be an oyster. (I never was very good at identifying -124 bivalves.) Whatever it is, it has now snapped shut again. -125 The oyster creaks open, revealing nothing but oyster inside. It -125 promptly snaps shut again. -126 You have crawled around in some little holes and found your way -126 blocked by a recent cave-in. You are now back in the main passage. -127 There are faint rustling noises from the darkness behind you. -128 Out from the shadows behind you pounces a bearded pirate! "Har, har," -128 he chortles, "I'll just take all this booty and hide it away with me -128 chest deep in the maze!" He snatches your treasure and vanishes into -128 the gloom. -129 A sepulchral voice reverberating through the cave, says, "Cave closing -129 soon. All adventurers exit immediately through Main Office." -130 A mysterious recorded voice groans into life and announces: -130 "This exit is closed. Please leave via Main Office." -131 It looks as though you're dead. Well, seeing as how it's so close to -131 closing time anyway, I think we'll just call it a day. -132 The sepulchral voice intones, "The cave is now closed." As the echoes -132 fade, there is a blinding flash of light (and a small puff of orange -132 smoke). . . . As your eyes refocus, you look around and find... -133 There is a loud explosion, and a twenty-foot hole appears in the far -133 wall, burying the dwarves in the rubble. You march through the hole -133 and find yourself in the Main Office, where a cheering band of -133 friendly elves carry the conquering adventurer off into the sunset. -134 There is a loud explosion, and a twenty-foot hole appears in the far -134 wall, burying the snakes in the rubble. A river of molten lava pours -134 in through the hole, destroying everything in its path, including you! -135 There is a loud explosion, and you are suddenly splashed across the -135 walls of the room. -136 The resulting ruckus has awakened the dwarves. There are now several -136 threatening little dwarves in the room with you! Most of them throw -136 knives at you! All of them get you! -137 Oh, leave the poor unhappy bird alone. -138 I dare say whatever you want is around here somewhere. -139 I don't know the word "stop". Use "quit" if you want to give up. -140 You can't get there from here. -141 You are being followed by a very large, tame bear. -142 If you want to end your adventure early, say "quit". To suspend your -142 adventure such that you can continue later, say "suspend" (or "pause" -142 or "save"). To see what hours the cave is normally open, say "hours". -142 To see how well you're doing, say "score". To get full credit for a -142 treasure, you must have left it safely in the building, though you get -142 partial credit just for locating it. You lose points for getting -142 killed, or for quitting, though the former costs you more. There are -142 also points based on how much (if any) of the cave you've managed to -142 explore; in particular, there is a large bonus just for getting in (to -142 distinguish the beginners from the rest of the pack), and there are -142 other ways to determine whether you've been through some of the more -142 harrowing sections. If you think you've found all the treasures, just -142 keep exploring for a while. If nothing interesting happens, you -142 haven't found them all yet. If something interesting *does* happen, -142 it means you're getting a bonus and have an opportunity to garner many -142 more points in the Master's Section. I may occasionally offer hints -142 if you seem to be having trouble. If I do, I'll warn you in advance -142 how much it will affect your score to accept the hints. Finally, to -142 save paper, you may specify "brief", which tells me never to repeat -142 the full description of a place unless you explicitly ask me to. -143 Do you indeed wish to quit now? -144 There is nothing here with which to fill the vase. -145 The sudden change in temperature has delicately shattered the vase. -146 It is beyond your power to do that. -147 I don't know how. -148 It is too far up for you to reach. -149 You killed a little dwarf. The body vanishes in a cloud of greasy -149 black smoke. -150 The shell is very strong and is impervious to attack. -151 What's the matter, can't you read? Now you'd best start over. -152 The axe bounces harmlessly off the dragon's thick scales. -153 The dragon looks rather nasty. You'd best not try to get by. -154 The little bird attacks the green dragon, and in an astounding flurry -154 gets burnt to a cinder. The ashes blow away. -155 On what? -156 Okay, from now on I'll only describe a place in full the first time -156 you come to it. To get the full description, say "look". -157 Trolls are close relatives with the rocks and have skin as tough as -157 that of a rhinoceros. The troll fends off your blows effortlessly. -158 The troll deftly catches the axe, examines it carefully, and tosses it -158 back, declaring, "Good workmanship, but it's not valuable enough." -159 The troll catches your treasure and scurries away out of sight. -160 The troll refuses to let you cross. -161 There is no longer any way across the chasm. -162 Just as you reach the other side, the bridge buckles beneath the -162 weight of the bear, which was still following you around. You -162 scrabble desperately for support, but as the bridge collapses you -162 stumble back and fall into the chasm. -163 The bear lumbers toward the troll, who lets out a startled shriek and -163 scurries away. The bear soon gives up the pursuit and wanders back. -164 The axe misses and lands near the bear where you can't get at it. -165 With what? Your bare hands? Against *his* bear hands?? -166 The bear is confused; he only wants to be your friend. -167 For crying out loud, the poor thing is already dead! -168 The bear eagerly wolfs down your food, after which he seems to calm -168 down considerably and even becomes rather friendly. -169 The bear is still chained to the wall. -170 The chain is still locked. -171 The chain is now unlocked. -172 The chain is now locked. -173 There is nothing here to which the chain can be locked. -174 There is nothing here to eat. -175 Do you want the hint? -176 Do you need help getting out of the maze? -177 You can make the passages look less alike by dropping things. -178 Are you trying to explore beyond the Plover Room? -179 There is a way to explore that region without having to worry about -179 falling into a pit. None of the objects available is immediately -179 useful in discovering the secret. -180 Do you need help getting out of here? -181 Don't go west. -182 Gluttony is not one of the troll's vices. Avarice, however, is. -183 Your lamp is getting dim. You'd best start wrapping this up, unless -183 You can find some fresh batteries. I seem to recall there's a vending -183 machine in the maze. Bring some coins with you. -184 Your lamp has run out of power. -185 There's not much point in wandering around out here, and you can't -185 explore the cave without a lamp. So let's just call it a day. -186 There are faint rustling noises from the darkness behind you. As you -186 turn toward them, the beam of your lamp falls across a bearded pirate. -186 He is carrying a large chest. "Shiver me timbers!" he cries, "I've -186 been spotted! I'd best hie meself off to the maze to hide me chest!" -186 With that, he vanishes into the gloom. -187 Your lamp is getting dim. You'd best go back for those batteries. -188 Your lamp is getting dim. I'm taking the liberty of replacing the -188 batteries. -189 Your lamp is getting dim, and you're out of spare batteries. You'd -189 best start wrapping this up. -190 I'm afraid the magazine is written in Dwarvish. -191 "This is not the maze where the pirate leaves his treasure chest." -192 Hmmm, this looks like a clue, which means it'll cost you 10 points to -192 read it. Should I go ahead and read it anyway? -193 It says, "there is something strange about this place, such that one -193 of the words I've always known now has a new effect." -194 It says the same thing it did before. -195 I'm afraid I don't understand. -196 "Congratulations on bringing light into the Dark-Room!" -197 You strike the mirror a resounding blow, whereupon it shatters into a -197 myriad tiny fragments. -198 You have taken the vase and hurled it delicately to the ground. -199 You prod the nearest dwarf, who wakes up grumpily, takes one look at -199 you, curses, and grabs for his axe. -200 Is this acceptable? -201 There's no point in suspending a demonstration game. -202 You awaken only to discover your bits have been dissolving while you -202 slept. You disappear in a cloud of greasy black smoke. --1 -7 -1 3 -2 3 -3 8 9 -4 10 -5 11 -6 0 -7 14 15 -8 13 -9 94 -1 -10 96 -11 19 -1 -12 17 27 -13 101 -1 -14 103 -15 0 -16 106 -17 0 -1 -18 0 -19 3 -20 3 -21 0 -22 0 -23 109 -1 -24 25 -1 -25 23 67 -26 111 -1 -27 35 110 -28 0 -29 97 -1 -30 0 -1 -31 119 121 -32 117 122 -33 117 122 -34 0 0 -35 130 -1 -36 0 -1 -37 126 -1 -38 140 -1 -39 0 -40 96 -1 -50 18 -51 27 -52 28 -53 29 -54 30 -55 0 -56 92 -57 95 -58 97 -59 100 -60 101 -61 0 -62 119 121 -63 127 -64 130 -1 --1 -8 -1 24 -2 29 -3 0 -4 33 -5 0 -6 33 -7 38 -8 38 -9 42 -10 14 -11 43 -12 110 -13 29 -14 110 -15 73 -16 75 -17 29 -18 13 -19 59 -20 59 -21 174 -22 109 -23 67 -24 13 -25 147 -26 155 -27 195 -28 146 -29 110 -30 13 -31 13 --1 -9 -0 1 2 3 4 5 6 7 8 9 10 -0 100 115 116 126 -2 1 3 4 7 38 95 113 24 -1 24 -3 46 47 48 54 56 58 82 85 86 -3 122 123 124 125 126 127 128 129 130 -4 8 -5 13 -6 19 -7 42 43 44 45 46 47 48 49 50 51 -7 52 53 54 55 56 80 81 82 86 87 -8 99 100 101 -9 108 --1 -10 -35 You are obviously a rank amateur. Better luck next time. -100 Your score qualifies you as a Novice class Adventurer. -130 You have achieved the rating: "Experienced Adventurer". -200 You may now consider yourself a "Seasoned Adventurer". -250 You have reached "Junior Master" status. -300 Your score puts you in Master Adventurer Class C. -330 Your score puts you in Master Adventurer Class B. -349 Your score puts you in Master Adventurer Class A. -9999 All of Adventuredom gives tribute to you, Adventurer Grandmaster! --1 -11 -2 9999 10 0 0 -3 9999 5 0 0 -4 4 2 62 63 -5 5 2 18 19 -6 8 2 20 21 -7 75 4 176 177 -8 25 5 178 179 -9 20 3 180 181 --1 -12 -1 A large cloud of green smoke appears in front of you. It clears away -1 to reveal a tall wizard, clothed in grey. He fixes you with a steely -1 glare and declares, "This adventure has lasted too long." With that -1 he makes a single pass over you with his hands, and everything around -1 you fades away into a grey nothingness. -2 Even wizards have to wait longer than that! -3 I'm terribly sorry, but Colossal Cave is closed. Our hours are: -4 Only wizards are permitted within the cave right now. -5 We do allow visitors to make short explorations during our off hours. -5 Would you like to do that? -6 Colossal Cave is open to regular adventurers at the following hours: -7 Very well. -8 Only a wizard may continue an adventure this soon. -9 I suggest you resume your adventure at a later time. -10 Do you wish to see the hours? -11 Do you wish to change the hours? -12 New magic word (null to leave unchanged): -13 New magic number (null to leave unchanged): -14 Do you wish to change the message of the day? -15 Okay. You can save this version now. -16 Are you a wizard? -17 Prove it! Say the magic word! -18 That is not what I thought it was. Do you know what I thought it was? -19 Oh dear, you really *are* a wizard! Sorry to have bothered you . . . -20 Foo, you are nothing but a charlatan! -21 New hours specified by defining "prime time". Give only the hour -21 (E.g. 14, not 14:00 or 2pm). Enter a negative number after last pair. -22 New hours for Colossal Cave: -23 Limit lines to 70 chars. End with null line. -24 Line too long, retype: -25 Not enough room for another line. Ending message here. -26 Do you wish to (re)schedule the next holiday? -27 To begin how many days from today? -28 To last how many days (zero if no holiday)? -29 To be called what (up to 20 characters)? -30 Too small! Assuming minimum value (45 minutes). -31 Break out of this and save your core-image. -32 Be sure to save your core-image... --1 -0 - glorkz 8.1 93/05/31 diff --git a/games/adventure/hdr.h b/games/adventure/hdr.h deleted file mode 100644 index 6f6f8df0af71..000000000000 --- a/games/adventure/hdr.h +++ /dev/null @@ -1,221 +0,0 @@ -/*- - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * The game adventure was originally written in Fortran by Will Crowther - * and Don Woods. It was later translated to C and enhanced by Jim - * Gillogly. This code is derived from software contributed to Berkeley - * by Jim Gillogly at The Rand Corporation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)hdr.h 8.1 (Berkeley) 5/31/93 - */ - -/* ADVENTURE -- Jim Gillogly, Jul 1977 - * This program is a re-write of ADVENT, written in FORTRAN mostly by - * Don Woods of SAIL. In most places it is as nearly identical to the - * original as possible given the language and word-size differences. - * A few places, such as the message arrays and travel arrays were changed - * to reflect the smaller core size and word size. The labels of the - * original are reflected in this version, so that the comments of the - * fortran are still applicable here. - * - * The data file distributed with the fortran source is assumed to be called - * "glorkz" in the directory where the program is first run. - * - * $FreeBSD$ - */ - -/* hdr.h: included by c advent files */ -#include -#include - -int datfd; /* message file descriptor */ -volatile sig_atomic_t delhit; -int yea; -extern char data_file[]; /* Virtual data file */ - -#define TAB 011 -#define LF 012 -#define FLUSHLINE do { int flushline_ch; while ((flushline_ch = getchar()) != EOF && flushline_ch != '\n'); } while (0) -#define FLUSHLF while (next()!=LF) - -int loc,newloc,oldloc,oldlc2,wzdark,gaveup,kq,k,k2; -char *wd1,*wd2; /* the complete words */ -int verb,obj,spk; -extern int blklin; -int saved,savet,mxscor,latncy; - -#define SHORT 50 /* How short is a demo game? */ - -#define MAXSTR 20 /* max length of user's words */ - -#define HTSIZE 512 /* max number of vocab words */ -struct hashtab /* hash table for vocabulary */ -{ int val; /* word type &index (ktab) */ - char *atab; /* pointer to actual string */ -} voc[HTSIZE]; - -#define SEED 1815622 /* "Encryption" seed */ - -struct text -#ifdef OLDSTUFF -{ int seekadr; /* DATFILE must be < 2**16 */ -#endif /* !OLDSTUFF */ -{ char *seekadr; /* Msg start in virtual disk */ - int txtlen; /* length of msg starting here */ -}; - -#define RTXSIZ 205 -struct text rtext[RTXSIZ]; /* random text messages */ - -#define MAGSIZ 35 -struct text mtext[MAGSIZ]; /* magic messages */ - -int clsses; -#define CLSMAX 12 -struct text ctext[CLSMAX]; /* classes of adventurer */ -int cval[CLSMAX]; - -struct text ptext[101]; /* object descriptions */ - -#define LOCSIZ 141 /* number of locations */ -struct text ltext[LOCSIZ]; /* long loc description */ -struct text stext[LOCSIZ]; /* short loc descriptions */ - -struct travlist /* direcs & conditions of travel*/ -{ struct travlist *next; /* ptr to next list entry */ - int conditions; /* m in writeup (newloc / 1000) */ - int tloc; /* n in writeup (newloc % 1000) */ - int tverb; /* the verb that takes you there*/ -} *travel[LOCSIZ],*tkk; /* travel is closer to keys(...)*/ - -int atloc[LOCSIZ]; - -int plac[101]; /* initial object placement */ -int fixd[101],fixed[101]; /* location fixed? */ - -int actspk[35]; /* rtext msg for verb */ - -int cond[LOCSIZ]; /* various condition bits */ - -extern int setbit[16]; /* bit defn masks 1,2,4,... */ - -int hntmax; -int hints[20][5]; /* info on hints */ -int hinted[20],hintlc[20]; - -int place[101], prop[101],linkx[201]; -int abb[LOCSIZ]; - -int maxtrs,tally,tally2; /* treasure values */ - -#define FALSE 0 -#define TRUE 1 - -int keys,lamp,grate,cage,rod,rod2,steps,/* mnemonics */ - bird,door,pillow,snake,fissur,tablet,clam,oyster,magzin, - dwarf,knife,food,bottle,water,oil,plant,plant2,axe,mirror,dragon, - chasm,troll,troll2,bear,messag,vend,batter, - nugget,coins,chest,eggs,tridnt,vase,emrald,pyram,pearl,rug,chain, - spices, - back,look,cave,null,entrnc,dprssn, - enter, stream, pour, - say,lock,throw,find,invent; - -int chloc,chloc2,dseen[7],dloc[7], /* dwarf stuff */ - odloc[7],dflag,daltlc; - -int tk[21],stick,dtotal,attack; -int turns,lmwarn,iwest,knfloc,detail, /* various flags & counters */ - abbnum,maxdie,numdie,holdng,dkill,foobar,bonus,clock1,clock2, - closng,panic,closed,scorng; - -int demo,limit; - -int at (int objj); -int bug (int n); -void carry (int, int); -void caveclose (void); -void checkhints (void); -void ciao (void); -void closing (void); -u_long crc (const char *ptr, size_t nr); -void crc_start (void); -int dark (void); -void datime (int *d, int *t); -char *decr (const unsigned char, const unsigned char, const unsigned char, - const unsigned char, const unsigned char); -void die (int entry); -void done (int entry); -void drop (int object,int where); -void dstroy (int); -int fdwarf (void); -int forced (int locc); -void getin (char **wrd1, char **wrd2); -int here (int objj); -void init (void); -void juggle (int); -int liq (void); -int liqloc (int locc); -int march (void); -void move (int, int); -void mspeak (int); -int pct (int n); -void poof (void); -void pspeak (int m, int skip); -int put (int, int, int); -int ran (int range); -void rdata (void); -int restore (const char *infile); -void rspeak (int); -int save (const char *); -int score (void); -void speak (const struct text *); -int Start (void); -void startup (void); -int toting (int objj); -void trapdel (int sig); -int trdrop (void); -int trfeed (void); -int trfill (void); -int trkill (void); -int tropen (void); -int trsay (void); -int trtake (void); -int trtoss (void); -int vocab (const char *,int,int); -int yes (int x, int y, int z); -int yesm (int x, int y, int z); - -/* We need to get a little tricky to avoid strings */ -#define DECR(a,b,c,d,e) decr(a+'+',b+'-',c+'#',d+'&',e+'%') - -gid_t egid; diff --git a/games/adventure/init.c b/games/adventure/init.c deleted file mode 100644 index d46218bdd741..000000000000 --- a/games/adventure/init.c +++ /dev/null @@ -1,226 +0,0 @@ -/*- - * Copyright (c) 1993 - * The Regents of the University of California. All rights reserved. - * - * The game adventure was originally written in Fortran by Will Crowther - * and Don Woods. It was later translated to C and enhanced by Jim - * Gillogly. This code is derived from software contributed to Berkeley - * by Jim Gillogly at The Rand Corporation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)init.c 8.1 (Berkeley) 6/2/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -/* Re-coding of advent in C: data initialization */ - -#include -#include -#include -#include -#include "hdr.h" - -int blklin = TRUE; - -int setbit[16] = {1,2,4,010,020,040,0100,0200,0400,01000,02000,04000, - 010000,020000,040000,0100000}; - -static void linkdata (void); - -void -init(void) /* everything for 1st time run */ -{ - rdata(); /* read data from orig. file */ - linkdata(); - poof(); -} - -char * -decr(const unsigned char a, const unsigned char b, const unsigned char c, - const unsigned char d, const unsigned char e) -{ - static char buf[6]; - - buf[0] = a-'+'; - buf[1] = b-'-'; - buf[2] = c-'#'; - buf[3] = d-'&'; - buf[4] = e-'%'; - buf[5] = 0; - return buf; -} - -static void -linkdata(void) /* secondary data manipulation */ -{ int i,j; - - /* array linkages */ - for (i=1; i<=LOCSIZ; i++) - if (ltext[i].seekadr!=0 && travel[i] != 0) - if ((travel[i]->tverb)==1) cond[i]=2; - for (j=100; j>0; j--) - if (fixd[j]>0) - { drop(j+100,fixd[j]); - drop(j,plac[j]); - } - for (j=100; j>0; j--) - { fixed[j]=fixd[j]; - if (plac[j]!=0 && fixd[j]<=0) drop(j,plac[j]); - } - - maxtrs=79; - tally=0; - tally2=0; - - for (i=50; i<=maxtrs; i++) - { if (ptext[i].seekadr!=0) prop[i] = -1; - tally -= prop[i]; - } - - /* define mnemonics */ - keys = vocab(DECR('k','e','y','s','\0'), 1, 0); - lamp = vocab(DECR('l','a','m','p','\0'), 1, 0); - grate = vocab(DECR('g','r','a','t','e'), 1, 0); - cage = vocab(DECR('c','a','g','e','\0'),1, 0); - rod = vocab(DECR('r','o','d','\0','\0'),1, 0); - rod2=rod+1; - steps=vocab(DECR('s','t','e','p','s'),1, 0); - bird = vocab(DECR('b','i','r','d','\0'),1, 0); - door = vocab(DECR('d','o','o','r','\0'),1, 0); - pillow= vocab(DECR('p','i','l','l','o'), 1, 0); - snake = vocab(DECR('s','n','a','k','e'), 1, 0); - fissur= vocab(DECR('f','i','s','s','u'), 1, 0); - tablet= vocab(DECR('t','a','b','l','e'), 1, 0); - clam = vocab(DECR('c','l','a','m','\0'),1, 0); - oyster= vocab(DECR('o','y','s','t','e'), 1, 0); - magzin= vocab(DECR('m','a','g','a','z'), 1, 0); - dwarf = vocab(DECR('d','w','a','r','f'), 1, 0); - knife = vocab(DECR('k','n','i','f','e'), 1, 0); - food = vocab(DECR('f','o','o','d','\0'),1, 0); - bottle= vocab(DECR('b','o','t','t','l'), 1, 0); - water = vocab(DECR('w','a','t','e','r'), 1, 0); - oil = vocab(DECR('o','i','l','\0','\0'),1, 0); - plant = vocab(DECR('p','l','a','n','t'), 1, 0); - plant2=plant+1; - axe = vocab(DECR('a','x','e','\0','\0'), 1, 0); - mirror= vocab(DECR('m','i','r','r','o'), 1, 0); - dragon= vocab(DECR('d','r','a','g','o'), 1, 0); - chasm = vocab(DECR('c','h','a','s','m'), 1, 0); - troll = vocab(DECR('t','r','o','l','l'), 1, 0); - troll2=troll+1; - bear = vocab(DECR('b','e','a','r','\0'),1, 0); - messag= vocab(DECR('m','e','s','s','a'), 1, 0); - vend = vocab(DECR('v','e','n','d','i'), 1, 0); - batter= vocab(DECR('b','a','t','t','e'), 1, 0); - - nugget= vocab(DECR('g','o','l','d','\0'),1, 0); - coins = vocab(DECR('c','o','i','n','s'), 1, 0); - chest = vocab(DECR('c','h','e','s','t'), 1, 0); - eggs = vocab(DECR('e','g','g','s','\0'),1, 0); - tridnt= vocab(DECR('t','r','i','d','e'), 1, 0); - vase = vocab(DECR('v','a','s','e','\0'),1, 0); - emrald= vocab(DECR('e','m','e','r','a'), 1, 0); - pyram = vocab(DECR('p','y','r','a','m'), 1, 0); - pearl = vocab(DECR('p','e','a','r','l'), 1, 0); - rug = vocab(DECR('r','u','g','\0','\0'),1, 0); - chain = vocab(DECR('c','h','a','i','n'), 1, 0); - - back = vocab(DECR('b','a','c','k','\0'),0, 0); - look = vocab(DECR('l','o','o','k','\0'),0, 0); - cave = vocab(DECR('c','a','v','e','\0'),0, 0); - null = vocab(DECR('n','u','l','l','\0'),0, 0); - entrnc= vocab(DECR('e','n','t','r','a'), 0, 0); - dprssn= vocab(DECR('d','e','p','r','e'), 0, 0); - enter = vocab(DECR('e','n','t','e','r'), 0, 0); - - pour = vocab(DECR('p','o','u','r','\0'), 2, 0); - say = vocab(DECR('s','a','y','\0','\0'),2, 0); - lock = vocab(DECR('l','o','c','k','\0'),2, 0); - throw = vocab(DECR('t','h','r','o','w'), 2, 0); - find = vocab(DECR('f','i','n','d','\0'),2, 0); - invent= vocab(DECR('i','n','v','e','n'), 2, 0); - - /* initialize dwarves */ - chloc=114; - chloc2=140; - for (i=1; i<=6; i++) - dseen[i]=FALSE; - dflag=0; - dloc[1]=19; - dloc[2]=27; - dloc[3]=33; - dloc[4]=44; - dloc[5]=64; - dloc[6]=chloc; - daltlc=18; - - /* random flags & ctrs */ - turns=0; - lmwarn=FALSE; - iwest=0; - knfloc=0; - detail=0; - abbnum=5; - for (i=0; i<=4; i++) - if (rtext[2*i+81].seekadr!=0) maxdie=i+1; - numdie=holdng=dkill=foobar=bonus=0; - clock1=30; - clock2=50; - saved=0; - closng=panic=closed=scorng=FALSE; -} - - - -void -trapdel(int sig) /* come here if he hits a del */ -{ - sig = 0; - delhit = 1; /* main checks, treats as QUIT */ - signal(2,trapdel); /* catch subsequent DELs */ -} - - -void -startup(void) -{ - demo=Start(); - srandomdev(); - hinted[3]=yes(65,1,0); - newloc=1; - delhit = 0; - limit=330; - if (hinted[3]) limit=1000; /* better batteries if instrucs */ -} diff --git a/games/adventure/io.c b/games/adventure/io.c deleted file mode 100644 index 04f17ee1fca9..000000000000 --- a/games/adventure/io.c +++ /dev/null @@ -1,557 +0,0 @@ -/*- - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * The game adventure was originally written in Fortran by Will Crowther - * and Don Woods. It was later translated to C and enhanced by Jim - * Gillogly. This code is derived from software contributed to Berkeley - * by Jim Gillogly at The Rand Corporation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)io.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -/* Re-coding of advent in C: file i/o and user i/o */ - -#include "hdr.h" -#include -#include -#include -#include - -static int next (void); -static int rnum (void); -static void rdesc (int); -static void rdflt (void); -static void rhints (void); -static void rliq (void); -static void rlocs (void); -static void rtrav (void); -static void rvoc (void); -#ifdef DEBUG -static void twrite (int); -#endif - -/* get command from user */ -/* no prompt, usually */ -void -getin(char **wrd1, char **wrd2) -{ char *s; - static char wd1buf[MAXSTR],wd2buf[MAXSTR]; - int first, numch; - - *wrd1=wd1buf; /* return ptr to internal string*/ - *wrd2=wd2buf; - wd2buf[0]=0; /* in case it isn't set here */ - for (s=wd1buf, first=1, numch=0;;) - { if ((*s=getchar())>='A' && *s <='Z') *s = *s - ('A' -'a'); - /* convert to upper case */ - switch(*s) /* start reading from user */ - { case '\n': - *s=0; - return; - case ' ': - if (s==wd1buf||s==wd2buf) /* initial blank */ - continue; - *s=0; - if (first) /* finished 1st wd; start 2nd */ - { first=numch=0; - s=wd2buf; - break; - } - else /* finished 2nd word */ - { FLUSHLINE; - *s=0; - return; - } - case EOF: - printf("user closed input stream, quitting...\n"); - exit(0); - default: - if (++numch>=MAXSTR) /* string too long */ - { printf("Give me a break!!\n"); - wd1buf[0]=wd2buf[0]=0; - FLUSHLINE; - return; - } - s++; - } - } -} - -int -yes(int x, int y, int z) /* confirm with rspeak */ -{ int result; - int ch; - - result = FALSE; - for (;;) - { rspeak(x); /* tell him what we want*/ - if ((ch=getchar())=='y') - result=TRUE; - else if (ch=='n') result=FALSE; - else if (ch == EOF) { - printf("user closed input stream, quitting...\n"); - exit(0); - } - FLUSHLINE; - if (ch=='y'|| ch=='n') break; - printf("Please answer the question.\n"); - } - if (result==TRUE) rspeak(y); - if (result==FALSE) rspeak(z); - return(result); -} - -int -yesm(int x, int y, int z) /* confirm with mspeak */ -{ int result; - int ch; - - result = FALSE; - for (;;) - { mspeak(x); /* tell him what we want*/ - if ((ch=getchar())=='y') - result=TRUE; - else if (ch=='n') result=FALSE; - else if (ch == EOF) { - printf("user closed input stream, quitting...\n"); - exit(0); - } - FLUSHLINE; - if (ch=='y'|| ch=='n') break; - printf("Please answer the question.\n"); - } - if (result==TRUE) mspeak(y); - if (result==FALSE) mspeak(z); - return(result); -} - -/* FILE *inbuf,*outbuf; */ - -char *inptr; /* Pointer into virtual disk */ - -int outsw = 0; /* putting stuff to data file? */ - -const char iotape[] = "Ax3F'\003tt$8h\315qer*h\017nGKrX\207:!l"; -const char *tape = iotape; /* pointer to encryption tape */ - -static int -next(void) /* next virtual char, bump adr */ -{ - int ch; - - ch=(*inptr ^ random()) & 0xFF; /* Decrypt input data */ - if (outsw) /* putting data in tmp file */ - { if (*tape==0) tape=iotape; /* rewind encryption tape */ - *inptr = ch ^ *tape++; /* re-encrypt and replace value */ - } - inptr++; - return(ch); -} - -char breakch; /* tell which char ended rnum */ - -void -rdata(void) /* "read" data from virtual file*/ -{ int sect; - char ch; - - inptr = data_file; /* Pointer to virtual data file */ - srandom(SEED); /* which is lightly encrypted. */ - - clsses=1; - for (;;) /* read data sections */ - { sect=next()-'0'; /* 1st digit of section number */ -#ifdef VERBOSE - printf("Section %c",sect+'0'); -#endif - if ((ch=next())!=LF) /* is there a second digit? */ - { - FLUSHLF; -#ifdef VERBOSE - putchar(ch); -#endif - sect=10*sect+ch-'0'; - } -#ifdef VERBOSE - putchar('\n'); -#endif - switch(sect) - { case 0: /* finished reading database */ - return; - case 1: /* long form descriptions */ - rdesc(1); - break; - case 2: /* short form descriptions */ - rdesc(2); - break; - case 3: /* travel table */ - rtrav(); break; - case 4: /* vocabulary */ - rvoc(); - break; - case 5: /* object descriptions */ - rdesc(5); - break; - case 6: /* arbitrary messages */ - rdesc(6); - break; - case 7: /* object locations */ - rlocs(); break; - case 8: /* action defaults */ - rdflt(); break; - case 9: /* liquid assets */ - rliq(); break; - case 10: /* class messages */ - rdesc(10); - break; - case 11: /* hints */ - rhints(); break; - case 12: /* magic messages */ - rdesc(12); - break; - default: - printf("Invalid data section number: %d\n",sect); - for (;;) putchar(next()); - } - if (breakch!=LF) /* routines return after "-1" */ - FLUSHLF; - } -} - -char nbf[12]; - - -static int -rnum(void) /* read initial location num */ -{ char *s; - tape = iotape; /* restart encryption tape */ - for (s=nbf,*s=0;; s++) - if ((*s=next())==TAB || *s=='\n' || *s==LF) - break; - breakch= *s; /* save char for rtrav() */ - *s=0; /* got the number as ascii */ - if (nbf[0]=='-') return(-1); /* end of data */ - return(atoi(nbf)); /* convert it to integer */ -} - -char *seekhere; - -static void -rdesc(int sect) /* read description-format msgs */ -{ - int locc; - char *seekstart, *maystart; - - seekhere = inptr; /* Where are we in virtual file?*/ - outsw=1; /* these msgs go into tmp file */ - for (oldloc= -1, seekstart=seekhere;;) - { maystart=inptr; /* maybe starting new entry */ - if ((locc=rnum())!=oldloc && oldloc>=0 /* finished msg */ - && ! (sect==5 && (locc==0 || locc>=100)))/* unless sect 5*/ - { switch(sect) /* now put it into right table */ - { case 1: /* long descriptions */ - ltext[oldloc].seekadr=seekhere; - ltext[oldloc].txtlen=maystart-seekstart; - break; - case 2: /* short descriptions */ - stext[oldloc].seekadr=seekhere; - stext[oldloc].txtlen=maystart-seekstart; - break; - case 5: /* object descriptions */ - ptext[oldloc].seekadr=seekhere; - ptext[oldloc].txtlen=maystart-seekstart; - break; - case 6: /* random messages */ - if (oldloc>RTXSIZ) - { errx(1, "Too many random msgs"); - } - rtext[oldloc].seekadr=seekhere; - rtext[oldloc].txtlen=maystart-seekstart; - break; - case 10: /* class messages */ - ctext[clsses].seekadr=seekhere; - ctext[clsses].txtlen=maystart-seekstart; - cval[clsses++]=oldloc; - break; - case 12: /* magic messages */ - if (oldloc>MAGSIZ) - { errx(1, "Too many magic msgs"); - } - mtext[oldloc].seekadr=seekhere; - mtext[oldloc].txtlen=maystart-seekstart; - break; - default: - errx(1, "rdesc called with bad section"); - } - seekhere += maystart-seekstart; - } - if (locc<0) - { outsw=0; /* turn off output */ - seekhere += 3; /* -1 */ - return; - } - if (sect!=5 || (locc>0 && locc<100)) - { if (oldloc!=locc)/* starting a new message */ - seekstart=maystart; - oldloc=locc; - } - FLUSHLF; /* scan the line */ - } -} - - -static void -rtrav(void) /* read travel table */ -{ int locc; - struct travlist *t; - char *s; - char buf[12]; - int len,m,n,entries; - - entries = 0; - t = NULL; - for (oldloc= -1;;) /* get another line */ - { if ((locc=rnum())!=oldloc && oldloc>=0) /* end of entry */ - { - t->next = 0; /* terminate the old entry */ -#if DEBUG - printf("%d:%d entries\n",oldloc,entries); - twrite(oldloc); -#endif - } - if (locc== -1) return; - if (locc!=oldloc) /* getting a new entry */ - { t=travel[locc]=(struct travlist *) malloc(sizeof (struct travlist)); - /* printf("New travel list for %d\n",locc); */ - if (t == NULL) - errx(1, "Out of memory!"); - entries=0; - oldloc=locc; - } - s = buf; - for (;; s++) /* get the newloc number /ASCII */ - if ((*s=next())==TAB || *s==LF) break; - *s=0; - len=strlen(buf); /* quad long number handling */ - /* printf("Newloc: %s (%d chars)\n",buf,len); */ - if (len<4) /* no "m" conditions */ - { m=0; - n=atoi(buf); /* newloc mod 1000 = newloc */ - } - else /* a long integer */ - { n=atoi(buf+len-3); - buf[len-3]=0; /* terminate newloc/1000 */ - m=atoi(buf); - } - while (breakch!=LF) /* only do one line at a time */ - { if (entries++) { - t=t->next=(struct travlist *) malloc(sizeof (struct travlist)); - if (t == NULL) - errx(1, "Out of memory!"); - } - t->tverb=rnum();/* get verb from the file */ - t->tloc=n; /* table entry mod 1000 */ - t->conditions=m;/* table entry / 1000 */ - /* printf("entry %d for %d\n",entries,locc); */ - } - } -} - -#ifdef DEBUG - -static void -twrite(int loq) /* travel options from this loc */ -{ struct travlist *t; - printf("If"); - speak(<ext[loq]); - printf("then\n"); - for (t=travel[loq]; t!=0; t=t->next) - { printf("verb %d takes you to ",t->tverb); - if (t->tloc<=300) - speak(<ext[t->tloc]); - else if (t->tloc<=500) - printf("special code %d\n",t->tloc-300); - else - rspeak(t->tloc-500); - printf("under conditions %d\n",t->conditions); - } -} - -#endif /* DEBUG */ - -static void -rvoc(void) -{ char *s; /* read the vocabulary */ - int rv_index; - char buf[6]; - for (;;) - { rv_index=rnum(); - if (rv_index<0) break; - for (s=buf,*s=0;; s++) /* get the word */ - if ((*s=next())==TAB || *s=='\n' || *s==LF - || *s==' ') break; - /* terminate word with newline, LF, tab, blank */ - if (*s!='\n' && *s!=LF) FLUSHLF; /* can be comments */ - *s=0; - /* printf("\"%s\"=%d\n",buf,index);*/ - vocab(buf,-2,rv_index); - } -} - - -static void -rlocs(void) /* initial object locations */ -{ for (;;) - { if ((obj=rnum())<0) break; - plac[obj]=rnum(); /* initial loc for this obj */ - if (breakch==TAB) /* there's another entry */ - fixd[obj]=rnum(); - else fixd[obj]=0; - } -} - -static void -rdflt(void) /* default verb messages */ -{ for (;;) - { if ((verb=rnum())<0) break; - actspk[verb]=rnum(); - } -} - -static void -rliq(void) /* liquid assets &c: cond bits */ -{ int bitnum; - for (;;) /* read new bit list */ - { if ((bitnum=rnum())<0) break; - for (;;) /* read locs for bits */ - { cond[rnum()] |= setbit[bitnum]; - if (breakch==LF) break; - } - } -} - -static void -rhints(void) -{ int hintnum,i; - hntmax=0; - for (;;) - { if ((hintnum=rnum())<0) break; - for (i=1; i<5; i++) - hints[hintnum][i]=rnum(); - if (hintnum>hntmax) hntmax=hintnum; - } -} - - -void -rspeak(int msg) -{ if (msg!=0) speak(&rtext[msg]); -} - - -void -mspeak(int msg) -{ if (msg!=0) speak(&mtext[msg]); -} - -/* read, decrypt, and print a message (not ptext) */ -/* msg is a pointer to seek address and length of mess */ -void -speak(const struct text *msg) -{ - char *s, nonfirst; - - s = msg->seekadr; - nonfirst=0; - while (s - msg->seekadr < msg->txtlen) /* read a line at a time */ - { tape=iotape; /* restart decryption tape */ - while ((*s++ ^ *tape++) != TAB); /* read past loc num */ - /* assume tape is longer than location number */ - /* plus the lookahead put together */ - if ((*s ^ *tape) == '>' && - (*(s+1) ^ *(tape+1)) == '$' && - (*(s+2) ^ *(tape+2)) == '<') break; - if (blklin && !nonfirst++) putchar('\n'); - do - { if (*tape == 0) tape = iotape;/* rewind decryp tape */ - putchar(*s ^ *tape); - } while ((*s++ ^ *tape++) != LF); /* better end with LF */ - } -} - -/* read, decrypt an print a ptext message */ -/* msg is the number of all the p msgs for this place */ -/* assumes object 1 doesn't have prop 1, obj 2 no prop 2 &c*/ -void -pspeak(int m, int skip) -{ - char *s,nonfirst; - char *numst, ps_save; - struct text *msg; - char *tbuf; - - msg = &ptext[m]; - if ((tbuf = malloc((unsigned int)(msg->txtlen + 1))) == 0) - errx(1, "Out of memory!"); - memcpy(tbuf, msg->seekadr, (size_t)msg->txtlen + 1); /* Room to null */ - s = tbuf; - - nonfirst=0; - while (s - tbuf < msg->txtlen) /* read line at a time */ - { tape=iotape; /* restart decryption tape */ - for (numst=s; (*s^= *tape++)!=TAB; s++); /* get number */ - - ps_save = *s; /* Temporarily trash the string (cringe) */ - *s++ = 0; /* decrypting number within the string */ - - if (atoi(numst) != 100 * skip && skip >= 0) - { while ((*s++^*tape++)!=LF) /* flush the line */ - if (*tape==0) tape=iotape; - continue; - } - if ((*s^*tape)=='>' && (*(s+1)^*(tape+1))=='$' && - (*(s+2)^*(tape+2))=='<') break; - if (blklin && ! nonfirst++) putchar('\n'); - do - { if (*tape==0) tape=iotape; - putchar(*s^*tape); - } while ((*s++^*tape++)!=LF); /* better end with LF */ - if (skip<0) break; - } - free(tbuf); -} diff --git a/games/adventure/main.c b/games/adventure/main.c deleted file mode 100644 index 5b67d7bba1cb..000000000000 --- a/games/adventure/main.c +++ /dev/null @@ -1,586 +0,0 @@ -/*- - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * The game adventure was originally written in Fortran by Will Crowther - * and Don Woods. It was later translated to C and enhanced by Jim - * Gillogly. This code is derived from software contributed to Berkeley - * by Jim Gillogly at The Rand Corporation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -static const char copyright[] = -"@(#) Copyright (c) 1991, 1993\n\ - The Regents of the University of California. All rights reserved.\n"; -#endif /* not lint */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/2/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -/* Re-coding of advent in C: main program */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "hdr.h" - - -int -main(int argc, char **argv) -{ - int i; - int rval,ll; - struct text *kk; - - /* revoke */ - setgid(getgid()); - - init(); /* Initialize everything */ - signal(SIGINT,trapdel); - - if (argc > 1) /* Restore file specified */ - { /* Restart is label 8305 (Fortran) */ - i = restore(argv[1]); /* See what we've got */ - switch(i) - { - case 0: /* The restore worked fine */ - yea=Start(); - k=null; - unlink(argv[1]);/* Don't re-use the save */ - goto l8; /* Get where we're going */ - case 1: /* Couldn't open it */ - exit(1); /* So give up */ - case 2: /* Oops -- file was altered */ - rspeak(202); /* You dissolve */ - exit(1); /* File could be non-adventure */ - } /* So don't unlink it. */ - } - - startup(); /* prepare for a user */ - - for (;;) /* main command loop (label 2) */ - { if (newloc<9 && newloc!=0 && closng) - { rspeak(130); /* if closing leave only by */ - newloc=loc; /* main office */ - if (!panic) clock2=15; - panic=TRUE; - } - - rval=fdwarf(); /* dwarf stuff */ - if (rval==99) die(99); - - l2000: if (loc==0) die(99); /* label 2000 */ - kk = &stext[loc]; - if ((abb[loc]%abbnum)==0 || kk->seekadr==0) - kk = <ext[loc]; - if (!forced(loc) && dark()) - { if (wzdark && pct(35)) - { die(90); - goto l2000; - } - kk = &rtext[16]; - } - if (toting(bear)) rspeak(141); /* 2001 */ - speak(kk); - k=1; - if (forced(loc)) - goto l8; - if (loc==33 && pct(25)&&!closng) rspeak(8); - if (!dark()) - { abb[loc]++; - for (i=atloc[loc]; i!=0; i=linkx[i]) /*2004 */ - { obj=i; - if (obj>100) obj -= 100; - if (obj==steps && toting(nugget)) continue; - if (prop[obj]<0) - { if (closed) continue; - prop[obj]=0; - if (obj==rug||obj==chain) - prop[obj]=1; - tally--; - if (tally==tally2 && tally != 0) - if (limit>35) limit=35; - } - ll = prop[obj]; /* 2006 */ - if (obj==steps && loc==fixed[steps]) - ll = 1; - pspeak(obj, ll); - } /* 2008 */ - goto l2012; - l2009: k=54; /* 2009 */ - l2010: spk=k; - l2011: rspeak(spk); - } - l2012: verb=0; /* 2012 */ - obj=0; - l2600: checkhints(); /* to 2600-2602 */ - if (closed) - { if (prop[oyster]<0 && toting(oyster)) - pspeak(oyster,1); - for (i=1; i<100; i++) - if (toting(i)&&prop[i]<0) /*2604 */ - prop[i] = -1-prop[i]; - } - wzdark=dark(); /* 2605 */ - if (knfloc>0 && knfloc!=loc) knfloc=1; - getin(&wd1,&wd2); - if (delhit) /* user typed a DEL */ - { delhit=0; /* reset counter */ - strcpy(wd1,"quit"); /* pretend he's quitting*/ - *wd2=0; - } - l2608: if ((foobar = -foobar)>0) foobar=0; /* 2608 */ - /* should check here for "magic mode" */ - turns++; - if (demo && turns>=SHORT) done(1); /* to 13000 */ - - if (verb==say && *wd2!=0) verb=0; - if (verb==say) - goto l4090; - if (tally==0 && loc>=15 && loc!=33) clock1--; - if (clock1==0) - { closing(); /* to 10000 */ - goto l19999; - } - if (clock1<0) clock2--; - if (clock2==0) - { caveclose(); /* to 11000 */ - continue; /* back to 2 */ - } - if (prop[lamp]==1) limit--; - if (limit<=30 && here(batter) && prop[batter]==0 - && here(lamp)) - { rspeak(188); /* 12000 */ - prop[batter]=1; - if (toting(batter)) drop(batter,loc); - limit=limit+2500; - lmwarn=FALSE; - goto l19999; - } - if (limit==0) - { limit = -1; /* 12400 */ - prop[lamp]=0; - rspeak(184); - goto l19999; - } - if (limit<0&&loc<=8) - { rspeak(185); /* 12600 */ - gaveup=TRUE; - done(2); /* to 20000 */ - } - if (limit<=30) - { if (lmwarn|| !here(lamp)) goto l19999; /*12200*/ - lmwarn=TRUE; - spk=187; - if (place[batter]==0) spk=183; - if (prop[batter]==1) spk=189; - rspeak(spk); - } - l19999: k=43; - if (liqloc(loc)==water) k=70; - if (!strncmp(wd1,"enter",5) && - (!strncmp(wd2,"strea",5)||!strncmp(wd2,"water",5))) - goto l2010; - if (!strncmp(wd1,"enter",5) && *wd2!=0) goto l2800; - if ((strncmp(wd1,"water",5)&&strncmp(wd1,"oil",3)) - || (strncmp(wd2,"plant",5)&&strncmp(wd2,"door",4))) - goto l2610; - if (at(vocab(wd2,1,0))) strcpy(wd2,"pour"); - - l2610: if (!strncmp(wd1,"west",4)) - if (++iwest==10) rspeak(17); - l2630: i=vocab(wd1,-1,0); - if (i== -1) - { spk=60; /* 3000 */ - if (pct(20)) spk=61; - if (pct(20)) spk=13; - rspeak(spk); - goto l2600; - } - k=i%1000; - kq=i/1000+1; - switch(kq) - { case 1: goto l8; - case 2: goto l5000; - case 3: goto l4000; - case 4: goto l2010; - default: - bug(22); - } - - l8: - switch(march()) - { case 2: continue; /* i.e. goto l2 */ - case 99: - die(99); - goto l2000; - default: bug(110); - } - - l2800: strcpy(wd1,wd2); - *wd2=0; - goto l2610; - - l4000: verb=k; - spk=actspk[verb]; - if (*wd2!=0 && verb!=say) goto l2800; - if (verb==say) obj= *wd2; - if (obj!=0) goto l4090; - switch(verb) - { case 1: /* take = 8010 */ - if (atloc[loc]==0||linkx[atloc[loc]]!=0) goto l8000; - for (i=1; i<=5; i++) - if (dloc[i]==loc&&dflag>=2) goto l8000; - obj=atloc[loc]; - goto l9010; - case 2: case 3: case 9: /* 8000 : drop,say,wave */ - case 10: case 16: case 17: /* calm,rub,toss */ - case 19: case 21: case 28: /* find,feed,break */ - case 29: /* wake */ - l8000: printf("%s what?\n",wd1); - obj=0; - goto l2600; - case 4: case 6: /* 8040 open,lock */ - spk=28; - if (here(clam)) obj=clam; - if (here(oyster)) obj=oyster; - if (at(door)) obj=door; - if (at(grate)) obj=grate; - if (obj!=0 && here(chain)) goto l8000; - if (here(chain)) obj=chain; - if (obj==0) goto l2011; - goto l9040; - case 5: goto l2009; /* nothing */ - case 7: goto l9070; /* on */ - case 8: goto l9080; /* off */ - case 11: goto l8000; /* walk */ - case 12: goto l9120; /* kill */ - case 13: goto l9130; /* pour */ - case 14: /* eat: 8140 */ - if (!here(food)) goto l8000; - l8142: dstroy(food); - spk=72; - goto l2011; - case 15: goto l9150; /* drink */ - case 18: /* quit: 8180 */ - gaveup=yes(22,54,54); - if (gaveup) done(2); /* 8185 */ - goto l2012; - case 20: /* invent=8200 */ - spk=98; - for (i=1; i<=100; i++) - { if (i!=bear && toting(i)) - { if (spk==98) rspeak(99); - blklin=FALSE; - pspeak(i,-1); - blklin=TRUE; - spk=0; - } - } - if (toting(bear)) spk=141; - goto l2011; - case 22: goto l9220; /* fill */ - case 23: goto l9230; /* blast */ - case 24: /* score: 8240 */ - scorng=TRUE; - printf("If you were to quit now, you would score"); - printf(" %d out of a possible ",score()); - printf("%d.",mxscor); - scorng=FALSE; - gaveup=yes(143,54,54); - if (gaveup) done(2); - goto l2012; - case 25: /* foo: 8250 */ - k=vocab(wd1,3,0); - spk=42; - if (foobar==1-k) goto l8252; - if (foobar!=0) spk=151; - goto l2011; - l8252: foobar=k; - if (k!=4) goto l2009; - foobar=0; - if (place[eggs]==plac[eggs] - ||(toting(eggs)&&loc==plac[eggs])) goto l2011; - if (place[eggs]==0&&place[troll]==0&&prop[troll]==0) - prop[troll]=1; - k=2; - if (here(eggs)) k=1; - if (loc==plac[eggs]) k=0; - move(eggs,plac[eggs]); - pspeak(eggs,k); - goto l2012; - case 26: /* brief=8260 */ - spk=156; - abbnum=10000; - detail=3; - goto l2011; - case 27: /* read=8270 */ - if (here(magzin)) obj=magzin; - if (here(tablet)) obj=obj*100+tablet; - if (here(messag)) obj=obj*100+messag; - if (closed&&toting(oyster)) obj=oyster; - if (obj>100||obj==0||dark()) goto l8000; - goto l9270; - case 30: /* suspend=8300 */ - spk=201; - if (demo) goto l2011; - printf("I can suspend your adventure for you so"); - printf(" you can resume later, but\n"); - printf("you will have to wait at least"); - printf(" %d minutes before continuing.",latncy); - if (!yes(200,54,54)) goto l2012; - datime(&saved,&savet); - ciao(); /* Do we quit? */ - continue; /* Maybe not */ - case 31: /* hours=8310 */ - printf("Colossal cave is closed 9am-5pm Mon "); - printf("through Fri except holidays.\n"); - goto l2012; - default: bug(23); - } - - l4090: - switch(verb) - { case 1: /* take = 9010 */ - l9010: switch(trtake()) - { case 2011: goto l2011; - case 9220: goto l9220; - case 2009: goto l2009; - case 2012: goto l2012; - default: bug(102); - } - l9020: case 2: /* drop = 9020 */ - switch(trdrop()) - { case 2011: goto l2011; - case 19000: done(3); - case 2012: goto l2012; - default: bug(105); - } - case 3: - switch(trsay()) - { case 2012: goto l2012; - case 2630: goto l2630; - default: bug(107); - } - l9040: case 4: case 6: /* open, close */ - switch(tropen()) - { case 2011: goto l2011; - case 2010: goto l2010; - default: bug(106); - } - case 5: goto l2009; /* nothing */ - case 7: /* on 9070 */ - l9070: if (!here(lamp)) goto l2011; - spk=184; - if (limit<0) goto l2011; - prop[lamp]=1; - rspeak(39); - if (wzdark) goto l2000; - goto l2012; - - case 8: /* off */ - l9080: if (!here(lamp)) goto l2011; - prop[lamp]=0; - rspeak(40); - if (dark()) rspeak(16); - goto l2012; - - case 9: /* wave */ - if ((!toting(obj))&&(obj!=rod||!toting(rod2))) - spk=29; - if (obj!=rod||!at(fissur)||!toting(obj)||closng) - goto l2011; - prop[fissur]=1-prop[fissur]; - pspeak(fissur,2-prop[fissur]); - goto l2012; - case 10: case 11: case 18: /* calm, walk, quit */ - case 24: case 25: case 26: /* score, foo, brief */ - case 30: case 31: /* suspend, hours */ - goto l2011; - l9120: case 12: /* kill */ - switch(trkill()) - { case 8000: goto l8000; - case 8: goto l8; - case 2011: goto l2011; - case 2608: goto l2608; - case 19000: done(3); - default: bug(112); - } - l9130: case 13: /* pour */ - if (obj==bottle||obj==0) obj=liq(); - if (obj==0) goto l8000; - if (!toting(obj)) goto l2011; - spk=78; - if (obj!=oil&&obj!=water) goto l2011; - prop[bottle]=1; - place[obj]=0; - spk=77; - if (!(at(plant)||at(door))) goto l2011; - if (at(door)) - { prop[door]=0; /* 9132 */ - if (obj==oil) prop[door]=1; - spk=113+prop[door]; - goto l2011; - } - spk=112; - if (obj!=water) goto l2011; - pspeak(plant,prop[plant]+1); - prop[plant]=(prop[plant]+2)% 6; - prop[plant2]=prop[plant]/2; - k=null; - goto l8; - case 14: /* 9140 - eat */ - if (obj==food) goto l8142; - if (obj==bird||obj==snake||obj==clam||obj==oyster - ||obj==dwarf||obj==dragon||obj==troll - ||obj==bear) spk=71; - goto l2011; - l9150: case 15: /* 9150 - drink */ - if (obj==0&&liqloc(loc)!=water&&(liq()!=water - ||!here(bottle))) goto l8000; - if (obj!=0&&obj!=water) spk=110; - if (spk==110||liq()!=water||!here(bottle)) - goto l2011; - prop[bottle]=1; - place[water]=0; - spk=74; - goto l2011; - case 16: /* 9160: rub */ - if (obj!=lamp) spk=76; - goto l2011; - case 17: /* 9170: throw */ - switch(trtoss()) - { case 2011: goto l2011; - case 9020: goto l9020; - case 9120: goto l9120; - case 8: goto l8; - case 9210: goto l9210; - default: bug(113); - } - case 19: case 20: /* 9190: find, invent */ - if (at(obj)||(liq()==obj&&at(bottle)) - ||k==liqloc(loc)) spk=94; - for (i=1; i<=5; i++) - if (dloc[i]==loc&&dflag>=2&&obj==dwarf) - spk=94; - if (closed) spk=138; - if (toting(obj)) spk=24; - goto l2011; - l9210: case 21: /* feed */ - switch(trfeed()) - { case 2011: goto l2011; - default: bug(114); - } - l9220: case 22: /* fill */ - switch(trfill()) - { case 2011: goto l2011; - case 8000: goto l8000; - case 9020: goto l9020; - default: bug(115); - } - l9230: case 23: /* blast */ - if (prop[rod2]<0||!closed) goto l2011; - bonus=133; - if (loc==115) bonus=134; - if (here(rod2)) bonus=135; - rspeak(bonus); - done(2); - l9270: case 27: /* read */ - if (dark()) goto l5190; - if (obj==magzin) spk=190; - if (obj==tablet) spk=196; - if (obj==messag) spk=191; - if (obj==oyster&&hinted[2]&&toting(oyster)) spk=194; - if (obj!=oyster||hinted[2]||!toting(oyster) - ||!closed) goto l2011; - hinted[2]=yes(192,193,54); - goto l2012; - case 28: /* break */ - if (obj==mirror) spk=148; - if (obj==vase&&prop[vase]==0) - { spk=198; - if (toting(vase)) drop(vase,loc); - prop[vase]=2; - fixed[vase]= -1; - goto l2011; - } - if (obj!=mirror||!closed) goto l2011; - rspeak(197); - done(3); - - case 29: /* wake */ - if (obj!=dwarf||!closed) goto l2011; - rspeak(199); - done(3); - - default: bug(24); - } - - l5000: - obj=k; - if (fixed[k]!=loc && !here(k)) goto l5100; - l5010: if (*wd2!=0) goto l2800; - if (verb!=0) goto l4090; - printf("What do you want to do with the %s?\n",wd1); - goto l2600; - l5100: if (k!=grate) goto l5110; - if (loc==1||loc==4||loc==7) k=dprssn; - if (loc>9&&loc<15) k=entrnc; - if (k!=grate) goto l8; - l5110: if (k!=dwarf) goto l5120; - for (i=1; i<=5; i++) - if (dloc[i]==loc&&dflag>=2) goto l5010; - l5120: if ((liq()==k&&here(bottle))||k==liqloc(loc)) goto l5010; - if (obj!=plant||!at(plant2)||prop[plant2]==0) goto l5130; - obj=plant2; - goto l5010; - l5130: if (obj!=knife||knfloc!=loc) goto l5140; - knfloc = -1; - spk=116; - goto l2011; - l5140: if (obj!=rod||!here(rod2)) goto l5190; - obj=rod2; - goto l5010; - l5190: if ((verb==find||verb==invent)&&*wd2==0) goto l5010; - printf("I see no %s here\n",wd1); - goto l2012; - } -} diff --git a/games/adventure/save.c b/games/adventure/save.c deleted file mode 100644 index 234ce63f6fb4..000000000000 --- a/games/adventure/save.c +++ /dev/null @@ -1,195 +0,0 @@ -/*- - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * The game adventure was originally written in Fortran by Will Crowther - * and Don Woods. It was later translated to C and enhanced by Jim - * Gillogly. This code is derived from software contributed to Berkeley - * by Jim Gillogly at The Rand Corporation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)save.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include -#include -#include -#include "hdr.h" - -struct savestruct -{ - void *address; - size_t width; -}; - -struct savestruct save_array[] = -{ - {&abbnum, sizeof(abbnum)}, - {&attack, sizeof(attack)}, - {&blklin, sizeof(blklin)}, - {&bonus, sizeof(bonus)}, - {&chloc, sizeof(chloc)}, - {&chloc2, sizeof(chloc2)}, - {&clock1, sizeof(clock1)}, - {&clock2, sizeof(clock2)}, - {&closed, sizeof(closed)}, - {&closng, sizeof(closng)}, - {&daltlc, sizeof(daltlc)}, - {&demo, sizeof(demo)}, - {&detail, sizeof(detail)}, - {&dflag, sizeof(dflag)}, - {&dkill, sizeof(dkill)}, - {&dtotal, sizeof(dtotal)}, - {&foobar, sizeof(foobar)}, - {&gaveup, sizeof(gaveup)}, - {&holdng, sizeof(holdng)}, - {&iwest, sizeof(iwest)}, - {&k, sizeof(k)}, - {&k2, sizeof(k2)}, - {&knfloc, sizeof(knfloc)}, - {&kq, sizeof(kq)}, - {&latncy, sizeof(latncy)}, - {&limit, sizeof(limit)}, - {&lmwarn, sizeof(lmwarn)}, - {&loc, sizeof(loc)}, - {&maxdie, sizeof(maxdie)}, - {&mxscor, sizeof(mxscor)}, - {&newloc, sizeof(newloc)}, - {&numdie, sizeof(numdie)}, - {&obj, sizeof(obj)}, - {&oldlc2, sizeof(oldlc2)}, - {&oldloc, sizeof(oldloc)}, - {&panic, sizeof(panic)}, - {&saved, sizeof(saved)}, - {&savet, sizeof(savet)}, - {&scorng, sizeof(scorng)}, - {&spk, sizeof(spk)}, - {&stick, sizeof(stick)}, - {&tally, sizeof(tally)}, - {&tally2, sizeof(tally2)}, - {&tkk, sizeof(tkk)}, - {&turns, sizeof(turns)}, - {&verb, sizeof(verb)}, - {&wd1, sizeof(wd1)}, - {&wd2, sizeof(wd2)}, - {&wzdark, sizeof(wzdark)}, - {&yea, sizeof(yea)}, - {atloc, sizeof(atloc)}, - {dloc, sizeof(dloc)}, - {dseen, sizeof(dseen)}, - {fixed, sizeof(fixed)}, - {hinted, sizeof(hinted)}, - {linkx, sizeof(linkx)}, - {odloc, sizeof(odloc)}, - {place, sizeof(place)}, - {prop, sizeof(prop)}, - {tk, sizeof(tk)}, - - {NULL, 0} -}; - -/* Two passes on data: first to get checksum, second */ -/* to output the data using checksum to start random #s */ -int -save(const char *outfile) -{ - FILE *out; - struct savestruct *p; - char *s; - unsigned long sum; - size_t i; - - crc_start(); - for (p = save_array; p->address != NULL; p++) - sum = crc(p->address, p->width); - srandom(sum); - - if ((out = fopen(outfile, "wb")) == NULL) - { - fprintf(stderr, - "Hmm. The name \"%s\" appears to be magically blocked.\n", - outfile); - return 1; - } - - fwrite(&sum, sizeof(sum), 1, out); /* Here's the random() key */ - for (p = save_array; p->address != NULL; p++) - { - for (s = p->address, i = 0; i < p->width; i++, s++) - *s = (*s ^ random()) & 0xFF; /* Lightly encrypt */ - fwrite(p->address, p->width, 1, out); - } - fclose(out); - return 0; -} - -int -restore(const char *infile) -{ - FILE *in; - struct savestruct *p; - char *s; - unsigned long sum, cksum; - size_t i; - - cksum = 0; - if ((in = fopen(infile, "rb")) == NULL) - { - fprintf(stderr, - "Hmm. The file \"%s\" appears to be magically blocked.\n", - infile); - return 1; - } - - fread(&sum, sizeof(sum), 1, in); /* Get the seed */ - srandom(sum); - for (p = save_array; p->address != NULL; p++) - { - fread(p->address, p->width, 1, in); - for (s = p->address, i = 0; i < p->width; i++, s++) - *s = (*s ^ random()) & 0xFF; /* Lightly decrypt */ - } - fclose(in); - - crc_start(); /* See if she cheated */ - for (p = save_array; p->address != NULL; p++) - cksum = crc(p->address, p->width); - if (sum != cksum) /* Tsk tsk */ - return 2; /* Altered the file */ - /* We successfully restored, so this really was a save file */ - /* Get rid of the file, but don't bother checking that we did */ - return 0; -} diff --git a/games/adventure/setup.c b/games/adventure/setup.c deleted file mode 100644 index 587de58e10e3..000000000000 --- a/games/adventure/setup.c +++ /dev/null @@ -1,122 +0,0 @@ -/*- - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Jim Gillogly at The Rand Corporation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -static const char copyright[] = -"@(#) Copyright (c) 1991, 1993\n\ - The Regents of the University of California. All rights reserved.\n"; -#endif /* not lint */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)setup.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -/* - * Setup: keep the structure of the original Adventure port, but use an - * internal copy of the data file, serving as a sort of virtual disk. It's - * lightly encrypted to prevent casual snooping of the executable. - * - * Also do appropriate things to tabs so that bogus editors will do the right - * thing with the data file. - * - */ - -#define SIG1 " * Jim Gillogly" -#define SIG2 " * Sterday, 6 Thrimidge S.R. 1993, 15:24" - -#include -#include -#include -#include "hdr.h" /* SEED lives in there; keep them coordinated. */ - -#define USAGE "usage: setup file > data.c (file is typically glorkz)" - -#define YES 1 -#define NO 0 - -#define LINE 10 /* How many values do we get on a line? */ - -int -main(int argc, char **argv) -{ - FILE *infile; - int c, count, linestart; - - if (argc != 2) errx(1, USAGE); - - if ((infile = fopen(argv[1], "r")) == NULL) - err(1, "Can't read file %s", argv[1]); - puts("/*\n * data.c: created by setup from the ascii data file."); - puts(SIG1); - puts(SIG2); - puts(" */"); - printf("\n\nunsigned char data_file[] =\n{"); - srandom(SEED); - count = 0; - linestart = YES; - - while ((c = getc(infile)) != EOF) - { - if (linestart && c == ' ') /* Convert first spaces to tab */ - { - if (count++ % LINE == 0) - printf("\n\t"); - printf("0x%02lx,", ('\t' ^ random()) & 0xFF); - while ((c = getc(infile)) == ' ' && c != EOF); - /* Drop the non-whitespace character through */ - linestart = NO; - } - switch(c) - { - case '\t': - linestart = NO; /* Don't need to convert spaces */ - break; - case '\n': - linestart = YES; /* Ready to convert spaces again */ - break; - } - if (count++ % LINE == 0) - printf("\n\t"); - printf("0x%02lx,", (c ^ random()) & 0xFF); - } - puts("\n\t0\n};"); - fclose(infile); - exit(0); -} diff --git a/games/adventure/subr.c b/games/adventure/subr.c deleted file mode 100644 index ea41cddb1d1f..000000000000 --- a/games/adventure/subr.c +++ /dev/null @@ -1,862 +0,0 @@ -/*- - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * The game adventure was originally written in Fortran by Will Crowther - * and Don Woods. It was later translated to C and enhanced by Jim - * Gillogly. This code is derived from software contributed to Berkeley - * by Jim Gillogly at The Rand Corporation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)subr.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -/* Re-coding of advent in C: subroutines from main */ - -#include -#include -#include -#include "hdr.h" - -static void badmove (void); -static int bitset (int,int); -static int dropper (void); -static int liq2 (int); -static int mback (void); -static int specials (void); -static int trbridge (void); - -/* Statement functions */ -int -toting(int objj) -{ if (place[objj] == -1) return(TRUE); - else return(FALSE); -} - -int -here(int objj) -{ if (place[objj]==loc || toting(objj)) return(TRUE); - else return(FALSE); -} - -int -at(int objj) -{ if (place[objj]==loc || fixed[objj]==loc) return(TRUE); - else return (FALSE); -} - -static int -liq2(int pbotl) -{ return((1-pbotl)*water+(pbotl/2)*(water+oil)); -} - -int -liq(void) -{ int i; - i=prop[bottle]; - if (i>-1-i) return(liq2(i)); - else return(liq2(-1-i)); -} - -int -liqloc(int locc) -{ int i,j,l; - i=cond[locc]/2; - j=((i*2)%8)-5; - l=cond[locc]/4; - l=l%2; - return(liq2(j*l+1)); -} - -static int -bitset(int l, int n) -{ if (cond[l] & setbit[n]) return(TRUE); - return(FALSE); -} - -int -forced(int locc) -{ if (cond[locc]==2) return(TRUE); - return(FALSE); -} - -int -dark(void) -{ if ((cond[loc]%2)==0 && (prop[lamp]==0 || !here(lamp))) - return(TRUE); - return(FALSE); -} - -int -pct(int n) -{ if (ran(100)=15) dflag=1; - return(2000); - } - if (dflag==1) /* 6000 */ - { if (loc<15||pct(95)) return(2000); - dflag=2; - for (i=1; i<=2; i++) - { j=1+ran(5); - if (pct(50)&&saved== -1) dloc[j]=0; /* 6001 */ - } - for (i=1; i<=5; i++) - { if (dloc[i]==loc) dloc[i]=daltlc; - odloc[i]=dloc[i]; /* 6002 */ - } - rspeak(3); - drop(axe,loc); - return(2000); - } - dtotal=attack=stick=0; /* 6010 */ - for (i=1; i<=6; i++) /* loop to 6030 */ - { if (dloc[i]==0) continue; - j=1; - for (kk=travel[dloc[i]]; kk!=0; kk=kk->next) - { newloc=kk->tloc; - if (newloc>300||newloc<15||newloc==odloc[i] - ||(j>1&&newloc==tk[j-1])||j>=20 - ||newloc==dloc[i]||forced(newloc) - ||(i==6&&bitset(newloc,3)) - ||kk->conditions==100) continue; - tk[j++]=newloc; - } - tk[j]=odloc[i]; /* 6016 */ - if (j>=2) j--; - j=1+ran(j); - odloc[i]=dloc[i]; - dloc[i]=tk[j]; - dseen[i]=(dseen[i]&&loc>=15)||(dloc[i]==loc||odloc[i]==loc); - if (!dseen[i]) continue; /* i.e. goto 6030 */ - dloc[i]=loc; - if (i==6) /* pirate's spotted him */ - { if (loc==chloc||prop[chest]>=0) continue; - k=0; - for (j=50; j<=maxtrs; j++) /* loop to 6020 */ - { if (j==pyram&&(loc==plac[pyram] - || loc==plac[emrald])) goto l6020; - if (toting(j)) goto l6022; - l6020: if (here(j)) k=1; - } /* 6020 */ - if (tally==tally2+1 && k==0 && place[chest]==0 - &&here(lamp) && prop[lamp]==1) goto l6025; - if (odloc[6]!=dloc[6]&&pct(20)) - rspeak(127); - continue; /* to 6030 */ - l6022: rspeak(128); - if (place[messag]==0) move(chest,chloc); - move(messag,chloc2); - for (j=50; j<=maxtrs; j++) /* loop to 6023 */ - { if (j==pyram && (loc==plac[pyram] - || loc==plac[emrald])) continue; - if (at(j)&&fixed[j]==0) carry(j,loc); - if (toting(j)) drop(j,chloc); - } - l6024: dloc[6]=odloc[6]=chloc; - dseen[6]=FALSE; - continue; - l6025: rspeak(186); - move(chest,chloc); - move(messag,chloc2); - goto l6024; - } - dtotal++; /* 6027 */ - if (odloc[i]!=dloc[i]) continue; - attack++; - if (knfloc>=0) knfloc=loc; - if (ran(1000)<95*(dflag-2)) stick++; - } /* 6030 */ - if (dtotal==0) return(2000); - if (dtotal!=1) - { printf("There are %d threatening little dwarves ",dtotal); - printf("in the room with you.\n"); - } - else rspeak(4); - if (attack==0) return(2000); - if (dflag==2) dflag=3; - if (saved!= -1) dflag=20; - if (attack!=1) - { printf("%d of them throw knives at you!\n",attack); - k=6; - l82: if (stick<=1) /* 82 */ - { rspeak(k+stick); - if (stick==0) return(2000); - } - else - printf("%d of them get you!\n",stick); /* 83 */ - oldlc2=loc; - return(99); - } - rspeak(5); - k=52; - goto l82; -} - - -int -march(void) /* label 8 */ -{ int ll1,ll2; - - if ((tkk=travel[newloc=loc])==0) bug(26); - if (k==null) return(2); - if (k==cave) /* 40 */ - { if (loc<8) rspeak(57); - if (loc>=8) rspeak(58); - return(2); - } - if (k==look) /* 30 */ - { if (detail++<3) rspeak(15); - wzdark=FALSE; - abb[loc]=0; - return(2); - } - if (k==back) /* 20 */ - { switch(mback()) - { case 2: return(2); - case 9: goto l9; - default: bug(100); - } - } - oldlc2=oldloc; - oldloc=loc; -l9: - for (; tkk!=0; tkk=tkk->next) - if (tkk->tverb==1 || tkk->tverb==k) break; - if (tkk==0) - { badmove(); - return(2); - } -l11: ll1=tkk->conditions; /* 11 */ - ll2=tkk->tloc; - newloc=ll1; /* newloc=conditions */ - k=newloc%100; /* k used for prob */ - if (newloc<=300) - { if (newloc<=100) /* 13 */ - { if (newloc!=0&&!pct(newloc)) goto l12; /* 14 */ - l16: newloc=ll2; /* newloc=location */ - if (newloc<=300) return(2); - if (newloc<=500) - switch(specials())/* to 30000 */ - { case 2: return(2); - case 12: goto l12; - case 99: return(99); - default: bug(101); - } - rspeak(newloc-500); - newloc=loc; - return(2); - } - if (toting(k)||(newloc>200&&at(k))) goto l16; - goto l12; - } - if (prop[k]!=(newloc/100)-3) goto l16; /* newloc still conditions*/ -l12: /* alternative to probability move */ - for (; tkk!=0; tkk=tkk->next) - if (tkk->tloc!=ll2 || tkk->conditions!=ll1) break; - if (tkk==0) bug(25); - goto l11; -} - - - -static int -mback(void) /* 20 */ -{ struct travlist *tk2,*j; - int ll; - if (forced(k=oldloc)) k=oldlc2; /* k=location */ - oldlc2=oldloc; - oldloc=loc; - tk2=0; - if (k==loc) - { rspeak(91); - return(2); - } - for (; tkk!=0; tkk=tkk->next) /* 21 */ - { ll=tkk->tloc; - if (ll==k) - { k=tkk->tverb; /* k back to verb */ - tkk=travel[loc]; - return(9); - } - if (ll<=300) - { j=travel[loc]; - if (forced(ll) && k==j->tloc) tk2=tkk; - } - } - tkk=tk2; /* 23 */ - if (tkk!=0) - { k=tkk->tverb; - tkk=travel[loc]; - return(9); - } - rspeak(140); - return(2); -} - - -static int -specials(void) /* 30000 */ -{ switch(newloc -= 300) - { case 1: /* 30100 */ - newloc = 99+100-loc; - if (holdng==0||(holdng==1&&toting(emrald))) return(2); - newloc=loc; - rspeak(117); - return(2); - case 2: /* 30200 */ - drop(emrald,loc); - return(12); - case 3: /* to 30300 */ - return(trbridge()); - default: bug(29); - } - /* NOTREACHED */ - return(-1); -} - - -static int -trbridge(void) /* 30300 */ -{ if (prop[troll]==1) - { pspeak(troll,1); - prop[troll]=0; - move(troll2,0); - move(troll2+100,0); - move(troll,plac[troll]); - move(troll+100,fixd[troll]); - juggle(chasm); - newloc=loc; - return(2); - } - newloc=plac[troll]+fixd[troll]-loc; /* 30310 */ - if (prop[troll]==0) prop[troll]=1; - if (!toting(bear)) return(2); - rspeak(162); - prop[chasm]=1; - prop[troll]=2; - drop(bear,newloc); - fixed[bear] = -1; - prop[bear]=3; - if (prop[spices]<0) tally2++; - oldlc2=newloc; - return(99); -} - - -static void -badmove(void) /* 20 */ -{ spk=12; - if (k>=43 && k<=50) spk=9; - if (k==29||k==30) spk=9; - if (k==7||k==36||k==37) spk=10; - if (k==11||k==19) spk=11; - if (verb==find||verb==invent) spk=59; - if (k==62||k==65) spk=42; - if (k==17) spk=80; - rspeak(spk); -} - -int -bug(int n) -{ printf("Please tell jim@rand.org that fatal bug %d happened.\n",n); - exit(1); -} - - -void -checkhints(void) /* 2600 &c */ -{ int hint; - for (hint=4; hint<=hntmax; hint++) - { if (hinted[hint]) continue; - if (!bitset(loc,hint)) hintlc[hint]= -1; - hintlc[hint]++; - if (hintlc[hint]1) goto l40010; - goto l40020; - case 8: /* 40800 */ - if (prop[emrald]!= -1&&prop[pyram]== -1) goto l40010; - goto l40020; - case 9: - goto l40010; /* 40900 */ - default: bug(27); - } - l40010: hintlc[hint]=0; - if (!yes(hints[hint][3],0,54)) continue; - printf("I am prepared to give you a hint, but it will "); - printf("cost you %d points.\n",hints[hint][2]); - hinted[hint]=yes(175,hints[hint][4],54); - l40020: hintlc[hint]=0; - } -} - - -int -trsay(void) /* 9030 */ -{ int i; - if (*wd2!=0) strcpy(wd1,wd2); - i=vocab(wd1,-1,0); - if (i==62||i==65||i==71||i==2025) - { *wd2=0; - obj=0; - return(2630); - } - printf("\nOkay, \"%s\".\n",wd2); - return(2012); -} - - -int -trtake(void) /* 9010 */ -{ - if (toting(obj)) return(2011); /* 9010 */ - spk=25; - if (obj==plant&&prop[plant]<=0) spk=115; - if (obj==bear&&prop[bear]==1) spk=169; - if (obj==chain&&prop[bear]!=0) spk=170; - if (fixed[obj]!=0) return(2011); - if (obj==water||obj==oil) - { if (here(bottle)&&liq()==obj) - { obj=bottle; - goto l9017; - } - obj=bottle; - if (toting(bottle)&&prop[bottle]==1) - return(9220); - if (prop[bottle]!=1) spk=105; - if (!toting(bottle)) spk=104; - return(2011); - } -l9017: if (holdng>=7) - { rspeak(92); - return(2012); - } - if (obj==bird) - { if (prop[bird]!=0) goto l9014; - if (toting(rod)) - { rspeak(26); - return(2012); - } - if (!toting(cage)) /* 9013 */ - { rspeak(27); - return(2012); - } - prop[bird]=1; /* 9015 */ - } -l9014: if ((obj==bird||obj==cage)&&prop[bird]!=0) - carry(bird+cage-obj,loc); - carry(obj,loc); - k=liq(); - if (obj==bottle && k!=0) place[k] = -1; - return(2009); -} - - -static int -dropper(void) /* 9021 */ -{ k=liq(); - if (k==obj) obj=bottle; - if (obj==bottle&&k!=0) place[k]=0; - if (obj==cage&&prop[bird]!=0) drop(bird,loc); - if (obj==bird) prop[bird]=0; - drop(obj,loc); - return(2012); -} - -int -trdrop(void) /* 9020 */ -{ - if (toting(rod2)&&obj==rod&&!toting(rod)) obj=rod2; - if (!toting(obj)) return(2011); - if (obj==bird&&here(snake)) - { rspeak(30); - if (closed) return(19000); - dstroy(snake); - prop[snake]=1; - return(dropper()); - } - if (obj==coins&&here(vend)) /* 9024 */ - { dstroy(coins); - drop(batter,loc); - pspeak(batter,0); - return(2012); - } - if (obj==bird&&at(dragon)&&prop[dragon]==0) /* 9025 */ - { rspeak(154); - dstroy(bird); - prop[bird]=0; - if (place[snake]==plac[snake]) tally2--; - return(2012); - } - if (obj==bear&&at(troll)) /* 9026 */ - { rspeak(163); - move(troll,0); - move(troll+100,0); - move(troll2,plac[troll]); - move(troll2+100,fixd[troll]); - juggle(chasm); - prop[troll]=2; - return(dropper()); - } - if (obj!=vase||loc==plac[pillow]) /* 9027 */ - { rspeak(54); - return(dropper()); - } - prop[vase]=2; /* 9028 */ - if (at(pillow)) prop[vase]=0; - pspeak(vase,prop[vase]+1); - if (prop[vase]!=0) fixed[vase] = -1; - return(dropper()); -} - - -int -tropen(void) /* 9040 */ -{ if (obj==clam||obj==oyster) - { k=0; /* 9046 */ - if (obj==oyster) k=1; - spk=124+k; - if (toting(obj)) spk=120+k; - if (!toting(tridnt)) spk=122+k; - if (verb==lock) spk=61; - if (spk!=124) return(2011); - dstroy(clam); - drop(oyster,loc); - drop(pearl,105); - return(2011); - } - if (obj==door) spk=111; - if (obj==door&&prop[door]==1) spk=54; - if (obj==cage) spk=32; - if (obj==keys) spk=55; - if (obj==grate||obj==chain) spk=31; - if (spk!=31||!here(keys)) return(2011); - if (obj==chain) - { if (verb==lock) - { spk=172; /* 9049: lock */ - if (prop[chain]!=0) spk=34; - if (loc!=plac[chain]) spk=173; - if (spk!=172) return(2011); - prop[chain]=2; - if (toting(chain)) drop(chain,loc); - fixed[chain]= -1; - return(2011); - } - spk=171; - if (prop[bear]==0) spk=41; - if (prop[chain]==0) spk=37; - if (spk!=171) return(2011); - prop[chain]=0; - fixed[chain]=0; - if (prop[bear]!=3) prop[bear]=2; - fixed[bear]=2-prop[bear]; - return(2011); - } - if (closng) - { k=130; - if (!panic) clock2=15; - panic=TRUE; - return(2010); - } - k=34+prop[grate]; /* 9043 */ - prop[grate]=1; - if (verb==lock) prop[grate]=0; - k=k+2*prop[grate]; - return(2010); -} - - -int -trkill(void) /* 9120 */ -{ int i; - for (i=1; i<=5; i++) - if (dloc[i]==loc&&dflag>=2) break; - if (i==6) i=0; - if (obj==0) /* 9122 */ - { if (i!=0) obj=dwarf; - if (here(snake)) obj=obj*100+snake; - if (at(dragon)&&prop[dragon]==0) obj=obj*100+dragon; - if (at(troll)) obj=obj*100+troll; - if (here(bear)&&prop[bear]==0) obj=obj*100+bear; - if (obj>100) return(8000); - if (obj==0) - { if (here(bird)&&verb!=throw) obj=bird; - if (here(clam)||here(oyster)) obj=100*obj+clam; - if (obj>100) return(8000); - } - } - if (obj==bird) /* 9124 */ - { spk=137; - if (closed) return(2011); - dstroy(bird); - prop[bird]=0; - if (place[snake]==plac[snake]) tally2++; - spk=45; - } - if (obj==0) spk=44; /* 9125 */ - if (obj==clam||obj==oyster) spk=150; - if (obj==snake) spk=46; - if (obj==dwarf) spk=49; - if (obj==dwarf&&closed) return(19000); - if (obj==dragon) spk=147; - if (obj==troll) spk=157; - if (obj==bear) spk=165+(prop[bear]+1)/2; - if (obj!=dragon||prop[dragon]!=0) return(2011); - rspeak(49); - verb=0; - obj=0; - getin(&wd1,&wd2); - if (strncmp(wd1,"y",1)&&strncmp(wd1,"yes",3)) return(2608); - pspeak(dragon,1); - prop[dragon]=2; - prop[rug]=0; - k=(plac[dragon]+fixd[dragon])/2; - move(dragon+100,-1); - move(rug+100,0); - move(dragon,k); - move(rug,k); - for (obj=1; obj<=100; obj++) - if (place[obj]==plac[dragon]||place[obj]==fixd[dragon]) - move(obj,k); - loc=k; - k=null; - return(8); -} - - -int -trtoss(void) /* 9170: throw */ -{ int i; - if (toting(rod2)&&obj==rod&&!toting(rod)) obj=rod2; - if (!toting(obj)) return(2011); - if (obj>=50&&obj<=maxtrs&&at(troll)) - { spk=159; /* 9178 */ - drop(obj,0); - move(troll,0); - move(troll+100,0); - drop(troll2,plac[troll]); - drop(troll2+100,fixd[troll]); - juggle(chasm); - return(2011); - } - if (obj==food&&here(bear)) - { obj=bear; /* 9177 */ - return(9210); - } - if (obj!=axe) return(9020); - for (i=1; i<=5; i++) - { if (dloc[i]==loc) - { spk=48; /* 9172 */ - if (ran(3)==0||saved!= -1) - l9175: { rspeak(spk); - drop(axe,loc); - k=null; - return(8); - } - dseen[i]=FALSE; - dloc[i]=0; - spk=47; - dkill++; - if (dkill==1) spk=149; - goto l9175; - } - } - spk=152; - if (at(dragon)&&prop[dragon]==0) - goto l9175; - spk=158; - if (at(troll)) goto l9175; - if (here(bear)&&prop[bear]==0) - { spk=164; - drop(axe,loc); - fixed[axe]= -1; - prop[axe]=1; - juggle(bear); - return(2011); - } - obj=0; - return(9120); -} - - -int -trfeed(void) /* 9210 */ -{ if (obj==bird) - { spk=100; - return(2011); - } - if (obj==snake||obj==dragon||obj==troll) - { spk=102; - if (obj==dragon&&prop[dragon]!=0) spk=110; - if (obj==troll) spk=182; - if (obj!=snake||closed||!here(bird)) return(2011); - spk=101; - dstroy(bird); - prop[bird]=0; - tally2++; - return(2011); - } - if (obj==dwarf) - { if (!here(food)) return(2011); - spk=103; - dflag++; - return(2011); - } - if (obj==bear) - { if (prop[bear]==0) spk=102; - if (prop[bear]==3) spk=110; - if (!here(food)) return(2011); - dstroy(food); - prop[bear]=1; - fixed[axe]=0; - prop[axe]=0; - spk=168; - return(2011); - } - spk=14; - return(2011); -} - - -int -trfill(void) /* 9220 */ -{ if (obj==vase) - { spk=29; - if (liqloc(loc)==0) spk=144; - if (liqloc(loc)==0||!toting(vase)) return(2011); - rspeak(145); - prop[vase]=2; - fixed[vase]= -1; - return(9020); /* advent/10 goes to 9024 */ - } - if (obj!=0&&obj!=bottle) return(2011); - if (obj==0&&!here(bottle)) return(8000); - spk=107; - if (liqloc(loc)==0) spk=106; - if (liq()!=0) spk=105; - if (spk!=107) return(2011); - prop[bottle]=((cond[loc]%4)/2)*2; - k=liq(); - if (toting(bottle)) place[k]= -1; - if (k==oil) spk=108; - return(2011); -} - - -void -closing(void) /* 10000 */ -{ int i; - - prop[grate]=prop[fissur]=0; - for (i=1; i<=6; i++) - { dseen[i]=FALSE; - dloc[i]=0; - } - move(troll,0); - move(troll+100,0); - move(troll2,plac[troll]); - move(troll2+100,fixd[troll]); - juggle(chasm); - if(prop[bear]!=3) dstroy(bear); - prop[chain]=0; - fixed[chain]=0; - prop[axe]=0; - fixed[axe]=0; - rspeak(129); - clock1 = -1; - closng=TRUE; -} - - -void -caveclose(void) /* 11000 */ -{ int i; - prop[bottle]=put(bottle,115,1); - prop[plant]=put(plant,115,0); - prop[oyster]=put(oyster,115,0); - prop[lamp]=put(lamp,115,0); - prop[rod]=put(rod,115,0); - prop[dwarf]=put(dwarf,115,0); - loc=115; - oldloc=115; - newloc=115; - - put(grate,116,0); - prop[snake]=put(snake,116,1); - prop[bird]=put(bird,116,1); - prop[cage]=put(cage,116,0); - prop[rod2]=put(rod2,116,0); - prop[pillow]=put(pillow,116,0); - - prop[mirror]=put(mirror,115,0); - fixed[mirror]=116; - - for (i=1; i<=100; i++) - if (toting(i)) dstroy(i); - rspeak(132); - closed=TRUE; -} diff --git a/games/adventure/vocab.c b/games/adventure/vocab.c deleted file mode 100644 index f16d3c5c47ed..000000000000 --- a/games/adventure/vocab.c +++ /dev/null @@ -1,178 +0,0 @@ -/*- - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * The game adventure was originally written in Fortran by Will Crowther - * and Don Woods. It was later translated to C and enhanced by Jim - * Gillogly. This code is derived from software contributed to Berkeley - * by Jim Gillogly at The Rand Corporation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)vocab.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -/* Re-coding of advent in C: data structure routines */ - -#include -#include -#include -#include -#include "hdr.h" - -void -dstroy(int object) -{ move(object,0); -} - -void -juggle(int object) -{ int i,j; - - i=place[object]; - j=fixed[object]; - move(object,i); - move(object+100,j); -} - - -void -move(int object, int where) -{ int from; - - if (object<=100) - from=place[object]; - else - from=fixed[object-100]; - if (from>0 && from<=300) carry(object,from); - drop(object,where); -} - - -int -put(int object, int where, int pval) -{ move(object,where); - return(-1-pval); -} - -void -carry(int object, int where) -{ int temp; - - if (object<=100) - { if (place[object]== -1) return; - place[object] = -1; - holdng++; - } - if (atloc[where]==object) - { atloc[where]=linkx[object]; - return; - } - for (temp=atloc[where]; linkx[temp]!=object; temp=linkx[temp]); - linkx[temp]=linkx[object]; -} - - -void -drop(int object, int where) -{ if (object>100) fixed[object-100]=where; - else - { if (place[object]== -1) holdng--; - place[object]=where; - } - if (where<=0) return; - linkx[object]=atloc[where]; - atloc[where]=object; -} - -/* vocab(): look up or store a word */ -/* type: -2 for store, -1 for user word, >=0 for canned lookup*/ -/* store: used for storing only */ -int -vocab(const char *word, int type, int value) -{ int adr; - const char *s; - char *t; - int hash, i; - struct hashtab *h; - - for (hash=0,s=word,i=0; i<5 &&*s; i++) /* some kind of hash */ - hash += *s++; /* add all chars in the word */ - hash = (hash*3719)&077777; /* pulled that one out of a hat */ - hash %= HTSIZE; /* put it into range of table */ - - for(adr=hash;; adr++) /* look for entry in table */ - { if (adr==HTSIZE) adr=0; /* wrap around */ - h = &voc[adr]; /* point at the entry */ - switch(type) - { case -2: /* fill in entry */ - if (h->val) /* already got an entry? */ - goto exitloop2; - h->val=value; - h->atab=malloc(strlen(word)+1); - if (h->atab == NULL) - errx(1, "Out of memory!"); - for (s=word,t=h->atab; *s;) - *t++ = *s++ ^ '='; - *t=0^'='; - /* encrypt slightly to thwart core reader */ - /* printf("Stored \"%s\" (%d ch) as entry %d\n", */ - /* word, strlen(word)+1, adr); */ - return(0); /* entry unused */ - case -1: /* looking up user word */ - if (h->val==0) return(-1); /* not found */ - for (s=word, t=h->atab;*t ^ '=';) - if ((*s++ ^ '=') != *t++) - goto exitloop2; - if ((*s ^ '=') != *t && s-word<5) goto exitloop2; - /* the word matched o.k. */ - return(h->val); - default: /* looking up known word */ - if (h->val==0) - { errx(1, "Unable to find %s in vocab", word); - } - for (s=word, t=h->atab;*t ^ '=';) - if ((*s++ ^ '=') != *t++) goto exitloop2; - /* the word matched o.k. */ - if (h->val/1000 != type) continue; - return(h->val%1000); - } - - exitloop2: /* hashed entry does not match */ - if (adr+1==hash || (adr==HTSIZE && hash==0)) - { errx(1, "Hash table overflow"); - } - } -} diff --git a/games/adventure/wizard.c b/games/adventure/wizard.c deleted file mode 100644 index 93c54a3da2e1..000000000000 --- a/games/adventure/wizard.c +++ /dev/null @@ -1,156 +0,0 @@ -/*- - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * The game adventure was originally written in Fortran by Will Crowther - * and Don Woods. It was later translated to C and enhanced by Jim - * Gillogly. This code is derived from software contributed to Berkeley - * by Jim Gillogly at The Rand Corporation. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)wizard.c 8.1 (Berkeley) 6/2/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -/* Re-coding of advent in C: privileged operations */ - -#include -#include -#include -#include -#include -#include -#include "hdr.h" - -static int wizard (void); - -void -datime(int *d, int *t) -{ struct tm *tptr; - time_t tvec; - - time(&tvec); - tptr=localtime(&tvec); - /* day since 1977 */ - *d = (tptr->tm_yday + 365 * (tptr->tm_year - 77) - + (tptr->tm_year - 77) / 4 - (tptr->tm_year - 1) / 100 - + (tptr->tm_year + 299) / 400); - /* bug: this will overflow in the year 2066 AD (with 16 bit int) */ - /* it will be attributed to Wm the C's millenial celebration */ - /* and minutes since midnite */ - *t=tptr->tm_hour*60+tptr->tm_min; -} - - -char magic[6]; - -void -poof(void) -{ - strcpy(magic, DECR('d','w','a','r','f')); - latncy = 45; -} - -int -Start(void) -{ int d,t,delay; - - datime(&d,&t); - delay=(d-saved)*1440+(t-savet); /* good for about a month */ - - if (delay >= latncy) - { saved = -1; - return(FALSE); - } - printf("This adventure was suspended a mere %d minute%s ago.", - delay, delay == 1? "" : "s"); - if (delay <= latncy/3) - { mspeak(2); - exit(0); - } - mspeak(8); - if (!wizard()) - { mspeak(9); - exit(0); - } - saved = -1; - return(FALSE); -} - -static int -wizard(void) /* not as complex as advent/10 (for now) */ -{ - char *word,*x; - if (!yesm(16,0,7)) return(FALSE); - mspeak(17); - getin(&word,&x); - if (strncmp(word,magic,5)) - { mspeak(20); - return(FALSE); - } - mspeak(19); - return(TRUE); -} - -void -ciao(void) -{ char *c; - char fname[80]; - - printf("What would you like to call the saved version?\n"); - /* XXX - should use fgetln to avoid arbitrary limit */ - for (c = fname; c < fname + sizeof fname - 1; c++) { - int ch; - ch = getchar(); - if (ch == '\n' || ch == EOF) - break; - *c = ch; - } - *c=0; - if (save(fname) != 0) return; /* Save failed */ - printf("To resume, say \"adventure %s\".\n", fname); - printf("\"With these rooms I might now have been familiarly acquainted.\"\n"); - exit(0); -} - - -int -ran(int range) -{ - int i; - - i = random() % range; - return(i); -} diff --git a/games/arithmetic/Makefile b/games/arithmetic/Makefile deleted file mode 100644 index f02d43dcb345..000000000000 --- a/games/arithmetic/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -# @(#)Makefile 8.1 (Berkeley) 5/31/93 -# $FreeBSD$ - -PROG= arithmetic -MAN= arithmetic.6 -HIDEGAME=hidegame - -.include diff --git a/games/arithmetic/arithmetic.6 b/games/arithmetic/arithmetic.6 deleted file mode 100644 index 1b8ccaef1c64..000000000000 --- a/games/arithmetic/arithmetic.6 +++ /dev/null @@ -1,104 +0,0 @@ -.\" Copyright (c) 1989, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" This code is derived from software contributed to Berkeley by -.\" Eamonn McManus of Trinity College Dublin. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" 3. All advertising materials mentioning features or use of this software -.\" must display the following acknowledgement: -.\" This product includes software developed by the University of -.\" California, Berkeley and its contributors. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" @(#)arithmetic.6 8.1 (Berkeley) 5/31/93 -.\" $FreeBSD$ -.\" -.TH ARITHMETIC 6 "May 31, 1993" -.UC 4 -.SH NAME -arithmetic \- quiz on simple arithmetic -.SH SYNOPSIS -.B arithmetic -.B [ -\-o +\-x/ -.B ] -.B [ -\-r range -.B ] -.SH DESCRIPTION -.I Arithmetic -asks you to solve problems in simple arithmetic. -Each question must be answered correctly before going on to the next. -After every 20 problems, it prints the score so far and the time taken. -You can quit at any time by typing the interrupt or end-of-file character. -.PP -The options are as follows: -.TP -\-o -By default, -.I arithmetic -asks questions on addition of numbers from 0 to 10, and corresponding -subtraction. -By supplying one or more of the characters -.BR +\-x/ , -you can ask for problems in addition, subtraction, multiplication, and -division, respectively. -If you give one of these characters more than once, that kind of problem -will be asked correspondingly more often. -.TP -\-r -If a -.I range -is supplied, -.I arithmetic -selects the numbers in its problems in the following way. -For addition and multiplication, the numbers to be added or multiplied -are between 0 and -.IR range , -inclusive. -For subtraction and division, both the required result and the number to -divide by or subtract will be between 0 and -.IR range . -(Of course, -.I arithmetic -will not ask you to divide by 0.) The default -.I range -is 10. -.PP -When you get a problem wrong, -.I arithmetic -will remember the numbers involved, and will tend to select those numbers -more often than others, in problems of the same sort. -Eventually it will forgive and forget. -.PP -.I Arithmetic -cannot be persuaded to tell you the right answer. -You must work it out for yourself. -.SH DIAGNOSTICS -``What?'' if you get a question wrong. -``Right!'' if you get it right. -``Please type a number.'' if arithmetic doesn't understand what you typed. -.SH "SEE ALSO" -bc(1), dc(1) diff --git a/games/arithmetic/arithmetic.c b/games/arithmetic/arithmetic.c deleted file mode 100644 index 68cd045f4b14..000000000000 --- a/games/arithmetic/arithmetic.c +++ /dev/null @@ -1,393 +0,0 @@ -/* - * Copyright (c) 1989, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Eamonn McManus of Trinity College Dublin. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -static const char copyright[] = -"@(#) Copyright (c) 1989, 1993\n\ - The Regents of the University of California. All rights reserved.\n"; -#endif /* not lint */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)arithmetic.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -/* - * By Eamonn McManus, Trinity College Dublin . - * - * The operation of this program mimics that of the standard Unix game - * `arithmetic'. I've made it as close as I could manage without examining - * the source code. The principal differences are: - * - * The method of biasing towards numbers that had wrong answers in the past - * is different; original `arithmetic' seems to retain the bias forever, - * whereas this program lets the bias gradually decay as it is used. - * - * Original `arithmetic' delays for some period (3 seconds?) after printing - * the score. I saw no reason for this delay, so I scrapped it. - * - * There is no longer a limitation on the maximum range that can be supplied - * to the program. The original program required it to be less than 100. - * Anomalous results may occur with this program if ranges big enough to - * allow overflow are given. - * - * I have obviously not attempted to duplicate bugs in the original. It - * would go into an infinite loop if invoked as `arithmetic / 0'. It also - * did not recognise an EOF in its input, and would continue trying to read - * after it. It did not check that the input was a valid number, treating any - * garbage as 0. Finally, it did not flush stdout after printing its prompt, - * so in the unlikely event that stdout was not a terminal, it would not work - * properly. - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -const char keylist[] = "+-x/"; -const char defaultkeys[] = "+-"; -const char *keys = defaultkeys; -int nkeys = sizeof(defaultkeys) - 1; -int rangemax = 10; -int nright, nwrong; -time_t qtime; -#define NQUESTS 20 - -static void usage(void); -int getrandom(int, int, int); -void intr(int); -int opnum(int); -void penalise(int, int, int); -int problem(void); -void showstats(void); - -/* - * Select keys from +-x/ to be asked addition, subtraction, multiplication, - * and division problems. More than one key may be given. The default is - * +-. Specify a range to confine the operands to 0 - range. Default upper - * bound is 10. After every NQUESTS questions, statistics on the performance - * so far are printed. - */ -int -main(int argc, char **argv) -{ - int ch, cnt; - - /* Revoke setgid privileges */ - setgid(getgid()); - - while ((ch = getopt(argc, argv, "r:o:")) != -1) - switch(ch) { - case 'o': { - const char *p; - - for (p = keys = optarg; *p; ++p) - if (!index(keylist, *p)) { - (void)fprintf(stderr, - "arithmetic: unknown key.\n"); - exit(1); - } - nkeys = p - optarg; - break; - } - case 'r': - if ((rangemax = atoi(optarg)) <= 0) { - (void)fprintf(stderr, - "arithmetic: invalid range.\n"); - exit(1); - } - break; - case '?': - default: - usage(); - } - if (argc -= optind) - usage(); - - /* Seed the random-number generator. */ - srandomdev(); - - (void)signal(SIGINT, intr); - - /* Now ask the questions. */ - for (;;) { - for (cnt = NQUESTS; cnt--;) - if (problem() == EOF) - exit(0); - showstats(); - } - /* NOTREACHED */ -} - -/* Handle interrupt character. Print score and exit. */ -void -intr(int sig) -{ - sig = 0; - showstats(); - exit(0); -} - -/* Print score. Original `arithmetic' had a delay after printing it. */ -void -showstats(void) -{ - if (nright + nwrong > 0) { - (void)printf("\n\nRights %d; Wrongs %d; Score %d%%", - nright, nwrong, (int)(100L * nright / (nright + nwrong))); - if (nright > 0) - (void)printf("\nTotal time %ld seconds; %.1f seconds per problem\n\n", - (long)qtime, (float)qtime / nright); - } - (void)printf("\n"); -} - -/* - * Pick a problem and ask it. Keeps asking the same problem until supplied - * with the correct answer, or until EOF or interrupt is typed. Problems are - * selected such that the right operand and either the left operand (for +, x) - * or the correct result (for -, /) are in the range 0 to rangemax. Each wrong - * answer causes the numbers in the problem to be penalised, so that they are - * more likely to appear in subsequent problems. - */ -int -problem(void) -{ - char *p; - time_t start, finish; - int left, op, right, result; - char line[80]; - - left = 0; - right = 0; - result = 0; - op = keys[random() % nkeys]; - if (op != '/') - right = getrandom(rangemax + 1, op, 1); -retry: - /* Get the operands. */ - switch (op) { - case '+': - left = getrandom(rangemax + 1, op, 0); - result = left + right; - break; - case '-': - result = getrandom(rangemax + 1, op, 0); - left = right + result; - break; - case 'x': - left = getrandom(rangemax + 1, op, 0); - result = left * right; - break; - case '/': - right = getrandom(rangemax, op, 1) + 1; - result = getrandom(rangemax + 1, op, 0); - left = right * result + random() % right; - break; - } - - /* - * A very big maxrange could cause negative values to pop - * up, owing to overflow. - */ - if (result < 0 || left < 0) - goto retry; - - (void)printf("%d %c %d = ", left, op, right); - (void)fflush(stdout); - (void)time(&start); - - /* - * Keep looping until the correct answer is given, or until EOF or - * interrupt is typed. - */ - for (;;) { - if (!fgets(line, sizeof(line), stdin)) { - (void)printf("\n"); - return(EOF); - } - for (p = line; *p && isspace(*p); ++p); - if (!isdigit(*p)) { - (void)printf("Please type a number.\n"); - continue; - } - if (atoi(p) == result) { - (void)printf("Right!\n"); - ++nright; - break; - } - /* Wrong answer; penalise and ask again. */ - (void)printf("What?\n"); - ++nwrong; - penalise(right, op, 1); - if (op == 'x' || op == '+') - penalise(left, op, 0); - else - penalise(result, op, 0); - } - - /* - * Accumulate the time taken. Obviously rounding errors happen here; - * however they should cancel out, because some of the time you are - * charged for a partially elapsed second at the start, and some of - * the time you are not charged for a partially elapsed second at the - * end. - */ - (void)time(&finish); - qtime += finish - start; - return(0); -} - -/* - * Here is the code for accumulating penalties against the numbers for which - * a wrong answer was given. The right operand and either the left operand - * (for +, x) or the result (for -, /) are stored in a list for the particular - * operation, and each becomes more likely to appear again in that operation. - * Initially, each number is charged a penalty of WRONGPENALTY, giving it that - * many extra chances of appearing. Each time it is selected because of this, - * its penalty is decreased by one; it is removed when it reaches 0. - * - * The penalty[] array gives the sum of all penalties in the list for - * each operation and each operand. The penlist[] array has the lists of - * penalties themselves. - */ - -int penalty[sizeof(keylist) - 1][2]; -struct penalty { - int value, penalty; /* Penalised value and its penalty. */ - struct penalty *next; -} *penlist[sizeof(keylist) - 1][2]; - -#define WRONGPENALTY 5 /* Perhaps this should depend on maxrange. */ - -/* - * Add a penalty for the number `value' to the list for operation `op', - * operand number `operand' (0 or 1). If we run out of memory, we just - * forget about the penalty (how likely is this, anyway?). - */ -void -penalise(int value, int op, int operand) -{ - struct penalty *p; - - op = opnum(op); - if ((p = (struct penalty *)malloc((u_int)sizeof(*p))) == NULL) - return; - p->next = penlist[op][operand]; - penlist[op][operand] = p; - penalty[op][operand] += p->penalty = WRONGPENALTY; - p->value = value; -} - -/* - * Select a random value from 0 to maxval - 1 for operand `operand' (0 or 1) - * of operation `op'. The random number we generate is either used directly - * as a value, or represents a position in the penalty list. If the latter, - * we find the corresponding value and return that, decreasing its penalty. - */ -int -getrandom(int maxval, int op, int operand) -{ - int value; - struct penalty **pp, *p; - - op = opnum(op); - value = random() % (maxval + penalty[op][operand]); - - /* - * 0 to maxval - 1 is a number to be used directly; bigger values - * are positions to be located in the penalty list. - */ - if (value < maxval) - return(value); - value -= maxval; - - /* - * Find the penalty at position `value'; decrement its penalty and - * delete it if it reaches 0; return the corresponding value. - */ - for (pp = &penlist[op][operand]; (p = *pp) != NULL; pp = &p->next) { - if (p->penalty > value) { - value = p->value; - penalty[op][operand]--; - if (--(p->penalty) <= 0) { - p = p->next; - (void)free((char *)*pp); - *pp = p; - } - return(value); - } - value -= p->penalty; - } - /* - * We can only get here if the value from the penalty[] array doesn't - * correspond to the actual sum of penalties in the list. Provide an - * obscure message. - */ - (void)fprintf(stderr, "arithmetic: bug: inconsistent penalties\n"); - exit(1); - /* NOTREACHED */ -} - -/* Return an index for the character op, which is one of [+-x/]. */ -int -opnum(int op) -{ - char *p; - - if (op == 0 || (p = index(keylist, op)) == NULL) { - (void)fprintf(stderr, - "arithmetic: bug: op %c not in keylist %s\n", op, keylist); - exit(1); - } - return(p - keylist); -} - -/* Print usage message and quit. */ -static void -usage(void) -{ - (void)fprintf(stderr, "usage: arithmetic [-o +-x/] [-r range]\n"); - exit(1); -} diff --git a/games/atc/BUGS b/games/atc/BUGS deleted file mode 100644 index 7d2af2944701..000000000000 --- a/games/atc/BUGS +++ /dev/null @@ -1,4 +0,0 @@ -log restarts if interrupted -Still refreshes after exit -Should ^Z be disabled? -does not exit after hup diff --git a/games/atc/Makefile b/games/atc/Makefile deleted file mode 100644 index ee086e4892b8..000000000000 --- a/games/atc/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -# @(#)Makefile 8.1 (Berkeley) 5/31/93 -# $FreeBSD$ - -PROG= atc -CFLAGS+=-DBSD -I${.CURDIR} -I. -SRCS= extern.c grammar.y graphics.c input.c lex.l list.c log.c \ - main.c tunable.c update.c y.tab.h -MAN= atc.6 -DPADD= ${LIBL} ${LIBM} ${LIBCURSES} -LDADD= -ll -lm -lcurses -FILES= Game_List Killer crossover default easy game_2 -FILESDIR= ${SHAREDIR}/games/atc -HIDEGAME=hidegame - -.PATH: ${.CURDIR}/games - -.include diff --git a/games/atc/atc.6 b/games/atc/atc.6 deleted file mode 100644 index 8251371de06a..000000000000 --- a/games/atc/atc.6 +++ /dev/null @@ -1,589 +0,0 @@ -.\" Copyright (c) 1990, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" This code is derived from software contributed to Berkeley by -.\" Ed James. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" 3. All advertising materials mentioning features or use of this software -.\" must display the following acknowledgement: -.\" This product includes software developed by the University of -.\" California, Berkeley and its contributors. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" @(#)atc.6 8.1 (Berkeley) 5/31/93 -.\" $FreeBSD$ -.\" -. \" XP - exdented paragraph -.de XP -.RT -.if \\n(1T .sp \\n(PDu -.ne 1.1 -.if !\\n(IP .nr IP +1 -.in +\\n(I\\n(IRu -.ti -\\n(I\\n(IRu -.. -.\" Copyright (c) 1986 Ed James. All rights reserved. -.\" -.TH ATC 6 "May 31, 1993" -.UC -.SH NAME -atc \- air traffic controller game -.SH SYNOPSIS -.B atc --[u?lstp] [-[gf] game_name] [-r random seed] -.SH DESCRIPTION -.LP -.I Atc -lets you try your hand at the nerve wracking duties of the air traffic -controller without endangering the lives of millions of -travelers each year. -Your responsibilities require you to direct the flight of jets -and prop planes into and out of the flight arena and airports. -The speed (update time) and frequency of the planes depend on the -difficulty of the chosen arena. -.SH OPTIONS -.LP -.TP 8 -.B \-u -Print the usage line and exit. -.TP -.B \-? -Same as -.B \-u. -.TP -.B \-l -Print a list of available games and exit. -The first game name printed is the default game. -.TP -.B \-s -Print the score list (formerly the Top Ten list). -.TP -.B \-t -Same as -.B \-s. -.TP -.B \-p -Print the path to the special directory where -.I atc -expects to find its private files. This is used during the -installation of the program. -.TP -.B "\-g game" -Play the named game. If the game listed is not one of the -ones printed from the -.B \-l -option, the default game is played. -.TP -.B "\-f game" -Same as -.B \-g. -.TP -.B "\-r seed" -Set the random seed. The purpose of this flag is questionable. -.SH GOALS -.LP -Your goal in -.I atc -is to keep the game going as long as possible. -There is no winning state, except to beat the times of other players. -You will need to: launch planes at airports (by instructing them to -increase their altitude); land planes at airports (by instructing them to -go to altitude zero when exactly over the airport); and maneuver planes -out of exit points. -.LP -Several things will cause the end of the game. -Each plane has a destination (see information area), and -sending a plane to the wrong destination is an error. -Planes can run out of fuel, or can collide. Collision is defined as -adjacency in any of the three dimensions. A plane leaving the arena -in any other way than through its destination exit is an error as well. -.LP -Scores are sorted in order of the number of planes safe. The other -statistics are provided merely for fun. There is no penalty for -taking longer than another player (except in the case of ties). -.LP -Suspending a game is not permitted. If you get a talk message, tough. -When was the last time an Air Traffic Controller got called away to -the phone? -.SH "THE DISPLAY" -.LP -Depending on the terminal you run -.I atc -on, the screen will be divided into 4 areas. -It should be stressed that the terminal driver portion of the -game was designed to be reconfigurable, so the display format can vary -depending the version you are playing. The descriptions here are based -on the ASCII version -of the game. The game rules and input format, however, -should remain consistent. -Control-L redraws the screen, should it become muddled. -.SS RADAR -.IP -The first screen area is the radar display, showing the relative locations -of the planes, airports, standard entry/exit points, radar -beacons, and "lines" which simply serve to aid you in guiding -the planes. -.IP -Planes are shown as a single letter with an altitude. If -the numerical altitude is a single digit, then it represents -thousands of feet. -Some distinction is made between the prop -planes and the jets. On ASCII terminals, prop planes are -represented by a upper case letter, jets by a lower case letter. -.IP -Airports are shown as a number and some indication of the direction -planes must be going to land at the airport. -On ASCII terminals, this is one of '^', '>', '<', and 'v', to indicate -north (0 degrees), east (90), west (270) and south (180), respectively. -The planes will also -take off in this direction. -.IP -Beacons are represented as circles or asterisks and a number. -Their purpose is to offer a place of easy reference to the plane pilots. -See 'the delay command' under the input section of this manual. -.IP -Entry/exit points are displayed as numbers along the border of the -radar screen. Planes will enter the arena from these points without -warning. These points have a direction associated with them, and -planes will always enter the arena from this direction. On the -ASCII version of -.I atc, -this direction is not displayed. It will become apparent -what this direction is as the game progresses. -.IP -Incoming planes will always enter at the same altitude: 7000 feet. -For a plane to successfully depart through an entry/exit point, -it must be flying at 9000 feet. -It is not necessary for the planes to be flying in any particular -direction when they leave the arena (yet). -.SS "INFORMATION AREA" -.IP -The second area of the display is the information area, which lists -the time (number of updates since start), and the number of planes you -have directed safely out of the arena. -Below this is a list of planes currently in the air, followed by a -blank line, and then a list of planes on the ground (at airports). -Each line lists the plane name and its current altitude, -an optional asterisk indicating low fuel, the plane's destination, -and the plane's current command. Changing altitude is not considered -to be a command and is therefore not displayed. The following are -some possible information lines: -.IP - B4*A0: Circle @ b1 -.br - g7 E4: 225 -.IP -The first example shows a prop plane named 'B' that is flying at 4000 -feet. It is low on fuel (note the '*'). It's destination is -Airport #0. -The next command it expects -to do is circle when it reaches Beacon #1. -The second example shows a jet named 'g' at 7000 feet, destined for -Exit #4. It is just now executing a turn to 225 degrees (South-West). -.SS "INPUT AREA" -.IP -The third area of the display is the input area. It is here that -your input is reflected. See the INPUT heading of this manual -for more details. -.SS "AUTHOR AREA" -.IP -This area is used simply to give credit where credit is due. :-) -.SH INPUT -.LP -A command completion interface is built into -the game. At any time, typing '?' will list possible input characters. -Typing a backspace (your erase character) backs up, erasing the last part -of the command. When a command is complete, a return enters it, and -any semantic checking is done at that time. If no errors are detected, -the command is sent to the appropriate plane. If an error is discovered -during the check, the offending statement will be underscored and a -(hopefully) descriptive message will be printed under it. -.LP -The command syntax is broken into two parts: -.I "Immediate Only" -and -.I Delayable -commands. -.I "Immediate Only" -commands happen on the next -update. -.I Delayable -commands also happen on the next update unless they -are followed by an optional predicate called the -.I Delay -command. -.LP -In the following tables, the syntax -.B [0\-9] -means any single digit, and -.B -refers to the keys around the 's' key, namely ``wedcxzaq''. -In absolute references, 'q' refers to North-West or 315 degrees, and 'w' -refers to North, or 0 degrees. -In relative references, 'q' refers to -45 degrees or 45 degrees left, and 'w' -refers to 0 degrees, or no change in direction. -.LP -All commands start with a plane letter. This indicates the recipient -of the command. Case is ignored. -.SS "IMMEDIATE ONLY COMMANDS" -.RS -.B "\- a Altitude:" -.RS -Affect a plane's altitude (and take off). -.RE -.RS -.B "\- [0\-9] Number:" -.RS -Go to the given altitude (thousands of feet). -.RE -.B "\- c/+ Climb:" -.RS -Relative altitude change. -.RE -.RS -.B "\- [0\-9] Number:" -.RS -Difference in thousands of feet. -.RE -.RE -.B "\- d/\- Descend:" -.RS -Relative altitude change. -.RE -.RS -.B "\- [0\-9] Number:" -.RS -Difference in thousands of feet. -.RE -.RE -.RE -.B "\- m Mark:" -.RS -Display in highlighted mode. Command is displayed normally. -.RE -.B "\- i Ignore:" -.RS -Do not display highlighted. Command is displayed as a -line of dashes if there is no command. -.RE -.B "\- u Unmark:" -.RS -Same as ignore, but if a delayed command is processed, -the plane will become marked. This is useful if you want -to forget about a plane during part, but not all, of its -journey. -.RE -.RE -.SS "DELAYABLE COMMANDS" -.RS -.B "\- c Circle:" -.RS -Have the plane circle. -.RE -.B "\- t Turn:" -.RS -Change direction. -.RE -.RS -.B "\- l Left:" -.RS -Turn counterclockwise (45 degrees by default). -.RE -.RS -.B "\- Direction:" -.RS -Turn ccw the given number of degrees. -Zero degrees is no turn. A ccw turn -of -45 degrees is 45 cw. -.RE -.RE -.B "\- r Right:" -.RS -Turn clockwise (45 degrees by default). -.RE -.RS -.B "\- Direction:" -.RS -Same as turn left . -.RE -.RE -.B "\- L Left 90:" -.RS -Turn counterclockwise 90 degrees. -.RE -.B "\- R Right 90:" -.RS -Turn clockwise 90 degrees. -.RE -.B "\- Direction:" -.RS -Turn to the absolute compass heading given. -The shortest turn will be taken. -.RE -.B "\- t Towards:" -.RS -Turn towards a beacon, airport or exit. The turn is -just an estimate. -.RE -.RS -.B "\- b/* Beacon:" -.RS -Turn towards the beacon. -.RE -.RS -.B "\- [0-9] Number:" -.RS -The beacon number. -.RE -.RE -.B "\- e Exit:" -.RS -Turn towards the exit. -.RE -.RS -.B "\- [0-9] Number:" -.RS -The exit number. -.RE -.RE -.B "\- a Airport:" -.RS -Turn towards the airport. -.RE -.RS -.B "\- [0-9] Number:" -.RS -The airport number. -.RE -.RE -.RE -.RE -.RE -.SS THE DELAY COMMAND -.LP -The -.B Delay -(a/@) -command may be appended to any -.B Delayable -command. It allows the controller to instruct a plane to do an action -when the plane reaches a particular beacon (or other objects in future -versions). -.sp -.RS -.B "\- a/@ At:" -.RS -Do the given delayable command when the plane reaches the given beacon. -.RE -.RS -.B "\- b/* Beacon:" -.RS -This is redundant to allow for expansion. -.RE -.RS -.B "\- [0-9] Number:" -.RS -The beacon number. -.RE -.RE -.RE -.RE -.SS "MARKING, UNMARKING AND IGNORING" -.LP -Planes are -.B marked -when they enter the arena. This means they are displayed in highlighted -mode on the radar display. A plane may also be either -.B unmarked -or -.B ignored. -An -.B unmarked -plane is drawn in unhighlighted mode, and a line of dashes is displayed in -the command field of the information area. The plane will remain this -way until a mark command has been issued. Any other command will be issued, -but the command line will return to a line of dashes when the command -is completed. -.LP -An -.B ignored -plane is treated the same as an unmarked plane, except that it will -automatically switch to -.B marked -status when a delayed command has been processed. This is useful if -you want to forget about a plane for a while, but its flight path has -not yet been completely set. -.LP -As with all of the commands, marking, unmarking and ignoring will take effect -at the beginning of the next update. Do not be surprised if the plane does -not immediately switch to unhighlighted mode. -.SS EXAMPLES -.RS -.TP 16 -atlab1 -a: turn left at beacon #1 -.TP 16 -cc -C: circle -.TP 16 -gtte4ab2 -g: turn towards exit #4 at beacon #2 -.TP 16 -ma+2 -m: altitude: climb 2000 feet -.TP 16 -stq -S: turn to 315 -.TP 16 -xi -x: ignore -.RE -.SH "OTHER INFORMATION" -.LP -Jets move every update; prop planes move every other update. -.LP -All planes turn a most 90 degrees per movement. -.LP -Planes enter at 7000 feet and leave at 9000 feet. -.LP -Planes flying at an altitude of 0 crash if they are not over an airport. -.LP -Planes waiting at airports can only be told to take off (climb in altitude). -.SH "NEW GAMES" -.LP -The -.B Game_List -file lists the currently available play fields. New field description -file names must be placed in this file to be 'playable'. If a player -specifies a game not in this file, his score will not be logged. -.LP -The game field description files are broken into two parts. The first -part is the definition section. Here, the four tunable game parameters -must be set. These variables are set with the syntax: -.IP -variable = number; -.LP -Variable may be one of: -.B update, -indicating the number of seconds between forced updates; -.B newplane, -indicating (about) the number of updates between new plane entries; -.B width, -indicating the width of the play field; and -.B height, -indicating the height of the play field. -.LP -The second part of the field description files describes the locations -of the exits, the beacons, the airports and the lines. -The syntax is as follows: -.IP -beacon: (x y) ... ; -.br -airport: (x y direction) ... ; -.br -exit: (x y direction) ... ; -.br -line: [ (x1 y1) (x2 y2) ] ... ; -.LP -For beacons, a simple x, y coordinate pair is used (enclosed in parenthesis). -Airports and exits require a third value, a direction, which is one -of -.B wedcxzaq. -For airports, this is the direction that planes must be going to take -off and land, and for exits, this is the direction that planes will going -when they -.B enter -the arena. This may not seem intuitive, but as there is no restriction on -direction of exit, this is appropriate. -Lines are slightly different, since they need two coordinate pairs to -specify the line endpoints. These endpoints must be enclosed in -square brackets. -.LP -All statements are semi-colon (;) terminated. Multiple item statements -accumulate. Each definition must occur exactly once, before any -item statements. Comments begin with a hash (#) symbol -and terminate with a newline. -The coordinates are between zero and width-1 and height-1 -inclusive. All of the exit coordinates must lie on the borders, and -all of the beacons and airports must lie inside of the borders. -Line endpoints may be anywhere within the field, so long as -the lines are horizontal, vertical or -.B "exactly diagonal." -.SS "FIELD FILE EXAMPLE" -.RS -.sp -.nf -.ta \w'airport:\ \ \ 'u -# This is the default game. - -update = 5; -newplane = 5; -width = 30; -height = 21; - -exit: ( 12 0 x ) ( 29 0 z ) ( 29 7 a ) ( 29 17 a ) - ( 9 20 e ) ( 0 13 d ) ( 0 7 d ) ( 0 0 c ) ; - -beacon: ( 12 7 ) ( 12 17 ) ; - -airport: ( 20 15 w ) ( 20 18 d ) ; - -line: [ ( 1 1 ) ( 6 6 ) ] - [ ( 12 1 ) ( 12 6 ) ] - [ ( 13 7 ) ( 28 7 ) ] - [ ( 28 1 ) ( 13 16 ) ] - [ ( 1 13 ) ( 11 13 ) ] - [ ( 12 8 ) ( 12 16 ) ] - [ ( 11 18 ) ( 10 19 ) ] - [ ( 13 17 ) ( 28 17 ) ] - [ ( 1 7 ) ( 11 7 ) ] ; -.DT -.fi -.RE -.SH FILES -.LP -Files are kept in a special directory. See the OPTIONS for a way to -print this path out. -.TP \w'/usr/share/games/atc/Game_List\ \ \ 'u -/var/games/atc_score -Where the scores are kept. -.TP -/usr/share/games/atc/Game_List -The list of playable games. -.SH AUTHOR -.LP -Ed James, UC Berkeley: edjames@ucbvax.berkeley.edu, ucbvax!edjames -.LP -This game is based on someone's description of the overall flavor -of a game written for some unknown PC many years ago, maybe. -.SH BUGS -.LP -The screen sometimes refreshes after you have quit. -.LP -Yet Another Curses Bug was discovered during the development of this game. -If your curses library clrtobot.o is version 5.1 or earlier, -you will have erase problems with the backspace operator in the input -window. - diff --git a/games/atc/def.h b/games/atc/def.h deleted file mode 100644 index 99e319018258..000000000000 --- a/games/atc/def.h +++ /dev/null @@ -1,82 +0,0 @@ -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Ed James. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)def.h 8.1 (Berkeley) 5/31/93 - */ - -/* - * Copyright (c) 1987 by Ed James, UC Berkeley. All rights reserved. - * - * Copy permission is hereby granted provided that this notice is - * retained on all partial or complete copies. - * - * For more info on this and all of my stuff, mail edjames@berkeley.edu. - */ - -#define AUTHOR_STR "ATC - by Ed James" - -#ifndef PI -#define PI 3.14159265358979323846 -#endif - -#define LOWFUEL 15 - -#define REALLOC 10 - -#define SGN(x) ((x < 0) ? -1 : ((x > 0) ? 1 : 0)) -#define ABS(x) ((x < 0) ? -(x) : (x)) -#define DIR_FROM_DXDY(dx,dy) ((int) (atan2((double)(dy), (double)(dx)) \ - * MAXDIR / (2 * PI) + 2.5 + MAXDIR) % MAXDIR) - -#define MAXDIR 8 - -#define D_LEFT 1 -#define D_RIGHT 2 -#define D_UP 3 -#define D_DOWN 4 - -#define T_NODEST 0 -#define T_BEACON 1 -#define T_EXIT 2 -#define T_AIRPORT 3 - -#define S_NONE 0 -#define S_GONE 1 -#define S_MARKED 2 -#define S_UNMARKED 3 -#define S_IGNORED 4 - -#define INPUT_LINES 3 -#define PLANE_COLS 20 diff --git a/games/atc/extern.c b/games/atc/extern.c deleted file mode 100644 index 2976b0c82ece..000000000000 --- a/games/atc/extern.c +++ /dev/null @@ -1,79 +0,0 @@ -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Ed James. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * Copyright (c) 1987 by Ed James, UC Berkeley. All rights reserved. - * - * Copy permission is hereby granted provided that this notice is - * retained on all partial or complete copies. - * - * For more info on this and all of my stuff, mail edjames@berkeley.edu. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)extern.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include "include.h" - -char GAMES[] = "Game_List"; - -int clck, safe_planes, start_time, test_mode; - -const char *file; - -FILE *filein, *fileout; - -C_SCREEN screen, *sp = &screen; - -LIST air, ground; - -struct sgttyb tty_start, tty_new; - -DISPLACEMENT displacement[MAXDIR] = { - { 0, -1 }, - { 1, -1 }, - { 1, 0 }, - { 1, 1 }, - { 0, 1 }, - { -1, 1 }, - { -1, 0 }, - { -1, -1 } -}; diff --git a/games/atc/extern.h b/games/atc/extern.h deleted file mode 100644 index 4072873f819d..000000000000 --- a/games/atc/extern.h +++ /dev/null @@ -1,63 +0,0 @@ -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Ed James. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)extern.h 8.1 (Berkeley) 5/31/93 - */ - -/* - * Copyright (c) 1987 by Ed James, UC Berkeley. All rights reserved. - * - * Copy permission is hereby granted provided that this notice is - * retained on all partial or complete copies. - * - * For more info on this and all of my stuff, mail edjames@berkeley.edu. - */ - -extern char GAMES[]; -extern const char *file; - -extern int clck, safe_planes, start_time, test_mode; - -extern FILE *filein, *fileout; - -extern C_SCREEN screen, *sp; - -extern LIST air, ground; - -extern struct sgttyb tty_start, tty_new; - -extern DISPLACEMENT displacement[MAXDIR]; - -extern PLANE *findplane(), *newplane(); diff --git a/games/atc/games/Game_List b/games/atc/games/Game_List deleted file mode 100644 index 0117385b5bbd..000000000000 --- a/games/atc/games/Game_List +++ /dev/null @@ -1,5 +0,0 @@ -default -easy -crossover -Killer -game_2 diff --git a/games/atc/games/Killer b/games/atc/games/Killer deleted file mode 100644 index f15d0602367f..000000000000 --- a/games/atc/games/Killer +++ /dev/null @@ -1,21 +0,0 @@ -update = 1; -newplane = 4; -width = 30; -height = 21; - -exit: ( 29 7 a ) ( 29 17 a ) - ( 0 7 d ) ( 0 0 c ) ; - -beacon: ( 12 7 ) ( 12 17 ) ( 14 10 ) ( 20 15 ) ; - -airport: ( 20 18 d ) ; - -line: [ ( 1 1 ) ( 6 6 ) ] - [ ( 12 1 ) ( 12 6 ) ] - [ ( 13 7 ) ( 28 7 ) ] - [ ( 28 1 ) ( 13 16 ) ] - [ ( 1 13 ) ( 11 13 ) ] - [ ( 12 8 ) ( 12 16 ) ] - [ ( 11 18 ) ( 10 19 ) ] - [ ( 13 17 ) ( 28 17 ) ] - [ ( 1 7 ) ( 11 7 ) ] ; diff --git a/games/atc/games/crossover b/games/atc/games/crossover deleted file mode 100644 index d2689ffd3a38..000000000000 --- a/games/atc/games/crossover +++ /dev/null @@ -1,14 +0,0 @@ -update = 5; -newplane = 5; -width = 29; -height = 21; - -exit: ( 0 0 c ) ( 8 0 c ) ( 20 0 z ) ( 28 0 z ) - ( 28 20 q ) ( 20 20 q ) ( 8 20 e ) ( 0 20 e ); - -beacon: ( 14 6 ) ( 18 10 ) ( 14 14 ) ( 10 10 ); - -line: [ ( 0 0 ) ( 20 20 ) ] - [ ( 8 0 ) ( 28 20 ) ] - [ ( 20 0 ) ( 0 20 ) ] - [ ( 28 0 ) ( 8 20 ) ]; diff --git a/games/atc/games/default b/games/atc/games/default deleted file mode 100644 index e19ef9d249c5..000000000000 --- a/games/atc/games/default +++ /dev/null @@ -1,21 +0,0 @@ -update = 5; -newplane = 10; -width = 30; -height = 21; - -exit: ( 12 0 x ) ( 29 0 z ) ( 29 7 a ) ( 29 17 a ) - ( 9 20 e ) ( 0 13 d ) ( 0 7 d ) ( 0 0 c ) ; - -beacon: ( 12 7 ) ( 12 17 ) ; - -airport: ( 20 15 w ) ( 20 18 d ) ; - -line: [ ( 1 1 ) ( 6 6 ) ] - [ ( 12 1 ) ( 12 6 ) ] - [ ( 13 7 ) ( 28 7 ) ] - [ ( 28 1 ) ( 13 16 ) ] - [ ( 1 13 ) ( 11 13 ) ] - [ ( 12 8 ) ( 12 16 ) ] - [ ( 11 18 ) ( 10 19 ) ] - [ ( 13 17 ) ( 28 17 ) ] - [ ( 1 7 ) ( 11 7 ) ] ; diff --git a/games/atc/games/easy b/games/atc/games/easy deleted file mode 100644 index 4ab8eac0ee8c..000000000000 --- a/games/atc/games/easy +++ /dev/null @@ -1,15 +0,0 @@ -update = 7; -newplane = 12; -width = 15; -height = 15; - -exit: ( 7 0 x ) ( 14 0 z ) ( 12 14 q ) ( 0 14 e ) ; - -beacon: ( 12 7 ) ; - -airport: ( 7 8 w ) ; - -line: [ ( 1 1 ) ( 6 6 ) ] - [ ( 7 9 ) ( 12 14 ) ] - [ ( 7 0 ) ( 7 14 ) ] - [ ( 1 7 ) ( 11 7 ) ] ; diff --git a/games/atc/games/game_2 b/games/atc/games/game_2 deleted file mode 100644 index 5788c8a2726d..000000000000 --- a/games/atc/games/game_2 +++ /dev/null @@ -1,22 +0,0 @@ -update = 5; -newplane = 8; -width = 30; -height = 21; - -exit: ( 12 0 x ) ( 29 0 z ) ( 29 6 a ) ( 29 13 a ) - ( 9 20 e ) ( 0 13 d ) ( 0 6 d ) ( 0 0 c ) ; - -beacon: ( 12 17 ) ( 23 6 ) ( 23 13 ) ( 25 17 ) - ( 12 6 ) ( 12 13 ) ( 6 6 ) ; - -airport: ( 18 17 d ) ; - -line: [ ( 1 1 ) ( 16 16 ) ] - [ ( 1 6 ) ( 28 6 ) ] - [ ( 12 1 ) ( 12 17 ) ] - [ ( 10 19 ) ( 28 1 ) ] - [ ( 13 17 ) ( 17 17 ) ] - [ ( 1 13 ) ( 28 13 ) ] - [ ( 19 17 ) ( 24 17 ) ] - [ ( 19 17 ) ( 22 14 ) ] - [ ( 26 16 ) ( 28 14 ) ] ; diff --git a/games/atc/grammar.y b/games/atc/grammar.y deleted file mode 100644 index 6a2694af181b..000000000000 --- a/games/atc/grammar.y +++ /dev/null @@ -1,390 +0,0 @@ -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Ed James. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * Copyright (c) 1987 by Ed James, UC Berkeley. All rights reserved. - * - * Copy permission is hereby granted provided that this notice is - * retained on all partial or complete copies. - * - * For more info on this and all of my stuff, mail edjames@berkeley.edu. - */ - -%token HeightOp -%token WidthOp -%token UpdateOp -%token NewplaneOp -%token DirOp -%token ConstOp -%token LineOp -%token AirportOp -%token BeaconOp -%token ExitOp -%union { - int ival; - char cval; -} - -%{ -#include "include.h" - -#ifndef lint -static char sccsid[] = "@(#)grammar.y 8.1 (Berkeley) 5/31/93"; -#endif /* not lint */ - -int errors = 0; -int line = 1; -%} - -%% -file: - bunch_of_defs { if (checkdefs() < 0) return (errors); } bunch_of_lines - { - if (sp->num_exits + sp->num_airports < 2) - yyerror("Need at least 2 airports and/or exits."); - return (errors); - } - ; - -bunch_of_defs: - def bunch_of_defs - | def - ; - -def: - udef - | ndef - | wdef - | hdef - ; - -udef: - UpdateOp '=' ConstOp ';' - { - if (sp->update_secs != 0) - return (yyerror("Redefinition of 'update'.")); - else if ($3 < 1) - return (yyerror("'update' is too small.")); - else - sp->update_secs = $3; - } - ; - -ndef: - NewplaneOp '=' ConstOp ';' - { - if (sp->newplane_time != 0) - return (yyerror("Redefinition of 'newplane'.")); - else if ($3 < 1) - return (yyerror("'newplane' is too small.")); - else - sp->newplane_time = $3; - } - ; - -hdef: - HeightOp '=' ConstOp ';' - { - if (sp->height != 0) - return (yyerror("Redefinition of 'height'.")); - else if ($3 < 3) - return (yyerror("'height' is too small.")); - else - sp->height = $3; - } - ; - -wdef: - WidthOp '=' ConstOp ';' - { - if (sp->height != 0) - return (yyerror("Redefinition of 'width'.")); - else if ($3 < 3) - return (yyerror("'width' is too small.")); - else - sp->width = $3; - } - ; - -bunch_of_lines: - line bunch_of_lines - {} - | line - {} - ; - -line: - BeaconOp ':' Bpoint_list ';' - {} - | ExitOp ':' Epoint_list ';' - {} - | LineOp ':' Lline_list ';' - {} - | AirportOp ':' Apoint_list ';' - {} - ; - -Bpoint_list: - Bpoint Bpoint_list - {} - | Bpoint - {} - ; - -Bpoint: - '(' ConstOp ConstOp ')' - { - if (sp->num_beacons % REALLOC == 0) { - if (sp->beacon == NULL) - sp->beacon = (BEACON *) malloc((sp->num_beacons - + REALLOC) * sizeof (BEACON)); - else - sp->beacon = (BEACON *) realloc(sp->beacon, - (sp->num_beacons + REALLOC) * - sizeof (BEACON)); - if (sp->beacon == NULL) - return (yyerror("No memory available.")); - } - sp->beacon[sp->num_beacons].x = $2; - sp->beacon[sp->num_beacons].y = $3; - check_point($2, $3); - sp->num_beacons++; - } - ; - -Epoint_list: - Epoint Epoint_list - {} - | Epoint - {} - ; - -Epoint: - '(' ConstOp ConstOp DirOp ')' - { - int dir; - - if (sp->num_exits % REALLOC == 0) { - if (sp->exit == NULL) - sp->exit = (EXIT *) malloc((sp->num_exits + - REALLOC) * sizeof (EXIT)); - else - sp->exit = (EXIT *) realloc(sp->exit, - (sp->num_exits + REALLOC) * - sizeof (EXIT)); - if (sp->exit == NULL) - return (yyerror("No memory available.")); - } - dir = dir_no($4); - sp->exit[sp->num_exits].x = $2; - sp->exit[sp->num_exits].y = $3; - sp->exit[sp->num_exits].dir = dir; - check_edge($2, $3); - check_edir($2, $3, dir); - sp->num_exits++; - } - ; - -Apoint_list: - Apoint Apoint_list - {} - | Apoint - {} - ; - -Apoint: - '(' ConstOp ConstOp DirOp ')' - { - int dir; - - if (sp->num_airports % REALLOC == 0) { - if (sp->airport == NULL) - sp->airport=(AIRPORT *)malloc((sp->num_airports - + REALLOC) * sizeof(AIRPORT)); - else - sp->airport = (AIRPORT *) realloc(sp->airport, - (sp->num_airports + REALLOC) * - sizeof(AIRPORT)); - if (sp->airport == NULL) - return (yyerror("No memory available.")); - } - dir = dir_no($4); - sp->airport[sp->num_airports].x = $2; - sp->airport[sp->num_airports].y = $3; - sp->airport[sp->num_airports].dir = dir; - check_point($2, $3); - check_adir($2, $3, dir); - sp->num_airports++; - } - ; - -Lline_list: - Lline Lline_list - {} - | Lline - {} - ; - -Lline: - '[' '(' ConstOp ConstOp ')' '(' ConstOp ConstOp ')' ']' - { - if (sp->num_lines % REALLOC == 0) { - if (sp->line == NULL) - sp->line = (LINE *) malloc((sp->num_lines + - REALLOC) * sizeof (LINE)); - else - sp->line = (LINE *) realloc(sp->line, - (sp->num_lines + REALLOC) * - sizeof (LINE)); - if (sp->line == NULL) - return (yyerror("No memory available.")); - } - sp->line[sp->num_lines].p1.x = $3; - sp->line[sp->num_lines].p1.y = $4; - sp->line[sp->num_lines].p2.x = $7; - sp->line[sp->num_lines].p2.y = $8; - check_line($3, $4, $7, $8); - sp->num_lines++; - } - ; -%% - -check_edge(x, y) -{ - if (!(x == 0) && !(x == sp->width - 1) && - !(y == 0) && !(y == sp->height - 1)) - yyerror("edge value not on edge."); -} - -check_point(x, y) -{ - if (x < 1 || x >= sp->width - 1) - yyerror("X value out of range."); - if (y < 1 || y >= sp->height - 1) - yyerror("Y value out of range."); -} - -check_linepoint(x, y) -{ - if (x < 0 || x >= sp->width) - yyerror("X value out of range."); - if (y < 0 || y >= sp->height) - yyerror("Y value out of range."); -} - -check_line(x1, y1, x2, y2) -{ - int d1, d2; - - check_linepoint(x1, y1); - check_linepoint(x2, y2); - - d1 = ABS(x2 - x1); - d2 = ABS(y2 - y1); - - if (!(d1 == d2) && !(d1 == 0) && !(d2 == 0)) - yyerror("Bad line endpoints."); -} - -yyerror(s) - char *s; -{ - fprintf(stderr, "\"%s\": line %d: %s\n", file, line, s); - errors++; - - return (errors); -} - -check_edir(x, y, dir) -{ - int bad = 0; - - if (x == sp->width - 1) - x = 2; - else if (x != 0) - x = 1; - if (y == sp->height - 1) - y = 2; - else if (y != 0) - y = 1; - - switch (x * 10 + y) { - case 00: if (dir != 3) bad++; break; - case 01: if (dir < 1 || dir > 3) bad++; break; - case 02: if (dir != 1) bad++; break; - case 10: if (dir < 3 || dir > 5) bad++; break; - case 11: break; - case 12: if (dir > 1 && dir < 7) bad++; break; - case 20: if (dir != 5) bad++; break; - case 21: if (dir < 5) bad++; break; - case 22: if (dir != 7) bad++; break; - default: - yyerror("Unknown value in checkdir! Get help!"); - break; - } - if (bad) - yyerror("Bad direction for entrance at exit."); -} - -check_adir(x, y, dir) -{ -} - -checkdefs() -{ - int err = 0; - - if (sp->width == 0) { - yyerror("'width' undefined."); - err++; - } - if (sp->height == 0) { - yyerror("'height' undefined."); - err++; - } - if (sp->update_secs == 0) { - yyerror("'update' undefined."); - err++; - } - if (sp->newplane_time == 0) { - yyerror("'newplane' undefined."); - err++; - } - if (err) - return (-1); - else - return (0); -} diff --git a/games/atc/graphics.c b/games/atc/graphics.c deleted file mode 100644 index 8b521a39f13d..000000000000 --- a/games/atc/graphics.c +++ /dev/null @@ -1,425 +0,0 @@ -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Ed James. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * Copyright (c) 1987 by Ed James, UC Berkeley. All rights reserved. - * - * Copy permission is hereby granted provided that this notice is - * retained on all partial or complete copies. - * - * For more info on this and all of my stuff, mail edjames@berkeley.edu. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)graphics.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include -#include "include.h" -#ifdef SYSV -#include -#endif - -#define C_TOPBOTTOM '-' -#define C_LEFTRIGHT '|' -#define C_AIRPORT '=' -#define C_LINE '+' -#define C_BACKROUND '.' -#define C_BEACON '*' -#define C_CREDIT '*' - -WINDOW *radar, *cleanradar, *credit, *input, *planes; - -getAChar() -{ -#ifdef BSD - return (getchar()); -#endif -#ifdef SYSV - int c; - - while ((c = getchar()) == -1 && errno == EINTR) ; - return(c); -#endif -} - -erase_all() -{ - PLANE *pp; - - for (pp = air.head; pp != NULL; pp = pp->next) { - wmove(cleanradar, pp->ypos, pp->xpos * 2); - wmove(radar, pp->ypos, pp->xpos * 2); - waddch(radar, winch(cleanradar)); - wmove(cleanradar, pp->ypos, pp->xpos * 2 + 1); - wmove(radar, pp->ypos, pp->xpos * 2 + 1); - waddch(radar, winch(cleanradar)); - } -} - -draw_all() -{ - PLANE *pp; - - for (pp = air.head; pp != NULL; pp = pp->next) { - if (pp->status == S_MARKED) - wstandout(radar); - wmove(radar, pp->ypos, pp->xpos * 2); - waddch(radar, name(pp)); - waddch(radar, '0' + pp->altitude); - if (pp->status == S_MARKED) - wstandend(radar); - } - wrefresh(radar); - planewin(); - wrefresh(input); /* return cursor */ - fflush(stdout); -} - -init_gr() -{ - static char buffer[BUFSIZ]; - - initscr(); - setbuf(stdout, buffer); - input = newwin(INPUT_LINES, COLS - PLANE_COLS, LINES - INPUT_LINES, 0); - credit = newwin(INPUT_LINES, PLANE_COLS, LINES - INPUT_LINES, - COLS - PLANE_COLS); - planes = newwin(LINES - INPUT_LINES, PLANE_COLS, 0, COLS - PLANE_COLS); -} - -setup_screen(scp) - const C_SCREEN *scp; -{ - int i, j; - char str[3]; - const char *airstr; - - str[2] = '\0'; - - if (radar != NULL) - delwin(radar); - radar = newwin(scp->height, scp->width * 2, 0, 0); - - if (cleanradar != NULL) - delwin(cleanradar); - cleanradar = newwin(scp->height, scp->width * 2, 0, 0); - - /* minus one here to prevent a scroll */ - for (i = 0; i < PLANE_COLS - 1; i++) { - wmove(credit, 0, i); - waddch(credit, C_CREDIT); - wmove(credit, INPUT_LINES - 1, i); - waddch(credit, C_CREDIT); - } - wmove(credit, INPUT_LINES / 2, 1); - waddstr(credit, AUTHOR_STR); - - for (i = 1; i < scp->height - 1; i++) { - for (j = 1; j < scp->width - 1; j++) { - wmove(radar, i, j * 2); - waddch(radar, C_BACKROUND); - } - } - - /* - * Draw the lines first, since people like to draw lines - * through beacons and exit points. - */ - str[0] = C_LINE; - for (i = 0; i < scp->num_lines; i++) { - str[1] = ' '; - draw_line(radar, scp->line[i].p1.x, scp->line[i].p1.y, - scp->line[i].p2.x, scp->line[i].p2.y, str); - } - - str[0] = C_TOPBOTTOM; - str[1] = C_TOPBOTTOM; - wmove(radar, 0, 0); - for (i = 0; i < scp->width - 1; i++) - waddstr(radar, str); - waddch(radar, C_TOPBOTTOM); - - str[0] = C_TOPBOTTOM; - str[1] = C_TOPBOTTOM; - wmove(radar, scp->height - 1, 0); - for (i = 0; i < scp->width - 1; i++) - waddstr(radar, str); - waddch(radar, C_TOPBOTTOM); - - for (i = 1; i < scp->height - 1; i++) { - wmove(radar, i, 0); - waddch(radar, C_LEFTRIGHT); - wmove(radar, i, (scp->width - 1) * 2); - waddch(radar, C_LEFTRIGHT); - } - - str[0] = C_BEACON; - for (i = 0; i < scp->num_beacons; i++) { - str[1] = '0' + i; - wmove(radar, scp->beacon[i].y, scp->beacon[i].x * 2); - waddstr(radar, str); - } - - for (i = 0; i < scp->num_exits; i++) { - wmove(radar, scp->exit[i].y, scp->exit[i].x * 2); - waddch(radar, '0' + i); - } - - airstr = "^?>?v?num_airports; i++) { - str[0] = airstr[scp->airport[i].dir]; - str[1] = '0' + i; - wmove(radar, scp->airport[i].y, scp->airport[i].x * 2); - waddstr(radar, str); - } - - overwrite(radar, cleanradar); - wrefresh(radar); - wrefresh(credit); - fflush(stdout); -} - -draw_line(w, x, y, lx, ly, s) - WINDOW *w; - int x, y, lx, ly; - const char *s; -{ - int dx, dy; - - dx = SGN(lx - x); - dy = SGN(ly - y); - for (;;) { - wmove(w, y, x * 2); - waddstr(w, s); - if (x == lx && y == ly) - break; - x += dx; - y += dy; - } -} - -ioclrtoeol(pos) -{ - wmove(input, 0, pos); - wclrtoeol(input); - wrefresh(input); - fflush(stdout); -} - -iomove(pos) -{ - wmove(input, 0, pos); - wrefresh(input); - fflush(stdout); -} - -ioaddstr(pos, str) - const char *str; -{ - wmove(input, 0, pos); - waddstr(input, str); - wrefresh(input); - fflush(stdout); -} - -ioclrtobot() -{ - wclrtobot(input); - wrefresh(input); - fflush(stdout); -} - -ioerror(pos, len, str) - const char *str; -{ - int i; - - wmove(input, 1, pos); - for (i = 0; i < len; i++) - waddch(input, '^'); - wmove(input, 2, 0); - waddstr(input, str); - wrefresh(input); - fflush(stdout); -} - -quit() -{ - int c, y, x; -#ifdef BSD - struct itimerval itv; -#endif - - getyx(input, y, x); - wmove(input, 2, 0); - waddstr(input, "Really quit? (y/n) "); - wclrtobot(input); - wrefresh(input); - fflush(stdout); - - c = getchar(); - if (c == EOF || c == 'y') { - /* disable timer */ -#ifdef BSD - itv.it_value.tv_sec = 0; - itv.it_value.tv_usec = 0; - setitimer(ITIMER_REAL, &itv, NULL); -#endif -#ifdef SYSV - alarm(0); -#endif - fflush(stdout); - clear(); - refresh(); - endwin(); - log_score(0); - exit(0); - } - wmove(input, 2, 0); - wclrtobot(input); - wmove(input, y, x); - wrefresh(input); - fflush(stdout); - return; -} - -planewin() -{ - PLANE *pp; - char *command(); - int warning = 0; - -#ifdef BSD - wclear(planes); -#endif - - wmove(planes, 0,0); - -#ifdef SYSV - wclrtobot(planes); -#endif - wprintw(planes, "Time: %-4d Safe: %d", clck, safe_planes); - wmove(planes, 2, 0); - - waddstr(planes, "pl dt comm"); - for (pp = air.head; pp != NULL; pp = pp->next) { - if (waddch(planes, '\n') == ERR) { - warning++; - break; - } - waddstr(planes, command(pp)); - } - waddch(planes, '\n'); - for (pp = ground.head; pp != NULL; pp = pp->next) { - if (waddch(planes, '\n') == ERR) { - warning++; - break; - } - waddstr(planes, command(pp)); - } - if (warning) { - wmove(planes, LINES - INPUT_LINES - 1, 0); - waddstr(planes, "---- more ----"); - wclrtoeol(planes); - } - wrefresh(planes); - fflush(stdout); -} - -loser(p, s) - const PLANE *p; - const char *s; -{ - int c; -#ifdef BSD - struct itimerval itv; -#endif - - /* disable timer */ -#ifdef BSD - itv.it_value.tv_sec = 0; - itv.it_value.tv_usec = 0; - setitimer(ITIMER_REAL, &itv, NULL); -#endif -#ifdef SYSV - alarm(0); -#endif - - wmove(input, 0, 0); - wclrtobot(input); - wprintw(input, "Plane '%c' %s\n\nHit space for top players list...", - name(p), s); - wrefresh(input); - fflush(stdout); - while ((c = getchar()) != EOF && c != ' ') - ; - clear(); /* move to top of screen */ - refresh(); - endwin(); - log_score(0); - exit(0); -} - -redraw() -{ - clear(); - refresh(); - - touchwin(radar); - wrefresh(radar); - touchwin(planes); - wrefresh(planes); - touchwin(credit); - wrefresh(credit); - - /* refresh input last to get cursor in right place */ - touchwin(input); - wrefresh(input); - fflush(stdout); -} - - -done_screen() -{ - clear(); - refresh(); - endwin(); /* clean up curses */ -} diff --git a/games/atc/include.h b/games/atc/include.h deleted file mode 100644 index bef7e0556748..000000000000 --- a/games/atc/include.h +++ /dev/null @@ -1,86 +0,0 @@ -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Ed James. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)include.h 8.1 (Berkeley) 5/31/93 - */ - -/* - * Copyright (c) 1987 by Ed James, UC Berkeley. All rights reserved. - * - * Copy permission is hereby granted provided that this notice is - * retained on all partial or complete copies. - * - * For more info on this and all of my stuff, mail edjames@berkeley.edu. - */ - -#include -#include -#include -#include - -#ifdef BSD -#include -#include -#include -#endif - -#ifdef SYSV -#include -#include -#include -#include -#endif - -#include -#include - -#include - -#ifdef SYSV -#define index strchr -#define rindex strrchr -#define bcopy(a,b,c) memcpy((b), (a), (c)) -#define bzero(a,b) memset((a), '\0', (b)) -#define srandom srand -#define random rand -#define sgttyb termio -#define sg_erase c_cc[2] -#define sg_kill c_cc[3] -#endif - -#include "def.h" -#include "struct.h" -#include "extern.h" -#include "tunable.h" diff --git a/games/atc/input.c b/games/atc/input.c deleted file mode 100644 index b6f18891d373..000000000000 --- a/games/atc/input.c +++ /dev/null @@ -1,670 +0,0 @@ -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Ed James. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * Copyright (c) 1987 by Ed James, UC Berkeley. All rights reserved. - * - * Copy permission is hereby granted provided that this notice is - * retained on all partial or complete copies. - * - * For more info on this and all of my stuff, mail edjames@berkeley.edu. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)input.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include -#include -#include "include.h" -#include "pathnames.h" - -#define MAXRULES 6 -#define MAXDEPTH 15 - -#define RETTOKEN '\r' -#ifdef SYSV -#define CRTOKEN '\r' -#endif -#define REDRAWTOKEN '\014' /* CTRL(L) */ -#define SHELLTOKEN '!' -#define HELPTOKEN '?' -#define ALPHATOKEN 256 -#define NUMTOKEN 257 - -typedef struct { - int token; - int to_state; - const char *str; - const char *(*func)(); -} RULE; - -typedef struct { - int num_rules; - RULE *rule; -} STATE; - -typedef struct { - char str[20]; - int state; - int rule; - int ch; - int pos; -} STACK; - -#define T_RULE stack[level].rule -#define T_STATE stack[level].state -#define T_STR stack[level].str -#define T_POS stack[level].pos -#define T_CH stack[level].ch - -#define NUMELS(a) (sizeof (a) / sizeof (*(a))) - -#define NUMSTATES NUMELS(st) - -const char *setplane(), *circle(), *left(), *right(), *Left(), *Right(), - *beacon(), *ex_it(), *climb(), *descend(), *setalt(), *setrelalt(), - *benum(), *to_dir(), *rel_dir(), *delayb(), *mark(), *unmark(), - *airport(), *turn(), *ignore(); - -RULE state0[] = { { ALPHATOKEN, 1, "%c:", setplane}, - { RETTOKEN, -1, "", NULL }, -#ifdef SYSV - { CRTOKEN, -1, "", NULL }, -#endif - { HELPTOKEN, 12, " [a-z]", NULL }}, - state1[] = { { 't', 2, " turn", turn }, - { 'a', 3, " altitude:", NULL }, - { 'c', 4, " circle", circle }, - { 'm', 7, " mark", mark }, - { 'u', 7, " unmark", unmark }, - { 'i', 7, " ignore", ignore }, - { HELPTOKEN, 12, " tacmui", NULL }}, - state2[] = { { 'l', 6, " left", left }, - { 'r', 6, " right", right }, - { 'L', 4, " left 90", Left }, - { 'R', 4, " right 90", Right }, - { 't', 11, " towards", NULL }, - { 'w', 4, " to 0", to_dir }, - { 'e', 4, " to 45", to_dir }, - { 'd', 4, " to 90", to_dir }, - { 'c', 4, " to 135", to_dir }, - { 'x', 4, " to 180", to_dir }, - { 'z', 4, " to 225", to_dir }, - { 'a', 4, " to 270", to_dir }, - { 'q', 4, " to 315", to_dir }, - { HELPTOKEN, 12, " lrLRt", NULL }}, - state3[] = { { '+', 10, " climb", climb }, - { 'c', 10, " climb", climb }, - { '-', 10, " descend", descend }, - { 'd', 10, " descend", descend }, - { NUMTOKEN, 7, " %c000 feet", setalt }, - { HELPTOKEN, 12, " +-cd[0-9]", NULL }}, - state4[] = { { '@', 9, " at", NULL }, - { 'a', 9, " at", NULL }, - { RETTOKEN, -1, "", NULL }, -#ifdef SYSV - { CRTOKEN, -1, "", NULL }, -#endif - { HELPTOKEN, 12, " @a", NULL }}, - state5[] = { { NUMTOKEN, 7, "%c", delayb }, - { HELPTOKEN, 12, " [0-9]", NULL }}, - state6[] = { { '@', 9, " at", NULL }, - { 'a', 9, " at", NULL }, - { 'w', 4, " 0", rel_dir }, - { 'e', 4, " 45", rel_dir }, - { 'd', 4, " 90", rel_dir }, - { 'c', 4, " 135", rel_dir }, - { 'x', 4, " 180", rel_dir }, - { 'z', 4, " 225", rel_dir }, - { 'a', 4, " 270", rel_dir }, - { 'q', 4, " 315", rel_dir }, - { RETTOKEN, -1, "", NULL }, -#ifdef SYSV - { CRTOKEN, -1, "", NULL }, -#endif - { HELPTOKEN, 12, " @a",NULL }}, - state7[] = { { RETTOKEN, -1, "", NULL }, -#ifdef SYSV - { CRTOKEN, -1, "", NULL }, -#endif - { HELPTOKEN, 12, " ", NULL }}, - state8[] = { { NUMTOKEN, 4, "%c", benum }, - { HELPTOKEN, 12, " [0-9]", NULL }}, - state9[] = { { 'b', 5, " beacon #", NULL }, - { '*', 5, " beacon #", NULL }, - { HELPTOKEN, 12, " b*", NULL }}, - state10[] = { { NUMTOKEN, 7, " %c000 ft", setrelalt}, - { HELPTOKEN, 12, " [0-9]", NULL }}, - state11[] = { { 'b', 8, " beacon #", beacon }, - { '*', 8, " beacon #", beacon }, - { 'e', 8, " exit #", ex_it }, - { 'a', 8, " airport #", airport }, - { HELPTOKEN, 12, " b*ea", NULL }}, - state12[] = { { -1, -1, "", NULL }}; - -#define DEF_STATE(s) { NUMELS(s), (s) } - -STATE st[] = { - DEF_STATE(state0), DEF_STATE(state1), DEF_STATE(state2), - DEF_STATE(state3), DEF_STATE(state4), DEF_STATE(state5), - DEF_STATE(state6), DEF_STATE(state7), DEF_STATE(state8), - DEF_STATE(state9), DEF_STATE(state10), DEF_STATE(state11), - DEF_STATE(state12) -}; - -PLANE p; -STACK stack[MAXDEPTH]; -int level; -int tval; -int dest_type, dest_no, dir; - -pop() -{ - if (level == 0) - return (-1); - level--; - - ioclrtoeol(T_POS); - - strcpy(T_STR, ""); - T_RULE = -1; - T_CH = -1; - return (0); -} - -rezero() -{ - iomove(0); - - level = 0; - T_STATE = 0; - T_RULE = -1; - T_CH = -1; - T_POS = 0; - strcpy(T_STR, ""); -} - -push(ruleno, ch) -{ - int newstate, newpos; - - (void)sprintf(T_STR, st[T_STATE].rule[ruleno].str, tval); - T_RULE = ruleno; - T_CH = ch; - newstate = st[T_STATE].rule[ruleno].to_state; - newpos = T_POS + strlen(T_STR); - - ioaddstr(T_POS, T_STR); - - if (level == 0) - ioclrtobot(); - level++; - T_STATE = newstate; - T_POS = newpos; - T_RULE = -1; - strcpy(T_STR, ""); -} - -getcommand() -{ - int c, i, done; - const char *s, *(*func)(); - PLANE *pp; - - rezero(); - - do { - c = gettoken(); - if (c == tty_new.sg_erase) { - if (pop() < 0) - noise(); - } else if (c == tty_new.sg_kill) { - while (pop() >= 0) - ; - } else { - done = 0; - for (i = 0; i < st[T_STATE].num_rules; i++) { - if (st[T_STATE].rule[i].token == c || - st[T_STATE].rule[i].token == tval) { - push(i, (c >= ALPHATOKEN) ? tval : c); - done = 1; - break; - } - } - if (!done) - noise(); - } - } while (T_STATE != -1); - - if (level == 1) - return (1); /* forced update */ - - dest_type = T_NODEST; - - for (i = 0; i < level; i++) { - func = st[stack[i].state].rule[stack[i].rule].func; - if (func != NULL) - if ((s = (*func)(stack[i].ch)) != NULL) { - ioerror(stack[i].pos, strlen(stack[i].str), s); - return (-1); - } - } - - pp = findplane(p.plane_no); - if (pp->new_altitude != p.new_altitude) - pp->new_altitude = p.new_altitude; - else if (pp->status != p.status) - pp->status = p.status; - else { - pp->new_dir = p.new_dir; - pp->delayd = p.delayd; - pp->delayd_no = p.delayd_no; - } - return (0); -} - -noise() -{ - putchar('\07'); - fflush(stdout); -} - -gettoken() -{ - while ((tval = getAChar()) == REDRAWTOKEN || tval == SHELLTOKEN) - { - if (tval == SHELLTOKEN) - { -#ifdef BSD - struct itimerval itv; - itv.it_value.tv_sec = 0; - itv.it_value.tv_usec = 0; - setitimer(ITIMER_REAL, &itv, NULL); -#endif -#ifdef SYSV - int aval; - aval = alarm(0); -#endif - if (fork() == 0) /* child */ - { - char *shell, *base; - - /* revoke */ - setgid(getgid()); - done_screen(); - - /* run user's favorite shell */ - if ((shell = getenv("SHELL")) != NULL) - { - base = strrchr(shell, '/'); - if (base == NULL) - base = shell; - else - base++; - execl(shell, base, (char *)0); - } - else - execl(_PATH_BSHELL, "sh", (char *)0); - - exit(0); /* oops */ - } - - wait(0); -#ifdef BSD - ioctl(fileno(stdin), TIOCSETP, &tty_new); - itv.it_value.tv_sec = 0; - itv.it_value.tv_usec = 1; - itv.it_interval.tv_sec = sp->update_secs; - itv.it_interval.tv_usec = 0; - setitimer(ITIMER_REAL, &itv, NULL); -#endif -#ifdef SYSV - ioctl(fileno(stdin), TCSETAW, &tty_new); - alarm(aval); -#endif - } - redraw(); - } - - if (isdigit(tval)) - return (NUMTOKEN); - else if (isalpha(tval)) - return (ALPHATOKEN); - else - return (tval); -} - -const char * -setplane(c) -{ - PLANE *pp; - - pp = findplane(number(c)); - if (pp == NULL) - return ("Unknown Plane"); - bcopy(pp, &p, sizeof (p)); - p.delayd = 0; - return (NULL); -} - -const char * -turn(c) -{ - if (p.altitude == 0) - return ("Planes at airports may not change direction"); - return (NULL); -} - -const char * -circle(c) -{ - if (p.altitude == 0) - return ("Planes cannot circle on the ground"); - p.new_dir = MAXDIR; - return (NULL); -} - -const char * -left(c) -{ - dir = D_LEFT; - p.new_dir = p.dir - 1; - if (p.new_dir < 0) - p.new_dir += MAXDIR; - return (NULL); -} - -const char * -right(c) -{ - dir = D_RIGHT; - p.new_dir = p.dir + 1; - if (p.new_dir >= MAXDIR) - p.new_dir -= MAXDIR; - return (NULL); -} - -const char * -Left(c) -{ - p.new_dir = p.dir - 2; - if (p.new_dir < 0) - p.new_dir += MAXDIR; - return (NULL); -} - -const char * -Right(c) -{ - p.new_dir = p.dir + 2; - if (p.new_dir >= MAXDIR) - p.new_dir -= MAXDIR; - return (NULL); -} - -const char * -delayb(c) -{ - int xdiff, ydiff; - - c -= '0'; - - if (c >= sp->num_beacons) - return ("Unknown beacon"); - xdiff = sp->beacon[c].x - p.xpos; - xdiff = SGN(xdiff); - ydiff = sp->beacon[c].y - p.ypos; - ydiff = SGN(ydiff); - if (xdiff != displacement[p.dir].dx || ydiff != displacement[p.dir].dy) - return ("Beacon is not in flight path"); - p.delayd = 1; - p.delayd_no = c; - - if (dest_type != T_NODEST) { - switch (dest_type) { - case T_BEACON: - xdiff = sp->beacon[dest_no].x - sp->beacon[c].x; - ydiff = sp->beacon[dest_no].y - sp->beacon[c].y; - break; - case T_EXIT: - xdiff = sp->exit[dest_no].x - sp->beacon[c].x; - ydiff = sp->exit[dest_no].y - sp->beacon[c].y; - break; - case T_AIRPORT: - xdiff = sp->airport[dest_no].x - sp->beacon[c].x; - ydiff = sp->airport[dest_no].y - sp->beacon[c].y; - break; - default: - return ("Bad case in delayb! Get help!"); - break; - } - if (xdiff == 0 && ydiff == 0) - return ("Would already be there"); - p.new_dir = DIR_FROM_DXDY(xdiff, ydiff); - if (p.new_dir == p.dir) - return ("Already going in that direction"); - } - return (NULL); -} - -const char * -beacon(c) -{ - dest_type = T_BEACON; - return (NULL); -} - -const char * -ex_it(c) -{ - dest_type = T_EXIT; - return (NULL); -} - -const char * -airport(c) -{ - dest_type = T_AIRPORT; - return (NULL); -} - -const char * -climb(c) -{ - dir = D_UP; - return (NULL); -} - -const char * -descend(c) -{ - dir = D_DOWN; - return (NULL); -} - -const char * -setalt(c) -{ - if ((p.altitude == c - '0') && (p.new_altitude == p.altitude)) - return ("Already at that altitude"); - p.new_altitude = c - '0'; - return (NULL); -} - -const char * -setrelalt(c) -{ - if (c == 0) - return ("altitude not changed"); - - switch (dir) { - case D_UP: - p.new_altitude = p.altitude + c - '0'; - break; - case D_DOWN: - p.new_altitude = p.altitude - (c - '0'); - break; - default: - return ("Unknown case in setrelalt! Get help!"); - break; - } - if (p.new_altitude < 0) - return ("Altitude would be too low"); - else if (p.new_altitude > 9) - return ("Altitude would be too high"); - return (NULL); -} - -const char * -benum(c) -{ - dest_no = c -= '0'; - - switch (dest_type) { - case T_BEACON: - if (c >= sp->num_beacons) - return ("Unknown beacon"); - p.new_dir = DIR_FROM_DXDY(sp->beacon[c].x - p.xpos, - sp->beacon[c].y - p.ypos); - break; - case T_EXIT: - if (c >= sp->num_exits) - return ("Unknown exit"); - p.new_dir = DIR_FROM_DXDY(sp->exit[c].x - p.xpos, - sp->exit[c].y - p.ypos); - break; - case T_AIRPORT: - if (c >= sp->num_airports) - return ("Unknown airport"); - p.new_dir = DIR_FROM_DXDY(sp->airport[c].x - p.xpos, - sp->airport[c].y - p.ypos); - break; - default: - return ("Unknown case in benum! Get help!"); - break; - } - return (NULL); -} - -const char * -to_dir(c) -{ - p.new_dir = dir_no(c); - return (NULL); -} - -const char * -rel_dir(c) -{ - int angle; - - angle = dir_no(c); - switch (dir) { - case D_LEFT: - p.new_dir = p.dir - angle; - if (p.new_dir < 0) - p.new_dir += MAXDIR; - break; - case D_RIGHT: - p.new_dir = p.dir + angle; - if (p.new_dir >= MAXDIR) - p.new_dir -= MAXDIR; - break; - default: - return ("Bizarre direction in rel_dir! Get help!"); - break; - } - return (NULL); -} - -const char * -mark(c) -{ - if (p.altitude == 0) - return ("Cannot mark planes on the ground"); - if (p.status == S_MARKED) - return ("Already marked"); - p.status = S_MARKED; - return (NULL); -} - -const char * -unmark(c) -{ - if (p.altitude == 0) - return ("Cannot unmark planes on the ground"); - if (p.status == S_UNMARKED) - return ("Already unmarked"); - p.status = S_UNMARKED; - return (NULL); -} - -const char * -ignore(c) -{ - if (p.altitude == 0) - return ("Cannot ignore planes on the ground"); - if (p.status == S_IGNORED) - return ("Already ignored"); - p.status = S_IGNORED; - return (NULL); -} - -dir_no(ch) - char ch; -{ - int dir; - - switch (ch) { - case 'w': dir = 0; break; - case 'e': dir = 1; break; - case 'd': dir = 2; break; - case 'c': dir = 3; break; - case 'x': dir = 4; break; - case 'z': dir = 5; break; - case 'a': dir = 6; break; - case 'q': dir = 7; break; - default: - fprintf(stderr, "bad character in dir_no\n"); - break; - } - return (dir); -} diff --git a/games/atc/lex.l b/games/atc/lex.l deleted file mode 100644 index 0092a2959d1d..000000000000 --- a/games/atc/lex.l +++ /dev/null @@ -1,69 +0,0 @@ -%{ -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Ed James. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * Copyright (c) 1987 by Ed James, UC Berkeley. All rights reserved. - * - * Copy permission is hereby granted provided that this notice is - * retained on all partial or complete copies. - * - * For more info on this and all of my stuff, mail edjames@berkeley.edu. - */ - -#ifndef lint -static char sccsid[] = "@(#)lex.l 8.1 (Berkeley) 5/31/93"; -#endif /* not lint */ - -#include "y.tab.h" -extern int line; - -%} -%% -[0-9]+ { yylval.ival = atoi(yytext); return(ConstOp); } -height { return(HeightOp); } -width { return(WidthOp); } -newplane { return(NewplaneOp); } -update { return(UpdateOp); } -airport { return(AirportOp); } -line { return(LineOp); } -exit { return(ExitOp); } -beacon { return(BeaconOp); } -[wedcxzaq] { yylval.cval = *yytext; return (DirOp); } -[ \t]+ { } -#[^\n]*\n { line++; } -\n { line++; } -. { return *yytext; } diff --git a/games/atc/list.c b/games/atc/list.c deleted file mode 100644 index af5788fae8ab..000000000000 --- a/games/atc/list.c +++ /dev/null @@ -1,120 +0,0 @@ -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Ed James. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * Copyright (c) 1987 by Ed James, UC Berkeley. All rights reserved. - * - * Copy permission is hereby granted provided that this notice is - * retained on all partial or complete copies. - * - * For more info on this and all of my stuff, mail edjames@berkeley.edu. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)list.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include -#include "include.h" - -PLANE * -newplane() -{ - return ((PLANE *) calloc(1, sizeof (PLANE))); -} - -append(l, p) - LIST *l; - PLANE *p; -{ - PLANE *q = NULL, *r = NULL; - - if (l->head == NULL) { - p->next = p->prev = NULL; - l->head = l->tail = p; - } else { - q = l -> head; - - while (q != NULL && q->plane_no < p->plane_no) { - r = q; - q = q -> next; - } - - if (q) { - if (r) { - p->prev = r; - r->next = p; - p->next = q; - q->prev = p; - } else { - p->next = q; - p->prev = NULL; - q->prev = p; - l->head = p; - } - } else { - l->tail->next = p; - p->next = NULL; - p->prev = l->tail; - l->tail = p; - } - } -} - -delete(l, p) - LIST *l; - PLANE *p; -{ - if (l->head == NULL) - loser(p, "deleted a non-existant plane! Get help!"); - - if (l->head == p && l->tail == p) - l->head = l->tail = NULL; - else if (l->head == p) { - l->head = p->next; - l->head->prev = NULL; - } else if (l->tail == p) { - l->tail = p->prev; - l->tail->next = NULL; - } else { - p->prev->next = p->next; - p->next->prev = p->prev; - } -} diff --git a/games/atc/log.c b/games/atc/log.c deleted file mode 100644 index 471b9ecdf87f..000000000000 --- a/games/atc/log.c +++ /dev/null @@ -1,297 +0,0 @@ -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Ed James. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * Copyright (c) 1987 by Ed James, UC Berkeley. All rights reserved. - * - * Copy permission is hereby granted provided that this notice is - * retained on all partial or complete copies. - * - * For more info on this and all of my stuff, mail edjames@berkeley.edu. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)log.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include -#include "include.h" -#include "pathnames.h" - -#ifdef SYSV -#include -#endif - -static FILE *score_fp; - -int -compar(va, vb) - const void *va, *vb; -{ - const SCORE *a, *b; - - a = (const SCORE *)va; - b = (const SCORE *)vb; - - if (b->planes == a->planes) - return (b->time - a->time); - else - return (b->planes - a->planes); -} - -#define SECAMIN 60 -#define MINAHOUR 60 -#define HOURADAY 24 -#define SECAHOUR (SECAMIN * MINAHOUR) -#define SECADAY (SECAHOUR * HOURADAY) -#define DAY(t) ((t) / SECADAY) -#define HOUR(t) (((t) % SECADAY) / SECAHOUR) -#define MIN(t) (((t) % SECAHOUR) / SECAMIN) -#define SEC(t) ((t) % SECAMIN) - -const char * -timestr(t) -{ - static char s[80]; - - if (DAY(t) > 0) - (void)sprintf(s, "%dd+%02dhrs", DAY(t), HOUR(t)); - else if (HOUR(t) > 0) - (void)sprintf(s, "%d:%02d:%02d", HOUR(t), MIN(t), SEC(t)); - else if (MIN(t) > 0) - (void)sprintf(s, "%d:%02d", MIN(t), SEC(t)); - else if (SEC(t) > 0) - (void)sprintf(s, ":%02d", SEC(t)); - else - *s = '\0'; - - return (s); -} - -void -open_score_file() -{ - mode_t old_mask; - int score_fd; - int flags; - - old_mask = umask(0); - score_fd = open(_PATH_SCORE, O_CREAT|O_RDWR, 0664); - umask(old_mask); - if (score_fd < 0) { - warn("open %s", _PATH_SCORE); - return; - } - /* Set the close-on-exec flag. If this fails for any reason, quit - * rather than leave the score file open to tampering. */ - flags = fcntl(score_fd, F_GETFD); - if (flags < 0) - err(1, "fcntl F_GETFD"); - flags |= FD_CLOEXEC; - if (fcntl(score_fd, F_SETFD, flags) == -1) - err(1, "fcntl F_SETFD"); - /* - * This is done to take advantage of stdio, while still - * allowing a O_CREAT during the open(2) of the log file. - */ - score_fp = fdopen(score_fd, "r+"); - if (score_fp == NULL) { - warn("fdopen %s", _PATH_SCORE); - return; - } -} - -int -log_score(list_em) - int list_em; -{ - int i, num_scores = 0, good, changed = 0, found = 0; - struct passwd *pw; - char *cp; - SCORE score[100], thisscore; -#ifdef SYSV - struct utsname name; -#endif - - if (score_fp == NULL) { - warnx("no score file available"); - return (-1); - } - -#ifdef BSD - if (flock(fileno(score_fp), LOCK_EX) < 0) -#endif -#ifdef SYSV - while (lockf(fileno(score_fp), F_LOCK, 1) < 0) -#endif - { - warn("flock %s", _PATH_SCORE); - return (-1); - } - for (;;) { - good = fscanf(score_fp, SCORE_SCANF_FMT, - score[num_scores].name, - score[num_scores].host, - score[num_scores].game, - &score[num_scores].planes, - &score[num_scores].time, - &score[num_scores].real_time); - if (good != 6 || ++num_scores >= NUM_SCORES) - break; - } - if (!test_mode && !list_em) { - if ((pw = (struct passwd *) getpwuid(getuid())) == NULL) { - fprintf(stderr, - "getpwuid failed for uid %d. Who are you?\n", - (int)getuid()); - return (-1); - } - strcpy(thisscore.name, pw->pw_name); -#ifdef BSD - if (gethostname(thisscore.host, sizeof (thisscore.host)) < 0) { - perror("gethostname"); - return (-1); - } -#endif -#ifdef SYSV - uname(&name); - strcpy(thisscore.host, name.nodename); -#endif - - cp = rindex(file, '/'); - if (cp == NULL) { - fprintf(stderr, "log: where's the '/' in %s?\n", file); - return (-1); - } - cp++; - strcpy(thisscore.game, cp); - - thisscore.time = clck; - thisscore.planes = safe_planes; - thisscore.real_time = time(0) - start_time; - - for (i = 0; i < num_scores; i++) { - if (strcmp(thisscore.name, score[i].name) == 0 && - strcmp(thisscore.host, score[i].host) == 0 && - strcmp(thisscore.game, score[i].game) == 0) { - if (thisscore.time > score[i].time) { - score[i].time = thisscore.time; - score[i].planes = thisscore.planes; - score[i].real_time = - thisscore.real_time; - changed++; - } - found++; - break; - } - } - if (!found) { - for (i = 0; i < num_scores; i++) { - if (thisscore.time > score[i].time) { - if (num_scores < NUM_SCORES) - num_scores++; - bcopy(&score[i], - &score[num_scores - 1], - sizeof (score[i])); - bcopy(&thisscore, &score[i], - sizeof (score[i])); - changed++; - break; - } - } - } - if (!found && !changed && num_scores < NUM_SCORES) { - bcopy(&thisscore, &score[num_scores], - sizeof (score[num_scores])); - num_scores++; - changed++; - } - - if (changed) { - if (found) - puts("You beat your previous score!"); - else - puts("You made the top players list!"); - qsort(score, num_scores, sizeof (*score), compar); - rewind(score_fp); - for (i = 0; i < num_scores; i++) - fprintf(score_fp, "%s %s %s %d %d %d\n", - score[i].name, score[i].host, - score[i].game, score[i].planes, - score[i].time, score[i].real_time); - fflush(score_fp); - if (ferror(score_fp)) - warn("error writing %s", _PATH_SCORE); - /* It is just possible that updating an entry could - * have reduced the length of the file, so we - * truncate it. The lseek is required for stream/fd - * synchronisation by POSIX.1. */ - lseek(fileno(score_fp), 0, SEEK_END); - ftruncate(fileno(score_fp), ftell(score_fp)); - } else { - if (found) - puts("You didn't beat your previous score."); - else - puts("You didn't make the top players list."); - } - putchar('\n'); - } -#ifdef BSD - flock(fileno(score_fp), LOCK_UN); -#endif -#ifdef SYSV - /* lock will evaporate upon close */ -#endif - fclose(score_fp); - printf("%2s: %-8s %-8s %-18s %4s %9s %4s\n", "#", "name", "host", - "game", "time", "real time", "planes safe"); - puts("-------------------------------------------------------------------------------"); - for (i = 0; i < num_scores; i++) { - cp = index(score[i].host, '.'); - if (cp != NULL) - *cp = '\0'; - printf("%2d: %-8s %-8s %-18s %4d %9s %4d\n", i + 1, - score[i].name, score[i].host, score[i].game, - score[i].time, timestr(score[i].real_time), - score[i].planes); - } - putchar('\n'); - return (0); -} diff --git a/games/atc/main.c b/games/atc/main.c deleted file mode 100644 index 6a10ca63e933..000000000000 --- a/games/atc/main.c +++ /dev/null @@ -1,338 +0,0 @@ -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Ed James. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * Copyright (c) 1987 by Ed James, UC Berkeley. All rights reserved. - * - * Copy permission is hereby granted provided that this notice is - * retained on all partial or complete copies. - * - * For more info on this and all of my stuff, mail edjames@berkeley.edu. - */ - -#ifndef lint -static const char copyright[] = -"@(#) Copyright (c) 1990, 1993\n\ - The Regents of the University of California. All rights reserved.\n"; -#endif /* not lint */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include -#include "include.h" -#include "pathnames.h" - -main(ac, av) - int ac; - char *av[]; -{ - int seed = 0; - int f_usage = 0, f_list = 0, f_showscore = 0; - int f_printpath = 0; - const char *file = NULL; - char *name, *ptr; -#ifdef BSD - struct itimerval itv; -#endif - extern const char *default_game(), *okay_game(); - extern void log_score(), quit(), update(); - - /* Open the score file then revoke setgid privileges */ - open_score_file(); - setregid(getgid(), getgid()); - - start_time = time(0); - - name = *av++; - while (*av) { -#ifndef SAVEDASH - if (**av == '-') - *++*av; - else - break; -#endif - ptr = *av++; - while (*ptr) { - switch (*ptr) { - case '?': - case 'u': - f_usage++; - break; - case 'l': - f_list++; - break; - case 's': - case 't': - f_showscore++; - break; - case 'p': - f_printpath++; - break; - case 'r': - srandom(atoi(*av)); - seed = 1; - av++; - break; - case 'f': - case 'g': - file = *av; - av++; - break; - default: - fprintf(stderr, "Unknown option '%c'\n", *ptr); - f_usage++; - break; - } - ptr++; - } - } - if (!seed) - srandomdev(); - - if (f_usage) - fprintf(stderr, - "usage: %s -[u?lstp] [-[gf] game_name] [-r random seed]\n", - name); - if (f_showscore) - log_score(1); - if (f_list) - list_games(); - if (f_printpath) { - char buf[100]; - - strcpy(buf, _PATH_GAMES); - buf[strlen(buf) - 1] = '\0'; - puts(buf); - } - - if (f_usage || f_showscore || f_list || f_printpath) - exit(0); - - if (file == NULL) - file = default_game(); - else - file = okay_game(file); - - if (file == NULL || read_file(file) < 0) - exit(1); - - init_gr(); - setup_screen(sp); - - addplane(); - - signal(SIGINT, quit); - signal(SIGQUIT, quit); -#ifdef BSD - signal(SIGTSTP, SIG_IGN); - signal(SIGSTOP, SIG_IGN); -#endif - signal(SIGHUP, log_score); - signal(SIGTERM, log_score); - -#ifdef BSD - ioctl(fileno(stdin), TIOCGETP, &tty_start); - bcopy(&tty_start, &tty_new, sizeof(tty_new)); - tty_new.sg_flags |= CBREAK; - tty_new.sg_flags &= ~ECHO; - ioctl(fileno(stdin), TIOCSETP, &tty_new); -#endif - -#ifdef SYSV - ioctl(fileno(stdin), TCGETA, &tty_start); - bcopy(&tty_start, &tty_new, sizeof(tty_new)); - tty_new.c_lflag &= ~ICANON; - tty_new.c_lflag &= ~ECHO; - tty_new.c_cc[VMIN] = 1; - tty_new.c_cc[VTIME] = 0; - ioctl(fileno(stdin), TCSETAW, &tty_new); -#endif - - signal(SIGALRM, update); - -#ifdef BSD - itv.it_value.tv_sec = 0; - itv.it_value.tv_usec = 1; - itv.it_interval.tv_sec = sp->update_secs; - itv.it_interval.tv_usec = 0; - setitimer(ITIMER_REAL, &itv, NULL); -#endif -#ifdef SYSV - alarm(sp->update_secs); -#endif - - for (;;) { - if (getcommand() != 1) - planewin(); - else { -#ifdef BSD - itv.it_value.tv_sec = 0; - itv.it_value.tv_usec = 0; - setitimer(ITIMER_REAL, &itv, NULL); -#endif -#ifdef SYSV - alarm(0); -#endif - - update(); - -#ifdef BSD - itv.it_value.tv_sec = sp->update_secs; - itv.it_value.tv_usec = 0; - itv.it_interval.tv_sec = sp->update_secs; - itv.it_interval.tv_usec = 0; - setitimer(ITIMER_REAL, &itv, NULL); -#endif -#ifdef SYSV - alarm(sp->update_secs); -#endif - } - } -} - -read_file(s) - const char *s; -{ - extern FILE *yyin; - int retval; - - file = s; - yyin = fopen(s, "r"); - if (yyin == NULL) { - perror(s); - return (-1); - } - retval = yyparse(); - fclose(yyin); - - if (retval != 0) - return (-1); - else - return (0); -} - -const char * -default_game() -{ - FILE *fp; - static char file[256]; - char line[256], games[256]; - - strcpy(games, _PATH_GAMES); - strcat(games, GAMES); - - if ((fp = fopen(games, "r")) == NULL) { - perror(games); - return (NULL); - } - if (fgets(line, sizeof(line), fp) == NULL) { - fprintf(stderr, "%s: no default game available\n", games); - return (NULL); - } - fclose(fp); - line[strlen(line) - 1] = '\0'; - strcpy(file, _PATH_GAMES); - strcat(file, line); - return (file); -} - -const char * -okay_game(s) - char *s; -{ - FILE *fp; - static char file[256]; - const char *ret = NULL; - char line[256], games[256]; - - strcpy(games, _PATH_GAMES); - strcat(games, GAMES); - - if ((fp = fopen(games, "r")) == NULL) { - perror(games); - return (NULL); - } - while (fgets(line, sizeof(line), fp) != NULL) { - line[strlen(line) - 1] = '\0'; - if (strcmp(s, line) == 0) { - strcpy(file, _PATH_GAMES); - strcat(file, line); - ret = file; - break; - } - } - fclose(fp); - if (ret == NULL) { - test_mode = 1; - ret = s; - fprintf(stderr, "%s: %s: game not found\n", games, s); - fprintf(stderr, "Your score will not be logged.\n"); - sleep(2); /* give the guy time to read it */ - } - return (ret); -} - -list_games() -{ - FILE *fp; - char line[256], games[256]; - int num_games = 0; - - strcpy(games, _PATH_GAMES); - strcat(games, GAMES); - - if ((fp = fopen(games, "r")) == NULL) { - perror(games); - return (-1); - } - puts("available games:"); - while (fgets(line, sizeof(line), fp) != NULL) { - printf(" %s", line); - num_games++; - } - fclose(fp); - if (num_games == 0) { - fprintf(stderr, "%s: no games available\n", games); - return (-1); - } - return (0); -} diff --git a/games/atc/pathnames.h b/games/atc/pathnames.h deleted file mode 100644 index e2ee4f8c89c4..000000000000 --- a/games/atc/pathnames.h +++ /dev/null @@ -1,39 +0,0 @@ -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)pathnames.h 8.1 (Berkeley) 5/31/93 - */ - -#include - -#define _PATH_GAMES "/usr/share/games/atc/" -#define _PATH_SCORE "/var/games/atc_score" diff --git a/games/atc/struct.h b/games/atc/struct.h deleted file mode 100644 index 6034557af263..000000000000 --- a/games/atc/struct.h +++ /dev/null @@ -1,113 +0,0 @@ -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Ed James. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)struct.h 8.1 (Berkeley) 5/31/93 - */ - -/* - * Copyright (c) 1987 by Ed James, UC Berkeley. All rights reserved. - * - * Copy permission is hereby granted provided that this notice is - * retained on all partial or complete copies. - * - * For more info on this and all of my stuff, mail edjames@berkeley.edu. - */ - -typedef struct { - int x, y; - int dir; /* used only sometimes */ -} SCREEN_POS; - -typedef struct { - SCREEN_POS p1, p2; -} LINE; - -typedef SCREEN_POS EXIT; -typedef SCREEN_POS BEACON; -typedef SCREEN_POS AIRPORT; - -typedef struct { - int width, height; - int update_secs; - int newplane_time; - int num_exits; - int num_lines; - int num_beacons; - int num_airports; - EXIT *exit; - LINE *line; - BEACON *beacon; - AIRPORT *airport; -} C_SCREEN; - -typedef struct plane { - struct plane *next, *prev; - int status; - int plane_no; - int plane_type; - int orig_no; - int orig_type; - int dest_no; - int dest_type; - int altitude; - int new_altitude; - int dir; - int new_dir; - int fuel; - int xpos; - int ypos; - int delayd; - int delayd_no; -} PLANE; - -typedef struct { - PLANE *head, *tail; -} LIST; - -typedef struct { - char name[10]; - char host[256]; - char game[256]; - int planes; - int time; - int real_time; -} SCORE; - -#define SCORE_SCANF_FMT "%9s %255s %255s %d %d %d" - -typedef struct displacement { - int dx; - int dy; -} DISPLACEMENT; diff --git a/games/atc/tunable.c b/games/atc/tunable.c deleted file mode 100644 index 7c7105984f51..000000000000 --- a/games/atc/tunable.c +++ /dev/null @@ -1,60 +0,0 @@ -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Ed James. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * Copyright (c) 1987 by Ed James, UC Berkeley. All rights reserved. - * - * Copy permission is hereby granted provided that this notice is - * retained on all partial or complete copies. - * - * For more info on this and all of my stuff, mail edjames@berkeley.edu. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)tunable.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -/* - * NUM_SCORES - Number of scores that are kept track of. - * Keep this greater than 0, but less than 100. - * 4 lines are printed above the score, one below + your prompt, so - * to prevent scrolling: 6 + NUM_SCORES <= 24 (lines on an average terminal). - */ -int NUM_SCORES = 18; diff --git a/games/atc/tunable.h b/games/atc/tunable.h deleted file mode 100644 index d2cb93230478..000000000000 --- a/games/atc/tunable.h +++ /dev/null @@ -1,48 +0,0 @@ -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Ed James. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)tunable.h 8.1 (Berkeley) 5/31/93 - */ - -/* - * Copyright (c) 1987 by Ed James, UC Berkeley. All rights reserved. - * - * Copy permission is hereby granted provided that this notice is - * retained on all partial or complete copies. - * - * For more info on this and all of my stuff, mail edjames@berkeley.edu. - */ - -extern int NUM_SCORES; diff --git a/games/atc/update.c b/games/atc/update.c deleted file mode 100644 index f7d898f6f9fe..000000000000 --- a/games/atc/update.c +++ /dev/null @@ -1,421 +0,0 @@ -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Ed James. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * Copyright (c) 1987 by Ed James, UC Berkeley. All rights reserved. - * - * Copy permission is hereby granted provided that this notice is - * retained on all partial or complete copies. - * - * For more info on this and all of my stuff, mail edjames@berkeley.edu. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)update.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include -#include "include.h" - -char name(); - -update() -{ - int i, dir_diff, mask, unclean; - PLANE *pp, *p1, *p2, *p; - -#ifdef BSD - mask = sigblock(sigmask(SIGINT)); -#endif -#ifdef SYSV - alarm(0); - signal(SIGALRM, update); -#endif - - clck++; - - erase_all(); - - /* put some planes in the air */ - do { - unclean = 0; - for (pp = ground.head; pp != NULL; pp = pp->next) { - if (pp->new_altitude > 0) { - delete(&ground, pp); - append(&air, pp); - unclean = 1; - break; - } - } - } while (unclean); - - /* do altitude change and basic movement */ - for (pp = air.head; pp != NULL; pp = pp->next) { - /* type 0 only move every other turn */ - if (pp->plane_type == 0 && clck & 1) - continue; - - pp->fuel--; - if (pp->fuel < 0) - loser(pp, "ran out of fuel."); - - pp->altitude += SGN(pp->new_altitude - pp->altitude); - - if (!pp->delayd) { - dir_diff = pp->new_dir - pp->dir; - /* - * Allow for circle commands - */ - if (pp->new_dir >= 0 && pp->new_dir < MAXDIR) { - if (dir_diff > MAXDIR/2) - dir_diff -= MAXDIR; - else if (dir_diff < -(MAXDIR/2)) - dir_diff += MAXDIR; - } - if (dir_diff > 2) - dir_diff = 2; - else if (dir_diff < -2) - dir_diff = -2; - pp->dir += dir_diff; - if (pp->dir >= MAXDIR) - pp->dir -= MAXDIR; - else if (pp->dir < 0) - pp->dir += MAXDIR; - } - pp->xpos += displacement[pp->dir].dx; - pp->ypos += displacement[pp->dir].dy; - - if (pp->delayd && pp->xpos == sp->beacon[pp->delayd_no].x && - pp->ypos == sp->beacon[pp->delayd_no].y) { - pp->delayd = 0; - if (pp->status == S_UNMARKED) - pp->status = S_MARKED; - } - - switch (pp->dest_type) { - case T_AIRPORT: - if (pp->xpos == sp->airport[pp->dest_no].x && - pp->ypos == sp->airport[pp->dest_no].y && - pp->altitude == 0) { - if (pp->dir != sp->airport[pp->dest_no].dir) - loser(pp, "landed in the wrong direction."); - else { - pp->status = S_GONE; - continue; - } - } - break; - case T_EXIT: - if (pp->xpos == sp->exit[pp->dest_no].x && - pp->ypos == sp->exit[pp->dest_no].y) { - if (pp->altitude != 9) - loser(pp, "exited at the wrong altitude."); - else { - pp->status = S_GONE; - continue; - } - } - break; - default: - loser(pp, "has a bizarre destination, get help!"); - } - if (pp->altitude > 9) - /* "this is impossible" */ - loser(pp, "exceded flight ceiling."); - if (pp->altitude <= 0) { - for (i = 0; i < sp->num_airports; i++) - if (pp->xpos == sp->airport[i].x && - pp->ypos == sp->airport[i].y) { - if (pp->dest_type == T_AIRPORT) - loser(pp, - "landed at the wrong airport."); - else - loser(pp, - "landed instead of exited."); - } - loser(pp, "crashed on the ground."); - } - if (pp->xpos < 1 || pp->xpos >= sp->width - 1 || - pp->ypos < 1 || pp->ypos >= sp->height - 1) { - for (i = 0; i < sp->num_exits; i++) - if (pp->xpos == sp->exit[i].x && - pp->ypos == sp->exit[i].y) { - if (pp->dest_type == T_EXIT) - loser(pp, - "exited via the wrong exit."); - else - loser(pp, - "exited instead of landed."); - } - loser(pp, "illegally left the flight arena."); - } - } - - /* - * Traverse the list once, deleting the planes that are gone. - */ - for (pp = air.head; pp != NULL; pp = p2) { - p2 = pp->next; - if (pp->status == S_GONE) { - safe_planes++; - delete(&air, pp); - } - } - - draw_all(); - - for (p1 = air.head; p1 != NULL; p1 = p1->next) - for (p2 = p1->next; p2 != NULL; p2 = p2->next) - if (too_close(p1, p2, 1)) { - static char buf[80]; - - (void)sprintf(buf, "collided with plane '%c'.", - name(p2)); - loser(p1, buf); - } - /* - * Check every other update. Actually, only add on even updates. - * Otherwise, prop jobs show up *on* entrance. Remember that - * we don't update props on odd updates. - */ - if ((random() % sp->newplane_time) == 0) - addplane(); - -#ifdef BSD - sigsetmask(mask); -#endif -#ifdef SYSV - alarm(sp->update_secs); -#endif -} - -const char * -command(pp) - const PLANE *pp; -{ - static char buf[50], *bp, *comm_start; - char *index(); - - buf[0] = '\0'; - bp = buf; - (void)sprintf(bp, "%c%d%c%c%d: ", name(pp), pp->altitude, - (pp->fuel < LOWFUEL) ? '*' : ' ', - (pp->dest_type == T_AIRPORT) ? 'A' : 'E', pp->dest_no); - - comm_start = bp = index(buf, '\0'); - if (pp->altitude == 0) - (void)sprintf(bp, "Holding @ A%d", pp->orig_no); - else if (pp->new_dir >= MAXDIR || pp->new_dir < 0) - strcpy(bp, "Circle"); - else if (pp->new_dir != pp->dir) - (void)sprintf(bp, "%d", dir_deg(pp->new_dir)); - - bp = index(buf, '\0'); - if (pp->delayd) - (void)sprintf(bp, " @ B%d", pp->delayd_no); - - bp = index(buf, '\0'); - if (*comm_start == '\0' && - (pp->status == S_UNMARKED || pp->status == S_IGNORED)) - strcpy(bp, "---------"); - return (buf); -} - -/* char */ -char -name(p) - const PLANE *p; -{ - if (p->plane_type == 0) - return ('A' + p->plane_no); - else - return ('a' + p->plane_no); -} - -number(l) -{ - if (l < 'a' && l > 'z' && l < 'A' && l > 'Z') - return (-1); - else if (l >= 'a' && l <= 'z') - return (l - 'a'); - else - return (l - 'A'); -} - -next_plane() -{ - static int last_plane = -1; - PLANE *pp; - int found, start_plane = last_plane; - - do { - found = 0; - last_plane++; - if (last_plane >= 26) - last_plane = 0; - for (pp = air.head; pp != NULL; pp = pp->next) - if (pp->plane_no == last_plane) { - found++; - break; - } - if (!found) - for (pp = ground.head; pp != NULL; pp = pp->next) - if (pp->plane_no == last_plane) { - found++; - break; - } - } while (found && last_plane != start_plane); - if (last_plane == start_plane) - return (-1); - return (last_plane); -} - -addplane() -{ - PLANE p, *pp, *p1; - int i, num_starts, close, rnd, rnd2, pnum; - - bzero(&p, sizeof (p)); - - p.status = S_MARKED; - p.plane_type = random() % 2; - - num_starts = sp->num_exits + sp->num_airports; - rnd = random() % num_starts; - - if (rnd < sp->num_exits) { - p.dest_type = T_EXIT; - p.dest_no = rnd; - } else { - p.dest_type = T_AIRPORT; - p.dest_no = rnd - sp->num_exits; - } - - /* loop until we get a plane not near another */ - for (i = 0; i < num_starts; i++) { - /* loop till we get a different start point */ - while ((rnd2 = random() % num_starts) == rnd) - ; - if (rnd2 < sp->num_exits) { - p.orig_type = T_EXIT; - p.orig_no = rnd2; - p.xpos = sp->exit[rnd2].x; - p.ypos = sp->exit[rnd2].y; - p.new_dir = p.dir = sp->exit[rnd2].dir; - p.altitude = p.new_altitude = 7; - close = 0; - for (p1 = air.head; p1 != NULL; p1 = p1->next) - if (too_close(p1, &p, 4)) { - close++; - break; - } - if (close) - continue; - } else { - p.orig_type = T_AIRPORT; - p.orig_no = rnd2 - sp->num_exits; - p.xpos = sp->airport[p.orig_no].x; - p.ypos = sp->airport[p.orig_no].y; - p.new_dir = p.dir = sp->airport[p.orig_no].dir; - p.altitude = p.new_altitude = 0; - } - p.fuel = sp->width + sp->height; - break; - } - if (i >= num_starts) - return (-1); - pnum = next_plane(); - if (pnum < 0) - return (-1); - p.plane_no = pnum; - - pp = newplane(); - bcopy(&p, pp, sizeof (p)); - - if (pp->orig_type == T_AIRPORT) - append(&ground, pp); - else - append(&air, pp); - - return (pp->dest_type); -} - -PLANE * -findplane(n) - int n; -{ - PLANE *pp; - - for (pp = air.head; pp != NULL; pp = pp->next) - if (pp->plane_no == n) - return (pp); - for (pp = ground.head; pp != NULL; pp = pp->next) - if (pp->plane_no == n) - return (pp); - return (NULL); -} - -int -too_close(p1, p2, dist) - const PLANE *p1, *p2; - int dist; -{ - if (ABS(p1->altitude - p2->altitude) <= dist && - ABS(p1->xpos - p2->xpos) <= dist && ABS(p1->ypos - p2->ypos) <= dist) - return (1); - else - return (0); -} - -dir_deg(d) -{ - switch (d) { - case 0: return (0); - case 1: return (45); - case 2: return (90); - case 3: return (135); - case 4: return (180); - case 5: return (225); - case 6: return (270); - case 7: return (315); - default: - return (-1); - } -} diff --git a/games/backgammon/Makefile b/games/backgammon/Makefile deleted file mode 100644 index 5384677eb67d..000000000000 --- a/games/backgammon/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -# @(#)Makefile 8.1 (Berkeley) 5/31/93 - -SUBDIR= backgammon teachgammon - -.include diff --git a/games/backgammon/backgammon/Makefile b/games/backgammon/backgammon/Makefile deleted file mode 100644 index 8277c0939f32..000000000000 --- a/games/backgammon/backgammon/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -# @(#)Makefile 8.1 (Berkeley) 5/31/93 -# $FreeBSD$ - -PROG= backgammon -CFLAGS+=-DV7 -I${.CURDIR}/../common_source -SRCS= allow.c board.c check.c extra.c fancy.c init.c main.c move.c \ - odds.c one.c save.c subs.c table.c text.c version.c -MAN= backgammon.6 -DPADD= ${LIBTERMCAP} ${LIBCOMPAT} -LDADD= -ltermcap -lcompat -.PATH: ${.CURDIR}/../common_source -HIDEGAME=hidegame - -.include "../../Makefile.inc" -.include diff --git a/games/backgammon/backgammon/backgammon.6 b/games/backgammon/backgammon/backgammon.6 deleted file mode 100644 index 007c267de60e..000000000000 --- a/games/backgammon/backgammon/backgammon.6 +++ /dev/null @@ -1,198 +0,0 @@ -.\" Copyright (c) 1980, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" 3. All advertising materials mentioning features or use of this software -.\" must display the following acknowledgement: -.\" This product includes software developed by the University of -.\" California, Berkeley and its contributors. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" @(#)backgammon.6 8.1 (Berkeley) 5/31/93 -.\" $FreeBSD$ -.\" -.TH BACKGAMMON 6 "May 31, 1993" -.UC 5 -.SH NAME -backgammon \- the game of backgammon -.SH SYNOPSIS -.B backgammon -[ -h n r w b pr pw pb t\c -.I term -s\c -.I file -] -.SH DESCRIPTION -This program lets you play backgammon against the computer -or against a "friend". -All commands only are one letter, -so you don't need to type a carriage return, -except at the end of a move. -The program is mostly self documenting, -so that a question mark (?) will usually get some help. -If you answer `y' when the program asks if you want the rules, -you will get text explaining the rules of the game, -some hints on strategy, -instruction on how to use the program, -and a tutorial consisting of a practice game against the computer. -A description of how to use the program can be -obtained by answering `y' when it asks if you want instructions. -.PP -The possible arguments for backgammon -(most are unnecessary but some are very convenient) -consist of: -.ne 11 -.PP -.na -.TP 8 -.B -h -Get a description of possible arguments and exit -.TP 8 -.B -n -don't ask for rules or instructions -.TP 8 -.B -r -player is red (implies -n) -.TP 8 -.B -w -player is white (implies -n) -.TP 8 -.B -b -two players, red and white (implies -n) -.TP 8 -.B -pr -print the board before red's turn -.TP 8 -.B -pw -print the board before white's turn -.TP 8 -.B -pb -print the board before both player's turn -.TP 8 -.B -t\fIterm -terminal is type -.IR term , -uses /etc/termcap -.TP 8 -.B -s\fIfile -recover previously saved game from -.IR file . -.ad -.PP -.PP -If -.IR term -has capabilities for direct cursor movement (see -.IR termcap (5)) -.IR backgammon -``fixes'' the board after each move, -so the board does not need to be reprinted, -unless the screen suffers some horrendous malady. -Also, any `-p' option will be ignored. -(The `-t' option is not necessary unless the terminal type does not match -the entry in the /etc/termcap data base.) -.SH QUICK\ REFERENCE -When the program prompts by typing only your color, -type a space or carriage return to roll, or -.ne 5 -.PP -.na -.TP 8 -.B d -to double -.TP 8 -.B p -to print the board -.TP 8 -.B q -to quit -.TP 8 -.B s -to save the game for later -.PP -.ad -When the program prompts with 'Move:', type -.ne 4 -.PP -.na -.TP 8 -.B p -to print the board -.TP 8 -.B q -to quit -.TP 8 -.B s -to save the game -.ad -.PP -or a -.IR move , -which is a sequence of -.ne 4 -.PP -.na -.TP 8 -.B s-f -move from -.BR s -to -.BR f -.TP 8 -.B s/r -move one man on -.BR s -the roll -.BR r -.ad -.PP -separated by commas or spaces and ending with a newline. -Available abbreviations are -.ne 4 -.PP -.na -.TP 10 -.B s-f1-f2 -means -.BR s-f1,f1-f2 -.TP 10 -.B s/r1r2 -means -.BR s/r1,s/r2 -.ad -.PP -Use `b' for bar and `h' for home, -or 0 or 25 as appropriate. -.SH AUTHOR -Alan Char -.SH FILES -.TP 25 -/usr/games/teachgammon -\- rules and tutorial -.br -.TP 25 -/etc/termcap -\- terminal capabilities -.SH BUGS -The program's strategy needs much work. diff --git a/games/backgammon/backgammon/extra.c b/games/backgammon/backgammon/extra.c deleted file mode 100644 index 0b2406e01b05..000000000000 --- a/games/backgammon/backgammon/extra.c +++ /dev/null @@ -1,257 +0,0 @@ -/* - * Copyright (c) 1980, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)extra.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include "back.h" - -#ifdef DEBUG -#include -FILE *trace; -#endif - -/* - * dble() - * Have the current player double and ask opponent to accept. - */ - -dble () { - int resp; /* response to y/n */ - - for (;;) { - writel (" doubles."); /* indicate double */ - - if (cturn == -pnum) { /* see if computer accepts */ - if (dblgood()) { /* guess not */ - writel (" Declined.\n"); - nexturn(); - cturn *= -2; /* indicate loss */ - return; - } else { /* computer accepts */ - writel (" Accepted.\n"); - gvalue *= 2; /* double game value */ - dlast = cturn; - if (tflag) - gwrite(); - return; - } - } - - /* ask if player accepts */ - writel (" Does "); - writel (cturn == 1? color[2]: color[3]); - writel (" accept?"); - - /* get response from yorn, - * a "2" means he said "p" - * for print board. */ - if ((resp = yorn ('R')) == 2) { - writel (" Reprint.\n"); - buflush(); - wrboard(); - writel (*Colorptr); - continue; - } - - /* check response */ - if (resp) { - /* accepted */ - gvalue *= 2; - dlast = cturn; - if (tflag) - gwrite(); - return; - } - - nexturn (); /* declined */ - cturn *= -2; - return; - } -} - -/* - * dblgood () - * Returns 1 if the computer would double in this position. This - * is not an exact science. The computer will decline a double that he - * would have made. Accumulated judgments are kept in the variable n, - * which is in "pips", i.e., the position of each man summed over all - * men, with opponent's totals negative. Thus, n should have a positive - * value of 7 for each move ahead, or a negative value of 7 for each one - * behind. - */ - -dblgood () { - int n; /* accumulated judgment */ - int OFFC = *offptr; /* no. of computer's men off */ - int OFFO = *offopp; /* no. of player's men off */ - -#ifdef DEBUG - int i; - if (trace == NULL) - trace = fopen ("bgtrace","w"); -#endif - - /* get real pip value */ - n = eval()*cturn; -#ifdef DEBUG - fputs ("\nDoubles:\nBoard: ",trace); - for (i = 0; i < 26; i++) - fprintf (trace," %d",board[i]); - fprintf (trace,"\n\tpip = %d, ",n); -#endif - - /* below adjusts pip value - * according to position - * judgments */ - - /* check men moving off - * board */ - if (OFFC > -15 || OFFO > -15) { - if (OFFC < 0 && OFFO < 0) { - OFFC += 15; - OFFO += 15; - n +=((OFFC-OFFO)*7)/2; - } else if (OFFC < 0) { - OFFC += 15; - n -= OFFO*7/2; - } else if (OFFO < 0) { - OFFO += 15; - n += OFFC*7/2; - } - if (OFFC < 8 && OFFO > 8) - n -= 7; - if (OFFC < 10 && OFFO > 10) - n -= 7; - if (OFFC < 12 && OFFO > 12) - n -= 7; - if (OFFO < 8 && OFFC > 8) - n += 7; - if (OFFO < 10 && OFFC > 10) - n += 7; - if (OFFO < 12 && OFFC > 12) - n += 7; - n += ((OFFC-OFFO)*7)/2; - } - -#ifdef DEBUG - fprintf (trace,"off = %d, ",n); -#endif - - /* see if men are trapped */ - n -= freemen(bar); - n += freemen(home); - n += trapped(home,-cturn); - n -= trapped(bar,cturn); - -#ifdef DEBUG - fprintf (trace,"free = %d\n",n); - fprintf (trace,"\tOFFC = %d, OFFO = %d\n",OFFC,OFFO); - fflush (trace); -#endif - - /* double if 2-3 moves ahead */ - if (n > 10+rnum(7)) - return(1); - return (0); -} - -freemen (b) -int b; - -{ - int i, inc, lim; - - odds(0,0,0); - if (board[b] == 0) - return (0); - inc = (b == 0? 1: -1); - lim = (b == 0? 7: 18); - for (i = b+inc; i != lim; i += inc) - if (board[i]*inc < -1) - odds(abs(b-i),0,abs(board[b])); - if (abs(board[b]) == 1) - return ((36-count())/5); - return (count()/5); -} - -trapped (n,inc) -int n, inc; - -{ - int i, j, k; - int c, l, ct; - - ct = 0; - l = n+7*inc; - for (i = n+inc; i != l; i += inc) { - odds (0,0,0); - c = abs(i-l); - if (board[i]*inc > 0) { - for (j = c; j < 13; j++) - if (board[i+inc*j]*inc < -1) { - if (j < 7) - odds (j,0,1); - for (k = 1; k < 7 && k < j; k++) - if (j-k < 7) - odds (k,j-k,1); - } - ct += abs(board[i])*(36-count()); - } - } - return (ct/5); -} - -eval () { - - int i, j; - - for (j = i = 0; i < 26; i++) - j += (board[i] >= 0 ? i*board[i] : (25-i)*board[i]); - - if (off[1] >= 0) - j += 25*off[1]; - else - j += 25*(off[1]+15); - - if (off[0] >= 0) - j -= 25*off[0]; - else - j -= 25*(off[0]+15); - return (j); -} diff --git a/games/backgammon/backgammon/main.c b/games/backgammon/backgammon/main.c deleted file mode 100644 index fc2110f57b01..000000000000 --- a/games/backgammon/backgammon/main.c +++ /dev/null @@ -1,571 +0,0 @@ -/* - * Copyright (c) 1980, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -static const char copyright[] = -"@(#) Copyright (c) 1980, 1993\n\ - The Regents of the University of California. All rights reserved.\n"; -#endif /* not lint */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include -#include -#include -#include -#include -#include -#include "back.h" - -#define MVPAUSE 5 /* time to sleep when stuck */ -#define MAXUSERS 35 /* maximum number of users */ - -extern const char *const instr[]; /* text of instructions */ -extern const char *const message[]; /* update message */ - -const char *helpm[] = { /* help message */ - "Enter a space or newline to roll, or", - " R to reprint the board\tD to double", - " S to save the game\tQ to quit", - 0 -}; - -const char *contin[] = { /* pause message */ - "(Type a newline to continue.)", - "", - 0 -}; - -static const char rules[] = "\nDo you want the rules of the game?"; -static const char noteach[] = "Teachgammon not available!\n\007"; -static const char need[] = "Do you need instructions for this program?"; -static const char askcol[] = - "Enter 'r' to play red, 'w' to play white, 'b' to play both:"; -static const char rollr[] = "Red rolls a "; -static const char rollw[] = ". White rolls a "; -static const char rstart[] = ". Red starts.\n"; -static const char wstart[] = ". White starts.\n"; -static const char toobad1[] = "Too bad, "; -static const char unable[] = " is unable to use that roll.\n"; -static const char toobad2[] = ". Too bad, "; -static const char cantmv[] = " can't move.\n"; -static const char bgammon[] = "Backgammon! "; -static const char gammon[] = "Gammon! "; -static const char again[] = ".\nWould you like to play again?"; -static const char svpromt[] = "Would you like to save this game?"; - -static const char password[] = "losfurng"; -static char pbuf[10]; - -main (argc,argv) -int argc; -char **argv; - -{ - int i; /* non-descript index */ - int l; /* non-descript index */ - char c; /* non-descript character storage */ - - /* revoke privs */ - setgid(getgid()); - - /* initialization */ - bflag = 2; /* default no board */ - acnt = 1; /* Nuber of args */ - signal (SIGINT,getout); /* trap interrupts */ - if (gtty (0,&tty) == -1) /* get old tty mode */ - errexit ("backgammon(gtty)"); - old = tty.sg_flags; -#ifdef V7 - raw = ((noech = old & ~ECHO) | CBREAK); /* set up modes */ -#else - raw = ((noech = old & ~ECHO) | RAW); /* set up modes */ -#endif - ospeed = tty.sg_ospeed; /* for termlib */ - - /* get terminal - * capabilities, and - * decide if it can - * cursor address */ - tflag = getcaps (getenv ("TERM")); - /* use whole screen - * for text */ - if (tflag) - begscr = 0; - srandomdev(); - - getarg (argc, argv); - args[acnt] = NULL; - if (tflag) { /* clear screen */ - noech &= ~(CRMOD|XTABS); - raw &= ~(CRMOD|XTABS); - clear(); - } - fixtty (raw); /* go into raw mode */ - - /* check if restored - * game and save flag - * for later */ - if (rfl = rflag) { - text (message); /* print message */ - text (contin); - wrboard(); /* print board */ - /* if new game, pretend - * to be a non-restored - * game */ - if (cturn == 0) - rflag = 0; - } else { - rscore = wscore = 0; /* zero score */ - text (message); /* update message - * without pausing */ - - if (aflag) { /* print rules */ - writel (rules); - if (yorn(0)) { - - fixtty (old); /* restore tty */ - args[0] = strdup ("teachgammon"); - execv (TEACH,args); - - tflag = 0; /* error! */ - writel (noteach); - exit(1); - } else { /* if not rules, then - * instructions */ - writel (need); - if (yorn(0)) { /* print instructions */ - clear(); - text (instr); - } - } - } - - for (i = 0; i < acnt; i++) - free (args[i]); - - init(); /* initialize board */ - - if (pnum == 2) { /* ask for color(s) */ - writec ('\n'); - writel (askcol); - while (pnum == 2) { - c = readc(); - switch (c) { - - case 'R': /* red */ - pnum = -1; - break; - - case 'W': /* white */ - pnum = 1; - break; - - case 'B': /* both */ - pnum = 0; - break; - - case 'P': - if (iroll) - break; - if (tflag) - curmove (curr,0); - else - writec ('\n'); - writel ("Password:"); - signal (SIGALRM,getout); - cflag = 1; - alarm (10); - for (i = 0; i < 10; i++) { - pbuf[i] = readc(); - if (pbuf[i] == '\n') - break; - } - if (i == 10) - while (readc() != '\n'); - alarm (0); - cflag = 0; - if (i < 10) - pbuf[i] = '\0'; - for (i = 0; i < 9; i++) - if (pbuf[i] != password[i]) - getout(); - iroll = 1; - if (tflag) - curmove (curr,0); - else - writec ('\n'); - writel (askcol); - break; - - default: /* error */ - writec ('\007'); - } - } - } else if (!aflag) - /* pause to read - * message */ - text (contin); - - wrboard(); /* print board */ - - if (tflag) - curmove (18,0); - else - writec ('\n'); - } - /* limit text to bottom - * of screen */ - if (tflag) - begscr = 17; - - for (;;) { /* begin game! */ - /* initial roll if - * needed */ - if ((! rflag) || raflag) - roll(); - - /* perform ritual of - * first roll */ - if (! rflag) { - if (tflag) - curmove (17,0); - while (D0 == D1) /* no doubles */ - roll(); - - /* print rolls */ - writel (rollr); - writec (D0+'0'); - writel (rollw); - writec (D1+'0'); - - /* winner goes first */ - if (D0 > D1) { - writel (rstart); - cturn = 1; - } else { - writel (wstart); - cturn = -1; - } - } - - /* initalize variables - * according to whose - * turn it is */ - - if (cturn == 1) { /* red */ - home = 25; - bar = 0; - inptr = &in[1]; - inopp = &in[0]; - offptr = &off[1]; - offopp = &off[0]; - Colorptr = &color[1]; - colorptr = &color[3]; - colen = 3; - } else { /* white */ - home = 0; - bar = 25; - inptr = &in[0]; - inopp = &in[1]; - offptr = &off[0]; - offopp = &off[1]; - Colorptr = &color[0]; - colorptr = &color[2]; - colen = 5; - } - - /* do first move - * (special case) */ - if (! (rflag && raflag)) { - if (cturn == pnum) /* computer's move */ - move (0); - else { /* player's move */ - mvlim = movallow(); - /* reprint roll */ - if (tflag) - curmove (cturn == -1? 18: 19,0); - proll(); - getmove(); /* get player's move */ - } - } - if (tflag) { - curmove (17,0); - cline(); - begscr = 18; - } - - /* no longer any diff- - * erence between normal - * game and recovered - * game. */ - rflag = 0; - - /* move as long as it's - * someone's turn */ - while (cturn == 1 || cturn == -1) { - - /* board maintainence */ - if (tflag) - refresh(); /* fix board */ - else - /* redo board if -p */ - if (cturn == bflag || bflag == 0) - wrboard(); - - /* do computer's move */ - if (cturn == pnum) { - move (1); - - /* see if double - * refused */ - if (cturn == -2 || cturn == 2) - break; - - /* check for winning - * move */ - if (*offopp == 15) { - cturn *= -2; - break; - } - continue; - - } - - /* (player's move) */ - - /* clean screen if - * safe */ - if (tflag && hflag) { - curmove (20,0); - clend (); - hflag = 1; - } - - /* if allowed, give him - * a chance to double */ - if (dlast != cturn && gvalue < 64) { - if (tflag) - curmove (cturn == -1? 18: 19,0); - writel (*Colorptr); - c = readc(); - - /* character cases */ - switch (c) { - - /* reprint board */ - case 'R': - wrboard(); - break; - - /* save game */ - case 'S': - raflag = 1; - save (1); - break; - - /* quit */ - case 'Q': - quit(); - break; - - /* double */ - case 'D': - dble(); - break; - - /* roll */ - case ' ': - case '\n': - roll(); - writel (" rolls "); - writec (D0+'0'); - writec (' '); - writec (D1+'0'); - writel (". "); - - /* see if he can move */ - if ( (mvlim = movallow()) == 0) { - - /* can't move */ - writel (toobad1); - writel (*colorptr); - writel (unable); - if (tflag) { - if (pnum) { - buflush(); - sleep (MVPAUSE); - } - } - nexturn(); - break; - } - - /* get move */ - getmove(); - - /* okay to clean - * screen */ - hflag = 1; - break; - - /* invalid character */ - default: - - /* print help message */ - if (tflag) - curmove (20,0); - else - writec ('\n'); - text (helpm); - if (tflag) - curmove (cturn == -1? 18: 19,0); - else - writec ('\n'); - - /* don't erase */ - hflag = 0; - } - } else { /* couldn't double */ - - /* print roll */ - roll(); - if (tflag) - curmove (cturn == -1? 18: 19,0); - proll (); - - /* can he move? */ - if ((mvlim = movallow()) == 0) { - - /* he can't */ - writel (toobad2); - writel (*colorptr); - writel (cantmv); - buflush(); - sleep (MVPAUSE); - nexturn(); - continue; - } - - /* get move */ - getmove(); - } - } - - /* don't worry about who - * won if quit */ - if (cturn == 0) - break; - - /* fix cturn = winner */ - cturn /= -2; - - /* final board pos. */ - if (tflag) - refresh(); - - /* backgammon? */ - mflag = 0; - l = bar+7*cturn; - for (i = bar; i != l; i += cturn) - if (board[i]*cturn) mflag++; - - /* compute game value */ - if (tflag) - curmove (20,0); - if (*offopp == 15) { - if (mflag) { - writel (bgammon); - gvalue *= 3; - } - else if (*offptr <= 0) { - writel (gammon); - gvalue *= 2; - } - } - - /* report situation */ - if (cturn == -1) { - writel ("Red wins "); - rscore += gvalue; - } else { - writel ("White wins "); - wscore += gvalue; - } - wrint (gvalue); - writel (" point"); - if (gvalue > 1) - writec ('s'); - writel (".\n"); - - /* write score */ - wrscore(); - - /* see if he wants - * another game */ - writel (again); - if ((i = yorn ('S')) == 0) - break; - - init(); - if (i == 2) { - writel (" Save.\n"); - cturn = 0; - save (0); - } - - /* yes, reset game */ - wrboard(); - } - - /* give him a chance to save if game was recovered */ - if (rfl && cturn) { - writel (svpromt); - if (yorn (0)) { - /* re-initialize for - * recovery */ - init(); - cturn = 0; - save(0); - } - } - - /* leave peacefully */ - getout (); -} diff --git a/games/backgammon/backgammon/move.c b/games/backgammon/backgammon/move.c deleted file mode 100644 index 8b85dad1f27e..000000000000 --- a/games/backgammon/backgammon/move.c +++ /dev/null @@ -1,556 +0,0 @@ -/* - * Copyright (c) 1980, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)move.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include -#include "back.h" - -#ifdef DEBUG -#include -FILE *trace; -static char tests[20]; -#endif - -struct BOARD { /* structure of game position */ - int b_board[26]; /* board position */ - int b_in[2]; /* men in */ - int b_off[2]; /* men off */ - int b_st[4], b_fn[4]; /* moves */ - - struct BOARD *b_next; /* forward queue pointer */ -}; - -struct BOARD *freeq = 0; -struct BOARD *checkq = 0; -struct BOARD *bsave(); -struct BOARD *nextfree(); - - /* these variables are values for the - * candidate move */ -static int ch; /* chance of being hit */ -static int op; /* computer's open men */ -static int pt; /* comp's protected points */ -static int em; /* farthest man back */ -static int frc; /* chance to free comp's men */ -static int frp; /* chance to free pl's men */ - - /* these values are the values for the - * move chosen (so far) */ -static int chance; /* chance of being hit */ -static int openmen; /* computer's open men */ -static int points; /* comp's protected points */ -static int endman; /* farthest man back */ -static int barmen; /* men on bar */ -static int menin; /* men in inner table */ -static int menoff; /* men off board */ -static int oldfrc; /* chance to free comp's men */ -static int oldfrp; /* chance to free pl's men */ - -static int cp[5]; /* candidate start position */ -static int cg[5]; /* candidate finish position */ - -static int race; /* game reduced to a race */ - -move (okay) -int okay; /* zero if first move */ -{ - int i; /* index */ - int l; /* last man */ - - if (okay) { - /* see if comp should double */ - if (gvalue < 64 && dlast != cturn && dblgood()) { - writel (*Colorptr); - dble(); /* double */ - /* return if declined */ - if (cturn != 1 && cturn != -1) - return; - } - roll(); - } - - race = 0; - for (i = 0; i < 26; i++) { - if (board[i] < 0) - l = i; - } - for (i = 0; i < l; i++) { - if (board[i] > 0) - break; - } - if (i == l) - race = 1; - - /* print roll */ - if (tflag) - curmove (cturn == -1? 18: 19,0); - writel (*Colorptr); - writel (" rolls "); - writec (D0+'0'); - writec (' '); - writec (D1+'0'); - /* make tty interruptable - * while thinking */ - if (tflag) - cline(); - fixtty (noech); - - /* find out how many moves */ - mvlim = movallow(); - if (mvlim == 0) { - writel (" but cannot use it.\n"); - nexturn(); - fixtty (raw); - return; - } - - /* initialize */ - for (i = 0; i < 4; i++) - cp[i] = cg[i] = 0; - - /* strategize */ - trymove (0,0); - pickmove(); - - /* print move */ - writel (" and moves "); - for (i = 0; i < mvlim; i++) { - if (i > 0) - writec (','); - wrint (p[i] = cp[i]); - writec ('-'); - wrint (g[i] = cg[i]); - makmove (i); - } - writec ('.'); - - /* print blots hit */ - if (tflag) - curmove (20,0); - else - writec ('\n'); - for (i = 0; i < mvlim; i++) - if (h[i]) - wrhit(g[i]); - /* get ready for next move */ - nexturn(); - if (!okay) { - buflush(); - sleep (3); - } - fixtty (raw); /* no more tty interrupt */ -} - -trymove (mvnum,swapped) -int mvnum; /* number of move (rel zero) */ -int swapped; /* see if swapped also tested */ - -{ - int pos; /* position on board */ - int rval; /* value of roll */ - - /* if recursed through all dice - * values, compare move */ - if (mvnum == mvlim) { - binsert (bsave()); - return; - } - - /* make sure dice in always - * same order */ - if (d0 == swapped) - swap; - /* choose value for this move */ - rval = dice[mvnum != 0]; - - /* find all legitimate moves */ - for (pos = bar; pos != home; pos += cturn) { - /* fix order of dice */ - if (d0 == swapped) - swap; - /* break if stuck on bar */ - if (board[bar] != 0 && pos != bar) - break; - /* on to next if not occupied */ - if (board[pos]*cturn <= 0) - continue; - /* set up arrays for move */ - p[mvnum] = pos; - g[mvnum] = pos+rval*cturn; - if (g[mvnum]*cturn >= home) { - if (*offptr < 0) - break; - g[mvnum] = home; - } - /* try to move */ - if (makmove (mvnum)) - continue; - else - trymove (mvnum+1,2); - /* undo move to try another */ - backone (mvnum); - } - - /* swap dice and try again */ - if ((!swapped) && D0 != D1) - trymove (0,1); -} - -struct BOARD * -bsave () { - int i; /* index */ - struct BOARD *now; /* current position */ - - now = nextfree (); /* get free BOARD */ - - /* store position */ - for (i = 0; i < 26; i++) - now->b_board[i] = board[i]; - now->b_in[0] = in[0]; - now->b_in[1] = in[1]; - now->b_off[0] = off[0]; - now->b_off[1] = off[1]; - for (i = 0; i < mvlim; i++) { - now->b_st[i] = p[i]; - now->b_fn[i] = g[i]; - } - return (now); -} - -binsert (new) -struct BOARD *new; /* item to insert */ -{ - struct BOARD *p = checkq; /* queue pointer */ - int result; /* comparison result */ - - if (p == 0) { /* check if queue empty */ - checkq = p = new; - p->b_next = 0; - return; - } - - result = bcomp (new,p); /* compare to first element */ - if (result < 0) { /* insert in front */ - new->b_next = p; - checkq = new; - return; - } - if (result == 0) { /* duplicate entry */ - mvcheck (p,new); - makefree (new); - return; - } - - while (p->b_next != 0) { /* traverse queue */ - result = bcomp (new,p->b_next); - if (result < 0) { /* found place */ - new->b_next = p->b_next; - p->b_next = new; - return; - } - if (result == 0) { /* duplicate entry */ - mvcheck (p->b_next,new); - makefree (new); - return; - } - p = p->b_next; - } - /* place at end of queue */ - p->b_next = new; - new->b_next = 0; -} - -bcomp (a,b) -struct BOARD *a; -struct BOARD *b; -{ - int *aloc = a->b_board; /* pointer to board a */ - int *bloc = b->b_board; /* pointer to board b */ - int i; /* index */ - int result; /* comparison result */ - - for (i = 0; i < 26; i++) { /* compare boards */ - result = cturn*(aloc[i]-bloc[i]); - if (result) - return (result); /* found inequality */ - } - return (0); /* same position */ -} - -mvcheck (incumbent,candidate) -struct BOARD *incumbent; -struct BOARD *candidate; -{ - int i; - int result; - - for (i = 0; i < mvlim; i++) { - result = cturn*(candidate->b_st[i]-incumbent->b_st[i]); - if (result > 0) - return; - if (result < 0) - break; - } - if (i == mvlim) - return; - for (i = 0; i < mvlim; i++) { - incumbent->b_st[i] = candidate->b_st[i]; - incumbent->b_fn[i] = candidate->b_fn[i]; - } -} - -makefree (dead) -struct BOARD *dead; /* dead position */ -{ - dead->b_next = freeq; /* add to freeq */ - freeq = dead; -} - -struct BOARD * -nextfree () { - struct BOARD *new; - - if (freeq == 0) { - new = (struct BOARD *)calloc (1,sizeof (struct BOARD)); - if (new == 0) { - writel ("\nOut of memory\n"); - getout(); - } - new->b_next = 0; - } else { - new = freeq; - freeq = freeq->b_next; - } - return (new); -} - -pickmove () { - /* current game position */ - struct BOARD *now = bsave(); - struct BOARD *next; /* next move */ - -#ifdef DEBUG - if (trace == NULL) - trace = fopen ("bgtrace","w"); - fprintf (trace,"\nRoll: %d %d%s\n",D0,D1,race? " (race)": ""); - fflush (trace); -#endif - do { /* compare moves */ - boardcopy (checkq); - next = checkq->b_next; - makefree (checkq); - checkq = next; - movcmp(); - } while (checkq != 0); - - boardcopy (now); -} - -boardcopy (s) -struct BOARD *s; /* game situation */ -{ - int i; /* index */ - - for (i = 0; i < 26; i++) - board[i] = s->b_board[i]; - for (i = 0; i < 2; i++) { - in[i] = s->b_in[i]; - off[i] = s->b_off[i]; - } - for (i = 0; i < mvlim; i++) { - p[i] = s->b_st[i]; - g[i] = s->b_fn[i]; - } -} - -movcmp () { - int i; - int c; - -#ifdef DEBUG - if (trace == NULL) - trace = fopen ("bgtrace","w"); -#endif - - odds (0,0,0); - if (!race) { - ch = op = pt = 0; - for (i = 1; i < 25; i++) { - if (board[i] == cturn) - ch = canhit (i,1); - op += abs (bar-i); - } - for (i = bar+cturn; i != home; i += cturn) - if (board[i]*cturn > 1) - pt += abs(bar-i); - frc = freemen (bar)+trapped (bar,cturn); - frp = freemen (home)+trapped (home,-cturn); - } - for (em = bar; em != home; em += cturn) - if (board[em]*cturn > 0) - break; - em = abs(home-em); -#ifdef DEBUG - fputs ("Board: ",trace); - for (i = 0; i < 26; i++) - fprintf (trace, " %d",board[i]); - if (race) - fprintf (trace,"\n\tem = %d\n",em); - else - fprintf (trace, - "\n\tch = %d, pt = %d, em = %d, frc = %d, frp = %d\n", - ch,pt,em,frc,frp); - fputs ("\tMove: ",trace); - for (i = 0; i < mvlim; i++) - fprintf (trace," %d-%d",p[i],g[i]); - fputs ("\n",trace); - fflush (trace); - strcpy (tests,""); -#endif - if ((cp[0] == 0 && cg[0] == 0) || movegood()) { -#ifdef DEBUG - fprintf (trace,"\t[%s] ... wins.\n",tests); - fflush (trace); -#endif - for (i = 0; i < mvlim; i++) { - cp[i] = p[i]; - cg[i] = g[i]; - } - if (!race) { - chance = ch; - openmen = op; - points = pt; - endman = em; - barmen = abs(board[home]); - oldfrc = frc; - oldfrp = frp; - } - menin = *inptr; - menoff = *offptr; - } -#ifdef DEBUG - else { - fprintf (trace,"\t[%s] ... loses.\n",tests); - fflush (trace); - } -#endif -} - -movegood () { - int n; - - if (*offptr == 15) - return (1); - if (menoff == 15) - return (0); - if (race) { -#ifdef DEBUG - strcat (tests,"o"); -#endif - if (*offptr-menoff) - return (*offptr > menoff); -#ifdef DEBUG - strcat (tests,"e"); -#endif - if (endman-em) - return (endman > em); -#ifdef DEBUG - strcat (tests,"i"); -#endif - if (menin == 15) - return (0); - if (*inptr == 15) - return (1); -#ifdef DEBUG - strcat (tests,"i"); -#endif - if (*inptr-menin) - return (*inptr > menin); - return (rnum(2)); - } else { - n = barmen-abs(board[home]); -#ifdef DEBUG - strcat (tests,"c"); -#endif - if (abs(chance-ch)+25*n > rnum(150)) - return (n? (n < 0): (ch < chance)); -#ifdef DEBUG - strcat (tests,"o"); -#endif - if (*offptr-menoff) - return (*offptr > menoff); -#ifdef DEBUG - strcat (tests,"o"); -#endif - if (abs(openmen-op) > 7+rnum(12)) - return (openmen > op); -#ifdef DEBUG - strcat (tests,"b"); -#endif - if (n) - return (n < 0); -#ifdef DEBUG - strcat (tests,"e"); -#endif - if (abs(endman-em) > rnum(2)) - return (endman > em); -#ifdef DEBUG - strcat (tests,"f"); -#endif - if (abs(frc-oldfrc) > rnum(2)) - return (frc < oldfrc); -#ifdef DEBUG - strcat (tests,"p"); -#endif - if (abs(n = pt-points) > rnum(4)) - return (n > 0); -#ifdef DEBUG - strcat (tests,"i"); -#endif - if (*inptr-menin) - return (*inptr > menin); -#ifdef DEBUG - strcat (tests,"f"); -#endif - if (abs(frp-oldfrp) > rnum(2)) - return (frp > oldfrp); - return (rnum(2)); - } -} diff --git a/games/backgammon/backgammon/text.c b/games/backgammon/backgammon/text.c deleted file mode 100644 index 740367c6006d..000000000000 --- a/games/backgammon/backgammon/text.c +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 1980, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)text.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include "back.h" - -const char *const instr[] = { - " If you did not notice by now, this program reacts to things as", - "soon as you type them, without waiting for a newline. This means that", - "the special characters RUBOUT, ESC, and CONTROL-D, will not perform", - "their special functions during most of this program. The program", - "should usually stop when a RUBOUT is typed, but occasionally it will", - "ignore RUBOUTs until it is waiting for input.\n", - " These instructions are presented in small chunks designed not to", - "roll off the top of your screen. When the characters '-->' are print-", - "ed, no more data will be printed until a space or newline is typed.", - "In this way, you can finish one section before continuing to another.", - "Like this:", - "", - " The two sides are colored 'red' and 'white.' The computer may play", - "one side, or if there are two players, the computer can merely act as", - "a gamekeeper, letting the players make the moves. Once you tell the", - "computer what color(s) you want to play, the decision remains in ef-", - "fect until you quit the program, even if you play more than one game,", - "since the program keeps a running score.\n", - " The program will prompt for a move in one of two ways. If the", - "player has the opportunity to double, then merely his color will be", - "typed out. The player can now do one of several things. He can dou-", - "ble by typing a 'd', he can roll by typing a space (' ') or newline,", - "or if he is not sure, he can reprint the board by typing a 'r'.\n", - " If the player cannot double, his roll will be thrust in front of", - "him, followed by the request 'Move:', asking for a move but not giving", - "him the chance to double. He can still ask for the board by typing", - "'r'. In either of these two states, the player can quit by typing 'q'", - "or save the game by typing 's'. In either case, the player will be", - "asked to verify, in case there was some error. The program then ends", - "immediately, after first saving the file if so requested.", - "", - " A player can move one of his men using two forms of input. The", - "first form is -, where is the starting position, and is", - "the finishing position of the player's man. For example, if white", - "wanted to move a piece from position 13 to position 8, his move could", - "be entered as 13-8. The second form is / where is the", - "starting position, an is the roll actually made. Hence, white", - "could have entered as 13/5 instead of 13-8.\n", - " A player must move each roll of the dice separately. For example,", - "if a player rolled 4 3, and wanted to move from 13 to 6, he could", - "enter it as 13/4,9/3 or 13/3,10/4 or 13-10,10-6 or 13-9,9-6, but not", - "13-6. The last two entries can be shortened to 13-10-6 and 13-9-6.", - "If you want to move more than one piece from the same position, such", - "as 13-10,13-9, you can abbreviate this using the / format as by", - "entering more than one , or 13/34. A player can use both forms for", - "the same roll, e.g. 13/3,13-9, and separates individual moves by ei-", - "ther a comma or a space. The letter 'b' represents the bar, and the", - "letter 'h' represents a player's home. You could also enter the", - "number that would be in the position of the bar, 25 or 0 as appropri-", - "ate. Use a newline at the end of your moves for a turn.", - "", - " As you type in your move, if a character does not make sense under", - "the above constrictions, a bell will sound instead of the character,", - "and it will be ignored. You may kill lines and erase characters as", - "you would normally, but don't be surprised if they look different than", - "usual. Also, if you have entered one or more of your rolls, and you", - "wish to see what the move looks like so far, type a 'r' to see what it", - "looks like. This cannot be done in the middle of a move (e.g., after", - "a '-' or '/'). After the printing board, the program will go back to", - "inputting your move and you can backspace or kill just as if you had", - "just typed in your input.\n", - " Now you should be ready to begin the game. Good luck!", - "", - 0}; - - -int -text (t) -const char *const *t; - -{ - int i; - const char *s, *a; - - fixtty (noech); - while (*t != 0) { - s = a = *t; - for (i = 0; *a != '\0'; i--) - a++; - if (i) { - writel (s); - writec ('\n'); - } else { - writel ("-->"); - fixtty (raw); - while ((i = readc()) != ' ' && i != '\n'); - fixtty (noech); - clear(); - } - t++; - } - fixtty (raw); -} diff --git a/games/backgammon/backgammon/version.c b/games/backgammon/backgammon/version.c deleted file mode 100644 index 12016e0f64d6..000000000000 --- a/games/backgammon/backgammon/version.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 1980, 1987, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)version.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -const char *const message[] = { - "Last updated on Saturday, January 11, 1986.", - 0 -}; diff --git a/games/backgammon/common_source/allow.c b/games/backgammon/common_source/allow.c deleted file mode 100644 index 7c9f593b267f..000000000000 --- a/games/backgammon/common_source/allow.c +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (c) 1980, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)allow.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include "back.h" - -movallow () { - - int i, m, iold; - int r; - - if (d0) - swap; - m = (D0 == D1? 4: 2); - for (i = 0; i < 4; i++) - p[i] = bar; - i = iold = 0; - while (i < m) { - if (*offptr == 15) - break; - h[i] = 0; - if (board[bar]) { - if (i == 1 || m == 4) - g[i] = bar+cturn*D1; - else - g[i] = bar+cturn*D0; - if (r = makmove(i)) { - if (d0 || m == 4) - break; - swap; - movback (i); - if (i > iold) - iold = i; - for (i = 0; i < 4; i++) - p[i] = bar; - i = 0; - } else - i++; - continue; - } - if ((p[i] += cturn) == home) { - if (i > iold) - iold = i; - if (m == 2 && i) { - movback(i); - p[i--] = bar; - if (p[i] != bar) - continue; - else - break; - } - if (d0 || m == 4) - break; - swap; - movback (i); - for (i = 0; i < 4; i++) - p[i] = bar; - i = 0; - continue; - } - if (i == 1 || m == 4) - g[i] = p[i]+cturn*D1; - else - g[i] = p[i]+cturn*D0; - if (g[i]*cturn > home) { - if (*offptr >= 0) - g[i] = home; - else - continue; - } - if (board[p[i]]*cturn > 0 && (r = makmove(i)) == 0) - i++; - } - movback (i); - return (iold > i? iold: i); -} diff --git a/games/backgammon/common_source/back.h b/games/backgammon/common_source/back.h deleted file mode 100644 index 88ca9333178b..000000000000 --- a/games/backgammon/common_source/back.h +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (c) 1980, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)back.h 8.1 (Berkeley) 5/31/93 - */ - -#include - -#define rnum(r) (random()%r) -#define D0 dice[0] -#define D1 dice[1] -#define swap {D0 ^= D1; D1 ^= D0; D0 ^= D1; d0 = 1-d0;} - -/* - * - * Some numerical conventions: - * - * Arrays have white's value in [0], red in [1]. - * Numeric values which are one color or the other use - * -1 for white, 1 for red. - * Hence, white will be negative values, red positive one. - * This makes a lot of sense since white is going in decending - * order around the board, and red is ascending. - * - */ - -extern const char EXEC[]; /* object for main program */ -extern const char TEACH[];/* object for tutorial program */ - -extern int pnum; /* color of player: - -1 = white - 1 = red - 0 = both - 2 = not yet init'ed */ -extern char *args[16]; /* args passed to teachgammon and back */ -extern int acnt; /* number of args */ -extern int aflag; /* flag to ask for rules or instructions */ -extern int bflag; /* flag for automatic board printing */ -extern int cflag; /* case conversion flag */ -extern int hflag; /* flag for cleaning screen */ -extern int mflag; /* backgammon flag */ -extern int raflag; /* 'roll again' flag for recovered game */ -extern int rflag; /* recovered game flag */ -extern int tflag; /* cursor addressing flag */ -extern int rfl; /* saved value of rflag */ -extern int iroll; /* special flag for inputting rolls */ -extern int board[26]; /* board: negative values are white, - positive are red */ -extern int dice[2]; /* value of dice */ -extern int mvlim; /* 'move limit': max. number of moves */ -extern int mvl; /* working copy of mvlim */ -extern int p[5]; /* starting position of moves */ -extern int g[5]; /* ending position of moves (goals) */ -extern int h[4]; /* flag for each move if a man was hit */ -extern int cturn; /* whose turn it currently is: - -1 = white - 1 = red - 0 = just quitted - -2 = white just lost - 2 = red just lost */ -extern int d0; /* flag if dice have been reversed from - original position */ -extern int table[6][6]; /* odds table for possible rolls */ -extern int rscore; /* red's score */ -extern int wscore; /* white's score */ -extern int gvalue; /* value of game (64 max.) */ -extern int dlast; /* who doubled last (0 = neither) */ -extern int bar; /* position of bar for current player */ -extern int home; /* position of home for current player */ -extern int off[2]; /* number of men off board */ -extern int *offptr; /* pointer to off for current player */ -extern int *offopp; /* pointer to off for opponent */ -extern int in[2]; /* number of men in inner table */ -extern int *inptr; /* pointer to in for current player */ -extern int *inopp; /* pointer to in for opponent */ - -extern int ncin; /* number of characters in cin */ -extern char cin[100]; /* input line of current move - (used for reconstructing input after - a backspace) */ - -extern const char *const color[]; - /* colors as strings */ -extern const char *const *colorptr; /* color of current player */ -extern const char *const *Colorptr; /* color of current player, capitalized */ -extern int colen; /* length of color of current player */ - -extern struct sgttyb tty; /* tty information buffer */ -extern int old; /* original tty status */ -extern int noech; /* original tty status without echo */ -extern int raw; /* raw tty status, no echo */ - -extern int curr; /* row position of cursor */ -extern int curc; /* column position of cursor */ -extern int begscr; /* 'beginning' of screen - (not including board) */ - -void getout(); /* function to exit backgammon cleanly */ diff --git a/games/backgammon/common_source/board.c b/games/backgammon/common_source/board.c deleted file mode 100644 index 792b04207562..000000000000 --- a/games/backgammon/common_source/board.c +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Copyright (c) 1980, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)board.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include -#include "back.h" - -static int i, j, k; -static char ln[60]; - -wrboard () { - int l; - static const char bl[] = - "| | | |\n"; - static const char sv[] = - "| | | | \n"; - - fixtty (noech); - clear(); - - if (tflag) { - fboard(); - goto lastline; - } - - writel ("_____________________________________________________\n"); - writel (bl); - strcpy (ln,bl); - for (j = 1; j < 50; j += 4) { - k = j/4+(j > 24? 12: 13); - ln[j+1] = k%10+'0'; - ln[j] = k/10+'0'; - if (j == 21) - j += 4; - } - writel (ln); - for (i = 0; i < 5; i++) { - strcpy (ln,sv); - for (j = 1; j < 50; j += 4) { - k = j/4+(j > 24? 12: 13); - wrbsub (); - if (j == 21) - j += 4; - } - if (-board[25] > i) - ln[26] = 'w'; - if (-board[25] > i+5) - ln[25] = 'w'; - if (-board[25] > i+10) - ln[27] = 'w'; - l = 53; - if (off[1] > i || (off[1] < 0 && off[1]+15 > i)) { - ln[54] = 'r'; - l = 55; - } - if (off[1] > i+5 || (off[1] < 0 && off[1]+15 > i+5)) { - ln[55] = 'r'; - l = 56; - } - if (off[1] > i+10 || (off[1] < 0 && off[1]+15 > i+10)) { - ln[56] = 'r'; - l = 57; - } - ln[l++] = '\n'; - ln[l] = '\0'; - writel (ln); - } - strcpy (ln,bl); - ln[25] = 'B'; - ln[26] = 'A'; - ln[27] = 'R'; - writel (ln); - strcpy (ln,sv); - for (i = 4; i > -1; i--) { - for (j = 1; j < 50; j += 4) { - k = ((j > 24? 53: 49)-j)/4; - wrbsub(); - if (j == 21) - j += 4; - } - if (board[0] > i) - ln[26] = 'r'; - if (board[0] > i+5) - ln[25] = 'r'; - if (board[0] > i+10) - ln[27] = 'r'; - l = 53; - if (off[0] > i || (off[0] < 0 && off[0]+15 > i)) { - ln[54] = 'w'; - l = 55; - } - if (off[0] > i+5 || (off[0] < 0 && off[0]+15 > i+5)) { - ln[55] = 'w'; - l = 56; - } - if (off[0] > i+10 || (off[0] < 0 && off[0]+15 > i+10)) { - ln[56] = 'w'; - l = 57; - } - ln[l++] = '\n'; - ln[l] = '\0'; - writel (ln); - } - strcpy (ln,bl); - for (j = 1; j < 50; j += 4) { - k = ((j > 24? 53: 49)-j)/4; - ln[j+1] = k%10+'0'; - if (k > 9) - ln[j] = k/10+'0'; - if (j == 21) - j += 4; - } - writel (ln); - writel ("|_______________________|___|_______________________|\n"); - -lastline: - gwrite (); - if (tflag) - curmove (18,0); - else { - writec ('\n'); - writec ('\n'); - } - fixtty(raw); -} - -wrbsub () { - int m; - char d; - - if (board[k] > 0) { - m = board[k]; - d = 'r'; - } else { - m = -board[k]; - d = 'w'; - } - if (m>i) - ln[j+1] = d; - if (m>i+5) - ln[j] = d; - if (m>i+10) - ln[j+2] = d; -} diff --git a/games/backgammon/common_source/check.c b/games/backgammon/common_source/check.c deleted file mode 100644 index 70b9c62efed3..000000000000 --- a/games/backgammon/common_source/check.c +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Copyright (c) 1980, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)check.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include "back.h" - -getmove () { - int i, c; - - c = 0; - for (;;) { - i = checkmove(c); - - switch (i) { - case -1: - if (movokay(mvlim)) { - if (tflag) - curmove (20,0); - else - writec ('\n'); - for (i = 0; i < mvlim; i++) - if (h[i]) - wrhit(g[i]); - nexturn(); - if (*offopp == 15) - cturn *= -2; - if (tflag && pnum) - bflag = pnum; - return; - } - - case -4: - case 0: - if (tflag) - refresh(); - if (i != 0 && i != -4) - break; - if (tflag) - curmove (20,0); - else - writec ('\n'); - writel (*Colorptr); - if (i == -4) - writel (" must make "); - else - writel (" can only make "); - writec (mvlim+'0'); - writel (" move"); - if (mvlim > 1) - writec ('s'); - writec ('.'); - writec ('\n'); - break; - - case -3: - if (quit()) - return; - } - - if (! tflag) - proll (); - else { - curmove (cturn == -1? 18: 19,39); - cline (); - c = -1; - } - } -} - -movokay (mv) -int mv; - -{ - int i, m; - - if (d0) - swap; - - for (i = 0; i < mv; i++) { - - if (p[i] == g[i]) { - moverr (i); - curmove (20,0); - writel ("Attempt to move to same location.\n"); - return (0); - } - - if (cturn*(g[i]-p[i]) < 0) { - moverr (i); - curmove (20,0); - writel ("Backwards move.\n"); - return (0); - } - - if (abs(board[bar]) && p[i] != bar) { - moverr (i); - curmove (20,0); - writel ("Men still on bar.\n"); - return (0); - } - - if ( (m = makmove(i)) ) { - moverr (i); - switch (m) { - - case 1: - writel ("Move not rolled.\n"); - break; - - case 2: - writel ("Bad starting position.\n"); - break; - - case 3: - writel ("Destination occupied.\n"); - break; - - case 4: - writel ("Can't remove men yet.\n"); - } - return (0); - } - } - return (1); -} diff --git a/games/backgammon/common_source/fancy.c b/games/backgammon/common_source/fancy.c deleted file mode 100644 index e4aad246f7f1..000000000000 --- a/games/backgammon/common_source/fancy.c +++ /dev/null @@ -1,752 +0,0 @@ -/* - * Copyright (c) 1980, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)fancy.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include -#include -#include -#include "back.h" - -char PC; /* padding character */ -char *BC; /* backspace sequence */ -char *CD; /* clear to end of screen sequence */ -char *CE; /* clear to end of line sequence */ -char *CL; /* clear screen sequence */ -char *CM; /* cursor movement instructions */ -char *HO; /* home cursor sequence */ -char *MC; /* column cursor movement map */ -char *ML; /* row cursor movement map */ -char *ND; /* forward cursor sequence */ -char *UP; /* up cursor sequence */ - -int lHO; /* length of HO */ -int lBC; /* length of BC */ -int lND; /* length of ND */ -int lUP; /* length of UP */ -int CO; /* number of columns */ -int LI; /* number of lines */ -int *linect; /* array of lengths of lines on screen - (the actual screen is not stored) */ - - /* two letter codes */ -char tcap[] = "bccdceclcmhomcmlndup"; - /* corresponding strings */ -char **tstr[] = { &BC, &CD, &CE, &CL, &CM, &HO, &MC, &ML, &ND, &UP }; - -int buffnum; /* pointer to output buffer */ - -char tbuf[1024]; /* buffer for decoded termcap entries */ - -int oldb[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; - -int oldr; -int oldw; - /* "real" cursor positions, so - * it knows when to reposition. - * These are -1 if curr and curc - * are accurate */ -int realr; -int realc; - -int addbuf(int); - -fboard () { - int i, j, l; - - curmove (0,0); /* do top line */ - for (i = 0; i < 53; i++) - fancyc ('_'); - - curmove (15,0); /* do botttom line */ - for (i = 0; i < 53; i++) - fancyc ('_'); - - l = 1; /* do vertical lines */ - for (i = 52; i > -1; i -= 28) { - curmove ( (l == 1? 1: 15) ,i); - fancyc ('|'); - for (j = 0; j < 14; j++) { - curmove (curr+l,curc-1); - fancyc ('|'); - } - if (i == 24) - i += 32; - l = -l; /* alternate directions */ - } - - curmove (2,1); /* label positions 13-18 */ - for (i = 13; i < 18; i++) { - fancyc ('1'); - fancyc ((i % 10)+'0'); - curmove (curr,curc+2); - } - fancyc ('1'); - fancyc ('8'); - - curmove (2,29); /* label positions 19-24 */ - fancyc ('1'); - fancyc ('9'); - for (i = 20; i < 25; i++) { - curmove (curr,curc+2); - fancyc ('2'); - fancyc ((i % 10)+'0'); - } - - curmove (14,1); /* label positions 12-7 */ - fancyc ('1'); - fancyc ('2'); - for (i = 11; i > 6; i--) { - curmove (curr,curc+2); - fancyc (i > 9? '1': ' '); - fancyc ((i % 10)+'0'); - } - - curmove (14,30); /* label positions 6-1 */ - fancyc ('6'); - for (i = 5; i > 0; i--) { - curmove (curr,curc+3); - fancyc (i+'0'); - } - - for (i = 12; i > 6; i--) /* print positions 12-7 */ - if (board[i]) - bsect (board[i],13,1+4*(12-i),-1); - - if (board[0]) /* print red men on bar */ - bsect (board[0],13,25,-1); - - for (i = 6; i > 0; i--) /* print positions 6-1 */ - if (board[i]) - bsect (board[i],13,29+4*(6-i),-1); - - l = (off[1] < 0? off[1]+15: off[1]); /* print white's home */ - bsect (l,3,54,1); - - curmove (8,25); /* print the word BAR */ - fancyc ('B'); - fancyc ('A'); - fancyc ('R'); - - for (i = 13; i < 19; i++) /* print positions 13-18 */ - if (board[i]) - bsect (board[i],3,1+4*(i-13),1); - - if (board[25]) /* print white's men on bar */ - bsect (board[25],3,25,1); - - for (i = 19; i < 25; i++) /* print positions 19-24 */ - if (board[i]) - bsect (board[i],3,29+4*(i-19),1); - - l = (off[0] < 0? off[0]+15: off[0]); /* print red's home */ - bsect (-l,13,54,-1); - - for (i = 0; i < 26; i++) /* save board position - * for refresh later */ - oldb[i] = board[i]; - oldr = (off[1] < 0? off[1]+15: off[1]); - oldw = -(off[0] < 0? off[0]+15: off[0]); -} - -/* - * bsect (b,rpos,cpos,cnext) - * Print the contents of a board position. "b" has the value of the - * position, "rpos" is the row to start printing, "cpos" is the column to - * start printing, and "cnext" is positive if the position starts at the top - * and negative if it starts at the bottom. The value of "cpos" is checked - * to see if the position is a player's home, since those are printed - * differently. - */ - -bsect (b,rpos,cpos,cnext) -int b; /* contents of position */ -int rpos; /* row of position */ -int cpos; /* column of position */ -int cnext; /* direction of position */ - -{ - int j; /* index */ - int n; /* number of men on position */ - int bct; /* counter */ - int k; /* index */ - char pc; /* color of men on position */ - - n = abs(b); /* initialize n and pc */ - pc = (b > 0? 'r': 'w'); - - if (n < 6 && cpos < 54) /* position cursor at start */ - curmove (rpos,cpos+1); - else - curmove (rpos,cpos); - - for (j = 0; j < 5; j++) { /* print position row by row */ - - for (k = 0; k < 15; k += 5) /* print men */ - if (n > j+k) - fancyc (pc); - - if (j < 4) { /* figure how far to - * back up for next - * row */ - if (n < 6) { /* stop if none left */ - if (j+1 == n) - break; - bct = 1; /* single column */ - } else { - if (n < 11) { /* two columns */ - if (cpos == 54) { /* home pos */ - if (j+5 >= n) - bct = 1; - else - bct = 2; - } - if (cpos < 54) { /* not home */ - if (j+6 >= n) - bct = 1; - else - bct = 2; - } - } else { /* three columns */ - if (j+10 >= n) - bct = 2; - else - bct = 3; - } - } - curmove (curr+cnext,curc-bct); /* reposition cursor */ - } - } -} - -refresh() { - int i, r, c; - - r = curr; /* save current position */ - c = curc; - - for (i = 12; i > 6; i--) /* fix positions 12-7 */ - if (board[i] != oldb[i]) { - fixpos (oldb[i],board[i],13,1+(12-i)*4,-1); - oldb[i] = board[i]; - } - - if (board[0] != oldb[0]) { /* fix red men on bar */ - fixpos (oldb[0],board[0],13,25,-1); - oldb[0] = board[0]; - } - - for (i = 6; i > 0; i--) /* fix positions 6-1 */ - if (board[i] != oldb[i]) { - fixpos (oldb[i],board[i],13,29+(6-i)*4,-1); - oldb[i] = board[i]; - } - - i = -(off[0] < 0? off[0]+15: off[0]); /* fix white's home */ - if (oldw != i) { - fixpos (oldw,i,13,54,-1); - oldw = i; - } - - for (i = 13; i < 19; i++) /* fix positions 13-18 */ - if (board[i] != oldb[i]) { - fixpos (oldb[i],board[i],3,1+(i-13)*4,1); - oldb[i] = board[i]; - } - - if (board[25] != oldb[25]) { /* fix white men on bar */ - fixpos (oldb[25],board[25],3,25,1); - oldb[25] = board[25]; - } - - for (i = 19; i < 25; i++) /* fix positions 19-24 */ - if (board[i] != oldb[i]) { - fixpos (oldb[i],board[i],3,29+(i-19)*4,1); - oldb[i] = board[i]; - } - - i = (off[1] < 0? off[1]+15: off[1]); /* fix red's home */ - if (oldr != i) { - fixpos (oldr,i,3,54,1); - oldr = i; - } - - curmove (r,c); /* return to saved position */ - newpos(); - buflush(); -} - -fixpos (old,new,r,c,inc) -int old, new, r, c, inc; - -{ - int o, n, nv; - int ov, nc; - char col; - - if (old*new >= 0) { - ov = abs(old); - nv = abs(new); - col = (old+new > 0? 'r': 'w'); - o = (ov-1)/5; - n = (nv-1)/5; - if (o == n) { - if (o == 2) - nc = c+2; - if (o == 1) - nc = c < 54? c: c+1; - if (o == 0) - nc = c < 54? c+1: c; - if (ov > nv) - fixcol (r+inc*(nv-n*5),nc,abs(ov-nv),' ',inc); - else - fixcol (r+inc*(ov-o*5),nc,abs(ov-nv),col,inc); - return; - } else { - if (c < 54) { - if (o+n == 1) { - if (n) { - fixcol (r,c,abs(nv-5),col,inc); - if (ov != 5) - fixcol (r+inc*ov,c+1,abs(ov-5),col,inc); - } else { - fixcol (r,c,abs(ov-5),' ',inc); - if (nv != 5) - fixcol (r+inc*nv,c+1,abs(nv-5),' ',inc); - } - return; - } - if (n == 2) { - if (ov != 10) - fixcol (r+inc*(ov-5),c,abs(ov-10),col,inc); - fixcol (r,c+2,abs(nv-10),col,inc); - } else { - if (nv != 10) - fixcol (r+inc*(nv-5),c,abs(nv-10),' ',inc); - fixcol (r,c+2,abs(ov-10),' ',inc); - } - return; - } - if (n > o) { - fixcol (r+inc*(ov%5),c+o,abs(5*n-ov),col,inc); - if (nv != 5*n) - fixcol (r,c+n,abs(5*n-nv),col,inc); - } else { - fixcol (r+inc*(nv%5),c+n,abs(5*n-nv),' ',inc); - if (ov != 5*o) - fixcol (r,c+o,abs(5*o-ov),' ',inc); - } - return; - } - } - nv = abs(new); - fixcol (r,c+1,nv,new > 0? 'r': 'w',inc); - if (abs(old) <= abs(new)) - return; - fixcol (r+inc*new,c+1,abs(old+new),' ',inc); -} - -fixcol (r,c,l,ch,inc) -int l, ch, r, c, inc; - -{ - int i; - - curmove (r,c); - fancyc (ch); - for (i = 1; i < l; i++) { - curmove (curr+inc,curc-1); - fancyc (ch); - } -} - -curmove (r,c) -int r, c; - -{ - if (curr == r && curc == c) - return; - if (realr == -1) { - realr = curr; - realc = curc; - } - curr = r; - curc = c; -} - -newpos () { - int r; /* destination row */ - int c; /* destination column */ - int mode = -1; /* mode of movement */ - - int count = 1000; /* character count */ - int i; /* index */ - int j; /* index */ - int n; /* temporary variable */ - char *m; /* string containing CM movement */ - - - if (realr == -1) /* see if already there */ - return; - - r = curr; /* set current and dest. positions */ - c = curc; - curr = realr; - curc = realc; - - /* double check position */ - if (curr == r && curc == c) { - realr = realc = -1; - return; - } - - if (CM) { /* try CM to get there */ - mode = 0; - m = (char *)tgoto (CM,c,r); - count = strlen (m); - } - - /* try HO and local movement */ - if (HO && (n = r+c*lND+lHO) < count) { - mode = 1; - count = n; - } - - /* try various LF combinations */ - if (r >= curr) { - /* CR, LF, and ND */ - if ((n = (r-curr)+c*lND+1) < count) { - mode = 2; - count = n; - } - /* LF, ND */ - if (c >= curc && (n = (r-curr)+(c-curc)*lND) < count) { - mode = 3; - count = n; - } - /* LF, BS */ - if (c < curc && (n = (r-curr)+(curc-c)*lBC) < count) { - mode = 4; - count = n; - } - } - - /* try corresponding UP combinations */ - if (r < curr) { - /* CR, UP, and ND */ - if ((n = (curr-r)*lUP+c*lND+1) < count) { - mode = 5; - count = n; - } - /* UP and ND */ - if (c >= curc && (n = (curr-r)*lUP+(c-curc)*lND) < count) { - mode = 6; - count = n; - } - /* UP and BS */ - if (c < curc && (n = (curr-r)*lUP+(curc-c)*lBC) < count) { - mode = 7; - count = n; - } - } - - /* space over */ - if (curr == r && c > curc && linect[r] < curc && c-curc < count) - mode = 8; - - switch (mode) { - - case -1: /* error! */ - write (2,"\r\nInternal cursor error.\r\n",26); - getout(); - - /* direct cursor motion */ - case 0: - tputs (m,abs(curr-r),addbuf); - break; - - /* relative to "home" */ - case 1: - tputs (HO,r,addbuf); - for (i = 0; i < r; i++) - addbuf ('\012'); - for (i = 0; i < c; i++) - tputs (ND,1,addbuf); - break; - - /* CR and down and over */ - case 2: - addbuf ('\015'); - for (i = 0; i < r-curr; i++) - addbuf ('\012'); - for (i = 0; i < c; i++) - tputs (ND,1,addbuf); - break; - - /* down and over */ - case 3: - for (i = 0; i < r-curr; i++) - addbuf ('\012'); - for (i = 0; i < c-curc; i++) - tputs (ND,1,addbuf); - break; - - /* down and back */ - case 4: - for (i = 0; i < r-curr; i++) - addbuf ('\012'); - for (i = 0; i < curc-c; i++) - addbuf ('\010'); - break; - - /* CR and up and over */ - case 5: - addbuf ('\015'); - for (i = 0; i < curr-r; i++) - tputs (UP,1,addbuf); - for (i = 0; i < c; i++) - tputs (ND,1,addbuf); - break; - - /* up and over */ - case 6: - for (i = 0; i < curr-r; i++) - tputs (UP,1,addbuf); - for (i = 0; i < c-curc; i++) - tputs (ND,1,addbuf); - break; - - /* up and back */ - case 7: - for (i = 0; i < curr-r; i++) - tputs (UP,1,addbuf); - for (i = 0; i < curc-c; i++) { - if (BC) - tputs (BC,1,addbuf); - else - addbuf ('\010'); - } - break; - - /* safe space */ - case 8: - for (i = 0; i < c-curc; i++) - addbuf (' '); - } - - /* fix positions */ - curr = r; - curc = c; - realr = -1; - realc = -1; -} - -clear () { - int i; - - /* double space if can't clear */ - if (CL == 0) { - writel ("\n\n"); - return; - } - - curr = curc = 0; /* fix position markers */ - realr = realc = -1; - for (i = 0; i < 24; i++) /* clear line counts */ - linect[i] = -1; - buffnum = -1; /* ignore leftover buffer contents */ - tputs (CL,CO,addbuf); /* put CL in buffer */ -} - - -fancyc (c) -char c; /* character to output */ -{ - int sp; /* counts spaces in a tab */ - - if (c == '\007') { /* bells go in blindly */ - addbuf (c); - return; - } - - /* process tabs, use spaces if the - * the tab should be erasing things, - * otherwise use cursor movement - * routines. Note this does not use - * hardware tabs at all. */ - if (c == '\t') { - sp = (curc+8) & (~ 7); /* compute spaces */ - /* check line length */ - if (linect[curr] >= curc || sp < 4) { - for (; sp > curc; sp--) - addbuf (' '); - curc = sp; /* fix curc */ - } else - curmove (curr,sp); - return; - } - - /* do newline be calling newline */ - if (c == '\n') { - newline(); - return; - } - - /* ignore any other control chars */ - if (c < ' ') - return; - - /* if an erasing space or non-space, - * just add it to buffer. Otherwise - * use cursor movement routine, so that - * multiple spaces will be grouped - * together */ - if (c > ' ' || linect[curr] >= curc) { - newpos (); /* make sure position correct */ - addbuf (c); /* add character to buffer */ - /* fix line length */ - if (c == ' ' && linect[curr] == curc) - linect[curr]--; - else if (linect[curr] < curc) - linect[curr] = curc; - curc++; /* fix curc */ - } else - /* use cursor movement routine */ - curmove (curr,curc+1); -} - -clend() { - int i; - char *s; - - - if (CD) { - tputs (CD,CO-curr,addbuf); - for (i = curr; i < LI; i++) - linect[i] = -1; - return; - } - - curmove (i = curr,0); - cline(); - while (curr < LI-1) { - curmove (curr+1,0); - if (linect[curr] > -1) - cline (); - } - curmove (i,0); -} - -cline () { - int i; - int c; - char *s; - - if (curc > linect[curr]) - return; - newpos (); - if (CE) { - tputs (CE,1,addbuf); - linect[curr] = curc-1; - } else { - c = curc-1; - while (linect[curr] > c) { - addbuf (' '); - curc++; - linect[curr]--; - } - curmove (curr,c+1); - } -} - -newline () { - cline(); - if (curr == LI-1) - curmove (begscr,0); - else - curmove (curr+1,0); -} - -int -getcaps (s) -const char *s; - -{ - char *code; /* two letter code */ - char ***cap; /* pointer to cap string */ - char *bufp; /* pointer to cap buffer */ - char tentry[1024]; /* temporary uncoded caps buffer */ - - tgetent (tentry, (char *)s); /* get uncoded termcap entry */ - - LI = tgetnum ("li"); /* get number of lines */ - if (LI == -1) - LI = 12; - CO = tgetnum ("co"); /* get number of columns */ - if (CO == -1) - CO = 65; - - bufp = tbuf; /* get padding character */ - tgetstr ("pc",&bufp); - if (bufp != tbuf) - PC = *tbuf; - else - PC = 0; - - bufp = tbuf; /* get string entries */ - cap = tstr; - for (code = tcap; *code; code += 2) - **cap++ = (char *)tgetstr (code,&bufp); - - /* get pertinent lengths */ - if (HO) - lHO = strlen (HO); - if (BC) - lBC = strlen (BC); - else - lBC = 1; - if (UP) - lUP = strlen (UP); - if (ND) - lND = strlen (ND); - if (LI < 24 || CO < 72 || !(CL && UP && ND)) - return (0); - linect = (int *)calloc (LI+1,sizeof(int)); - return (1); -} diff --git a/games/backgammon/common_source/init.c b/games/backgammon/common_source/init.c deleted file mode 100644 index 24ee2a0a936b..000000000000 --- a/games/backgammon/common_source/init.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (c) 1980, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)init.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include -#include - -/* - * variable initialization. - */ - - /* name of executable object programs */ -const char EXEC[] = "/usr/games/backgammon"; -const char TEACH[] = "/usr/games/teachgammon"; - -int pnum = 2; /* color of player: - -1 = white - 1 = red - 0 = both - 2 = not yet init'ed */ -int acnt = 1; /* number of args */ -int aflag = 1; /* flag to ask for rules or instructions */ -int bflag = 0; /* flag for automatic board printing */ -int cflag = 0; /* case conversion flag */ -int hflag = 1; /* flag for cleaning screen */ -int mflag = 0; /* backgammon flag */ -int raflag = 0; /* 'roll again' flag for recovered game */ -int rflag = 0; /* recovered game flag */ -int tflag = 0; /* cursor addressing flag */ -int iroll = 0; /* special flag for inputting rolls */ -int rfl = 0; - -const char *const color[] = {"White","Red","white","red"}; - -const char *const *Colorptr; -const char *const *colorptr; -int *inopp; -int *inptr; -int *offopp; -int *offptr; -char args[100]; -int bar; -int begscr; -int board[26]; -char cin[100]; -int colen; -int cturn; -int curc; -int curr; -int d0; -int dice[2]; -int dlast; -int g[5]; -int gvalue; -int h[4]; -int home; -int in[2]; -int mvl; -int mvlim; -int ncin; -int off[2]; -int p[5]; -int rscore; -int table[6][6]; -int wscore; -struct termios tty, old, noech, raw; diff --git a/games/backgammon/common_source/odds.c b/games/backgammon/common_source/odds.c deleted file mode 100644 index f840376d8319..000000000000 --- a/games/backgammon/common_source/odds.c +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 1980, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)odds.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include "back.h" - -odds (r1,r2,val) -int r1; -int r2, val; -{ - int i, j; - - if (r1 == 0) { - for (i = 0; i < 6; i++) - for (j = 0; j < 6; j++) - table[i][j] = 0; - return; - } else { - r1--; - if (r2-- == 0) - for (i = 0; i < 6; i++) { - table[i][r1] += val; - table[r1][i] += val; - } - else { - table[r2][r1] += val; - table[r1][r2] += val; - } - } -} - -count () { - int i; - int j; - int total; - - total = 0; - for (i = 0; i < 6; i++) - for (j = 0; j < 6; j++) - total += table[i][j]; - return (total); -} - -canhit (i,c) -int i, c; - -{ - int j, k, b; - int a, d, diff, place, addon, menstuck; - - if (c == 0) - odds (0,0,0); - if (board[i] > 0) { - a = -1; - b = 25; - } else { - a = 1; - b = 0; - } - place = abs (25-b-i); - menstuck = abs (board[b]); - for (j = b; j != i; j += a) { - if (board[j]*a > 0) { - diff = abs(j-i); - addon = place+((board[j]*a > 2 || j == b)? 5: 0); - if ((j == b && menstuck == 1) && - (j != b && menstuck == 0)) - for (k = 1; k < diff; k++) - if (k < 7 && diff-k < 7 && - (board[i+a*k]*a >= 0 || - board[i+a*(diff-k)] >= 0)) - odds (k,diff-k,addon); - if ((j == b || menstuck < 2) && diff < 7) - odds (diff,0,addon); - } - if (j == b && menstuck > 1) - break; - } - return (count()); -} diff --git a/games/backgammon/common_source/one.c b/games/backgammon/common_source/one.c deleted file mode 100644 index e94c183f0d81..000000000000 --- a/games/backgammon/common_source/one.c +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright (c) 1980, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)one.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include "back.h" - -makmove (i) -int i; - -{ - int n, d; - int max; - - d = d0; - n = abs(g[i]-p[i]); - max = (*offptr < 0? 7: last()); - if (board[p[i]]*cturn <= 0) - return (checkd(d)+2); - if (g[i] != home && board[g[i]]*cturn < -1) - return (checkd(d)+3); - if (i || D0 == D1) { - if (n == max? D1 < n: D1 != n) - return (checkd(d)+1); - } else { - if (n == max? D0 < n && D1 < n: D0 != n && D1 != n) - return (checkd(d)+1); - if (n == max? D0 < n: D0 != n) { - if (d0) - return (checkd(d)+1); - swap; - } - } - if (g[i] == home && *offptr < 0) - return (checkd(d)+4); - h[i] = 0; - board[p[i]] -= cturn; - if (g[i] != home) { - if (board[g[i]] == -cturn) { - board[home] -= cturn; - board[g[i]] = 0; - h[i] = 1; - if (abs(bar-g[i]) < 7) { - (*inopp)--; - if (*offopp >= 0) - *offopp -= 15; - } - } - board[g[i]] += cturn; - if (abs(home-g[i]) < 7 && abs(home-p[i]) > 6) { - (*inptr)++; - if (*inptr+*offptr == 0) - *offptr += 15; - } - } else { - (*offptr)++; - (*inptr)--; - } - return (0); -} - -moverr (i) -int i; - -{ - int j; - - if (tflag) - curmove (20,0); - else - writec ('\n'); - writel ("Error: "); - for (j = 0; j <= i; j++) { - wrint (p[j]); - writec ('-'); - wrint (g[j]); - if (j < i) - writec (','); - } - writel ("... "); - movback (i); -} - - -checkd (d) -int d; - -{ - if (d0 != d) - swap; - return (0); -} - -last () { - int i; - - for (i = home-6*cturn; i != home; i += cturn) - if (board[i]*cturn > 0) - return (abs(home-i)); -} - -movback (i) -int i; - -{ - int j; - - for (j = i-1; j >= 0; j--) - backone(j); -} - -backone (i) -int i; - -{ - board[p[i]] += cturn; - if (g[i] != home) { - board[g[i]] -= cturn; - if (abs(g[i]-home) < 7 && abs(p[i]-home) > 6) { - (*inptr)--; - if (*inptr+*offptr < 15 && *offptr >= 0) - *offptr -= 15; - } - } else { - (*offptr)--; - (*inptr)++; - } - if (h[i]) { - board[home] += cturn; - board[g[i]] = -cturn; - if (abs(bar-g[i]) < 7) { - (*inopp)++; - if (*inopp+*offopp == 0) - *offopp += 15; - } - } -} diff --git a/games/backgammon/common_source/save.c b/games/backgammon/common_source/save.c deleted file mode 100644 index fe3475d99a1d..000000000000 --- a/games/backgammon/common_source/save.c +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Copyright (c) 1980, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)save.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include -#include -#include "back.h" - -static const char confirm[] = "Are you sure you want to leave now?"; -static const char prompt[] = "Enter a file name: "; -static const char exist1[] = "The file '"; -static const char exist2[] = - "' already exists.\nAre you sure you want to use this file?"; -static const char cantuse[] = "\nCan't use "; -static const char saved[] = "This game has been saved on the file '"; -static const char type[] = "'.\nType \"backgammon "; -static const char rec[] = "\" to recover your game.\n\n"; -static const char cantrec[] = "Can't recover file: "; - -save (n) -int n; - -{ - int fdesc; - char *fs; - char fname[50]; - - if (n) { - if (tflag) { - curmove (20,0); - clend(); - } else - writec ('\n'); - writel (confirm); - if (! yorn(0)) - return; - } - cflag = 1; - for (;;) { - writel (prompt); - fs = fname; - while ((*fs = readc()) != '\n') { - if (*fs == tty.sg_erase) { - if (fs > fname) { - fs--; - if (tflag) - curmove (curr,curc-1); - else - writec (*fs); - } else - writec ('\007'); - continue; - } - writec (*fs++); - } - *fs = '\0'; - if ((fdesc = open(fname,O_RDWR)) == -1 && errno == ENOENT) { - if ((fdesc = creat (fname,0600)) != -1) - break; - } - if (fdesc != -1) { - if (tflag) { - curmove (18,0); - clend(); - } else - writec ('\n'); - writel (exist1); - writel (fname); - writel (exist2); - cflag = 0; - close (fdesc); - if (yorn (0)) { - unlink (fname); - fdesc = creat (fname,0700); - break; - } else { - cflag = 1; - continue; - } - } - writel (cantuse); - writel (fname); - writel (".\n"); - close (fdesc); - cflag = 1; - } - write (fdesc,board,sizeof board); - write (fdesc,off,sizeof off); - write (fdesc,in,sizeof in); - write (fdesc,dice,sizeof dice); - write (fdesc,&cturn,sizeof cturn); - write (fdesc,&dlast,sizeof dlast); - write (fdesc,&pnum,sizeof pnum); - write (fdesc,&rscore,sizeof rscore); - write (fdesc,&wscore,sizeof wscore); - write (fdesc,&gvalue,sizeof gvalue); - write (fdesc,&raflag,sizeof raflag); - close (fdesc); - if (tflag) - curmove (18,0); - writel (saved); - writel (fname); - writel (type); - writel (fname); - writel (rec); - if (tflag) - clend(); - getout (); -} - -int -recover (s) -const char *s; - -{ - int i; - int fdesc; - - if ((fdesc = open (s,O_RDONLY)) == -1) - norec (s); - read (fdesc,board,sizeof board); - read (fdesc,off,sizeof off); - read (fdesc,in,sizeof in); - read (fdesc,dice,sizeof dice); - read (fdesc,&cturn,sizeof cturn); - read (fdesc,&dlast,sizeof dlast); - read (fdesc,&pnum,sizeof pnum); - read (fdesc,&rscore,sizeof rscore); - read (fdesc,&wscore,sizeof wscore); - read (fdesc,&gvalue,sizeof gvalue); - read (fdesc,&raflag,sizeof raflag); - close (fdesc); - rflag = 1; -} - -int -norec (s) -const char *s; - -{ - const char *c; - - tflag = 0; - writel (cantrec); - c = s; - while (*c != '\0') - writec (*c++); - getout (); -} diff --git a/games/backgammon/common_source/subs.c b/games/backgammon/common_source/subs.c deleted file mode 100644 index 3a1c5998be5f..000000000000 --- a/games/backgammon/common_source/subs.c +++ /dev/null @@ -1,483 +0,0 @@ -/* - * Copyright (c) 1980, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)subs.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include -#include -#include -#include "back.h" - -int buffnum; -char outbuff[BUFSIZ]; - -static const char plred[] = "Player is red, computer is white."; -static const char plwhite[] = "Player is white, computer is red."; -static const char nocomp[] = "(No computer play.)"; - -const char *const descr[] = { - "usage: backgammon [-h n r w b pr pw pb tterm sfile]\n", - "\t-h\tgets this list\n\t-n\tdon't ask for rules or instructions", - "\t-r\tplayer is red (implies -n)\n\t-w\tplayer is white (implies -n)", - "\t-b\ttwo players, red and white (implies -n)", - "\t-pr\tprint the board before red's turn", - "\t-pw\tprint the board before white's turn", - "\t-pb\tprint the board before both player's turn", - "\t-tterm\tterminal is a term", - "\t-sfile\trecover saved game from file", - 0 -}; - -errexit (s) -char *s; -{ - write (2,"\n",1); - perror (s); - getout(); -} - -int addbuf (c) -int c; - -{ - buffnum++; - if (buffnum == BUFSIZ) { - if (write(1,outbuff,BUFSIZ) != BUFSIZ) - errexit ("addbuf (write):"); - buffnum = 0; - } - outbuff[buffnum] = c; - return (0); -} - -buflush () { - if (buffnum < 0) - return; - buffnum++; - if (write (1,outbuff,buffnum) != buffnum) - errexit ("buflush (write):"); - buffnum = -1; -} - -readc () { - char c; - - if (tflag) { - cline(); - newpos(); - } - buflush(); - if (read(0,&c,1) != 1) - errexit ("readc"); -#ifdef WHY_IS_THIS_HARDWIRED_IN_HERE - if (c == '\177') - getout(); -#endif - if (c == '\033' || c == '\015') - return ('\n'); - if (cflag) - return (c); - if (c == '\014') - return ('R'); - if (c >= 'a' && c <= 'z') - return (c & 0137); - return (c); -} - -writec (c) -char c; -{ - if (tflag) - fancyc (c); - else - addbuf (c); -} - -void -writel (l) -const char *l; -{ -#ifdef DEBUG - const char *s; - - if (trace == NULL) - trace = fopen ("bgtrace","w"); - - fprintf (trace,"writel: \""); - for (s = l; *s; s++) { - if (*s < ' ' || *s == '\177') - fprintf (trace,"^%c",(*s)^0100); - else - putc (*s,trace); - } - fprintf (trace,"\"\n"); - fflush (trace); -#endif - - while (*l) - writec (*l++); -} - -proll () { - if (d0) - swap; - if (cturn == 1) - writel ("Red's roll: "); - else - writel ("White's roll: "); - writec (D0+'0'); - writec ('\040'); - writec (D1+'0'); - if (tflag) - cline(); -} - -wrint (n) -int n; -{ - int i, j, t; - - for (i = 4; i > 0; i--) { - t = 1; - for (j = 0; j t-1) - writec ((n/t)%10+'0'); - } - writec (n%10+'0'); -} - -gwrite() { - int r, c; - - if (tflag) { - r = curr; - c = curc; - curmove (16,0); - } - - if (gvalue > 1) { - writel ("Game value: "); - wrint (gvalue); - writel (". "); - if (dlast == -1) - writel (color[0]); - else - writel (color[1]); - writel (" doubled last."); - } else { - switch (pnum) { - case -1: /* player is red */ - writel (plred); - break; - case 0: /* player is both colors */ - writel (nocomp); - break; - case 1: /* player is white */ - writel (plwhite); - } - } - - if (rscore || wscore) { - writel (" "); - wrscore(); - } - - if (tflag) { - cline(); - curmove (r,c); - } -} - -quit () { - int i; - - if (tflag) { - curmove (20,0); - clend(); - } else - writec ('\n'); - writel ("Are you sure you want to quit?"); - if (yorn (0)) { - if (rfl) { - writel ("Would you like to save this game?"); - if (yorn(0)) - save(0); - } - cturn = 0; - return (1); - } - return (0); -} - -yorn (special) -char special; /* special response */ -{ - char c; - int i; - - i = 1; - while ( (c = readc()) != 'Y' && c != 'N') { - if (special && c == special) - return (2); - if (i) { - if (special) { - writel (" (Y, N, or "); - writec (special); - writec (')'); - } else - writel (" (Y or N)"); - i = 0; - } else - writec ('\007'); - } - if (c == 'Y') - writel (" Yes.\n"); - else - writel (" No.\n"); - if (tflag) - buflush(); - return (c == 'Y'); -} - -wrhit (i) -int i; -{ - writel ("Blot hit on "); - wrint (i); - writec ('.'); - writec ('\n'); -} - -nexturn () { - int c; - - cturn = -cturn; - c = cturn/abs(cturn); - home = bar; - bar = 25-bar; - offptr += c; - offopp -= c; - inptr += c; - inopp -= c; - Colorptr += c; - colorptr += c; -} - -getarg (argc, argv) -int argc; -char **argv; - -{ - char ch; - extern int optind; - extern char *optarg; - int i; - - /* process arguments here. dashes are ignored, nbrw are ignored - if the game is being recovered */ - - while ((ch = getopt (argc, argv, "nbrwp:t:s:h")) != -1) { - switch (ch) { - - /* don't ask if rules or instructions needed */ - case 'n': - if (rflag) - break; - aflag = 0; - args[acnt++] = strdup ("-n"); - break; - - /* player is both red and white */ - case 'b': - if (rflag) - break; - pnum = 0; - aflag = 0; - args[acnt++] = strdup ("-b"); - break; - - /* player is red */ - case 'r': - if (rflag) - break; - pnum = -1; - aflag = 0; - args[acnt++] = strdup ("-r"); - break; - - /* player is white */ - case 'w': - if (rflag) - break; - pnum = 1; - aflag = 0; - args[acnt++] = strdup ("-w"); - break; - - /* print board after move according to following character */ - case 'p': - if (optarg[0] != 'r' && optarg[0] != 'w' && optarg[0] != 'b') - break; - args[acnt] = strdup ("-p "); - args[acnt++][2] = optarg[0]; - if (optarg[0] == 'r') - bflag = 1; - if (optarg[0] == 'w') - bflag = -1; - if (optarg[0] == 'b') - bflag = 0; - break; - - case 't': - tflag = getcaps (optarg); - break; - - case 's': - /* recover file */ - recover (optarg); - break; - case 'h': - for (i = 0; descr[i] != 0; i++) - puts (descr[i]); - getout(); - } - } - argc -= optind; - argv += optind; - if ( argc && argv[0][0] != '\0' ) - recover(argv[0]); -} - -init () { - int i; - for (i = 0; i < 26;) - board[i++] = 0; - board[1] = 2; - board[6] = board[13] = -5; - board[8] = -3; - board[12] = board[19] = 5; - board[17] = 3; - board[24] = -2; - off[0] = off[1] = -15; - in[0] = in[1] = 5; - gvalue = 1; - dlast = 0; -} - -wrscore () { - writel ("Score: "); - writel (color[1]); - writec (' '); - wrint (rscore); - writel (", "); - writel (color[0]); - writec (' '); - wrint (wscore); -} - -fixtty (mode) -int mode; -{ - if (tflag) - newpos(); - buflush(); - tty.sg_flags = mode; - if (stty (0,&tty) < 0) - errexit("fixtty"); -} - -void -getout () { - /* go to bottom of screen */ - if (tflag) { - curmove (23,0); - cline(); - } else - writec ('\n'); - - /* fix terminal status */ - fixtty (old); - exit(0); -} -roll () { - char c; - int row; - int col; - - if (iroll) { - if (tflag) { - row = curr; - col = curc; - curmove (17,0); - } else - writec ('\n'); - writel ("ROLL: "); - c = readc(); - if (c != '\n') { - while (c < '1' || c > '6') - c = readc(); - D0 = c-'0'; - writec (' '); - writec (c); - c = readc(); - while (c < '1' || c > '6') - c = readc(); - D1 = c-'0'; - writec (' '); - writec (c); - if (tflag) { - curmove (17,0); - cline(); - curmove (row,col); - } else - writec ('\n'); - return; - } - if (tflag) { - curmove (17,0); - cline(); - curmove (row,col); - } else - writec ('\n'); - } - D0 = rnum(6)+1; - D1 = rnum(6)+1; - d0 = 0; -} diff --git a/games/backgammon/common_source/table.c b/games/backgammon/common_source/table.c deleted file mode 100644 index 572cba30eab0..000000000000 --- a/games/backgammon/common_source/table.c +++ /dev/null @@ -1,312 +0,0 @@ -/* - * Copyright (c) 1980, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)table.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include "back.h" - -const char *const help2[] = { - " Enter moves as - or / where is the starting", - "position, is the finishing position, and is the roll.", - "Remember, each die roll must be moved separately.", - 0 -}; - -struct state { - char ch; - int fcode; - int newst; -}; - -static const struct state atmata[] = { - - 'R', 1, 0, '?', 7, 0, 'Q', 0, -3, 'B', 8, 25, - '9', 2, 25, '8', 2, 25, '7', 2, 25, '6', 2, 25, - '5', 2, 25, '4', 2, 25, '3', 2, 25, '2', 2, 19, - '1', 2, 15, '0', 2, 25, '.', 0, 0, '9', 2, 25, - '8', 2, 25, '7', 2, 25, '6', 2, 25, '5', 2, 25, - - '4', 2, 25, '3', 2, 25, '2', 2, 25, '1', 2, 25, - '0', 2, 25, '/', 0, 32, '-', 0, 39, '.', 0, 0, - '/', 5, 32, ' ', 6, 3, ',', 6, 3, '\n', 0, -1, - '6', 3, 28, '5', 3, 28, '4', 3, 28, '3', 3, 28, - '2', 3, 28, '1', 3, 28, '.', 0, 0, 'H', 9, 61, - - '9', 4, 61, '8', 4, 61, '7', 4, 61, '6', 4, 61, - '5', 4, 61, '4', 4, 61, '3', 4, 61, '2', 4, 53, - '1', 4, 51, '0', 4, 61, '.', 0, 0, '9', 4, 61, - '8', 4, 61, '7', 4, 61, '6', 4, 61, '5', 4, 61, - '4', 4, 61, '3', 4, 61, '2', 4, 61, '1', 4, 61, - - '0', 4, 61, ' ', 6, 3, ',', 6, 3, '-', 5, 39, - '\n', 0, -1, '.', 0, 0 -}; - -checkmove (ist) - -int ist; - -{ - int j, n; - char c; - char a; - -domove: - if (ist == 0) { - if (tflag) - curmove (curr,32); - else - writel ("\t\t"); - writel ("Move: "); - } - ist = mvl = ncin = 0; - for (j = 0; j < 5; j++) - p[j] = g[j] = -1; - -dochar: - c = readc(); - - if (c == 'S') { - raflag = 0; - save (1); - if (tflag) { - curmove (cturn == -1? 18: 19,39); - ist = -1; - goto domove; - } else { - proll (); - ist = 0; - goto domove; - } - } - - if (c == tty.sg_erase && ncin > 0) { - if (tflag) - curmove (curr,curc-1); - else { - if (tty.sg_erase == '\010') - writel ("\010 \010"); - else - writec (cin[ncin-1]); - } - ncin--; - n = rsetbrd(); - if (n == 0) { - n = -1; - if (tflag) - refresh(); - } - if ((ist = n) > 0) - goto dochar; - goto domove; - } - - if (c == tty.sg_kill && ncin > 0) { - if (tflag) { - refresh(); - curmove (curr,39); - ist = -1; - goto domove; - } else if (tty.sg_erase == '\010') { - for (j = 0; j < ncin; j++) - writel ("\010 \010"); - ist = -1; - goto domove; - } else { - writec ('\\'); - writec ('\n'); - proll (); - ist = 0; - goto domove; - } - } - - n = dotable(c,ist); - if (n >= 0) { - cin[ncin++] = c; - if (n > 2) - if ((! tflag) || c != '\n') - writec (c); - ist = n; - if (n) - goto dochar; - else - goto domove; - } - - if (n == -1 && mvl >= mvlim) - return(0); - if (n == -1 && mvl < mvlim-1) - return(-4); - - if (n == -6) { - if (! tflag) { - if (movokay(mvl+1)) { - wrboard(); - movback (mvl+1); - } - proll (); - writel ("\t\tMove: "); - for (j = 0; j < ncin;) - writec (cin[j++]); - } else { - if (movokay(mvl+1)) { - refresh(); - movback (mvl+1); - } else - curmove (cturn == -1? 18:19,ncin+39); - } - ist = n = rsetbrd(); - goto dochar; - } - - if (n != -5) - return(n); - writec ('\007'); - goto dochar; -} - -dotable (c,i) -char c; -int i; - -{ - int a, j; - int test; - - test = (c == 'R'); - - while ( (a = atmata[i].ch) != '.') { - if (a == c || (test && a == '\n')) { - switch (atmata[i].fcode) { - - case 1: - wrboard(); - if (tflag) { - curmove (cturn == -1? 18: 19,0); - proll (); - writel ("\t\t"); - } else - proll (); - break; - - case 2: - if (p[mvl] == -1) - p[mvl] = c-'0'; - else - p[mvl] = p[mvl]*10+c-'0'; - break; - - case 3: - if (g[mvl] != -1) { - if (mvl < mvlim) - mvl++; - p[mvl] = p[mvl-1]; - } - g[mvl] = p[mvl]+cturn*(c-'0'); - if (g[mvl] < 0) - g[mvl] = 0; - if (g[mvl] > 25) - g[mvl] = 25; - break; - - case 4: - if (g[mvl] == -1) - g[mvl] = c-'0'; - else - g[mvl] = g[mvl]*10+c-'0'; - break; - - case 5: - if (mvl < mvlim) - mvl++; - p[mvl] = g[mvl-1]; - break; - - case 6: - if (mvl < mvlim) - mvl++; - break; - - case 7: - if (tflag) - curmove (20,0); - else - writec ('\n'); - text (help2); - if (tflag) { - curmove (cturn == -1? 18: 19,39); - } else { - writec ('\n'); - proll(); - writel ("\t\tMove: "); - } - break; - - case 8: - p[mvl] = bar; - break; - - case 9: - g[mvl] = home; - } - - if (! test || a != '\n') - return (atmata[i].newst); - else - return (-6); - } - - i++; - } - - return (-5); -} - -rsetbrd () { - int i, j, n; - - n = 0; - mvl = 0; - for (i = 0; i < 4; i++) - p[i] = g[i] = -1; - for (j = 0; j < ncin; j++) - n = dotable (cin[j],n); - return (n); -} diff --git a/games/backgammon/teachgammon/Makefile b/games/backgammon/teachgammon/Makefile deleted file mode 100644 index 56ceb882dbbb..000000000000 --- a/games/backgammon/teachgammon/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -# @(#)Makefile 8.1 (Berkeley) 5/31/93 - -PROG= teachgammon -CFLAGS+=-DV7 -I${.CURDIR}/../common_source -SRCS= allow.c board.c check.c data.c fancy.c init.c odds.c one.c save.c \ - subs.c table.c teach.c ttext1.c ttext2.c tutor.c -DPADD= ${LIBTERMCAP} ${LIBCOMPAT} -LDADD= -ltermcap -lcompat -HIDEGAME=hidegame -NOMAN= noman - -.PATH: ${.CURDIR}/../common_source - -.include "../../Makefile.inc" -.include diff --git a/games/backgammon/teachgammon/data.c b/games/backgammon/teachgammon/data.c deleted file mode 100644 index 4f9151a2aabc..000000000000 --- a/games/backgammon/teachgammon/data.c +++ /dev/null @@ -1,319 +0,0 @@ -/* - * Copyright (c) 1980, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)data.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include "tutor.h" - -int maxmoves = 23; - -const char *const text0[] = { - "To start the game, I roll a 3, and you roll a 1. This means", - "that I get to start first. I move 8-5,6-5 since this makes a", - "new point and helps to trap your back men on 1. You should be", - "able to do a similar move with your roll.", - 0 -}; - -const char *const text1[] = { - "Now you shall see a move using doubles. I just rolled double", - "5's. I will move two men from position 13 to position 3. The", - "notation for this is 13-8,13-8,8-3,8-3. You will also roll dou-", - "bles, but you will be able to make a much stronger move.", - 0 -}; - -const char *const text2[] = { - "Excellent! As you can see, you are beginning to develop a wall", - "which is trapping my men on position 24. Also, moving your back", - "men forward not only improves your board position safely, but it", - "thwarts my effort to make a wall.", - "", - "My roll now is 5 6. Normally, I would use that roll to move from", - "position 24 to position 13 (24-18-13), but your new point prevents", - "that. Instead, I am forced to move from 13 to 2, where my man is", - "open but cannot be hit.", - 0 -}; - -const char *const text3[] = { - "As you can see, although you left a man open, it is a rela-", - "tively safe move to an advantageous position, which might help", - "you make a point later. Only two rolls (4 5 or 5 4) will allow", - "me to hit you. With an unprecedented amount of luck, I happen", - "to roll a 4 5 and hit you as just mentioned.", - 0 -}; - -const char *const text4[] = { - "You're pretty lucky yourself, you know. I follow by rolling 2 3", - "and moving 25-22,24-22, forming a new point.", - 0 -}; - -const char *const text5[] = { - "Not a spectacular move, but a safe one. I follow by rolling 6 1.", - "I decide to use this roll to move 22-16,16-15. It leaves me with", - "one man still open, but the blot is farther back on the board, and", - "would suffer less of a loss by being hit.", - 0 -}; - -const char *const text6[] = { - "By moving your two men from 17 to 20, you lessen my chance of", - "getting my man off the board. In fact, the odds are 5 to 4", - "against me getting off. I roll with the odds and helplessly", - "receive a 3 5.", - 0 -}; - -const char *const text7[] = { - "Note that the blot on 7 cannot be hit unless I get off the bar", - "and have a 1 or a 6 left over, and doing so will leave two of", - "my men open. Also, the blot on 16 cannot be hit at all! With", - "a sigh of frustration, I roll double 6's and remain immobile.", - 0 -}; - -const char *const text8[] = { - "See, you did not get hit and, you got to 'cover up' your open men.", - "Quite an accomplishment. Finally, I get off the bar by rolling", - "6 2 and moving 25-23,23-17.", - 0 -}; - -const char *const text9[] = { - "My venture off the bar did not last long. However, I got lucky", - "and rolled double 1's, allowing me to move 25-24,24-23,15-14,15-14.", - 0 -}; - -const char *const text10[] = { - "You are improving your position greatly and safely, and are well", - "on the way to winning the game. I roll a 6 2 and squeak past", - "your back man. Now the game becomes a race to the finish.", - 0 -}; - -const char *const text11[] = { - "Now that it is merely a race, you are trying to get as many men", - "as possible into the inner table, so you can start removing them.", - "I roll a 3 4 and move my two men farthest back to position 11", - "(15-11,14-11).", - 0 -}; - -const char *const text12[] = { - "The race is still on, and you have seem to be doing all right.", - "I roll 6 1 and move 14-8,13-12.", - 0 -}; - -const char *const text13[] = { - "Notice that you get to remove men the instant you have all of", - "them at your inner table, even if it is the middle of a turn.", - "I roll 1 2 and move 13-11,12-11.", - 0 -}; - -const char *const text14[] = { - "Although you could have removed a man, this move illustrates two", - "points: 1) You never have to remove men, and 2) You should try", - "to spread out your men on your inner table. Since you have one", - "man on each position, you should be able to remove at least two", - "men next turn. I roll 2 5 and move 8-6,11-6.", - 0 -}; - -const char *const text15[] = { - "This time you were able to remove men. I roll 3 4 and move", - "11-7,11-8. The race continues.", - 0 -}; - -const char *const text16[] = { - "More holes are opening up in your inner table, but you are", - "still very much ahead. If we were doubling, you would have", - "doubled long ago. I roll 2 6 and move 8-6,11-5.", - 0 -}; - -const char *const text17[] = { - "It pays to spread out your men. I roll 3 5 and move 7-4,8-3.", - 0 -}; - -const char *const text18[] = { - "You can only remove some men, but you spread out more and", - "more, in order to be able to remove men more efficiently.", - "I roll double 3's, which help, but not that much. I move", - "8-5,3-0,3-0,3-0.", - 0 -}; - -const char *const text19[] = { - "I roll 1 4 and move 5-4,4-0.", - 0 -}; - -const char *const text20[] = { - "You are now nicely spread out to win a game. I roll 5 6 and", - "move 5-0,6-0.", - 0 -}; - -const char *const text21[] = { - "Any minute now. Just a few short steps from victory. I roll", - "2 4 and move 6-4,4-0.", - 0 -}; - -const char *const text22[] = { - "It looks pretty hopeless for me, but I play on, rolling 1 3 and", - "moving 4-3,3-0.", - 0 -}; - -const char *const text23[] = { - "Congratulations! You just won a game of backgammon against the", - "computer! You will now be able to play a game, but remember,", - "when you start playing, that doubling will be enabled, which", - "will add another factor to the game... Good luck!!", - "", - 0 -}; - -const struct situatn test[] = { - { - {0,2,0,0,0,0,-5,0,-3,0,0,0,5,-5,0,0,0,3,0,5,0,0,0,0,-2,0}, - 3, 1, {8,6,0,0}, {5,5,0,0}, 4, 2, text0 - }, - { - {0,2,0,0,0,-2,-4,0,-2,0,0,0,5,-5,0,0,0,2,0,4,0,2,0,0,-2,0}, - 5, 5, {13,13,8,8}, {8,8,3,3}, 6, 6, text1 - }, - { - {0,0,0,-2,0,-2,-4,2,-2,0,0,0,3,-3,0,0,0,2,2,4,0,2,0,0,-2,0}, - 6, 5, {13,8,0,0}, {8,2,0,0}, 1, 2, text2 - }, - { - {0,0,-1,-2,0,-2,-4,2,-2,0,0,0,2,-2,0,1,0,2,2,4,0,2,0,0,-2,0}, - 4, 5, {24,20,0,0}, {20,15,0,0}, 2, 5, text3 - }, - { - {0,0,0,-2,0,-2,-4,3,-2,0,0,0,2,-2,0,-1,0,2,2,4,0,2,0,0,-1,-1}, - 2, 3, {25,24,0,0}, {22,22,0,0}, 4, 1, text4 - }, - { - {0,0,0,-2,0,-2,-4,2,-2,0,0,0,3,-2,0,-1,0,2,2,4,0,2,-2,0,0,0}, - 6, 1, {22,16,0,0}, {16,15,0,0}, 3, 3, text5 - }, - { - {0,0,0,-2,0,-2,-4,2,-2,0,0,0,3,-2,0,-2,0,0,2,2,2,2,2,0,0,-1}, - 3, 5, {0,0,0,0}, {0,0,0,0}, 5, 4, text6 - }, - { - {0,0,0,-2,0,-2,-4,1,-2,0,0,0,3,-2,0,-2,1,0,2,2,2,2,2,0,0,-1}, - 6, 6, {0,0,0,0}, {0,0,0,0}, 3, 6, text7 - }, - { - {0,0,0,-2,0,-2,-4,0,-2,0,0,0,3,-2,0,-2,2,0,2,2,2,2,2,0,0,-1}, - 2, 6, {25,23,0,0}, {23,17,0,0}, 5, 1, text8 - }, - { - {0,0,0,-2,0,-2,-4,0,-2,0,0,0,2,-2,0,-2,2,0,3,2,2,2,2,0,0,-1}, - 1, 1, {25,24,15,15}, {24,23,14,14}, 4, 6, text9 - }, - { - {0,0,0,-2,0,-2,-4,0,-2,0,0,0,0,-2,-2,0,3,0,4,2,2,2,2,-1,0,0}, - 6, 2, {23,17,0,0}, {17,15,0,0}, 1, 3, text10 - }, - { - {0,0,0,-2,0,-2,-4,0,-2,0,0,0,0,-2,-2,-1,2,0,3,4,2,2,2,0,0,0}, - 4, 3, {15,14,0,0}, {11,11,0,0}, 5, 3, text11 - }, - { - {0,0,0,-2,0,-2,-4,0,-2,0,0,-2,0,-2,-1,0,0,0,3,5,2,3,2,0,0,0}, - 6, 1, {14,13,0,0}, {8,12,0,0}, 4, 4, text12 - }, - { - {0,0,0,-2,0,-2,-4,0,-3,0,0,-2,-1,-1,0,0,0,0,0,5,2,2,5,0,0,0}, - 2, 1, {13,12,0,0}, {11,11,0,0}, 2, 1, text13 - }, - { - {0,0,0,-2,0,-2,-4,0,-3,0,0,-4,0,0,0,0,0,0,0,5,2,2,3,1,1,0}, - 2, 5, {8,11,0,0}, {6,6,0,0}, 6, 3, text14 - }, - { - {0,0,0,-2,0,-2,-6,0,-2,0,0,-3,0,0,0,0,0,0,0,4,2,2,2,1,1,0}, - 4, 3, {11,11,0,0}, {7,8,0,0}, 2, 5, text15 - }, - { - {0,0,0,-2,0,-2,-6,-1,-3,0,0,-1,0,0,0,0,0,0,0,4,1,2,2,0,1,0}, - 2, 6, {8,11,0,0}, {6,5,0,0}, 6, 1, text16 - }, - { - {0,0,0,-2,0,-3,-7,-1,-2,0,0,0,0,0,0,0,0,0,0,3,1,2,2,0,0,0}, - 5, 3, {8,7,0,0}, {3,4,0,0}, 5, 2, text17 - }, - { - {0,0,0,-3,-1,-3,-7,0,-1,0,0,0,0,0,0,0,0,0,0,3,0,1,2,1,0,0}, - 3, 3, {8,3,3,3}, {5,0,0,0}, 1, 6, text18 - }, - { - {0,0,0,0,-1,-4,-7,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,2,1,0,0}, - 1, 4, {4,5,0,0}, {0,4,0,0}, 2, 3, text19 - }, - { - {0,0,0,0,-1,-3,-7,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0}, - 5, 6, {6,5,0,0}, {0,0,0,0}, 1, 4, text20 - }, - { - {0,0,0,0,-1,-2,-6,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0}, - 2, 4, {4,6,0,0}, {0,4,0,0}, 6, 2, text21 - }, - { - {0,0,0,0,-1,-2,-5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0}, - 3, 1, {4,3,0,0}, {3,0,0,0}, 4, 3, text22 - }, - { - {0,0,0,0,0,-2,-5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - 0, 0, {0,0,0,0}, {0,0,0,0}, 0, 0, text23 - } -}; diff --git a/games/backgammon/teachgammon/teach.c b/games/backgammon/teachgammon/teach.c deleted file mode 100644 index f8dc85e0177f..000000000000 --- a/games/backgammon/teachgammon/teach.c +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright (c) 1980, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -static const char copyright[] = -"@(#) Copyright (c) 1980, 1993\n\ - The Regents of the University of California. All rights reserved.\n"; -#endif /* not lint */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)teach.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include -#include -#include -#include -#include -#include "back.h" - -extern char *hello[]; -extern char *list[]; -extern char *intro1[]; -extern char *intro2[]; -extern char *moves[]; -extern char *remove[]; -extern char *hits[]; -extern char *endgame[]; -extern char *doubl[]; -extern char *stragy[]; -extern char *prog[]; -extern char *lastch[]; - -const char *const helpm[] = { - "\nEnter a space or newline to roll, or", - " b to display the board", - " d to double", - " q to quit\n", - 0 -}; - -const char *const contin[] = { - "", - 0 -}; - -main (argc,argv) -int argc; -char **argv; - -{ - int i; - - /* revoke privs */ - setgid(getgid()); - - acnt = 1; - signal (SIGINT,getout); - if (gtty (0,&tty) == -1) /* get old tty mode */ - errexit ("teachgammon(gtty)"); - old = tty.sg_flags; -#ifdef V7 - raw = ((noech = old & ~ECHO) | CBREAK); /* set up modes */ -#else - raw = ((noech = old & ~ECHO) | RAW); /* set up modes */ -#endif - ospeed = tty.sg_ospeed; /* for termlib */ - tflag = getcaps (getenv ("TERM")); - getarg (argc, argv); - if (tflag) { - noech &= ~(CRMOD|XTABS); - raw &= ~(CRMOD|XTABS); - clear(); - } - text (hello); - text (list); - i = text (contin); - if (i == 0) - i = 2; - init(); - while (i) - switch (i) { - - case 1: - leave(); - - case 2: - if (i = text(intro1)) - break; - wrboard(); - if (i = text(intro2)) - break; - - case 3: - if (i = text(moves)) - break; - - case 4: - if (i = text(remove)) - break; - - case 5: - if (i = text(hits)) - break; - - case 6: - if (i = text(endgame)) - break; - - case 7: - if (i = text(doubl)) - break; - - case 8: - if (i = text(stragy)) - break; - - case 9: - if (i = text(prog)) - break; - - case 10: - if (i = text(lastch)) - break; - } - tutor(); -} - -leave() { - int i; - if (tflag) - clear(); - else - writec ('\n'); - fixtty(old); - args[0] = strdup("backgammon"); - args[acnt++] = strdup("-n"); - args[acnt] = 0; - execv (EXEC,args); - for (i = 0; i < acnt; i++) - free (args[i]); - writel ("Help! Backgammon program is missing\007!!\n"); - exit (-1); -} diff --git a/games/backgammon/teachgammon/ttext1.c b/games/backgammon/teachgammon/ttext1.c deleted file mode 100644 index 89cb306e626d..000000000000 --- a/games/backgammon/teachgammon/ttext1.c +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Copyright (c) 1980, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)ttext1.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include "back.h" - -const char *opts = " QIMRHEDSPT"; -const char *prompt = "-->"; - -const char *const list[] = { - "\n\n\tI\tIntroduction to Backgammon", - "\tM\tMoves and Points", - "\tR\tRemoving Men from the Board", - "\tH\tHitting Blots", - "\tE\tEnding the Game and Scoring", - "\tD\tDoubling", - "\tS\tStrategy", - "\tP\tThe Program and How to Use It", - "\nalso, you can type:", - "\t?\tto get this list", - "\tQ\tto go start playing", - "\tT\tto go straight to the tutorial", - 0 -}; - -const char *const hello[] = { - "\n\032 These rules consist of text describing how to play Backgammon", - "followed by a tutorial session where you play a practice game", - "against the computer. When using this program, think carefuly", - "before typing, since it reacts as soon as you type something. In", - "addition, the program presents text output, such as these rules,", - "in small blocks that will not roll off the top of the screen.", - "Frequently, you will see the characters '-->' indicating that the", - "program is waiting for you to finish reading, and will continue", - "printing when you type a space or newline. Also, the rules are", - "divided into sections, and although you should read them in or-", - "der, you can go directly to any of them by typing one of the fol-", - "lowing letters:", - "(Remember to hit a space or a newline to continue.)", - "", - 0 -}; - -const char *const intro1[] = { - "\nIntroduction:", - "\n Backgammon is a game involving the skill of two players and", - "the luck of two dice. There are two players, red and white, and", - "each player gets fifteen men. The object of the game is to re-", - "move all your men from the board before the opponent does. The", - "board consists of twenty-four positions, a 'bar' and a 'home' for", - "each player. It looks like this:", - "", - 0}; - -const char *const intro2[] = { - "", - "\n Although not indicated on the board, the players' homes are", - "located just to the right of the board. A player's men are placed", - "there when they are removed from the board. The board you just", - "saw was in it's initial position. All games start with the board", - "looking like this. Notice that red's pieces are represented by the", - "letter 'r' and white's pieces are represented by the letter 'w'.", - "Also, a position may have zero or more pieces on it, e.g. posi-", - "tion 12 has five red pieces on it, while position 11 does not", - "have any pieces of either color.", - "", - 0}; - -const char *const moves[] = { - "\nMoves and Points:", - "\n Moves are made along the positions on the board according to", - "their numbers. Red moves in the positive direction (clockwise", - "from 1 to 24), and white moves in the negative direction (coun-", - "terclockwise from 24 to 1).", - "\n A turn consists of rolling the dice, and moving the number of", - "positions indicated on each die. The two numbers can be used to", - "move one man the sum of the two rolls, or two men the number on", - "each individual die. For example, if red rolled 6 3 at the start", - "of the game, he might move a man from 1 to 7 to 10, using both", - "dice for one man, or he might move two men from position 12, one", - "to 15 and one to 18. (Red did not have to choose two men start-", - "ing from the same position.) In addition, doubles are treated", - "specially in backgammon. When a player rolls doubles, he gets to", - "move as if he had four dice instead of two. For instance, if you", - "rolled double 2's, you could move one man eight positions, four", - "men two positions each, or any permutation in between.", - "", - "\n However, there are certain limitations, called 'points.' A", - "player has a point when he has two or more men on the same posi-", - "tion. This gives him custody of that position, and his opponent", - "cannot place his men there, even if passing through on the way to", - "another position. When a player has six points in a row, it is", - "called a 'wall,' since any of his opponent's men behind the wall", - "cannot pass it and are trapped, at least for the moment. Notice", - "that this could mean that a player could not use part or all of", - "his roll. However, he must use as much of his roll as possible.", - "", - 0}; - -const char *const remove[] = { - "\nRemoving Men from the Board:", - "\n The most important part of the game is removing men, since", - "that is how you win the game. Once a man is removed, he stays", - "off the board for the duration of the game. However, a player", - "cannot remove men until all his men are on his 'inner table,' or", - "the last six positions of the board (19-24 for red, 6-1 for", - "white).", - "\n To get off the board, a player must roll the exact number to", - "get his man one position past the last position on the board, or", - "his 'home.' Hence, if red wanted to remove a man from position", - "23, he would have to roll a 2, anything else would be used for", - "another man, or for another purpose. However, there is one ex-", - "ception. If the player rolling has no men far enough to move the", - "roll made, he may move his farthest man off the board. For exam-", - "ple, if red's farthest man back was on position 21, he could re-", - "move men from that position if he rolled a 5 or a 6, as well as a", - "4. Since he does not have men on 20 (where he could use a 5) or", - "on 19 (where he could use a 6), he can use these rolls for posi-", - "tion 21. A player never has to remove men, but he must make as", - "many moves as possible.", - "", - 0}; - -const char *const hits[] = { - "\nHitting Blots:", - "\n Although two men on a position form an impenetrable point, a", - "lone man is not so secure. Such a man is called a 'blot' and has", - "the potential of getting hit by an opposing man. When a player's", - "blot is hit, he is placed on the bar, and the first thing that", - "player must do is move the man off the bar. Such moves are", - "counted as if the bar is one position behind the first position", - "on the board. Thus if red has a man on the bar and rolls 2 3, he", - "must move the man on the bar to position 2 or 3 before moving any", - "other man. If white had points on positions 2 and 3, then red", - "would forfeit his turn. Being on the bar is a very bad position,", - "for often a player can lose many turns trying to move off the", - "bar, as well as being set back the full distance of the board.", - "", - 0}; - -const char *const endgame[] = { - "\nEnding the Game and Scoring:", - "\n Winning a game usually wins one point, the normal value of a", - "game. However, if the losing player has not removed any men yet,", - "then the winning player wins double the game value, called a", - "'gammon.' If the losing player has a player on the bar or on the", - "winner's inner table, then the winner gets triple the game value,", - "which is called a 'backgammon.' (So that's where the name comes", - "from!)", - "", - 0}; diff --git a/games/backgammon/teachgammon/ttext2.c b/games/backgammon/teachgammon/ttext2.c deleted file mode 100644 index d64659ef3e06..000000000000 --- a/games/backgammon/teachgammon/ttext2.c +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Copyright (c) 1980, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)ttext2.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include "back.h" - -extern const char *const list[]; -char *prompt, *opts; - -const char *const doubl[] = { - "\nDoubling:", - "\n If a player thinks he is in a good position, he may double the", - "value of the game. However, his opponent may not accept the pro-", - "posal and forfeit the game before the price gets too high. A", - "player must double before he rolls, and once his double has been", - "accepted, he cannot double again, until his opponent has doubled.", - "Thus, unless the game swings back and forth in advantage between", - "the two players a great deal, the value of the game should be", - "low. At any rate, the value of the game will never go above 64,", - "or six doubles. However, if a player wins a backgammon at 64", - "points, he wins 192 points!", - "", - 0}; - -const char *const stragy[] = { - "\nStrategy:", - "\n Some general hints when playing: Try not to leave men open", - "unless absolutely necessary. Also, it is good to make as many", - "points as possible. Often, two men from different positions can", - "be brought together to form a new point. Although walls (six", - "points in a row) are difficult to form, many points nestled close-", - "ly together produce a formidable barrier. Also, while it is good", - "to move back men forward, doing so lessens the opportunity for you", - "to hit men. Finally, remember that once the two player's have", - "passed each other on the board, there is no chance of either team", - "being hit, so the game reduces to a race off the board. Addi-", - "tional hints on strategy are presented in the practice game.", - "", - 0}; - -const char *const prog[] = { - "\nThe Program and How It Works:", - "\n A general rule of thumb is when you don't know what to do,", - "type a question mark, and you should get some help. When it is", - "your turn, only your color will be printed out, with nothing", - "after it. You may double by typing a 'd', but if you type a", - "space or newline, you will get your roll. (Remember, you must", - "double before you roll.) Also, typing a 'r' will reprint the", - "board, and a 'q' will quit the game. The program will type", - "'Move:' when it wants your move, and you may indicate each die's", - "move with -, where is the starting position and is", - "the finishing position, or / where is the roll made.", - "-- is short for -,- and / is", - "short for /,/. Moves may be separated by a comma", - "or a space.", - "", - "\n While typing, any input which does not make sense will not be", - "echoed, and a bell will sound instead. Also, backspacing and", - "killing lines will echo differently than normal. You may examine", - "the board by typing a 'r' if you have made a partial move, or be-", - "fore you type a newline, to see what the board looks like. You", - "must end your move with a newline. If you cannot double, your", - "roll will always be printed, and you will not be given the oppor-", - "tunity to double. Home and bar are represented by the appropri-", - "ate number, 0 or 25 as the case may be, or by the letters 'h' or", - "'b' as appropriate. You may also type 'r' or 'q' when the program", - "types 'Move:', which has the same effect as above. Finally, you", - "will get to decide if you want to play red or white (or both if you", - "want to play a friend) at the beginning of the session, and you", - "will not get to change your mind later, since the computer keeps", - "score.", - "", - 0}; - -const char *const lastch[] = { - "\nTutorial (Practice Game):", - "\n This tutorial, for simplicity's sake, will let you play one", - "predetermined game. All the rolls have been pre-arranged, and", - "only one response will let you advance to the next move.", - "Although a given roll will may have several legal moves, the tu-", - "torial will only accept one (not including the same moves in a", - "different order), claiming that that move is 'best.' Obviously,", - "a subjective statement. At any rate, be patient with it and have", - "fun learning about backgammon. Also, to speed things up a lit-", - "tle, doubling will not take place in the tutorial, so you will", - "never get that opportunity, and quitting only leaves the tutori-", - "al, not the game. You will still be able to play backgammon", - "after quitting.", - "\n This is your last chance to look over the rules before the tu-", - "torial starts.", - "", - 0}; - -int -text (txt) -const char *const *txt; - -{ - const char *const *begin; - const char *a; - char b; - const char *c; - int i; - - fixtty (noech); - begin = txt; - while (*txt) { - a = *(txt++); - if (*a != '\0') { - c = a; - for (i = 0; *(c++) != '\0'; i--); - writel (a); - writec ('\n'); - } else { - fixtty (raw); - writel (prompt); - for (;;) { - if ((b = readc()) == '?') { - if (tflag) { - if (begscr) { - curmove (18,0); - clend(); - } else - clear(); - } else - writec ('\n'); - text (list); - writel (prompt); - continue; - } - i = 0; - if (b == '\n') - break; - while (i < 11) { - if (b == opts[i]) - break; - i++; - } - if (i == 11) - writec ('\007'); - else - break; - } - if (tflag) { - if (begscr) { - curmove (18,0); - clend(); - } else - clear(); - } else - writec ('\n'); - if (i) - return(i); - fixtty (noech); - if (tflag) - curmove (curr,0); - begin = txt; - } - } - fixtty (raw); - return (0); -} diff --git a/games/backgammon/teachgammon/tutor.c b/games/backgammon/teachgammon/tutor.c deleted file mode 100644 index 68124ced1ae0..000000000000 --- a/games/backgammon/teachgammon/tutor.c +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright (c) 1980, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)tutor.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include "back.h" -#include "tutor.h" - -extern int maxmoves; -extern const char *const finis[]; - -extern const struct situatn test[]; - -static const char better[] = "That is a legal move, but there is a better one.\n"; - -void -tutor () { - int i, j; - - i = 0; - begscr = 18; - cturn = -1; - home = 0; - bar = 25; - inptr = &in[0]; - inopp = &in[1]; - offptr = &off[0]; - offopp = &off[1]; - Colorptr = &color[0]; - colorptr = &color[2]; - colen = 5; - wrboard(); - - while (1) { - if (! brdeq(test[i].brd,board)) { - if (tflag && curr == 23) - curmove (18,0); - writel (better); - nexturn(); - movback (mvlim); - if (tflag) { - refresh(); - clrest (); - } - if ((! tflag) || curr == 19) { - proll(); - writec ('\t'); - } - else - curmove (curr > 19? curr-2: curr+4,25); - getmove(); - if (cturn == 0) - leave(); - continue; - } - if (tflag) - curmove (18,0); - text (*test[i].com); - if (! tflag) - writec ('\n'); - if (i == maxmoves) - break; - D0 = test[i].roll1; - D1 = test[i].roll2; - d0 = 0; - mvlim = 0; - for (j = 0; j < 4; j++) { - if (test[i].mp[j] == test[i].mg[j]) - break; - p[j] = test[i].mp[j]; - g[j] = test[i].mg[j]; - mvlim++; - } - if (mvlim) - for (j = 0; j < mvlim; j++) - if (makmove(j)) - writel ("AARGH!!!\n"); - if (tflag) - refresh(); - nexturn(); - D0 = test[i].new1; - D1 = test[i].new2; - d0 = 0; - i++; - mvlim = movallow(); - if (mvlim) { - if (tflag) - clrest(); - proll(); - writec('\t'); - getmove(); - if (tflag) - refresh(); - if (cturn == 0) - leave(); - } - } - leave(); -} - -clrest () { - int r, c, j; - - r = curr; - c = curc; - for (j = r+1; j < 24; j++) { - curmove (j,0); - cline(); - } - curmove (r,c); -} - -int -brdeq (b1,b2) -const int *b1, *b2; - -{ - const int *e; - - e = b1+26; - while (b1 < e) - if (*b1++ != *b2++) - return(0); - return(1); -} diff --git a/games/backgammon/teachgammon/tutor.h b/games/backgammon/teachgammon/tutor.h deleted file mode 100644 index 8b20e3367f3b..000000000000 --- a/games/backgammon/teachgammon/tutor.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 1980, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)tutor.h 8.1 (Berkeley) 5/31/93 - */ - -struct situatn { - int brd[26]; - int roll1; - int roll2; - int mp[4]; - int mg[4]; - int new1; - int new2; - const char *const (*com[8]); -}; - -extern const char *const doubl[]; -extern const char *const endgame[]; -extern const char *const finis[]; -extern const char *const hello[]; -extern const char *const hits[]; -extern const char *const intro1[]; -extern const char *const intro2[]; -extern const char *const lastch[]; -extern const char *const list[]; -extern int maxmoves; -extern const char *const moves[]; -extern const char *const opts; -extern const char *const prog[]; -extern const char *const prompt; -extern const char *const removepiece[]; -extern const char *const stragy[]; -extern const struct situatn test[]; diff --git a/games/battlestar/Makefile b/games/battlestar/Makefile deleted file mode 100644 index d4f86316f642..000000000000 --- a/games/battlestar/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -# @(#)Makefile 8.1 (Berkeley) 5/31/93 -# $FreeBSD$ - -PROG= battlestar -SRCS= battlestar.c com1.c com2.c com3.c com4.c com5.c com6.c com7.c \ - init.c cypher.c getcom.c parse.c room.c save.c fly.c misc.c \ - globals.c dayfile.c nightfile.c dayobjs.c nightobjs.c words.c -MAN= battlestar.6 -DPADD= ${LIBCURSES} ${LIBCOMPAT} -LDADD= -lcurses -lcompat -HIDEGAME=hidegame -#CFLAGS+= -Wall -W - -beforeinstall: -.if !exists(${DESTDIR}/var/games/battlestar.log) - ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 664 /dev/null \ - ${DESTDIR}/var/games/battlestar.log -.endif - -.include diff --git a/games/battlestar/battlestar.6 b/games/battlestar/battlestar.6 deleted file mode 100644 index 72f71bfa600c..000000000000 --- a/games/battlestar/battlestar.6 +++ /dev/null @@ -1,165 +0,0 @@ -.\" Copyright (c) 1983, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" 3. All advertising materials mentioning features or use of this software -.\" must display the following acknowledgement: -.\" This product includes software developed by the University of -.\" California, Berkeley and its contributors. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" @(#)battlestar.6 8.1 (Berkeley) 5/31/93 -.\" $FreeBSD$ -.\" -.TH BATTLESTAR 6 "May 31, 1993 -.UC 6 -.SH NAME -battlestar \- a tropical adventure game -.SH SYNOPSIS -.B battlestar -[ -.B -r (recover a saved game) -] -.br -.fi -.SH DESCRIPTION -.I Battlestar -is an adventure game in the classic style. However, it's slightly less -of a -puzzle and more a game of exploration. There are a few magical words -in the game, but on the whole, simple English -should suffice to make one's desires understandable to the parser. -.SH "THE SETTING" -In the days before the darkness came, when battlestars ruled the -heavens... -.br -.nf - - Three He made and gave them to His daughters, - Beautiful nymphs, the goddesses of the waters. - One to bring good luck and simple feats of wonder, - Two to wash the lands and churn the waves asunder, - Three to rule the world and purge the skies with thunder. - -.fi -.PP -In those times great wizards were known and their powers were beyond -belief. They could take any object from thin air, and, uttering the -word `su' could disappear. -.PP -In those times men were known for their lust of gold and desire to -wear fine weapons. Swords and coats of mail were fashioned that could -withstand a laser blast. -.PP -But when the darkness fell, the rightful reigns were toppled. Swords -and helms and heads of state went rolling across the grass. The entire -fleet of battlestars was reduced to a single ship. -.SH "SAMPLE COMMANDS" -.nf - - take --- take an object - drop --- drop an object - - wear --- wear an object you are holding - draw --- carry an object you are wearing - - puton --- take an object and wear it - take off -- draw an object and drop it - - throw - - ! - -.fi -.SH "IMPLIED OBJECTS" -.nf - - >-: take watermelon - watermelon: - Taken. - >-: eat - watermelon: - Eaten. - >-: take knife and sword and apple, drop all - knife: - Taken. - broadsword: - Taken. - apple: - Taken. - knife: - Dropped. - broadsword: - Dropped. - apple: - Dropped. - >-: get - knife: - Taken. - -.fi -.PP -Notice that the "shadow" of the next word stays around if you -want to take advantage of it. That is, saying "take knife" and then -"drop" -will drop the knife you just took. -.SH "SCORE & INVEN" -The two commands "score" and "inven" will print out your current status -in -the game. -.SH "SAVING A GAME" -The command "save" will save your game in a file called "Bstar." You -can -recover a saved game by using the "-r" option when you start up the -game. -.SH DIRECTIONS -The compass directions N, S, E, and W can be used if you have a compass. -If you don't have a compass, you'll have to say R, L, A, or B, which -stand for -Right, Left, Ahead, and Back. Directions printed in room descriptions -are -always printed in R, L, A, & B relative directions. -.SH HISTORY -I wrote Battlestar in 1979 in order to experiment with the niceties of -the C Language. -Most interesting things that happen in the game are hardwired into the -code, so don't -send me any hate mail about it! Instead, enjoy art for art's sake! -.SH AUTHOR -David Riggle -.SH "INSPIRATION & ASSISTANCE" -Chris Guthrie -.br -Peter Da Silva -.br -Kevin Brown -.br -Edward Wang -.br -Ken Arnold & Company -.SH BUGS -Countless. -.SH "FAN MAIL" -Send to edward%ucbarpa@Berkeley.arpa, chris%ucbcory@berkeley.arpa, -riggle.pa@xerox.arpa. diff --git a/games/battlestar/battlestar.c b/games/battlestar/battlestar.c deleted file mode 100644 index e4b9735f1a85..000000000000 --- a/games/battlestar/battlestar.c +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 1983, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -static const char copyright[] = -"@(#) Copyright (c) 1983, 1993\n\ - The Regents of the University of California. All rights reserved.\n"; -#endif /* not lint */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)battlestar.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -/* - * Battlestar - a stellar-tropical adventure game - * - * Originally written by His Lordship, Admiral David W. Horatio Riggle, - * on the Cory PDP-11/70, University of California, Berkeley. - */ - -#include "externs.h" - -int -main(argc,argv) -int argc; -char **argv; -{ - char mainbuf[LINELENGTH]; - char *next; - - open_score_file(); - - /* revoke privs. */ - setgid(getgid()); - - initialize(argc < 2 || strcmp(argv[1], "-r")); -start: - news(); - beenthere[position]++; - if (notes[LAUNCHED]) - crash(); /* decrements fuel & crash */ - if (matchlight) { - puts("Your match splutters out."); - matchlight = 0; - } - if (!notes[CANTSEE] || testbit(inven,LAMPON) || - testbit(location[position].objects, LAMPON)) { - writedes(); - printobjs(); - } else - puts("It's too dark to see anything in here!"); - whichway(location[position]); -run: - next = getcom(mainbuf, sizeof mainbuf, ">-: ", - "Please type in something."); - for (wordcount = 0; next && wordcount < 20; wordcount++) - next = getword(next, words[wordcount], -1); - parse(); - switch (cypher()) { - case -1: - goto run; - case 0: - goto start; - default: - exit(1); /* Shouldn't happen */ - } - exit(1); -} diff --git a/games/battlestar/com1.c b/games/battlestar/com1.c deleted file mode 100644 index 4e054f261316..000000000000 --- a/games/battlestar/com1.c +++ /dev/null @@ -1,262 +0,0 @@ -/* - * Copyright (c) 1983, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)com1.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include "externs.h" - -void convert(int); - -int -battlestar_move(thataway, token) -int thataway, token; -{ - wordnumber++; - if ((!notes[CANTMOVE] && !notes[LAUNCHED]) || - ((testbit(location[position].objects, LAND) || fuel > 0) && - notes[LAUNCHED])) - if (thataway) { - position = thataway; - newway(token); - gtime++; - } - else { - puts("You can't go this way."); - newway(token); - whichway(location[position]); - return(0); - } - else if (notes[CANTMOVE] && !notes[LAUNCHED]) - puts("You aren't able to move; you better drop something."); - else - puts("You are out of fuel; now you will rot in space forever!"); - return(1); -} - -void -convert(tothis) /* Converts day to night and vice versa. */ -int tothis; /* Day objects are permanent. Night objects are added*/ -{ /* at dusk, and subtracted at dawn. */ - const struct objs *p; - int i, j; - - if (tothis == TONIGHT) { - for (i = 1; i <= NUMOFROOMS; i++) - for (j = 0; j < NUMOFWORDS; j++) - nightfile[i].objects[j] = dayfile[i].objects[j]; - for (p = nightobjs; p->room != 0; p++) - setbit(nightfile[p->room].objects, p->obj); - location = nightfile; - } else { - for (i = 1; i <= NUMOFROOMS; i++) - for (j = 0; j < NUMOFWORDS; j++) - dayfile[i].objects[j] = nightfile[i].objects[j]; - for (p = nightobjs; p->room != 0; p++) - clearbit(dayfile[p->room].objects, p->obj); - location = dayfile; - } -} - -void -news() -{ - int n; - int hurt; - - if (gtime > 30 && position < 32){ - puts("An explosion of shuddering magnitude splinters bulkheads and"); - puts("ruptures the battlestar's hull. You are sucked out into the"); - puts("frozen void of space and killed."); - die(0); - } - if (gtime > 20 && position < 32) - puts("Explosions rock the battlestar."); - if (gtime > snooze){ - puts("You drop from exhaustion..."); - zzz(); - } - if (gtime > snooze - 5) - puts("You're getting tired."); - if (gtime > (rythmn + CYCLE)) { - if (location == nightfile) { - convert(TODAY); - if (OUTSIDE && gtime - rythmn - CYCLE < 10) { - puts("Dew lit sunbeams stretch out from a watery sunrise and herald the dawn."); - puts("You awake from a misty dream-world into stark reality."); - puts("It is day."); - } - } else { - convert(TONIGHT); - clearbit(location[POOLS].objects, BATHGOD); - if (OUTSIDE && gtime - rythmn - CYCLE < 10) { - puts("The dying sun sinks into the ocean, leaving a blood stained sunset."); - puts("The sky slowly fades from orange to violet to black. A few stars"); - puts("flicker on, and it is night."); - puts("The world seems completly different at night."); - } - } - rythmn = gtime - gtime % CYCLE; - } - if (!wiz && !tempwiz) - if ((testbit(inven,TALISMAN) || testbit(wear,TALISMAN)) && (testbit(inven,MEDALION) || testbit(wear,MEDALION)) && (testbit(inven,AMULET) || testbit(wear,AMULET))){ - tempwiz = 1; - puts("The three amulets glow and reenforce each other in power.\nYou are now a wizard."); - } - if (testbit(location[position].objects,ELF)){ - printf("%s\n",objdes[ELF]); - fight(ELF,rnd(30)); - } - if (testbit(location[position].objects,DARK)){ - printf("%s\n",objdes[DARK]); - fight(DARK,100); - } - if (testbit(location[position].objects,WOODSMAN)){ - printf("%s\n",objdes[WOODSMAN]); - fight(WOODSMAN,50); - } - switch(position){ - - case 267: - case 257: /* entering a cave */ - case 274: - case 246: - notes[CANTSEE] = 1; - break; - case 160: - case 216: /* leaving a cave */ - case 230: - case 231: - case 232: - notes[CANTSEE] = 0; - break; - } - if (testbit(location[position].objects, GIRL)) - meetgirl = 1; - if (meetgirl && CYCLE * 1.5 - gtime < 10){ - setbit(location[GARDEN].objects,GIRLTALK); - setbit(location[GARDEN].objects,LAMPON); - setbit(location[GARDEN].objects,ROPE); - } - if (position == DOCK && (beenthere[position] || gtime > CYCLE)){ - clearbit(location[DOCK].objects, GIRL); - clearbit(location[DOCK].objects,MAN); - } - if (meetgirl && gtime - CYCLE * 1.5 > 10){ - clearbit(location[GARDEN].objects,GIRLTALK); - clearbit(location[GARDEN].objects,LAMPON); - clearbit(location[GARDEN].objects,ROPE); - meetgirl = 0; - } - if (testbit(location[position].objects,CYLON)){ - puts("Oh my God, you're being shot at by an alien spacecraft!"); - printf("The targeting computer says we have %d seconds to attack!\n",gclock); - fflush(stdout); - sleep(1); - if (!visual()){ - hurt = rnd(NUMOFINJURIES); - injuries[hurt] = 1; - puts("Laser blasts sear the cockpit, and the alien veers off in a victory roll."); - puts("The viper shudders under a terrible explosion."); - printf("I'm afraid you have suffered %s.\n", ouch[hurt]); - } - else - clearbit(location[position].objects,CYLON); - } - if (injuries[SKULL] && injuries[INCISE] && injuries[NECK]){ - puts("I'm afraid you have suffered fatal injuries."); - die(0); - } - for (n=0; n < NUMOFINJURIES; n++) - if (injuries[n] == 1){ - injuries[n] = 2; - if (WEIGHT > 5) - WEIGHT -= 5; - else - WEIGHT = 0; - } - if (injuries[ARM] == 2){ - CUMBER -= 5; - injuries[ARM]++; - } - if (injuries[RIBS] == 2){ - CUMBER -= 2; - injuries[RIBS]++; - } - if (injuries[SPINE] == 2){ - WEIGHT = 0; - injuries[SPINE]++; - } - if (carrying > WEIGHT || encumber > CUMBER) - notes[CANTMOVE] = 1; - else - notes[CANTMOVE] = 0; -} - -void -crash() -{ - int hurt1,hurt2; - - fuel--; - if (!location[position].flyhere || (testbit(location[position].objects,LAND) && fuel <= 0)){ - if (!location[position].flyhere) - puts("You're flying too low. We're going to crash!"); - else{ - puts("You're out of fuel. We'll have to crash land!"); - if (!location[position].down){ - puts("Your viper strikes the ground and explodes into firey fragments."); - puts("Thick black smoke billows up from the wreckage."); - die(0); - } - position = location[position].down; - } - notes[LAUNCHED] = 0; - setbit(location[position].objects,CRASH); - gtime += rnd(CYCLE/4); - puts("The viper explodes into the ground and you lose consciousness..."); - zzz(); - hurt1 = rnd(NUMOFINJURIES - 2) + 2; - hurt2 = rnd(NUMOFINJURIES - 2) + 2; - injuries[hurt1] = 1; - injuries[hurt2] = 1; - injuries[0] = 1; /* abrasions */ - injuries[1] = 1; /* lacerations */ - printf("I'm afraid you have suffered %s and %s.\n",ouch[hurt1],ouch[hurt2]); - } -} diff --git a/games/battlestar/com2.c b/games/battlestar/com2.c deleted file mode 100644 index d41d603778a6..000000000000 --- a/games/battlestar/com2.c +++ /dev/null @@ -1,307 +0,0 @@ -/* - * Copyright (c) 1983, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)com2.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include "externs.h" - -int -wearit() /* synonyms = {sheathe, sheath} */ -{ - int n; - int firstnumber, value; - - firstnumber = wordnumber; - while(wordtype[++wordnumber] == ADJS); - while(wordnumber <= wordcount){ - value = wordvalue[wordnumber]; - if (value == -1) { - puts("Wear what?"); - return (firstnumber); - } - for (n=0; objsht[value][n]; n++); - switch(value){ - default: - printf("You can't wear%s%s!\n",(objsht[value][n-1] == 's' ? " " : " a "),objsht[value]); - return(firstnumber); - - case KNIFE: - /* case SHIRT: */ - case ROBE: - case LEVIS: /* wearable things */ - case SWORD: - case MAIL: - case HELM: - case SHOES: - case PAJAMAS: - case COMPASS: - case LASER: - case AMULET: - case TALISMAN: - case MEDALION: - case ROPE: - case RING: - case BRACELET: - case GRENADE: - - if (testbit(inven,value)){ - clearbit(inven,value); - setbit(wear,value); - carrying -= objwt[value]; - encumber -= objcumber[value]; - gtime++; - printf("You are now wearing %s %s.\n",(objsht[value][n-1] == 's' ? "the" : "a"), objsht[value]); - } - else if (testbit(wear,value)) - printf("You are already wearing the %s.\n", objsht[value]); - else - printf("You aren't holding the %s.\n", objsht[value]); - if (wordnumber < wordcount - 1 && wordvalue[++wordnumber] == AND) - wordnumber++; - else - return(firstnumber); - } /* end switch */ - } /* end while */ - puts("Don't be ridiculous."); - return(firstnumber); -} - -int -put() /* synonyms = {buckle, strap, tie} */ -{ - if (wordvalue[wordnumber + 1] == ON){ - wordvalue[++wordnumber] = PUTON; - return(cypher()); - } - if (wordvalue[wordnumber + 1] == DOWN){ - wordvalue[++wordnumber] = DROP; - return(cypher()); - } - puts("I don't understand what you want to put."); - return(-1); - -} - -int -draw() /* synonyms = {pull, carry} */ -{ - return(take(wear)); -} - -int -use() -{ - while (wordtype[++wordnumber] == ADJS && wordnumber < wordcount); - if (wordvalue[wordnumber] == AMULET && testbit(inven,AMULET) && position != FINAL){ - puts("The amulet begins to glow."); - if (testbit(inven,MEDALION)){ - puts("The medallion comes to life too."); - if (position == 114){ - location[position].down = 160; - whichway(location[position]); - puts("The waves subside and it is possible to descend to the sea cave now."); - gtime++; - return(-1); - } - } - puts("A light mist falls over your eyes and the sound of purling water trickles in"); - puts("your ears. When the mist lifts you are standing beside a cool stream."); - if (position == 229) - position = 224; - else - position = 229; - gtime++; - notes[CANTSEE] = 0; - return(0); - } - else if (position == FINAL) - puts("The amulet won't work in here."); - else if (wordvalue[wordnumber] == COMPASS && testbit(inven,COMPASS)) - printf("Your compass points %s.\n",truedirec(NORTH,'-')); - else if (wordvalue[wordnumber] == COMPASS) - puts("You aren't holding the compass."); - else if (wordvalue[wordnumber] == AMULET) - puts("You aren't holding the amulet."); - else - puts("There is no apparent use."); - return(-1); -} - -void -murder() -{ - int n; - - for (n=0; !((n == SWORD || n == KNIFE || n == TWO_HANDED || n == MACE || n == CLEAVER || n == BROAD || n == CHAIN || n == SHOVEL || n == HALBERD) && testbit(inven,n)) && n < NUMOFOBJECTS; n++); - if (n == NUMOFOBJECTS) - puts("You don't have suitable weapons to kill."); - else { - printf("Your %s should do the trick.\n",objsht[n]); - while (wordtype[++wordnumber] == ADJS); - switch(wordvalue[wordnumber]){ - - case NORMGOD: - if (testbit(location[position].objects,BATHGOD)){ - puts("The goddess's head slices off. Her corpse floats in the water."); - clearbit(location[position].objects,BATHGOD); - setbit(location[position].objects,DEADGOD); - power += 5; - notes[JINXED]++; - } else if (testbit(location[position].objects,NORMGOD)){ - puts("The goddess pleads but you strike her mercilessly. Her broken body lies in a\npool of blood."); - clearbit(location[position].objects,NORMGOD); - setbit(location[position].objects,DEADGOD); - power += 5; - notes[JINXED]++; - if (wintime) - live(); - } else puts("I dont see her anywhere."); - break; - case TIMER: - if (testbit(location[position].objects,TIMER)){ - puts("The old man offers no resistance."); - clearbit(location[position].objects,TIMER); - setbit(location[position].objects,DEADTIME); - power++; - notes[JINXED]++; - } else puts("Who?"); - break; - case NATIVE: - if (testbit(location[position].objects,NATIVE)){ - puts("The girl screams as you cut her body to shreds. She is dead."); - clearbit(location[position].objects,NATIVE); - setbit(location[position].objects,DEADNATIVE); - power += 5; - notes[JINXED]++; - } else puts("What girl?"); - break; - case MAN: - if (testbit(location[position].objects,MAN)){ - puts("You strike him to the ground, and he coughs up blood."); - puts("Your fantasy is over."); - die(0); - } - case -1: - puts("Kill what?"); - break; - - default: - if (wordtype[wordnumber] != NOUNS) - puts("Kill what?"); - else - printf("You can't kill the %s!\n",objsht[wordvalue[wordnumber]]); - } - } -} - -void -ravage() -{ - while (wordtype[++wordnumber] != NOUNS && wordnumber <= wordcount); - if (wordtype[wordnumber] == NOUNS && testbit(location[position].objects,wordvalue[wordnumber])){ - gtime++; - switch(wordvalue[wordnumber]){ - case NORMGOD: - puts("You attack the goddess, and she screams as you beat her. She falls down"); - puts("crying and tries to hold her torn and bloodied dress around her."); - power += 5; - pleasure += 8; - ego -= 10; - wordnumber--; - godready = -30000; - murder(); - bs_win = -30000; - break; - case NATIVE: - puts("The girl tries to run, but you catch her and throw her down. Her face is"); - puts("bleeding, and she screams as you tear off her clothes."); - power += 3; - pleasure += 5; - ego -= 10; - wordnumber--; - murder(); - if (rnd(100) < 50){ - puts("Her screams have attracted attention. I think we are surrounded."); - setbit(location[ahead].objects,WOODSMAN); - setbit(location[ahead].objects,DEADWOOD); - setbit(location[ahead].objects,MALLET); - setbit(location[back].objects,WOODSMAN); - setbit(location[back].objects,DEADWOOD); - setbit(location[back].objects,MALLET); - setbit(location[left].objects,WOODSMAN); - setbit(location[left].objects,DEADWOOD); - setbit(location[left].objects,MALLET); - setbit(location[right].objects,WOODSMAN); - setbit(location[right].objects,DEADWOOD); - setbit(location[right].objects,MALLET); - } - break; - default: - puts("You are perverted."); - } - } - else - puts("Who?"); -} - -int -follow() -{ - if (followfight == gtime){ - puts("The Dark Lord leaps away and runs down secret tunnels and corridors."); - puts("You chase him through the darkness and splash in pools of water."); - puts("You have cornered him. His laser sword extends as he steps forward."); - position = FINAL; - fight(DARK,75); - setbit(location[position].objects,TALISMAN); - setbit(location[position].objects,AMULET); - return(0); - } - else if (followgod == gtime){ - puts("The goddess leads you down a steamy tunnel and into a high, wide chamber."); - puts("She sits down on a throne."); - position = 268; - setbit(location[position].objects,NORMGOD); - notes[CANTSEE] = 1; - return(0); - } - else - puts("There is no one to follow."); - return(-1); -} diff --git a/games/battlestar/com3.c b/games/battlestar/com3.c deleted file mode 100644 index 22f8e0d8be07..000000000000 --- a/games/battlestar/com3.c +++ /dev/null @@ -1,321 +0,0 @@ -/* - * Copyright (c) 1983, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)com3.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include "externs.h" - -void -dig() -{ - if (testbit(inven,SHOVEL)){ - puts("OK"); - gtime++; - switch(position){ - case 144: /* copse near beach */ - if (!notes[DUG]){ - setbit(location[position].objects,DEADWOOD); - setbit(location[position].objects,COMPASS); - setbit(location[position].objects,KNIFE); - setbit(location[position].objects,MACE); - notes[DUG] = 1; - } - break; - - default: - puts("Nothing happens."); - } - } - else - puts("You don't have a shovel."); -} - -int -jump() -{ - int n; - - switch(position){ - default: - puts("Nothing happens."); - return(-1); - - case 242: - position = 133; - break; - case 214: - case 215: - case 162: - case 159: - position = 145; - break; - case 232: - position = 275; - break; - case 3: - position = 1; - break; - case 172: - position = 201; - } - puts("Ahhhhhhh..."); - injuries[12] = injuries[8] = injuries[7] = injuries[6] = 1; - for (n=0; n < NUMOFOBJECTS; n++) - if (testbit(inven,n)){ - clearbit(inven,n); - setbit(location[position].objects,n); - } - carrying = 0; - encumber = 0; - return(0); -} - -void -bury() -{ - int value; - - if (testbit(inven,SHOVEL)){ - while(wordtype[++wordnumber] != OBJECT && wordtype[wordnumber] != NOUNS && wordnumber < wordcount); - value = wordvalue[wordnumber]; - if (wordtype[wordnumber] == NOUNS && (testbit(location[position].objects,value) || value == BODY)) - switch(value){ - case BODY: - wordtype[wordnumber] = OBJECT; - if (testbit(inven,MAID) || testbit(location[position].objects,MAID)) - value = MAID; - if (testbit(inven,DEADWOOD) || testbit(location[position].objects,DEADWOOD)) - value = DEADWOOD; - if (testbit(inven,DEADGOD) || testbit(location[position].objects,DEADGOD)) - value = DEADGOD; - if (testbit(inven,DEADTIME) || testbit(location[position].objects,DEADTIME)) - value = DEADTIME; - if (testbit(inven,DEADNATIVE) || testbit(location[position].objects,DEADNATIVE)) - value = DEADNATIVE; - break; - - case NATIVE: - case NORMGOD: - puts("She screams as you wrestle her into the hole."); - case TIMER: - power += 7; - ego -= 10; - case AMULET: - case MEDALION: - case TALISMAN: - wordtype[wordnumber] = OBJECT; - break; - - default: - puts("Wha..?"); - } - if (wordtype[wordnumber] == OBJECT && position > 88 && (testbit(inven,value) || testbit(location[position].objects,value))){ - puts("Buried."); - if (testbit(inven,value)){ - clearbit(inven,value); - carrying -= objwt[value]; - encumber -= objcumber[value]; - } - clearbit(location[position].objects,value); - switch(value){ - case MAID: - case DEADWOOD: - case DEADNATIVE: - case DEADTIME: - case DEADGOD: - ego += 2; - printf("The %s should rest easier now.\n",objsht[value]); - } - } - else - puts("It doesn't seem to work."); - } - else - puts("You aren't holding a shovel."); -} - -void -drink() -{ - int n; - - if (testbit(inven,POTION)){ - puts("The cool liquid runs down your throat but turns to fire and you choke."); - puts("The heat reaches your limbs and tingles your spirit. You feel like falling"); - puts("asleep."); - clearbit(inven, POTION); - WEIGHT = MAXWEIGHT; - CUMBER = MAXCUMBER; - for (n=0; n < NUMOFINJURIES; n++) - injuries[n] = 0; - gtime++; - zzz(); - } - else - puts("I'm not thirsty."); -} - -int -shoot() -{ - int firstnumber, value; - int n; - - firstnumber = wordnumber; - if (!testbit(inven,LASER)) - puts("You aren't holding a blaster."); - else { - while(wordtype[++wordnumber] == ADJS); - while(wordnumber<=wordcount && wordtype[wordnumber] == OBJECT){ - value = wordvalue[wordnumber]; - printf("%s:\n", objsht[value]); - for (n=0; objsht[value][n]; n++); - if (testbit(location[position].objects,value)){ - clearbit(location[position].objects,value); - gtime++; - printf("The %s explode%s\n",objsht[value],(objsht[value][n-1]=='s' ? (objsht[value][n-2]=='s' ? "s." : ".") : "s.")); - if (value == BOMB) - die(0); - } - else - printf("I dont see any %s around here.\n", objsht[value]); - if (wordnumber < wordcount - 1 && wordvalue[++wordnumber] == AND) - wordnumber++; - else - return(firstnumber); - } - /* special cases with their own return()'s */ - - if (wordnumber <= wordcount && wordtype[wordnumber] == NOUNS){ - gtime++; - switch(wordvalue[wordnumber]){ - - case DOOR: - switch(position){ - case 189: - case 231: - puts("The door is unhinged."); - location[189].north = 231; - location[231].south = 189; - whichway(location[position]); - break; - case 30: - puts("The wooden door splinters."); - location[30].west = 25; - whichway(location[position]); - break; - case 31: - puts("The laser blast has no effect on the door."); - break; - case 20: - puts("The blast hits the door and it explodes into flame. The magnesium burns"); - puts("so rapidly that we have no chance to escape."); - die(0); - default: - puts("Nothing happens."); - } - break; - - case NORMGOD: - if (testbit(location[position].objects,BATHGOD)){ - puts("The goddess is hit in the chest and splashes back against the rocks."); - puts("Dark blood oozes from the charred blast hole. Her naked body floats in the"); - puts("pools and then off downstream."); - clearbit(location[position].objects,BATHGOD); - setbit(location[180].objects,DEADGOD); - power += 5; - ego -= 10; - notes[JINXED]++; - } else if (testbit(location[position].objects,NORMGOD)){ - puts("The blast catches the goddess in the stomach, knocking her to the ground."); - puts("She writhes in the dirt as the agony of death taunts her."); - puts("She has stopped moving."); - clearbit(location[position].objects,NORMGOD); - setbit(location[position].objects,DEADGOD); - power += 5; - ego -= 10; - notes[JINXED]++; - if (wintime) - live(); - break; - } else - puts("I don't see any goddess around here."); - break; - - case TIMER: - if (testbit(location[position].objects,TIMER)){ - puts("The old man slumps over the bar."); - power++; - ego -= 2; - notes[JINXED]++; - clearbit(location[position].objects,TIMER); - setbit(location[position].objects,DEADTIME); - } - else puts("What old timer?"); - break; - case MAN: - if (testbit(location[position].objects,MAN)){ - puts("The man falls to the ground with blood pouring all over his white suit."); - puts("Your fantasy is over."); - die(0); - } - else puts("What man?"); - break; - case NATIVE: - if (testbit(location[position].objects,NATIVE)){ - puts("The girl is blown backwards several feet and lies in a pool of blood."); - clearbit(location[position].objects,NATIVE); - setbit(location[position].objects,DEADNATIVE); - power += 5; - ego -= 2; - notes[JINXED]++; - } else puts("There is no girl here."); - break; - case -1: - puts("Shoot what?"); - break; - - default: - printf("You can't shoot the %s.\n",objsht[wordvalue[wordnumber]]); - } - } - else puts("You must be a looney."); - } - return(firstnumber); -} diff --git a/games/battlestar/com4.c b/games/battlestar/com4.c deleted file mode 100644 index 94532489d8c3..000000000000 --- a/games/battlestar/com4.c +++ /dev/null @@ -1,390 +0,0 @@ -/* - * Copyright (c) 1983, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)com4.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include -#include "externs.h" - -int -take(from) -unsigned int from[]; -{ - int firstnumber, heavy, bulky, value; - int n; - - firstnumber = wordnumber; - if (wordnumber < wordcount && wordvalue[wordnumber+1] == OFF){ - wordnumber++; - wordvalue[wordnumber] = TAKEOFF; - return(cypher()); - } - else { - while(wordtype[++wordnumber] == ADJS); - while(wordnumber<=wordcount && wordtype[wordnumber] == OBJECT){ - value = wordvalue[wordnumber]; - printf("%s:\n", objsht[value]); - for (n=0; objsht[value][n]; n++); - heavy = (carrying + objwt[value]) <= WEIGHT; - bulky = (encumber + objcumber[value]) <= CUMBER; - if ((testbit(from,value) || wiz || tempwiz) && heavy && bulky && !testbit(inven,value)){ - setbit(inven,value); - carrying += objwt[value]; - encumber += objcumber[value]; - gtime++; - if (testbit(from,value)) - printf("Taken.\n"); - else - printf("Zap! Taken from thin air.\n"); - clearbit(from,value); - if (value == MEDALION) - bs_win--; - } - else if (testbit(inven,value)) - printf("You're already holding%s%s.\n", (objsht[value][n-1] == 's' ? " " : " a "),objsht[value]); - else if (!heavy) - printf("The %s %s too heavy.\n", objsht[value],(objsht[value][n-1] == 's' ? "are" : "is")); - else if (!bulky) - printf("The %s %s too cumbersome to hold.\n", objsht[value],(objsht[value][n-1] == 's' ? "are" : "is")); - else - printf("I dont see any %s around here.\n", objsht[value]); - if (wordnumber < wordcount -1 && wordvalue[++wordnumber] == AND) - wordnumber++; - else - return(firstnumber); - } - } - /* special cases with their own return()'s */ - - if (wordnumber <= wordcount && wordtype[wordnumber] == NOUNS) - switch(wordvalue[wordnumber]){ - - case SWORD: - if (testbit(from, SWORD)){ - wordtype[wordnumber--] = OBJECT; - return(take(from)); - } - if (testbit(from, TWO_HANDED)){ - wordvalue[wordnumber] = TWO_HANDED; - wordtype[wordnumber--] = OBJECT; - return(take(from)); - } - wordvalue[wordnumber] = BROAD; - wordtype[wordnumber--] = OBJECT; - return(take(from)); - - case BODY: - if (testbit(from,MAID)){ - wordvalue[wordnumber] = MAID; - wordtype[wordnumber--] = OBJECT; - return(take(from)); - } - else if (testbit(from,DEADWOOD)){ - wordvalue[wordnumber] = DEADWOOD; - wordtype[wordnumber--] = OBJECT; - return(take(from)); - } - else if (testbit(from,DEADNATIVE)){ - wordvalue[wordnumber] = DEADNATIVE; - wordtype[wordnumber--] = OBJECT; - return(take(from)); - } - else if (testbit(from,DEADGOD)){ - wordvalue[wordnumber] = DEADGOD; - wordtype[wordnumber--] = OBJECT; - return(take(from)); - } - else { - wordvalue[wordnumber] = DEADTIME; - wordtype[wordnumber--] = OBJECT; - return(take(from)); - } - break; - - case AMULET: - if (testbit(location[position].objects,AMULET)){ - puts("The amulet is warm to the touch, and its beauty catches your breath."); - puts("A mist falls over your eyes, but then it is gone. Sounds seem clearer"); - puts("and sharper but far away as if in a dream. The sound of purling water reaches"); - puts("you from afar. The mist falls again, and your heart leaps in horror. The gold"); - puts("freezes your hands and fathomless darkness engulfs your soul."); - } - wordtype[wordnumber--] = OBJECT; - return(take(from)); - - case MEDALION: - if (testbit(location[position].objects, MEDALION)){ - puts("The medallion is warm, and it rekindles your spirit with the warmth of life."); - puts("Your amulet begins to glow as the medallion is brought near to it, and together\nthey radiate."); - } - wordtype[wordnumber--] = OBJECT; - return(take(from)); - - case TALISMAN: - if (testbit(location[position].objects,TALISMAN)){ - puts("The talisman is cold to the touch, and it sends a chill down your spine."); - } - wordtype[wordnumber--] = OBJECT; - return(take(from)); - - case NORMGOD: - if (testbit(location[position].objects,BATHGOD) && (testbit(wear,AMULET) || testbit(inven,AMULET))){ - puts("She offers a delicate hand, and you help her out of the sparkling springs."); - puts("Water droplets like liquid silver bedew her golden skin, but when they part"); - puts("from her, they fall as teardrops. She wraps a single cloth around her and"); - puts("ties it at the waist. Around her neck hangs a golden amulet."); - puts("She bids you to follow her."); - pleasure++; - followgod = gtime; - clearbit(location[position].objects,BATHGOD); - } else if (!testbit(location[position].objects,BATHGOD)) - puts("You're in no position to take her."); - else - puts("She moves away from you."); - break; - - default: - puts("It doesn't seem to work."); - } - else - puts("You've got to be kidding."); - return(firstnumber); -} - -int -throw(name) - const char *name; -{ - int n; - int deposit = 0; - int first, value; - - first = wordnumber; - if (drop(name) != -1){ - switch(wordvalue[wordnumber]){ - - case AHEAD: - deposit = ahead; - break; - - case BACK: - deposit = back; - break; - - case LEFT: - deposit = left; - break; - - case RIGHT: - deposit = right; - break; - - case UP: - deposit = location[position].up * (location[position].access || position == FINAL); - break; - - case DOWN: - deposit = location[position].down; - break; - } - wordnumber = first; - while (wordtype[++wordnumber] == ADJS); - while (wordnumber <= wordcount){ - value = wordvalue[wordnumber]; - if (deposit && testbit(location[position].objects,value)){ - clearbit(location[position].objects,value); - if (value != GRENADE) - setbit(location[deposit].objects,value); - else{ - puts("A thundering explosion nearby sends up a cloud of smoke and shrapnel."); - for (n = 0; n < NUMOFWORDS; n ++) - location[deposit].objects[n] = 0; - setbit(location[deposit].objects,CHAR); - } - if (value == ROPE && position == FINAL) - location[position].access = 1; - switch(deposit){ - case 189: - case 231: - puts("The stone door is unhinged."); - location[189].north = 231; - location[231].south = 189; - break; - case 30: - puts("The wooden door is blown open."); - location[30].west = 25; - break; - case 31: - puts("The door is not damaged."); - } - } - else if (value == GRENADE && testbit(location[position].objects,value)){ - puts("You are blown into shreds when your grenade explodes."); - die(0); - } - if (wordnumber < wordcount - 1 && wordvalue[++wordnumber] == AND) - wordnumber++; - else - return(first); - } - return(first); - } - return(first); -} - -int -drop(name) -const char *name; -{ - - int firstnumber, value; - - firstnumber = wordnumber; - while (wordtype[++wordnumber] == ADJS) - ; - while (wordnumber<=wordcount && (wordtype[wordnumber] == OBJECT || wordtype[wordnumber] == NOUNS)) { - value = wordvalue[wordnumber]; - printf("%s:\n", objsht[value]); - if (testbit(inven,value)){ - clearbit(inven,value); - carrying -= objwt[value]; - encumber -= objcumber[value]; - if (value == BOMB){ - puts("The bomb explodes. A blinding white light and immense concussion obliterate us."); - die(0); - } - if (value != AMULET && value != MEDALION && value != TALISMAN) - setbit(location[position].objects,value); - else - tempwiz = 0; - gtime++; - if (*name == 'K') - puts("Drop kicked."); - else - printf("%s.\n", name); - } - else { - if (*name != 'K') { - printf("You aren't holding the %s.\n", objsht[value]); - if (testbit(location[position].objects,value)) { - if (*name == 'T') - puts("Kicked instead."); - else if (*name == 'G') - puts("Given anyway."); - } - } else - puts("Kicked."); - } - if (wordnumber < wordcount - 1 && wordvalue[++wordnumber] == AND) - wordnumber++; - else - return(firstnumber); - } - puts("Do what?"); - return(-1); -} - -int -takeoff() -{ - wordnumber = take(wear); - return(drop("Dropped")); -} - -int -puton() -{ - wordnumber = take(location[position].objects); - return(wearit()); -} - -int -eat() -{ - int firstnumber, value; - - firstnumber = wordnumber; - while(wordtype[++wordnumber] == ADJS); - while(wordnumber <= wordcount){ - value = wordvalue[wordnumber]; - switch(value){ - - case -1: - puts("Eat what?"); - return(firstnumber); - - default: - printf("You can't eat%s%s!\n", - wordtype[wordnumber] == OBJECT && - objsht[value] - [strlen(objsht[value]) - 1] == 's' ? - " " : " a ", - words[wordnumber]); - return(firstnumber); - - case PAPAYAS: - case PINEAPPLE: - case KIWI: - case COCONUTS: /* eatable things */ - case MANGO: - - printf("%s:\n",objsht[value]); - if (testbit(inven,value) && gtime > ate - CYCLE && testbit(inven,KNIFE)){ - clearbit(inven,value); - carrying -= objwt[value]; - encumber -= objcumber[value]; - ate = max(gtime,ate) + CYCLE/3; - snooze += CYCLE/10; - gtime++; - puts("Eaten. You can explore a little longer now."); - } - else if (gtime < ate - CYCLE) - puts("You're stuffed."); - else if (!testbit(inven,KNIFE)) - puts("You need a knife."); - else - printf("You aren't holding the %s.\n", objsht[value]); - if (wordnumber < wordcount - 1 && wordvalue[++wordnumber] == AND) - wordnumber++; - else - return(firstnumber); - } /* end switch */ - } /* end while */ - return(firstnumber); -} diff --git a/games/battlestar/com5.c b/games/battlestar/com5.c deleted file mode 100644 index 873cf3eb98b0..000000000000 --- a/games/battlestar/com5.c +++ /dev/null @@ -1,349 +0,0 @@ -/* - * Copyright (c) 1983, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)com5.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include "externs.h" - -void -kiss() -{ - while (wordtype[++wordnumber] != NOUNS && wordnumber <= wordcount); - if (wordtype[wordnumber] == NOUNS && testbit(location[position].objects,wordvalue[wordnumber])){ - pleasure++; - printf("Kissed.\n"); - switch (wordvalue[wordnumber]){ - case NORMGOD: - switch(godready++){ - case 0: - puts("She squirms and avoids your advances."); - break; - case 1: - puts("She is coming around; she didn't fight it as much."); - break; - case 2: - puts("She's begining to like it."); - break; - default: - puts("She's gone limp."); - - } - break; - case NATIVE: - puts("The lips are warm and her body robust. She pulls you down to the ground."); - break; - case TIMER: - puts("The old man blushes."); - break; - case MAN: - puts("The dwarf punches you in the kneecap."); - break; - default: - pleasure--; - } - } - else puts("I'd prefer not to."); -} - -void -love() -{ - int n; - - while (wordtype[++wordnumber] != NOUNS && wordnumber <= wordcount); - if (wordtype[wordnumber] == NOUNS && testbit(location[position].objects,wordvalue[wordnumber])){ - if (wordvalue[wordnumber] == NORMGOD && !loved) { - if (godready >= 2){ - puts("She cuddles up to you, and her mouth starts to work:\n'That was my sister's amulet. The lovely goddess, Purl, was she. The Empire\ncaptured her just after the Darkness came. My other sister, Vert, was killed\nby the Dark Lord himself. He took her amulet and warped its power.\nYour quest was foretold by my father before he died, but to get the Dark Lord's\namulet you must use cunning and skill. I will leave you my amulet."); - puts("which you may use as you wish. As for me, I am the last goddess of the\nwaters. My father was the Island King, and the rule is rightfully mine.'\n\nShe pulls the throne out into a large bed."); - power++; - pleasure += 15; - ego++; - if (card(injuries, NUMOFINJURIES)){ - puts("Her kisses revive you; your wounds are healed.\n"); - for (n=0; n < NUMOFINJURIES; n++) - injuries[n] = 0; - WEIGHT = MAXWEIGHT; - CUMBER = MAXCUMBER; - } - printf("Goddess:\n"); - if (!loved) - setbit(location[position].objects,MEDALION); - loved = 1; - gtime += 10; - zzz(); - } - else { - puts("You wish!"); - return; - } - } - if (wordvalue[wordnumber] == NATIVE){ - puts("The girl is easy prey. She peels off her sarong and indulges you."); - power++; - pleasure += 5; - printf("Girl:\n"); - gtime += 10; - zzz(); - } - printf("Loved.\n"); - } - else puts("I't doesn't seem to work."); -} - -int -zzz() -{ - int oldtime; - int n; - - oldtime = gtime; - if ((snooze - gtime) < (0.75 * CYCLE)){ - gtime += 0.75 * CYCLE - (snooze - gtime); - printf(""); - for (n = 0; n < gtime - oldtime; n++) - printf("."); - printf("\n"); - snooze += 3 * (gtime - oldtime); - if (notes[LAUNCHED]){ - fuel -= (gtime - oldtime); - if (location[position].down){ - position = location[position].down; - crash(); - } - else - notes[LAUNCHED] = 0; - } - if (OUTSIDE && rnd(100) < 50){ - puts("You are awakened abruptly by the sound of someone nearby."); - switch(rnd(4)){ - case 0: - if (ucard(inven)){ - n = rnd(NUMOFOBJECTS); - while(!testbit(inven,n)) - n = rnd(NUMOFOBJECTS); - clearbit(inven,n); - if (n != AMULET && n != MEDALION && n != TALISMAN) - setbit(location[position].objects,n); - carrying -= objwt[n]; - encumber -= objcumber[n]; - } - puts("A fiendish little Elf is stealing your treasures!"); - fight(ELF,10); - break; - case 1: - setbit(location[position].objects,DEADWOOD); - break; - case 2: - setbit(location[position].objects,HALBERD); - break; - default: - break; - } - } - } - else - return(0); - return(1); -} - -void -chime() -{ - if ((gtime / CYCLE + 1) % 2 && OUTSIDE) - switch((gtime % CYCLE)/(CYCLE / 7)){ - case 0: - puts("It is just after sunrise."); - break; - case 1: - puts("It is early morning."); - break; - case 2: - puts("It is late morning."); - break; - case 3: - puts("It is near noon."); - break; - case 4: - puts("It is early afternoon."); - break; - case 5: - puts("It is late afternoon."); - break; - case 6: - puts("It is near sunset."); - break; - } - else if (OUTSIDE) - switch((gtime % CYCLE)/(CYCLE / 7)){ - case 0: - puts("It is just after sunset."); - break; - case 1: - puts("It is early evening."); - break; - case 2: - puts("The evening is getting old."); - break; - case 3: - puts("It is near midnight."); - break; - case 4: - puts("These are the wee hours of the morning."); - break; - case 5: - puts("The night is waning."); - break; - case 6: - puts("It is almost morning."); - break; - } - else - puts("I can't tell the time in here."); -} - -int -give() -{ - int obj = -1, result = -1, person = 0, firstnumber; - int last1 = 0, last2 = 0; - - firstnumber = wordnumber; - while (wordtype[++wordnumber] != OBJECT && wordvalue[wordnumber] != AMULET && wordvalue[wordnumber] != MEDALION && wordvalue[wordnumber] != TALISMAN && wordnumber <= wordcount); - if (wordnumber <= wordcount){ - obj = wordvalue[wordnumber]; - if (obj == EVERYTHING) - wordtype[wordnumber] = -1; - last1 = wordnumber; - } - wordnumber = firstnumber; - while ((wordtype[++wordnumber] != NOUNS || wordvalue[wordnumber] == obj) && wordnumber <= wordcount); - if (wordtype[wordnumber] == NOUNS){ - person = wordvalue[wordnumber]; - last2 = wordnumber; - } - /* Setting wordnumber to last1 - 1 looks wrong if last1 is 0, e.g., - * plain `give'. However, detecting this case is liable to detect - * `give foo' as well, which would give a confusing error. We - * need to make sure the -1 value can cause no problems if it arises. - * If in the below we get to the drop("Given") then drop will look - * at word 0 for an object to give, and fail, which is OK; then - * result will be -1 and we get to the end, where wordnumber gets - * set to something more sensible. If we get to "I don't think - * that is possible" then again wordnumber is set to something - * sensible. The wordnumber we leave with still isn't right if - * you include words the game doesn't know in your command, but - * that's no worse than what other commands than give do in - * the same place. */ - wordnumber = last1 - 1; - if (person && testbit(location[position].objects,person)) - if (person == NORMGOD && godready < 2 && !(obj == RING || obj == BRACELET)) - puts("The goddess won't look at you."); - else - result = drop("Given"); - else { - puts("I don't think that is possible."); - wordnumber = max(last1, last2) + 1; - return(0); - } - if (result != -1 && (testbit(location[position].objects,obj) || obj == AMULET || obj == MEDALION || obj == TALISMAN)){ - clearbit(location[position].objects,obj); - gtime++; - ego++; - switch(person){ - case NATIVE: - puts("She accepts it shyly."); - ego += 2; - break; - case NORMGOD: - if (obj == RING || obj == BRACELET){ - puts("She takes the charm and puts it on. A little kiss on the cheek is"); - puts("your reward."); - ego += 5; - godready += 3; - } - if (obj == AMULET || obj == MEDALION || obj == TALISMAN){ - bs_win++; - ego += 5; - power -= 5; - if (bs_win >= 3){ - puts("The powers of the earth are now legitimate. You have destroyed the Darkness"); - puts("and restored the goddess to her thrown. The entire island celebrates with"); - puts("dancing and spring feasts. As a measure of her gratitude, the goddess weds you"); - puts("in the late summer and crowns you Prince Liverwort, Lord of Fungus."); - puts("\nBut, as the year wears on and autumn comes along, you become restless and"); - puts("yearn for adventure. The goddess, too, realizes that the marriage can't last."); - puts("She becomes bored and takes several more natives as husbands. One evening,"); - puts("after having been out drinking with the girls, she kicks the throne particularly"); - puts("hard and wakes you up. (If you want to win this game, you're going to have to\nshoot her!)"); - clearbit(location[position].objects,MEDALION); - wintime = gtime; - } - } - break; - case TIMER: - if (obj == COINS){ - puts("He fingers the coins for a moment and then looks up agape. `Kind you are and"); - puts("I mean to repay you as best I can.' Grabbing a pencil and cocktail napkin...\n"); - printf( "+-----------------------------------------------------------------------------+\n"); - printf( "| xxxxxxxx\\ |\n"); - printf( "| xxxxx\\ CLIFFS |\n"); - printf( "| FOREST xxx\\ |\n"); - printf( "| \\\\ x\\ OCEAN |\n"); - printf( "| || x\\ |\n"); - printf( "| || ROAD x\\ |\n"); - printf( "| || x\\ |\n"); - printf( "| SECRET || ......... |\n"); - printf( "| - + - || ........ |\n"); - printf( "| ENTRANCE || ... BEACH |\n"); - printf( "| || ... E |\n"); - printf( "| || ... | |\n"); - printf( "| // ... N <-- + --- S |\n"); - printf( "| PALM GROVE // ... | |\n"); - printf( "| // ... W |\n"); - printf( "+-----------------------------------------------------------------------------+\n"); - puts("\n`This map shows a secret entrance to the catacombs."); - puts("You will know when you arrive because I left an old pair of shoes there.'"); - } - break; - } - } - wordnumber = max(last1,last2) + 1; - return(firstnumber); -} diff --git a/games/battlestar/com6.c b/games/battlestar/com6.c deleted file mode 100644 index d01644317ebf..000000000000 --- a/games/battlestar/com6.c +++ /dev/null @@ -1,238 +0,0 @@ -/* - * Copyright (c) 1983, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)com6.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include -#include "externs.h" -#include "pathnames.h" - -static void post(unsigned int ch); - -int -launch() -{ - if (testbit(location[position].objects,VIPER) && !notes[CANTLAUNCH]){ - if (fuel > 4){ - clearbit(location[position].objects,VIPER); - position = location[position].up; - notes[LAUNCHED] = 1; - gtime++; - fuel -= 4; - puts("You climb into the viper and prepare for launch."); - puts("With a touch of your thumb the turbo engines ignite, thrusting you back into\nyour seat."); - return(1); - } - else - puts("Not enough fuel to launch."); - } - else - puts("Can't launch."); - return(0); -} - -int -land() -{ - if (notes[LAUNCHED] && testbit(location[position].objects,LAND) && location[position].down){ - notes[LAUNCHED] = 0; - position = location[position].down; - setbit(location[position].objects,VIPER); - fuel -= 2; - gtime++; - puts("You are down."); - return(1); - } - else - puts("You can't land here."); - return(0); -} - -void -die(sig) /* endgame */ - int sig; -{ - sig = 0; - printf("bye.\nYour rating was %s.\n", rate()); - post(' '); - exit(0); -} - -void -live() -{ - puts("\nYou win!"); - post('!'); - exit(0); -} - -#include - -static FILE *score_fp; - -void -open_score_file() -{ - if ((score_fp = fopen(_PATH_SCORE,"a")) == NULL) - perror(_PATH_SCORE); -} - -static void -post(ch) -unsigned int ch; -{ - struct timeval tv; - char *date; - time_t tvsec; - int s; - - if (score_fp == NULL) - return; - - s = sigblock(sigmask(SIGINT)); - - gettimeofday(&tv, (struct timezone *)0); /* can't call time */ - tvsec = (time_t) tv.tv_sec; - date = ctime(&tvsec); - date[24] = '\0'; - - fprintf(score_fp, "%s %8s %c%20s", date, uname, ch, rate()); - if (wiz) - fprintf(score_fp, " wizard\n"); - else if (tempwiz) - fprintf(score_fp, " WIZARD!\n"); - else - fprintf(score_fp, "\n"); - - sigsetmask(s); -} - -const char * -rate() -{ - int score; - - score = max(max(pleasure,power),ego); - if (score == pleasure){ - if (score < 5) - return("novice"); - else if (score < 20) - return("junior voyeur"); - else if (score < 35) - return("Don Juan"); - else return("Marquis De Sade"); - } - else if (score == power){ - if (score < 5) - return("serf"); - else if (score < 8) - return("Samurai"); - else if (score < 13) - return("Klingon"); - else if (score < 22) - return("Darth Vader"); - else return("Sauron the Great"); - } - else{ - if (score < 5) - return("Polyanna"); - else if (score < 10) - return("philanthropist"); - else if (score < 20) - return("Tattoo"); - else return("Mr. Roarke"); - } -} - -int -drive() -{ - if (testbit(location[position].objects,CAR)){ - puts("You hop in the car and turn the key. There is a perceptible grating noise,"); - puts("and an explosion knocks you unconscious..."); - clearbit(location[position].objects,CAR); - setbit(location[position].objects,CRASH); - injuries[5] = injuries[6] = injuries[7] = injuries[8] = 1; - gtime += 15; - zzz(); - return(0); - } - else - puts("There is nothing to drive here."); - return(-1); -} - -int -ride() -{ - if (testbit(location[position].objects,HORSE)){ - puts("You climb onto the stallion and kick it in the guts. The stupid steed launches"); - puts("forward through bush and fern. You are thrown and the horse gallups off."); - clearbit(location[position].objects,HORSE); - while (!(position = rnd(NUMOFROOMS+1)) || !OUTSIDE || !beenthere[position] || location[position].flyhere); - setbit(location[position].objects,HORSE); - if (location[position].north) - position = location[position].north; - else if (location[position].south) - position = location[position].south; - else if (location[position].east) - position = location[position].east; - else - position = location[position].west; - return(0); - } - else puts("There is no horse here."); - return(-1); -} - -void -light() /* synonyms = {strike, smoke} */ -{ /* for matches, cigars */ - if (testbit(inven,MATCHES) && matchcount){ - puts("Your match splutters to life."); - gtime++; - matchlight = 1; - matchcount--; - if (position == 217){ - puts("The whole bungalow explodes with an intense blast."); - die(0); - } - } - else puts("You're out of matches."); -} diff --git a/games/battlestar/com7.c b/games/battlestar/com7.c deleted file mode 100644 index 9c509ffa5fb3..000000000000 --- a/games/battlestar/com7.c +++ /dev/null @@ -1,274 +0,0 @@ -/* - * Copyright (c) 1983, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)com7.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include "externs.h" - -int -fight(enemy,strength) -int enemy,strength; -{ - int lifeline = 0; - int hurt; - char auxbuf[LINELENGTH]; - char *next; - int i; - int exhaustion = 0; - -fighton: - gtime++; - snooze -= 5; - if (snooze > gtime) - exhaustion = CYCLE/(snooze - gtime); - else { - puts("You collapse exhausted, and he pulverizes your skull."); - die(0); - } - if (snooze - gtime < 20) - puts("You look tired! I hope you're able to fight."); - next = getcom(auxbuf, LINELENGTH, "-: ", 0); - for (i=0; next && i < 10; i++) - next = getword(next, words[i], -1); - parse(); - switch(wordvalue[wordnumber]){ - - case KILL: - case SMITE: - if (testbit(inven,TWO_HANDED)) - hurt = rnd(70) - 2 * card(injuries,NUMOFINJURIES) - ucard(wear) - exhaustion; - else if (testbit(inven,SWORD) || testbit(inven, BROAD)) - hurt = rnd(50)%(WEIGHT-carrying)-card(injuries,NUMOFINJURIES)-encumber - exhaustion; - else if (testbit(inven,KNIFE) || testbit(inven,MALLET) || testbit(inven,CHAIN) || testbit(inven,MACE) || testbit(inven,HALBERD)) - hurt = rnd(15) - card(injuries,NUMOFINJURIES) - exhaustion; - else - hurt = rnd(7) - encumber; - if (hurt < 5) - switch(rnd(3)){ - - case 0: - puts("You swung wide and missed."); - break; - case 1: - puts("He checked your blow. CLASH! CLANG!"); - break; - case 2: - puts("His filthy tunic hangs by one less thread."); - break; - } - else if (hurt < 10){ - switch(rnd(3)){ - case 0: - puts("He's bleeding."); - break; - case 1: - puts("A trickle of blood runs down his face."); - break; - case 2: - puts("A huge purple bruise is forming on the side of his face."); - break; - } - lifeline++; - } - else if (hurt < 20){ - switch(rnd(3)){ - case 0: - puts("He staggers back quavering."); - break; - case 1: - puts("He jumps back with his hand over the wound."); - break; - case 2: - puts("His shirt falls open with a swath across the chest."); - break; - } - lifeline += 5; - } - else if (hurt < 30){ - switch(rnd(3)){ - case 0: - printf("A bloody gash opens up on his %s side.\n",(rnd(2) ? "left" : "right")); - break; - case 1: - puts("The steel bites home and scrapes along his ribs."); - break; - case 2: - puts("You pierce him, and his breath hisses through clenched teeth."); - break; - } - lifeline += 10; - } - else if (hurt < 40){ - switch(rnd(3)){ - case 0: - puts("You smite him to the ground."); - if (strength - lifeline > 20) - puts("But in a flurry of steel he regains his feet!"); - break; - case 1: - puts("The force of your blow sends him to his knees."); - puts("His arm swings lifeless at his side."); - break; - case 2: - puts("Clutching his blood drenched shirt, he collapses stunned."); - break; - } - lifeline += 20; - } - else { - switch(rnd(3)){ - case 0: - puts("His ribs crack under your powerful swing, flooding his lungs with blood."); - break; - case 1: - puts("You shatter his upheld arm in a spray of blood. The blade continues deep"); - puts("into his back, severing the spinal cord."); - lifeline += 25; - break; - case 2: - puts("With a mighty lunge the steel slides in, and gasping, he falls to the ground."); - lifeline += 25; - break; - } - lifeline += 30; - } - break; - - case BACK: - if (enemy == DARK && lifeline > strength * 0.33){ - puts("He throws you back against the rock and pummels your face."); - if (testbit(inven,AMULET) || testbit(wear,AMULET)){ - printf("Lifting the amulet from you, "); - if (testbit(inven,MEDALION) || testbit(wear,MEDALION)){ - puts("his power grows and the walls of\nthe earth tremble."); - puts("When he touches the medallion, your chest explodes and the foundations of the\nearth collapse."); - puts("The planet is consumed by darkness."); - die(0); - } - if (testbit(inven,AMULET)){ - clearbit(inven,AMULET); - carrying -= objwt[AMULET]; - encumber -= objcumber[AMULET]; - } - else - clearbit(wear,AMULET); - puts("he flees down the dark caverns."); - clearbit(location[position].objects,DARK); - injuries[SKULL] = 1; - followfight = gtime; - return (0); - } - else{ - puts("I'm afraid you have been killed."); - die(0); - } - } - else{ - puts("You escape stunned and disoriented from the fight."); - puts("A victorious bellow echoes from the battlescene."); - if (back && position != back) - battlestar_move(back,BACK); - else if (ahead &&position != ahead) - battlestar_move(ahead,AHEAD); - else if (left && position != left) - battlestar_move(left,LEFT); - else if (right && position != right) - battlestar_move(right,RIGHT); - else - battlestar_move(location[position].down, - AHEAD); - return(0); - } - - case SHOOT: - if (testbit(inven,LASER)){ - if (strength - lifeline <= 50){ - printf("The %s took a direct hit!\n",objsht[enemy]); - lifeline += 50; - } - else { - puts("With his bare hand he deflects the laser blast and whips the pistol from you!"); - clearbit(inven,LASER); - setbit(location[position].objects,LASER); - carrying -= objwt[LASER]; - encumber -= objcumber[LASER]; - } - } - else - puts("Unfortunately, you don't have a blaster handy."); - break; - - case DROP: - case DRAW: - cypher(); - gtime--; - break; - - default: - puts("You don't have a chance, he is too quick."); - break; - - } - if (lifeline >= strength){ - printf("You have killed the %s.\n", objsht[enemy]); - if (enemy == ELF || enemy == DARK) - puts("A watery black smoke consumes his body and then vanishes with a peal of thunder!"); - clearbit(location[position].objects,enemy); - power += 2; - notes[JINXED]++; - return(0); - } - puts("He attacks..."); - /* some embellisments */ - hurt = rnd(NUMOFINJURIES) - (testbit(inven,SHIELD) != 0) - (testbit(wear,MAIL) != 0) - (testbit(wear,HELM) != 0); - hurt += (testbit(wear,AMULET) != 0) + (testbit(wear,MEDALION) != 0) + (testbit(wear,TALISMAN) != 0); - hurt = hurt < 0 ? 0 : hurt; - hurt = hurt >= NUMOFINJURIES ? NUMOFINJURIES -1 : hurt; - if (!injuries[hurt]){ - injuries[hurt] = 1; - printf("I'm afraid you have suffered %s.\n", ouch[hurt]); - } - else - puts("You emerge unscathed."); - if (injuries[SKULL] && injuries[INCISE] && injuries[NECK]){ - puts("I'm afraid you have suffered fatal injuries."); - die(0); - } - goto fighton; -} diff --git a/games/battlestar/cypher.c b/games/battlestar/cypher.c deleted file mode 100644 index e61c93845e5c..000000000000 --- a/games/battlestar/cypher.c +++ /dev/null @@ -1,436 +0,0 @@ -/* - * Copyright (c) 1983, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)cypher.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include "externs.h" - -int -cypher() -{ - int n; - int junk; - int lflag = -1; - char buffer[10]; - - while (wordtype[wordnumber] == ADJS) - wordnumber++; - while (wordnumber <= wordcount) { - switch(wordvalue[wordnumber]) { - - case UP: - if (location[position].access || wiz || tempwiz) { - if (!location[position].access) - puts("Zap! A gust of wind lifts you up."); - if (!battlestar_move(location[position].up, AHEAD)) - return(-1); - } else { - puts("There is no way up"); - return(-1); - } - lflag = 0; - break; - - case DOWN: - if (!battlestar_move(location[position].down, - AHEAD)) - return(-1); - lflag = 0; - break; - - case LEFT: - if (!battlestar_move(left, LEFT)) - return(-1); - lflag = 0; - break; - - case RIGHT: - if (!battlestar_move(right, RIGHT)) - return(-1); - lflag = 0; - break; - - case AHEAD: - if (!battlestar_move(ahead, AHEAD)) - return(-1); - lflag = 0; - break; - - case BACK: - if (!battlestar_move(back, BACK)) - return(-1); - lflag = 0; - break; - - case SHOOT: - if (wordnumber < wordcount && wordvalue[wordnumber+1] == EVERYTHING){ - for (n=0; n < NUMOFOBJECTS; n++) - if (testbit(location[position].objects,n) && objsht[n]){ - wordvalue[wordnumber+1] = n; - wordnumber = shoot(); - } - wordnumber++; - wordnumber++; - } - else - shoot(); - break; - - case TAKE: - if (wordnumber < wordcount && wordvalue[wordnumber+1] == EVERYTHING){ - for (n=0; n < NUMOFOBJECTS; n++) - if (testbit(location[position].objects,n) && objsht[n]){ - wordvalue[wordnumber+1] = n; - wordnumber = take(location[position].objects); - } - wordnumber++; - wordnumber++; - } - else - take(location[position].objects); - break; - - case DROP: - - if (wordnumber < wordcount && wordvalue[wordnumber+1] == EVERYTHING){ - for (n=0; n < NUMOFOBJECTS; n++) - if (testbit(inven,n)){ - wordvalue[wordnumber+1] = n; - wordnumber = drop("Dropped"); - } - wordnumber++; - wordnumber++; - } - else - drop("Dropped"); - break; - - - case KICK: - case THROW: - if (wordnumber < wordcount && wordvalue[wordnumber+1] == EVERYTHING){ - for (n=0; n < NUMOFOBJECTS; n++) - if ((testbit(inven,n) || - testbit(location[position].objects, n)) && objsht[n]){ - wordvalue[wordnumber+1] = n; - wordnumber = throw(wordvalue[wordnumber] == KICK ? "Kicked" : "Thrown"); - } - wordnumber += 2; - } else - throw(wordvalue[wordnumber] == KICK ? "Kicked" : "Thrown"); - break; - - case TAKEOFF: - if (wordnumber < wordcount && wordvalue[wordnumber+1] == EVERYTHING){ - for (n=0; n < NUMOFOBJECTS; n++) - if (testbit(wear,n)){ - wordvalue[wordnumber+1] = n; - wordnumber = takeoff(); - } - wordnumber += 2; - } - else - takeoff(); - break; - - - case DRAW: - - if (wordnumber < wordcount && wordvalue[wordnumber+1] == EVERYTHING){ - for (n=0; n < NUMOFOBJECTS; n++) - if (testbit(wear,n)){ - wordvalue[wordnumber+1] = n; - wordnumber = draw(); - } - wordnumber += 2; - } - else - draw(); - break; - - - case PUTON: - - if (wordnumber < wordcount && wordvalue[wordnumber+1] == EVERYTHING){ - for (n=0; n < NUMOFOBJECTS; n++) - if (testbit(location[position].objects,n) && objsht[n]){ - wordvalue[wordnumber+1] = n; - wordnumber = puton(); - } - wordnumber += 2; - } - else - puton(); - break; - - case WEARIT: - - if (wordnumber < wordcount && wordvalue[wordnumber+1] == EVERYTHING){ - for (n=0; n < NUMOFOBJECTS; n++) - if (testbit(inven,n)){ - wordvalue[wordnumber+1] = n; - wordnumber = wearit(); - } - wordnumber += 2; - } - else - wearit(); - break; - - - case EAT: - - if (wordnumber < wordcount && wordvalue[wordnumber+1] == EVERYTHING){ - for (n=0; n < NUMOFOBJECTS; n++) - if (testbit(inven,n)){ - wordvalue[wordnumber+1] = n; - wordnumber = eat(); - } - wordnumber += 2; - } - else - eat(); - break; - - - case PUT: - put(); - break; - - - case INVEN: - if (ucard(inven)){ - puts("You are holding:\n"); - for (n=0; n < NUMOFOBJECTS; n++) - if (testbit(inven,n)) - printf("\t%s\n", objsht[n]); - printf("\n= %d kilogram%s (%d%%)\n", carrying, (carrying == 1 ? "." : "s."),(WEIGHT ? carrying*100/WEIGHT : -1)); - printf("Your arms are %d%% full.\n",encumber*100/CUMBER); - } - else - puts("You aren't carrying anything."); - - if (ucard(wear)){ - puts("\nYou are wearing:\n"); - for (n=0; n < NUMOFOBJECTS; n++) - if (testbit(wear,n)) - printf("\t%s\n", objsht[n]); - } - else - puts("\nYou are stark naked."); - if (card(injuries,NUMOFINJURIES)){ - puts("\nYou have suffered:\n"); - for (n=0; n < NUMOFINJURIES; n++) - if (injuries[n]) - printf("\t%s\n",ouch[n]); - printf("\nYou can still carry up to %d kilogram%s\n",WEIGHT,(WEIGHT == 1 ? "." : "s.")); - } - else - puts("\nYou are in perfect health."); - break; - - case USE: - lflag = use(); - break; - - case LOOK: - if (!notes[CANTSEE] || testbit(inven,LAMPON) || testbit(location[position].objects,LAMPON) || matchlight){ - beenthere[position] = 2; - writedes(); - printobjs(); - if (matchlight){ - puts("\nYour match splutters out."); - matchlight = 0; - } - } else - puts("I can't see anything."); - return(-1); - break; - - case SU: - if (wiz || tempwiz){ - printf("\nRoom (was %d) = ", position); - fgets(buffer,10,stdin); - if (*buffer != '\n') - sscanf(buffer,"%d", &position); - printf("Time (was %d) = ",gtime); - fgets(buffer,10,stdin); - if (*buffer != '\n') - sscanf(buffer,"%d", >ime); - printf("Fuel (was %d) = ",fuel); - fgets(buffer,10,stdin); - if (*buffer != '\n') - sscanf(buffer,"%d", &fuel); - printf("Torps (was %d) = ",torps); - fgets(buffer,10,stdin); - if (*buffer != '\n') - sscanf(buffer,"%d", &torps); - printf("CUMBER (was %d) = ",CUMBER); - fgets(buffer,10,stdin); - if (*buffer != '\n') - sscanf(buffer,"%d", &CUMBER); - printf("WEIGHT (was %d) = ",WEIGHT); - fgets(buffer,10,stdin); - if (*buffer != '\n') - sscanf(buffer,"%d",&WEIGHT); - printf("Clock (was %d) = ",gclock); - fgets(buffer,10,stdin); - if (*buffer != '\n') - sscanf(buffer,"%d",&gclock); - printf("Wizard (was %d, %d) = ",wiz, tempwiz); - fgets(buffer,10,stdin); - if (*buffer != '\n'){ - sscanf(buffer,"%d",&junk); - if (!junk) - tempwiz = wiz = 0; - } - printf("\nDONE.\n"); - return(0); - } - else - puts("You aren't a wizard."); - break; - - case SCORE: - printf("\tPLEASURE\tPOWER\t\tEGO\n"); - printf("\t%3d\t\t%3d\t\t%3d\n\n",pleasure,power,ego); - printf("This gives you the rating of %s in %d turns.\n",rate(),gtime); - printf("You have visited %d out of %d rooms this run (%d%%).\n",card(beenthere,NUMOFROOMS),NUMOFROOMS,card(beenthere,NUMOFROOMS)*100/NUMOFROOMS); - break; - - case KNIFE: - case KILL: - murder(); - break; - - case UNDRESS: - case RAVAGE: - ravage(); - break; - - case SAVE: - save(); - break; - - case FOLLOW: - lflag = follow(); - break; - - case GIVE: - give(); - break; - - case KISS: - kiss(); - break; - - case LOVE: - love(); - break; - - case RIDE: - lflag = ride(); - break; - - case DRIVE: - lflag = drive(); - break; - - case LIGHT: - light(); - break; - - case LAUNCH: - if (!launch()) - return(-1); - else - lflag = 0; - break; - - case LANDIT: - if (!land()) - return(-1); - else - lflag = 0; - break; - - case TIME: - chime(); - break; - - case SLEEP: - zzz(); - break; - - case DIG: - dig(); - break; - - case JUMP: - lflag = jump(); - break; - - case BURY: - bury(); - break; - - case SWIM: - puts("Surf's up!"); - break; - - case DRINK: - drink(); - break; - - case QUIT: - die(0); - - default: - puts("How's that?"); - return(-1); - break; - - - } - if (wordnumber < wordcount && *words[wordnumber++] == ',') - continue; - else return(lflag); - } - return(lflag); -} diff --git a/games/battlestar/dayfile.c b/games/battlestar/dayfile.c deleted file mode 100644 index fca59953af1b..000000000000 --- a/games/battlestar/dayfile.c +++ /dev/null @@ -1,1209 +0,0 @@ -/* - * Copyright (c) 1983, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)dayfile.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include "externs.h" - -struct room dayfile[] = { - { 0 }, - { "You are in the main hangar.", - { 5, 2, 9, 3, 3, 1, 0, 0 }, -"This is a huge bay where many fighters and cargo craft lie. Alarms are \n\ -sounding and fighter pilots are running to their ships. Above is a gallery\n\ -overlooking the bay. The scream of turbo engines is coming from +. The rest\n\ -of the hangar is +. There is an exit +.*\n" }, - { "This is the landing bay.", - { 1, 0, 10, 0, 0, 0, 0, 0 }, -"Ships are landing here, some heavily damaged. Enemy fighters continually\n\ -strafe this vulnerable port. The main hangar is +, *\n\ -There is an exit +.*\n" }, - { "You are in the gallery.", - { 4, 0, 0, 0, 0, 0, 1, 0 }, -"From here a view of the entire landing bay reveals that our battlestar\n\ -is near destruction. Fires are spreading out of control and laser blasts\n\ -lick at the shadows. The control room is +. ***\n" }, - { "You are in the control room.", - { 0, 3, 0, 0, 0, 0, 5, 0 }, -"Several frantic technicians are flipping switches wildly but otherwise\n\ -this room seems fairly deserted. A weapons locker has been left open.\n\ -A staircase leads down. * There is a way -. ** \n" }, - { "This is the launch room.", - { 6, 1, 7, 0, 4, 1, 0, 0 }, -"From the launch tubes here fighters blast off into space. Only one is left,\n\ -and it is guarded by two fierce men. A staircase leads up from here.\n\ -There is a cluttered workbench +. From the main hangar come sounds of great\n\ -explosions. The main hangar is +. The viper launch tubes are to the -.*\n" }, - { "You are at the workbench.", - { 0, 5, 7, 0, 0, 0, 0, 0 }, -"Strange and unwieldy tools are arranged here including a lunch box \n\ -and pneumatic wrenches and turbo sprocket rockets.*\n\ -The launch room is +. The remaining viper is +.*\n" }, - { "You are in the viper launch tube.", - { 0, 5, 0, 5, 32, 0, 0, 0 }, -"The two guards are eyeing you warily! ****\n" }, - { "This is a walk in closet.", - { 22, 0, 0, 0, 0, 0, 0, 0 }, -"A wardrobe of immense magnitude greets the eye. Furs and robes of kings\n\ -hang on rack after rack. Silken gowns, capes woven with spun gold, and \n\ -delicate synthetic fabrics are stowed here. The bedroom is +.***\n" }, - { "You are in a wide hallway leading to the main hangar.", - { 0, 0, 11, 1, 0, 0, 0, 0 }, -"The walls and ceiling here have been blasted through in several places.\n\ -It looks as if quite a battle has been fought for possession of the landing bay\n\ -Gaping corpses litter the floor.** The hallway continues +.\n\ -The main hangar is +.\n" }, - { "You are in a wide hallway leading to the landing bay.", - { 0, 0, 12, 2, 0, 0, 0, 0 }, -"Most of the men and supplies needed in the main hangar come through this\n\ -corridor, but the wounded are forced to use it too. It very dank and\n\ -crowded here, and the floor is slippery with blood.**\n\ -The hallway continues -. The landing bay is +.\n" }, - { "The hallway is very congested with rubble here.", - { 0, 0, 0, 9, 13, 1, 0, 0 }, -"It is too choked with broken steel girders and other debris to continue\n\ -on much farther. Above, the ceiling has caved in and it is possible to \n\ -climb up. There is not much chance to go -, -, or -.\n\ -But the hallway seems clearer +.\n" }, - { "A wide hallway and a more narrow walkway meet here.", - { 14, 15, 0, 10, 0, 0, 0, 0 }, -"The intersection is crowded with the many wounded who have come up\n\ -the wide hallway and continued +. The walkway is less crowded +.\n\ -The wide hallway goes *-.\n" }, - { "You are in what was once an elegant stateroom.", - { 16, 0, 0, 0, 0, 0, 11, 0 }, -"Whoever lived in this stateroom, he and his female companion\n\ -were mercilessly slain in their sleep. Clothes, trinkets and personal\n\ -belongings are scattered all across the floor. Through a hole in the\n\ -collapsed floor I can see a hallway below. A door is +.***\n" }, - { "You're at the entrance to the sick bay.", - { 17, 12, 18, 0, 0, 0, 0, 0 }, -"The wounded are entering the sick bay in loudly moaning files.\n\ -The walkway continues - and +. A doctor is motioning for you to \n\ -come to the -. *\n" }, - { "You're in the walkway.", - { 12, 19, 0, 0, 0, 0, 0, 0 }, -"Most of the men and supplies were coming from the armory. The walkway\n\ -continues -. The armory is +.**\n" }, - { "These are the executive suites of the battlestar.", - { 20, 13, 21, 22, 23, 1, 24, 0 }, -"Luxurious staterooms carpeted with crushed velvet and adorned with beaten\n\ -gold open onto this parlor. A wide staircase with ivory banisters leads\n\ -up or down. This parlor leads into a hallway +. The bridal suite is +.\n\ -Other rooms lie - and +.\n" }, - { "You're in a long dimly lit hallway.", - { 0, 14, 25, 0, 0, 0, 0, 0 }, -"This part of the walkway is deserted. There is a dead end +. The\n\ -entrance to the sickbay is +. The walkway turns sharply -.*\n" }, - { "This is the sick bay.", - { 0, 0, 0, 14, 0, 0, 0, 0 }, -"Sinister nurses with long needles and pitiful aim probe the depths of suffering\n\ -here. Only the mortally wounded receive medical attention on a battlestar,\n\ -but afterwards they are thrown into the incinerators along with the rest.**\n\ -Nothing but death and suffering +. The walkway is +.\n" }, - { "You're in the armory.", - { 15, 26, 0, 0, 0, 0, 0, 0 }, -"An armed guard is stationed here 365 sectars a yarn to protect the magazine.\n\ -The walkway is +. The magazine is +.**\n" }, - { "The hallway ends here at the presidential suite.", - { 27, 16, 0, 0, 0, 0, 0, 0 }, -"The door to this suite is made from solid magnesium, and the entryway is\n\ -inlaid with diamonds and fire opals. The door is ajar +. The hallway\n\ -goes -.**\n" }, - { "This is the maid's utility room.", - { 0, 0, 0, 16, 0, 0, 0, 0 }, -"What a gruesome sight! The maid has been brutally drowned in a bucket of\n\ -Pine Sol and repeatedly stabbed in the back with a knife.***\n\ -The hallway is +.\n" }, - { "This is a luxurious stateroom.", - { 0, 8, 16, 0, 0, 0, 0, 0 }, -"The floor is carpeted with a soft animal fur and the great wooden furniture\n\ -is inlaid with strips of platinum and gold. Electronic equipment built\n\ -into the walls and ceiling is flashing wildly. The floor shudders and\n\ -the sounds of dull explosions rumble though the room. From a window in\n\ -the wall + comes a view of darkest space. There is a small adjoining\n\ -room +, and a doorway +.*\n" }, - { "You are at the entrance to the dining hall.", - { 0, 0, 28, 0, 0, 0, 16, 0 }, -"A wide staircase with ebony banisters leads down here.**\n\ -The dining hall is to the -.*\n" }, - { "This was once the first class lounge.", - { 0, 0, 29, 0, 16, 1, 0, 0 }, -"There is much rubble and destruction here that was not apparent elsewhere.\n\ -The walls and ceilings have broken in in some places. A staircase with\n\ -red coral banisters leads up. It is impossible to go - or -.\n\ -It seems a little clearer +.*\n" }, - { "You are in a narrow stairwell.", - { 0, 17, 0, 0, 30, 1, 0, 0 }, -"These dusty and decrepit stairs lead up. There is no way -. The\n\ -hallway turns sharply -.**\n" }, - { "You are in the magazine.", - { 19, 0, 0, 0, 0, 0, 0, 0 }, -"Rows and rows of neatly stacked ammunition for laser pistols and grenade\n\ -launchers are here. The armory is +.***\n" }, - { "You're in the presidential suite.", - { 0, 20, 0, 0, 0, 0, 0, 0 }, -"Apparently the president has been assassinated. A scorched figure lies\n\ -face downward on the carpet clutching his chest.*\n\ -The hallway leads -.**\n" }, - { "You are in the dining hall.", - { 0, 30, 31, 23, 0, 0, 0, 0 }, -"This was the scene of a mass suicide. Hundreds of ambassadors and assorted\n\ -dignitaries sit slumped over their breakfast cereal. I suppose the news\n\ -of the cylon attack killed them. There is a strange chill in this room. I\n\ -would not linger here. * The kitchen is +. Entrances + and +.\n" }, - { "The debris is very thick here.", - { 0, 11, 0, 24, 0, 0, 0, 0 }, -"Broken furniture, fallen girders, and other rubble block the way.\n\ -There is not much chance to continue -, -, or -.\n\ -It would be best to go -.\n" }, - { "You are in the kitchen.", - { 28, 0, 0, 0, 0, 0, 0, 0 }, -"This room is full of shining stainless steel and burnished bronze cookware. An \n\ -assortment of tropical fruits and vegetables as well as fine meats and cheeses \n\ -lies on a sterling platter. The chef, unfortunately, has been skewered like a \n\ -side of beef. The dining room is +. ** There is a locked door +.\n" }, - { "You are in an arched entry leading to the dining room.", - { 0, 0, 0, 28, 0, 0, 0, 0 }, -"The door leading out is bolted shut from the outside and is very strong.***\n\ -The dining room is +.\n" }, - { "You are in space.", - { 33, 34, 35, 36, 37, 1, 33, 1}, -"****\n" }, - { "You are in space.", - { 38, 32, 39, 40, 41, 1, 42, 1}, -"****\n" }, - { "You are in space.", - { 32, 44, 45, 46, 47, 1, 48, 1}, -"****\n" }, - { "You are in space.", - { 40, 45, 49, 32, 50, 1, 51, 1}, -"****\n" }, - { "You are in space.", - { 41, 46, 32, 52, 53, 1, 54, 1}, -"****\n" }, - { "You are in space.", - { 42, 47, 50, 53, 55, 1, 32, 1}, -"****\n" }, - { "You are in space.", - { 43, 48, 51, 54, 32, 1, 56, 1}, -"****\n" }, - { "You are in space.", - { 57, 33, 40, 41, 42, 1, 43, 1}, -"****\n" }, - { "You are in space.", - { 39, 35, 57, 33, 58, 1, 59, 1}, -"****\n" }, - { "You are in space.", - { 39, 36, 33, 59, 60, 1, 61, 1}, -"****\n" }, - { "You are in space.", - { 39, 37, 58, 60, 62, 1, 33, 1}, -"****\n" }, - { "You are in space.", - { 39, 38, 59, 61, 33, 1, 63, 1}, -"****\n" }, - { "You are in space.", - { 34, 64, 45, 46, 47, 1, 48, 1}, -"****\n" }, - { "You are in space.", - { 35, 44, 49, 34, 50, 1, 51, 1}, -"****\n" }, - { "You are in space.", - { 36, 44, 34, 52, 53, 1, 54, 1}, -"****\n" }, - { "You are in space.", - { 37, 44, 50, 53, 55, 1, 34, 1}, -"****\n" }, - { "You are in space.", - { 38, 44, 51, 54, 34, 1, 56, 1}, -"****\n" }, - { "You are in space.", - { 49, 49, 52, 35, 49, 1, 49, 1}, -"****\n" }, - { "You are in space.", - { 58, 47, 49, 37, 55, 1, 35, 1}, -"****\n" }, - { "You are in space.", - { 59, 48, 49, 38, 35, 1, 56, 1}, -"****\n" }, - { "You are in space.", - { 52, 52, 36, 49, 52, 1, 52, 1}, -"****\n" }, - { "You are in space.", - { 60, 46, 37, 52, 55, 1, 36, 1}, -"****\n" }, - { "You are in space.", - { 61, 48, 38, 52, 36, 1, 56, 1}, -"****\n" }, - { "You are in space.", - { 62, 55, 55, 55, 56, 1, 37, 1}, -"****\n" }, - { "You are in space.", - { 56, 56, 56, 56, 38, 1, 55, 1}, -"****\n" }, - { "You are in space.", - { 65, 39, 57, 57, 57, 1, 57, 1}, -"****\n" }, - { "You are in space.", - { 39, 50, 49, 42, 62, 1, 40, 1}, -"****\n" }, - { "You are in space.", - { 39, 51, 49, 43, 40, 1, 63, 1}, -"****\n" }, - { "You are in space.", - { 39, 53, 43, 59, 62, 1, 41, 1}, -"****\n" }, - { "You are in space.", - { 39, 54, 43, 59, 41, 1, 56, 1}, -"****\n" }, - { "You are in space.", - { 39, 55, 62, 62, 56, 1, 42, 1}, -"****\n" }, - { "You are in space.", - { 39, 56, 35, 36, 43, 1, 55, 1}, -"****\n" }, - { "You are in space.", - { 44, 66, 66, 66, 66, 1, 66, 1}, -"****\n" }, - { "You are in space.", - { 67, 57, 67, 67, 67, 1, 67, 1}, -"****\n" }, - { "You are in space.", - { 64, 68, 68, 68, 68, 1, 68, 1}, -"****\n" }, - { "You are orbiting a small blue planet.", - { 67, 67, 67, 67, 65, 1, 69, 1}, -"****\n" }, - { "You are orbiting a tropical planet.", - { 68, 68, 68, 68, 66, 1, 70, 1}, -"****\n" }, - { "You are flying through a dense fog.", - { 69, 69, 69, 69, 69, 1, 69, 1}, -"A cold grey sea of mist is swirling around the windshield and water droplets\n\ -are spewing from the wingtips. Ominous shadows loom in the darkness and it\n\ -feels as if a trap is closing around us. I have lost all sense of direction.\n\ -****\n" }, - { "You are approaching an island.", - { 71, 72, 73, 74, 68, 1, 0, 1}, -"Coconut palms, sword ferns, orchids, and other lush vegetation drape this\n\ -jagged island carved seemingly from pure emerald and set in a turquoise\n\ -sea. The land rises sharply +. There is a nice beach* +.*\n" }, - { "You are flying over a mountainous region.", - { 75, 73, 76, 77, 68, 1, 0, 1}, -"Below is a magnificent canyon with deep gorges, high pinnacles and\n\ -waterfalls plummeting hundreds of feet into mist. Everything in sight\n\ -is carpeted with a tropical green.* The ocean is +.**\n" }, - { "You are flying over the ocean.", - { 74, 78, 78, 78, 68, 1, 0, 1}, -"You bank over the water and your wingtips dip low to the green waves. The\n\ -sea is very shallow here and the white coral beds beneath us teem with \n\ -colorful fish.****\n" }, - { "You are flying over the beach.", - { 71, 72, 79, 74, 68, 1, 80, 1}, -"A warm gentle surf caresses the white coral beach here. The land rises\n\ -sharply +.* The beach is lost in low cliffs and rocks +.*\n" }, - { "You are flying over a large lagoon.", - { 81, 72, 73, 82, 68, 1, 0, 1}, -"Encircled by a coral reef, the palms and ferns in this sheltered spot\n\ -have grown down to the water's very brink which winds tortuously inland.\n\ -There looks like a small village +.***\n" }, - { "You are flying over a gently sloping plane.", - { 83, 71, 84, 85, 68, 1, 0, 1}, -"This is where several alluvial fans and ancient lava flows have run\n\ -together forming a fertile plane choked with vegetation. It would be\n\ -impossible to land safely here.* The terrain is more rugged +.**\n" }, - { "You are flying through a gorge.", - { 0, 0, 86, 71, 68, 1, 102, 1}, -"This narrow, steep sided canyon is lined with waving ferns. The floor is of\n\ -light gravel with many freshets pouring from the walls and running along it.\n\ -The gorge leads to the sea** +, and to a tumultuous origin +.\n" }, - { "You are flying over a plantation.", - { 85, 81, 71, 88, 68, 1, 89, 1}, -"Rows of palms, papayas, mangoes, kiwi, as well as smaller fields of sugar\n\ -cane and pineapple are growing here. It might be possible to land here, but\n\ -I wouldn't advise it.* There looks like two small settlements + \n\ -and *+.\n" }, - { "You are over the ocean.", - { 72, 78, 79, 74, 68, 1, 0, 1}, -"The deep green swells foam and roll into the shore **+*.\n" }, - { "You are flying along the coast.", - { 86, 72, 90, 73, 68, 1, 91, 1}, -"The coastline here is very rocky with little or no sand. The surf in some\n\ -places is violent and explodes in a shower of sparkling spray.\n\ -There is a winding road below which closely follows the shore. ****\n" }, - { "This is a beautiful coral beach.", - { 106, 0, 107, 108, 73, 0, 0, 0 }, -"Fine silver sand kissed lightly by warm tropical waters stretches at least\n\ -30 meters here from the ocean to under gently swaying palms +.***\n" }, - { "You are flying over a small fishing village.", - { 77, 74, 71, 82, 68, 1, 92, 1}, -"A few thatched huts a short distance from the water and row of more modern\n\ -bungalows on either side of a dirt road are all that is here. The road\n\ -continues on ***+.\n" }, - { "You are flying over a clearing.", - { 88, 72, 74, 87, 68, 1, 93, 1}, -"There is a dock here (big enough for a seaplane) leading to a grassy\n\ -meadow and a road. Some people are having a party down there. Below is\n\ -a good landing site. ****\n" }, - { "You are flying over the shore.", - { 94, 75, 95, 96, 68, 1, 0, 1}, -"Rocky lava flows or coarse sandy beaches are all that is here except for\n\ -sparse herbs and weeds.****\n" }, - { "You are flying in a wide valley.", - { 95, 97, 86, 75, 68, 1, 98, 1}, -"This is a shallow valley yet the floor is obscured by a thick mist.\n\ -The valley opens to the sea +. The mist grows thicker +.**\n" }, - { "You are flying near the shore.", - { 96, 77, 75, 99, 68, 1, 0, 1}, -"Very tall palm trees growing in neatly planted rows march off from the \n\ -water here towards the hills and down to the flat lands *+.*\n\ -There is a nice beach +.\n" }, - { "You are flying around the very tip of the island.", - { 95, 79, 90, 84, 68, 1, 0, 1}, -"There is no beach here for sheer cliffs rise several hundred feet\n\ -to a tree covered summit. Far below, the blue sea gnaws voraciously at\n\ -the roots of these cliffs. The island bends around +** and +.\n" }, - { "You are flying along the coastline.", - { 99, 82, 88, 100, 68, 1, 101, 1}, -"There is a narrow strip of sand here lined with ferns and shrubs, but very\n\ -few trees. The beach is barley wide enough to land on. The beach continues\n\ -on -.* There are some buildings +.*\n" }, - { "You are flying over several cottages and buildings", - { 99, 82, 77, 87, 68, 1, 103, 1}, -"The grounds here are landscaped with palm trees, ferns, orchids, and beds of\n\ -flowering plumeria and antheriums. Directly below is a small ornate white\n\ -house with a belltower, a lush green lawn, and a spurting fountain.\n\ -Small dirt roads go + and +.**\n" }, - { "You are in a field of sugar cane.", - { 109, 110, 111, 112, 77, 0, 0, 0 }, -"These strong, thick canes give little shelter but many cuts and scrapes.\n\ -There are some large trees ***+.\n" }, - { "You are flying over the ocean.", - { 95, 78, 90, 86, 68, 1, 0, 1}, -"The water is a placid turquoise and so clear that fish and sharks\n\ -many fathoms below are clearly visible.****\n" }, - { "You are on the coast road.", - { 113, 114, 115, 116, 79, 0, 0, 0 }, -"The road winds close to the shore here and the sound of crashing surf is\n\ -deafening.* The water is +. The road continues - and -.\n" }, - { "You are on the main street of the village.", - { 117, 118, 119, 120, 81, 0, 0, 0 }, -"Thatched roofs and outrigger canoes, palm trees and vacation bungalows, and\n\ -comely natives in a tropical paradise all make this a fantasy come true.\n\ -There is an open bungalow +.* The road continues - and -.\n" }, - { "You are at the sea plane dock.", - { 121, 122, 123, 124, 82, 0, 0, 0 }, -"Native girls with skin of gold, clad only in fragrant leis and lavalavas,\n\ -line the dockside to greet you. A couple of ukulele plucking islanders and a\n\ -keyboard player are adding appropriate music. A road crosses the clearing \n\ -+*. There are some tables set up +.*\n" }, - { "You are flying over the ocean.", - { 94, 83, 95, 96, 68, 1, 0, 1}, -"Sea weeds and kelp surge in the waves off shore here. The ocean becomes \n\ -much deeper +.***\n" }, - { "You are flying along the coast.", - { 94, 84, 86, 83, 68, 1, 0, 1}, -"The land is very low here with a river running into the sea +. There\n\ -is a wide valley opening up +. The very tip of the island is +.*\n" }, - { "You are flying along the coast.", - { 94, 85, 83, 99, 68, 1, 0, 1}, -"There are some secluded sandy stretches of beach here, but too many rocky\n\ -outcroppings of lava to land. There is a nicer beach ***+.\n" }, - { "You are lost in a sea of fog.", - { 97, 104, 97, 97, 97, 1, 0, 1}, -"What have you gotten us into?\n\ -I can't see a thing! ****\n" }, - { "You are on a gravel wash.", - { 125, 126, 127, 128, 84, 0, 0, 0 }, -"The sound of cascading water is the background for a diluted chorus of \n\ -gurgling, splashing, and enchantingly delicate singing. Great billows\n\ -of steam are rising *+.**\n" }, - { "You are flying over a wide beach.", - { 96, 88, 85, 87, 68, 1, 105, 1}, -"Unlike the leeward beaches, few coconut palms grow here but a well groomed\n\ -lawn and garden with traipsing stone walks leads down to the sand.*\n\ -There are some buildings +. Some trees are growing +.*\n" }, - { "You are flying over the ocean.", - { 100, 100, 87, 100, 68, 1, 0, 1}, -"The sea is a perfectly clear blue with a white sandy bottom. No coral\n\ -grows underwater here, but the force of the waves is broken by the steep\n\ -incline.****\n" }, - { "You are on a narrow strip of sand.", - { 129, 130, 131, 0, 87, 0, 0, 0 }, -"Rather coarse sand makes this beach very steep and only a few meters wide.\n\ -A fresh ocean breeze is rustling the ferns **+.*\n" }, - { "This is Fern Canyon.", - { 0, 0, 132, 133, 76, 0, 0, 0 }, -"Delicate waving ferns flourish here, suckled by warm water dripping from \n\ -every fissure and crevice in the solid rock walls.\n\ -The canyon winds **-, and -.\n" }, - { "This is the front lawn.", - { 134, 135, 136, 137, 88, 0, 0, 0 }, -"There is a small fountain here where the driveway meets the lawn.\n\ -Across the driveway, +, is an ornate white house with and elegant \n\ -woodworking. The bargeboards are carved with fylfots, the ancient \n\ -symbols of luck. Even a bell tower has been built here.* There is a \n\ -road + which turns into the driveway.*\n" }, - { "You have just crossed the crest of a mountain.", - { 97, 79, 86, 71, 68, 1, 0, 1}, -"The fog vanished mysteriously as we flew over the crest.*\n\ -Far + I can see the ocean.**\n" }, - { "You are on a sandy beach.", - { 138, 139, 140, 0, 99, 0, 0, 0 }, -"This is the only good beach on the weather side of the island. Fine coral\n\ -sand, a fresh sea breeze, and dramatic surf add to its appeal.**\n\ -Stone steps lead to the gardens +.*\n" }, - { "You are among palm trees near the shore.", - { 141, 80, 142, 143, 73, 0, 0, 0 }, -"Arching coconut palms laden with fruit provide a canopy for the glistening\n\ -white sand and sparse grasses growing here. The forest grows denser +.\n\ -The ocean is +.**\n" }, - { "You are walking along the beach.", - { 144, 0, 145, 80, 73, 0, 0, 0 }, -"The warm tropical waters nuzzle your ankles as you walk. Above is a fiercely\n\ -blue sky. The slope of the sand is so gentle that two hundred meters\n\ -offshore the water is only knee deep.** There are some rocks +.*\n" }, - { "You are walking along the beach.", - { 146, 0, 80, 147, 73, 0, 0, 0 }, -"Many beautiful shells have been washed up here including bright yellow \n\ -cowries, chocolate colored murex, orange conchs, striped tritons and the\n\ -deadly cone shells.****\n" }, - { "You are in a papaya grove.", - { 148, 89, 149, 150, 77, 0, 0, 0 }, -"Green slender trees no taller than three meters bulge with their\n\ -orange succulent fruit. There are some tall trees +.***\n" }, - { "You are in a field of pineapple.", - { 89, 151, 152, 153, 77, 0, 0, 0 }, -"The sharp dagger like pineapple leaves can pierce the flesh and hold fast\n\ -a skewered victim with tiny barbs.* The field ends +.**\n" }, - { "You are in a field of kiwi plants.", - { 149, 154, 155, 89, 77, 0, 0, 0 }, -"Round hairy fruit hang from staked vines here. There are some trees +\n\ -and +. The field ends in a dirt road +.*\n" }, - { "You are in a large grove of coconuts.", - { 150, 153, 89, 156, 77, 0, 0, 0 }, -"These trees are much taller than any growing near the shore plus the fat,\n\ -juicy coconuts have been selectively cultivated. The grove continues\n\ -+, +, *and +.\n" }, - { "You are in the woods.", - { 157, 91, 158, 116, 79, 0, 0, 0 }, -"Tropical undergrowth makes the going rough here. Sword ferns give no strong\n\ -foot hold and the dangling vines would gladly throttle one. Strange cackling\n\ -noises are coming from somewhere +.***\n" }, - { "You are at the shore.", - { 91, 0, 159, 145, 79, 0, 0, 0 }, -"Explosions of surf jetting out of underwater tunnels here make it\n\ -impossible to climb down to a small cave entrance below. Only at rare\n\ -minus tides would it be possible to enter.*** The beach is better +.\n" }, - { "You are on the coast road.", - { 158, 161, 162, 91, 79, 0, 0, 0 }, -"The road is beginning to turn inland.* I can hear the surf +. The road\n\ -continues +.*\n" }, - { "The road winds deeper into the trees.", - { 163, 142, 91, 164, 79, 0, 0, 0 }, -"Only narrow sunbeams filter through the foliage above. The moist rich earth\n\ -has nurtured a myriad of trees, shrubs, and flowers to grow here. The\n\ -road continues - and *- from here.*\n" }, - { "This is the front porch of the bungalow.", - { 165, 92, 0, 0, 81, 0, 0, 0 }, -"These wooden steps and porch are very bucolic. A little woven mat on the \n\ -doorstep reads \"Don't Tread on Me\". The open front door is +.\n\ -A stone walk leads to the main street +.**\n" }, - { "You are on a path leading to the lagoon.", - { 92, 166, 167, 168, 81, 0, 0, 0 }, -"This path trampled fern, grass, sapling, and anything else that got in its\n\ -way.* The water is +.**\n" }, - { "This is a dirt road.", - { 169, 118, 170, 92, 81, 0, 0, 0 }, -"**The road continues on - here for some distance. A village is +.\n" }, - { "You are on a dirt road.", - { 171, 118, 92, 172, 81, 0, 0, 0 }, -"**There is a small village +. The road continues +.\n" }, - { "You are on a dirt road.", - { 173, 93, 174, 175, 82, 0, 0, 0 }, -"The light tan soil of the road contrasts artistically with the lush green\n\ -vegetation and searing blue sky.* There is a clearing and many people +.\n\ -The road continues - and -.\n" }, - { "You are at the seaplane dock.", - { 93, 0, 176, 177, 82, 0, 0, 0 }, -"Several muscular, bronze skinned men greet you warmly as you pass under\n\ -a thatched shelter above the dock here. Polynesian hospitality.\n\ -There is a clearing +.* A trail runs around the lagoon + and +.\n" }, - { "There are some tables on the lawn here.", - { 121, 122, 123, 93, 82, 0, 0, 0 }, -"Hors d'oeuvres, canapes, mixed drinks, and various narcotic drugs along with\n\ -cartons of Di Gel fill the tables to overflowing. Several other guests are\n\ -conversing and talking excitedly****.\n" }, - { "You are nosing around in the bushes.", - { 124, 124, 93, 124, 82, 0, 0, 0 }, -"There is little here but some old beer cans. You are making fools out of\n\ -us in front of the other guests.** It would be best to go -.*\n" }, - { "You are walking in a dry stream bed.", - { 178, 98, 179, 0, 84, 0, 0, 0 }, -"The large cobblestones are difficult to walk on. No sunlight reaches\n\ -below a white canopy of fog seemingly generated from *+. A dirt path \n\ -along the wash is +. A high bank is impossible to climb +.\n" }, - { "You are at the thermal pools.", - { 98, 0, 180, 181, 84, 0, 0, 0 }, -"Several steaming fumaroles and spluttering geysers drenched by icy mountain\n\ -waters from a nearby waterfall heat half a dozen natural pools to a\n\ -delicious 42 degrees. Enchantingly beautiful singing seems to flow from the\n\ -water itself as it tumbles down the falls.*** There is a mossy entrance\n\ -to a cave +.\n" }, - { "You are in the woods.", - { 127, 180, 182, 98, 84, 0, 0, 0 }, -"Coniferous trees girded by wild huckleberries, elderberries, salmonberries\n\ -and thimbleberries enjoy a less tropical climate here in the high mountains.\n\ -*The sound of rushing water is coming from +.**\n" }, - { "You are on a dirt trail.", - { 179, 181, 98, 0, 84, 0, 0, 0 }, -"The trail seems to start here and head -.** High cliffs border the \n\ -trail +.\n" }, - { "You are walking along the beach.", - { 183, 101, 184, 0, 87, 0, 0, 0 }, -"A rather unnerving surf explodes onto the beach here and dashes itself into\n\ -spray on the steep incline. The beach continues + and +.**\n" }, - { "You are walking along the beach.", - { 101, 185, 186, 0, 87, 0, 0, 0 }, -"This is not a very nice beach. The coarse sand hurts my feet.****\n" }, - { "You are walking through some ferns.", - { 184, 186, 187, 101, 87, 0, 0, 0 }, -"This is a wide field growing only ferns and small shrubs.** The \n\ -ocean is *+.\n" }, - { "You are in a narrow canyon.", - { 0, 0, 188, 102, 76, 0, 0, 0 }, -"The steep sides here squeeze a little freshet through a gauntlet like\n\ -series of riffles and pools.****\n" }, - { "The canyon is much wider here.", - { 0, 0, 102, 189, 76, 0, 0, 0 }, -"The sheer rock walls rise 10 meters to the forest above. A slender \n\ -waterfall careens away from the face of the rock high above and showers\n\ -the gravel floor with sparkling raindrops.** The canyon continues -\n\ -and -.\n" }, - { "You are on the front porch of the cottage.", - { 190, 103, 0, 0, 0, 0, 0, 0 }, -"Several giggling native girls came running down the steps as you approached\n\ -and headed on down the road. On the fern rimmed porch is a small table with\n\ -matching white wrought iron chairs cushioned with red velvet. The front\n\ -door leads -. The lawn and fountain are +.**\n" }, - { "You are in a palm grove.", - { 103, 191, 192, 105, 88, 0, 0, 0 }, -"****\n" }, - { "You are on a dirt road.", - { 193, 192, 245, 103, 88, 0, 0, 0 }, -"There is a large village +. The road cleaves a coconut plantation +.\n\ -A small dirt road goes -, and a drive way peals off +.\n" }, - { "You are in a field of small shrubs.", - { 184, 186, 103, 187, 88, 0, 0, 0 }, -"**Pine and other coniferous saplings have been planted here. The rich brown\n\ -soil is well tilled and watered. Across a large lawn, there is a small\n\ -cottage +. I can feel a delicious sea breeze blowing from +.\n" }, - { "The beach is pretty rocky here.", - { 194, 105, 195, 0, 96, 0, 0, 0 }, -"Dangerous surf and lava outcroppings make this a treacherous strand.\n\ -The beach is nicer* +.**\n" }, - { "The beach is almost 10 meters wide here.", - { 105, 183, 196, 0, 99, 0, 0, 0 }, -"The sand has become more coarse and the beach steeper.* It gets \n\ -worse +.**\n" }, - { "You are in the gardens.", - { 195, 196, 197, 105, 99, 0, 0, 0 }, -"Lush green lawns studded with palms and benches stretch as far as the eye\n\ -can see.** A path leads -. Stone steps lead down to the beach +.\n" }, - { "You are on the coast road.", - { 198, 106, 163, 199, 73, 0, 0, 0 }, -"The forest is dense on either side and conceals the road from anyone\n\ -approaching it.** The road continues - and -.\n" }, - { "You are in the forest.", - { 116, 107, 91, 106, 73, 0, 0, 0 }, -"There are trees and ferns all around.****\n" }, - { "You are in the forest.", - { 199, 108, 106, 146, 73, 0, 0, 0 }, -"There are trees and ferns all around.****\n" }, - { "You are in a copse.", - { 142, 107, 145, 80, 0, 0, 0, 0 }, -"This is a secret hidden thicket only noticeable from the beach. Someone\n\ -has been digging here recently.****\n" }, - { "You are at the tide pools.", - { 91, 0, 114, 107, 79, 0, 0, 0 }, -"These rocks and pools are the home for many sea anemones and crustaceans.\n\ -**The surf is very rough +. There is a nice beach +.\n" }, - { "You are in the forest.", - { 199, 108, 143, 0, 73, 0, 0, 0 }, -"This is a shallow depression sheltered from the wind by a thick growth of \n\ -thorny shrubs. It looks like someone has camped here. There is a fire pit\n\ -with some dry sticks and grass nearby.* The beach is +.* The thorny\n\ -shrubs block the way -.\n" }, - { "You are at the mouth of the lagoon.", - { 200, 0, 108, 201, 74, 0, 0, 0 }, -"The beach ends here where the coral reef rises to form a wide lagoon\n\ -bending inland. A path winds around the lagoon to the -.*\n\ -The beach continues on -. Only water lies +.\n" }, - { "You are in a breadfruit grove.", - { 202, 109, 203, 204, 77, 0, 0, 0 }, -"The tall trees bend leisurely in the breeze, holding many round breadfruits\n\ -close to their large serrated leaves. There are coconut palms +,\n\ -*+, and +.\n" }, - { "You are in a grove of mango trees.", - { 203, 111, 205, 109, 77, 0, 0, 0 }, -"The juicy yellow red fruits are nearly ripe on the trees here. There are\n\ -some coconut palms +. There are some vines +. There is a road +.*\n" }, - { "You are in a grove of coconut palms.", - { 204, 112, 109, 206, 77, 0, 0, 0 }, -"All I can see around us are palm trees.****\n" }, - { "You are in a coconut grove.", - { 110, 207, 208, 209, 77, 0, 0, 0 }, -"There are countless trees here.****\n" }, - { "You are in a field of pineapple.", - { 154, 208, 210, 110, 77, 0, 0, 0 }, -"The sharp leaves are cutting me to ribbons. There is a road **+.\n\ -More pineapple +.\n" }, - { "You are in a coconut grove.", - { 112, 209, 110, 211, 77, 0, 0, 0 }, -"There is a field of pineapple **+.*\n" }, - { "You are on the edge of a kiwi and pineapple field.", - { 111, 152, 155, 110, 77, 0, 0, 0 }, -"An irrigation ditch separates the two fields here. There is a road **+.*\n" }, - { "This is a dirt road.", - { 205, 210, 212, 111, 77, 0, 0, 0 }, -"The road runs - and - here.**\n" }, - { "You are in a palm grove.", - { 206, 211, 112, 213, 77, 0, 0, 0 }, -"There are palm trees all around us.****\n" }, - { "You are on the edge of a small clearing.", - { 157, 113, 157, 157, 79, 0, 0, 0 }, -"The ground is rather marshy here and darting in and out of the many tussocks\n\ -is a flock of wild chicken like fowl.****\n" }, - { "You are in the woods.", - { 158, 115, 215, 113, 79, 0, 0, 0 }, -"You have walked a long way and found only trees. ****\n" }, - { "You are walking along the shore.", - { 115, 0, 214, 114, 86, 0, 0, 0 }, -"You are now about 10 meters above the surf on a gently rising cliffside.**\n\ -The land rises +. There is a beach far +.\n" }, - { "You are just inside the entrance to the sea cave.", - { 246, 114, 0, 0, 114, 1, 0, 0 }, -"The sound of water dripping in darkness and the roar of the ocean just outside\n\ -create a very unwelcoming atmosphere inside this cave. Only on rare occasions\n\ -such as this is it possible to enter the forbidden catacombs... The cave\n\ -continues -.***\n" }, - { "You are in a secret nook beside the road.", - { 115, 159, 162, 91, 79, 0, 0, 0 }, -"Hidden from all but the most stalwart snoopers are some old clothes, empty\n\ -beer cans and a trash baggie full of used Huggies and ordure. Lets get\n\ -back to the road +.***\n" }, - { "You are on the coast road.", - { 215, 214, 0, 115, 86, 0, 0, 0 }, -"The road turns abruptly - here, avoiding the cliffs near the shore\n\ -+ and +.*\n" }, - { "You are on a dirt road.", - { 216, 116, 113, 141, 79, 0, 0, 0 }, -"The roadside is choked with broad leaved plants fighting for every breath of\n\ -sunshine. The palm trees are taller than at the shore yet bend over the road \n\ -forming a canopy. The road continues *- and *-.\n" }, - { "You have discovered a hidden thicket near the road.", - { 163, 142, 116, 106, 73, 0, 0, 0 }, -"Stuffed into a little bundle here is a bloody silken robe and many beer cans.\n\ -*Some droplets of blood and a major spill sparkle farther +.\n\ -The road is +.*\n" }, - { "You are in the living room.", - { 0, 117, 217, 218, 0, 0, 0, 0 }, -"A decorative entry with fresh flowers and wall to wall carpeting leads into\n\ -the living room here where a couch and two chairs converse with an end table.\n\ -*The exit is +.* The bedroom is +.\n" }, - { "You are at the lagoon.", - { 118, 0, 167, 168, 81, 0, 0, 0 }, -"There are several outrigger canoes pulled up on a small beach here and a\n\ -catch of colorful fish is drying in the sun. There are paths leading \n\ -off -*, -, and -.\n" }, - { "You are at the lagoon.", - { 118, 0, 170, 166, 81, 0, 0, 0 }, -"This is a grassy little spot near the water. A sightly native girl is frolicking\n\ -in the water close to shore here.** The path continues - and -. \n" }, - { "You are at the lagoon.", - { 118, 0, 166, 172, 81, 0, 0, 0 }, -"The path meanders through tussocks of grass, ferns, and thorny bushes here\n\ -and continues on **- and -.\n" }, - { "You are in the woods.", - { 219, 119, 220, 92, 81, 0, 0, 0 }, -"There are plenty of ferns and thorny bushes here! ****\n" }, - { "You are on a dirt road.", - { 220, 167, 199, 119, 74, 0, 0, 0 }, -"The road winds rather close to a large lagoon here and many sedges and tall\n\ -grasses line the shoulder *+. The road continues - and -.\n" }, - { "You are in the woods beside the road.", - { 221, 120, 92, 222, 81, 0, 0, 0 }, -"The forest grows darker +. The road is +.**\n" }, - { "The road crosses the lagoon here.", - { 222, 0, 120, 174, 81, 0, 0, 0 }, -"Coursing through the trees, the road at this point bridges a watery finger\n\ -of the lagoon.* The water is +. The road continues - and -.\n" }, - { "You are in a coconut palm grove.", - { 223, 121, 224, 225, 82, 0, 0, 0 }, -"The tall palms are planted about 30 feet apart with a hardy deep green grass\n\ -filling the spaces in between. There are tire tracks through the grass. The\n\ -grove continues -. There is a road +.**\n" }, - { "You are walking along a dirt road.", - { 224, 176, 172, 121, 82, 0, 0, 0 }, -"You are nearing the lagoon.** The road continues - and -.\n" }, - { "You are on a dirt road.", - { 225, 177, 121, 226, 82, 0, 0, 0 }, -"The road turns abruptly - here, entering a grove of palm trees.* The road\n\ -also continues - toward the lagoon.*\n" }, - { "You are on a trail running around the lagoon.", - { 172, 0, 0, 122, 82, 0, 0, 0 }, -"The dark waters brush the trail here and the path crosses a bridge +.\n\ -There is deep water + and +. The trail continues -.\n" }, - { "This is the mouth of the lagoon.", - { 175, 0, 122, 227, 82, 0, 0, 0 }, -"The coral reef wraps around a natural bay here to create a wide lagoon which\n\ -winds tortuously inland.** A trail goes around the lagoon +. The beach\n\ -is +.\n" }, - { "You are in a dry stream bed.", - { 0, 125, 0, 0, 84, 0, 0, 0 }, -"The dry wash drains over a tall precipice here into a turbid morass below. The\n\ -most noisome stench imaginable is wafting up to defile our nostrils. Above,\n\ -the lurid sun glows brown through a strange mist.* The only direction \n\ -I'm going is -.**\n" }, - { "You are on a dirt path along the wash.", - { 0, 128, 125, 228, 84, 0, 0, 0 }, -"This path looks more like a deer trail. It scampers away ***+.\n" }, - { "The thermal pools flow into a stream here.", - { 127, 0, 229, 126, 84, 0, 0, 0 }, -"The gurgling hot waters pour over boulders into a swiftly flowing\n\ -stream **+. The pools are +.\n" }, - { "You are at the entrance to a cave.", - { 128, 230, 126, 0, 84, 0, 0, 0 }, -"A tall narrow fissure in the rock cliffs here has become a well traveled\n\ -passage way. A hoof beaten dirt path leads directly into it. A curl of\n\ -steam is trailing from a corner of the fissure's gaping mouth. The path\n\ -leads - and -. The pools are +.*\n" }, - { "You are in the woods.", - { 182, 229, 182, 127, 84, 0, 0, 0 }, -"Wild berry bushes plump with fruit and thorns tangle your every effort to\n\ -proceed.* The sound of rushing water is +.**\n" }, - { "You are walking along the beach.", - { 139, 129, 184, 0, 99, 0, 0, 0 }, -"Some dunes here progress inland and make it impossible to get very far in that\n\ -direction. The beach continues - and -.* The ocean is +.\n" }, - { "You are in the dunes.", - { 183, 101, 184, 129, 87, 0, 0, 0 }, -"The endless rolling and pitching sand dunes are enough to make one very queasy!\n\ -The only way I'm going is ***+.\n" }, - { "This is a lousy beach.", - { 130, 0, 0, 0, 87, 0, 0, 0 }, -"Volcanic and viciously sharp bitted grains of sand here bite like cold steel\n\ -into my tender feet. I refuse to continue on. Let's get out of here. The\n\ -beach is better +.***\n" }, - { "You are in a field of sparse ferns.", - { 131, 185, 187, 130, 87, 0, 0, 0 }, -"The lava rock outcroppings here will support few plants. There is more \n\ -vegetation +. There is a nice beach +.* The ocean is +.\n" }, - { "You are in the woods.", - { 131, 131, 137, 131, 87, 0, 0, 0 }, -"Young trees and tall shrubs grow densely together at this distance from the \n\ -shore.** The trees grow thicker +.*\n" }, - { "The canyon is no wider than a foot here.", - { 0, 0, 0, 132, 0, 0, 0, 0 }, -"The freshet is gushing through the narrow trough, but the canyon has grown\n\ -too narrow to follow it any farther.*** I guess we'll have to go -.\n" }, - { "You are in a narrow part of the canyon.", - { 0, 0, 133, 232, 76, 0, 0, 0 }, -"The two sheer sides are no more than a few meters apart here. There is a stone\n\ -door in the wall +. The gravelly floor runs with tiny rivulets seeping \n\ -from the ground itself.* The canyon continues - and -.\n" }, - { "You are in the drawing room.", - { 0, 134, 0, 0, 0, 0, 0, 0 }, -"Exquisitely decorated with plants and antique furniture of superb\n\ -craftsmanship, the parlor reflects its owners impeccable taste. The tropical\n\ -sun is streaming in through open shutters *+. There doesn't seem \n\ -to be anybody around. A large immaculate oaken desk is visible in the\n\ -study and it even has a old fashioned telephone to complete the decor.**\n" }, - { "You are in a palm grove.", - { 135, 191, 233, 191, 88, 0, 0, 0 }, -"Grassy rows of palms stretch as far as I can see.** There is a road +.*\n" }, - { "You are on a dirt road.", - { 136, 233, 234, 135, 88, 0, 0, 0 }, -"The road winds through a coconut palm grove here. It continues on - \n\ -and -.**\n" }, - { "The road leads to several large buildings here.", - { 235, 136, 236, 237, 88, 0, 0, 0 }, -"There is a clubhouse +,* a large barn and stable +, and a garage of \n\ -similar construct to the barn +.\n" }, - { "This part of the beach is impassable.", - { 0, 138, 0, 0, 96, 0, 0, 0 }, -"The huge rocks and thunderous surf here would pound our frail bodies to pulp\n\ -in an instant.* The only direction I'm going is -.**\n" }, - { "You are in the gardens.", - { 195, 140, 197, 138, 96, 0, 0, 0 }, -"So much green grass is a pleasure to the eyes.****\n" }, - { "You are in the gardens.", - { 140, 183, 197, 139, 99, 0, 0, 0 }, -"Beautiful flowers and shrubs surround a little goldfish pond.****\n" }, - { "You are on a stone walk in the garden.", - { 195, 196, 238, 140, 99, 0, 0, 0 }, -"The walk leads to a road **+.*\n" }, - { "You are in the forest near the road.", - { 198, 141, 216, 198, 73, 0, 0, 0 }, -"There are many thorny bushes here!****\n" }, - { "You are at a fork in the road.", - { 239, 146, 141, 170, 73, 0, 0, 0 }, -"Two roads come together in the forest here. One runs -,* the other \n\ -runs - and -.\n" }, - { "You are on a dirt path around the lagoon.", - { 170, 147, 146, 0, 74, 0, 0, 0 }, -"The still waters reflect bending palms and a cloudless sky. It looks like\n\ -the path runs into a clearing +. The path continues -.**\n" }, - { "You are drowning in the lagoon.", - { 201, 201, 147, 201, 74, 0, 0, 0 }, -"I suggest you get out before you become waterlogged.****\n" }, - { "You are in a coconut palm grove.", - { 202, 148, 203, 204, 77, 0, 0, 0 }, -"****\n" }, - { "You are in a palm grove.", - { 202, 149, 205, 148, 77, 0, 0, 0 }, -"****\n" }, - { "You are in a palm grove.", - { 202, 150, 148, 206, 77, 0, 0, 0 }, -"****\n" }, - { "You are on a dirt road.", - { 203, 155, 212, 149, 77, 0, 0, 0 }, -"*This road ends here at a palm grove but continues on - for quite\n\ -some way.**\n" }, - { "You are in a coconut palm grove.", - { 204, 156, 150, 213, 77, 0, 0, 0 }, -"****\n" }, - { "You are in a coconut grove.", - { 151, 219, 208, 209, 77, 0, 0, 0 }, -"*The grove ends +.**\n" }, - { "You are in a coconut grove.", - { 152, 207, 239, 151, 77, 0, 0, 0 }, -"**There is a dirt road +.*\n" }, - { "You are in a coconut grove.", - { 153, 207, 151, 211, 77, 0, 0, 0 }, -"****\n" }, - { "This is a dirt road.", - { 205, 239, 212, 154, 77, 0, 0, 0 }, -"The road continues - and -.**\n" }, - { "You are in a coconut grove.", - { 153, 209, 153, 213, 77, 0, 0, 0 }, -"****\n" }, - { "You are in the woods near the road.", - { 205, 210, 212, 155, 77, 0, 0, 0 }, -"There are many thorny bushes here!****\n" }, - { "You are in a coconut grove.", - { 213, 213, 156, 234, 88, 0, 0, 0 }, -"***The grove ends in a clearing +.\n" }, - { "You are walking along some high cliffs.", - { 162, 0, 0, 159, 86, 0, 0, 0 }, -"The island bends sharply + here with high cliffs -\n\ -and -. The cliffs are lower +.\n" }, - { "You are at the coast road turn around.", - { 0, 162, 0, 158, 90, 0, 0, 0 }, -"The coast road ends here in a lookout with a view of 100 kilometers of blue\n\ -sea and 100 meters of rugged cliff. Far below the waves crash against rocks.\n\ -****\n" }, - { "You are in the woods near the road.", - { 216, 163, 216, 198, 79, 0, 257, 0 }, -"These thorny bushes are killing me.****\n" }, - { "You are in the kitchen.", - { 0, 0, 0, 165, 0, 0, 0, 0 }, -"A small gas stove and a refrigerator are all the only appliances here. The\n\ -gas oven has been left on and the whole room is reeking with natural gas.\n\ -One spark from a match and.... The door out is ***+.\n" }, - { "You are in the bedroom.", - { 0, 0, 165, 0, 0, 0, 0, 0 }, -"A soft feather comforter on top of layers of Answer blankets make this a very\n\ -luxurious place to sleep indeed. There are also some end tables and a dresser\n\ -here.** The living room is +.*\n" }, - { "You are in the woods.", - { 207, 169, 220, 221, 81, 0, 0, 0 }, -"There seems to be a clearing +.***\n" }, - { "You are in the woods near the road.", - { 219, 170, 239, 169, 81, 0, 0, 0 }, -"*As far as I can tell, there are two roads + and +.*\n" }, - { "You are in the woods.", - { 207, 171, 219, 222, 81, 0, 0, 0 }, -"The forest is clearer +.***\n" }, - { "You are on the lagoon's inland finger.", - { 0, 172, 171, 172, 81, 0, 0, 0 }, -"It is impossible to follow the lagoon any farther inland because of sharp\n\ -and very painful sedges.* The road is +.**\n" }, - { "You are in a grassy coconut grove.", - { 240, 173, 224, 241, 82, 0, 0, 0 }, -"The tall palms provide a perfect canopy for the lush green grass.***\n\ -There is a road +.\n" }, - { "You are near the lagoon's inland finger.", - { 0, 174, 0, 173, 82, 0, 0, 0 }, -"Very sharp sedges make it impossible to follow the lagoon any farther inland.\n\ -*There is a road +.**\n" }, - { "You are on a dirt road.", - { 241, 175, 173, 226, 82, 0, 0, 0 }, -"The road winds through a coconut grove here and continues - and -.**\n" }, - { "You are in the woods near the road.", - { 226, 226, 175, 226, 82, 0, 0, 0 }, -"**The road is +.*\n" }, - { "This is a beach?", - { 227, 227, 177, 0, 82, 0, 0, 0 }, -"Hard jagged rocks that pierce with every footstep hardly comprise a beach.**\n\ -Let's go -.*\n" }, - { "The trail is lost in the woods here.", - { 241, 241, 179, 241, 84, 0, 0, 0 }, -"I suppose the animals that use this trail all depart in different directions\n\ -when they get this far into the woods.** The trail goes -.*\n" }, - { "You are on the bank of a stream.", - { 182, 0, 242, 180, 84, 0, 0, 0 }, -"The stream falls over several small boulders here and continues on **-.*\n" }, - { "You are just inside the cave.", - { 181, 267, 0, 0, 0, 0, 0, 0 }, -"A steamy hot breath is belching from the depths of the earth within.* The\n\ -cave continues -.**\n" }, - { "You are just inside the cave entrance.", - { 274, 0, 0, 0, 0, 0, 0, 0 }, -"The air is hot and sticky inside. The cave continues -. There is a \n\ -stone door in the wall +. A wooden sign in the dust reads in old elven\n\ -runes, \"GSRF KDIRE NLVEMP!\".**\n" }, - { "You are at the edge of a huge chasm.", - { 0, 0, 189, 0, 76, 0, 0, 0 }, -"Several hundred feet down I can see the glimmer of placid water. The\n\ -rivulets drain over the edge and trickle down into the depths. It is \n\ -impossible to climb down without a rope.** The canyon continues -.*\n" }, - { "You are on a dirt road.", - { 192, 241, 240, 191, 88, 0, 0, 0 }, -"The road winds through a coconut grove here. The road continues on -\n\ -and -.**\n" }, - { "You are in a coconut palm grove near the road.", - { 193, 233, 213, 192, 88, 0, 0, 0 }, -"***The road is +.\n" }, - { "You are at the clubhouse.", - { 0, 193, 0, 0, 0, 0, 0, 0 }, -"The clubhouse is built over the most inland part of the lagoon. Tropical\n\ -bananas and fragrant frangipani grow along the grassy shore. Walking across\n\ -the short wooden bridge, we enter. Along one wall is a bar with only a few\n\ -people seated at it. The restaurant and dance floor are closed off with\n\ -a 2 inch nylon rope. ****\n" }, - { "You are in the stables.", - { 0, 0, 0, 193, 0, 0, 0, 0 }, -"Neighing horses snacking on hay and oats fill the stalls on both sides of\n\ -the barn. It is rather warm in here but that is not the most offensive\n\ -part. The old boards of the barn part just enough to let in dust laden\n\ -shafts of light. Flies swarm overhead and strafe the ground for dung.\n\ -My nose is beginning to itch. ****\n" }, - { "You are in the old garage.", - { 0, 0, 193, 0, 0, 0, 0, 0 }, -"This is an old wooden building of the same vintage as the stables. Beneath\n\ -a sagging roof stand gardening tools and greasy rags. Parked in the center\n\ -is an underpowered Plymouth Volare' with a red and white striped golf cart\n\ -roof. ****\n" }, - { "You are on a dirt road.", - { 197, 197, 243, 197, 85, 0, 0, 0 }, -"The road leads to a beautiful formal garden laced with stone walks and tropical\n\ -flowers and trees.** The road continues -. A walk leads -.\n" }, - { "You are on a dirt road.", - { 210, 199, 198, 220, 73, 0, 0, 0 }, -"The road runs - and -.**\n" }, - { "You are in a coconut grove near the road.", - { 234, 223, 234, 233, 88, 0, 0, 0 }, -"***The road is +.\n" }, - { "You are on a dirt road.", - { 233, 225, 223, 226, 82, 0, 0, 0 }, -"The road continues - and -.**\n" }, - { "The stream plummets over a cliff here.", - { 182, 0, 0, 229, 84, 0, 0, 0 }, -"Falling 10 agonizing meters into spray, only droplets of the stream are\n\ -left to dance off the floor below. I thought I saw a sparkle of gold\n\ -at the bottom of the falls, but now it is gone. There is no way down,\n\ -even with a strong rope. ****\n" }, - { "You are on a dirt road.", - { 0, 0, 244, 238, 85, 0, 0, 0 }, -"**The road continues - and -.\n" }, - { "You are on a dirt road.", - { 0, 245, 0, 243, 88, 0, 0, 0 }, -"*The road continues -* and -.\n" }, - { "You are on a dirt road.", - { 244, 234, 213, 136, 88, 0, 0, 0 }, -"The road goes -* and *-.\n" }, - { "You are in a low passage.", - { 247, 160, 0, 0, 0, 0, 0, 0 }, -"The passage is partially flooded here and it may be hazardous to proceed.\n\ -Water is surging from the tunnel and heading out to sea. Strange moaning\n\ -noises rise above the rushing of the water. They are as thin as a whispering\n\ -wind yet penetrate to my very soul. I think we have come too far...\n\ -The passage continues -.***\n" }, - { "The walls are very close together here.", - { 248, 0, 0, 0, 0, 0, 0, 0 }, -"I can barely squeeze through the jagged opening. Slimy sea weeds provide\n\ -no footing at all. This tunnel seems to be an ancient lava tube. There is\n\ -a large room -.***\n" }, - { "You are in the cathedral room.", - { 249, 251, 249, 251, 0, 0, 0, 0 }, -"Your light casts ghostly shadows on the walls but cannot pierce the \n\ -engulfing darkness overhead. The sound of water dripping echoes in the void.\n\ -*I can see no passages leading out of this room. We have definitely\n\ -come too far.*** \n" }, - { "You are walking through a very round tunnel.", - { 252, 0, 0, 0, 252, 1, 0, 0 }, -"The round walls of this tunnel are amazingly smooth to the touch. A little\n\ -trickle of water flows down the center. The tunnel climbs steadily +.\n\ -The cave is beginning to flood again! Let's get out of here! ***\n" }, - { "You are in the cathedral anteroom.", - { 0, 0, 0, 248, 253, 1, 0, 0 }, -"This small chamber with a flat stone floor is to one side of the cathedral \n\ -room. We appear to be at the bottom of a tall narrow shaft. There are many \n\ -puddles of water here. A staircase hewn from solid rock and black lava \n\ -leads up.*** The cathedral room is +.\n" }, - { "You are in a wide chamber.", - { 0, 0, 248, 254, 0, 0, 0, 0 }, -"Water is sprinkling from the ceiling here. A shallow pool populated by a \n\ -myriad of blind white creatures sparkles in your light. Tiny shrimp and\n\ -crabs scurry away, frightened by the blinding rays.** The cave \n\ -continues - and -.\n" }, - { "You are at the top of a sloping passage.", - { 0, 0, 255, 256, 257, 1, 0, 0 }, -"There is much algae growing here, both green and brown specimens. \n\ -Water from an underground sea surges and splashes against the slope of\n\ -the rock. The walls glisten with shiny minerals. High above, light\n\ -filters in through a narrow shaft.** A hallway here runs -\n\ -and -.\n" }, - { "You are in an elaborately tiled room.", - { 0, 0, 258, 0, 0, 0, 250, 0 }, -"Large colorful tiles plate the floor and walls. The ceiling is a mosaic\n\ -of gems set in gold. Hopefully it is only our footsteps that are echoing in\n\ -this hollow chamber.** The room continues -. A stone staircase\n\ -leads down.*\n" }, - { "You are at a dead end.", - { 0, 0, 251, 0, 0, 0, 0, 0 }, -"The walls here are alive with dark mussels. They click their shells menacingly\n\ -if we disturb them. ** The only exit is +.*\n" }, - { "The tunnel is very low here.", - { 0, 0, 259, 252, 0, 0, 0, 0 }, -"I practically have to crawl on my knees to pass through this opening. The\n\ -air is stiflingly damp, but I can't hear any sounds of water dripping.**\n\ -The crawlspace continues -. The tunnel seems wider +.\n" }, - { "This is the supply room.", - { 0, 0, 252, 0, 0, 0, 0, 0 }, -"Picks and shovels line the walls here, as well as hard hats, boxes of\n\ -dynamite, and a cartload of very high grade gold and silver ore.** \n\ -A tunnel leads off +.*\n" }, - { "You have found a secret entrance to the catacombs.", - { 0, 0, 0, 0, 216, 1, 252, 0 }, -"I have a sickening feeling that we should not have entered the catacombs.\n\ -Below is a wet, seaweed covered floor. Above is a way out. ****\n" }, - { "You are in the catacombs.", - { 0, 0, 260, 253, 0, 0, 0, 0 }, -"Ornate tombs and piles of treasure line the walls. Long spears with many\n\ -blades, fine swords and coats of mail, heaps of coins, jewelry, pottery, \n\ -and golden statues are tribute of past kings and queens.** The catacombs\n\ -continue - and -.\n" }, - { "You are crawling on your stomach.", - { 0, 0, 261, 255, 0, 0, 0, 0 }, -"The passage is quite narrow and jagged, but the rock is no longer lava.\n\ -It appears to be a form of granite.** The crawlspace continues -, \n\ -but I would just as soon go -.\n" }, - { "You are in the Sepulcher.", - { 0, 0, 0, 258, 0, 0, 0, 0 }, -"A single tomb is here. Encrusted with diamonds and opals, and secured with \n\ -straps of a very hard, untarnished silver, this tomb must be of a great king.\n\ -Vases overflowing with gold coins stand nearby. A line of verse on the wall\n\ -reads, \"Three he made and gave them to his daughters.\"****\n" }, - { "The passage is wider here.", - { 0, 0, 0, 259, 0, 0, 0, 0 }, -"You are at the top of a flooded shaft. About a meter below the edge,\n\ -dark water rises and falls to the rhythm of the sea. A ladder goes\n\ -down into water here.*** A small crawlspace goes -.\n" }, - { "You are at the bottom of a ladder.", - { 0, 0, 0, 0, 261, 1, 263, 0 }, -"This is a narrow platform to rest on before we continue either up or down this\n\ -rickety wooden ladder.****\n" }, - { "You are standing in several inches of water.", - { 264, 0, 265, 266, 262, 1, 0, 0 }, -"This seems to be a working mine. Many different tunnels wander off following\n\ -glowing veins of precious metal. The floor is flooded here since we must\n\ -be nearly at sea level. A ladder leads up. ****\n" }, - { "The tunnel here is blocked by broken rocks.", - { 0, 263, 0, 0, 0, 0, 0, 0 }, -"The way is blocked, but if you had some dynamite, we might be able to blast our\n\ -way through.* The passage goes -.**\n" }, - { "The tunnel is too flooded to proceed.", - { 0, 0, 0, 263, 0, 0, 0, 0 }, -"Hidden shafts could swallow us if we tried to continue on down this tunnel.\n\ -The flooding is already up to my waist. Large crystals overhead shimmer\n\ -rainbows of reflected light.*** Let's go -.\n" }, - { "The mine is less flooded here.", - { 0, 0, 263, 0, 0, 0, 0, 0 }, -"A meandering gold laden vein of quartz and blooming crystals of diamonds\n\ -and topaz burst from the walls of the cave. A passage goes -.***\n" }, - { "You are inside the cave.", - { 230, 268, 0, 0, 0, 0, 0, 0 }, -"A hot steam swirls around our heads, and the walls are warm to the touch.\n\ -The trail winds + and +.**\n" }, - { "You are in a rather large chamber.", - { 267, 0, 0, 269, 0, 0, 269, 0 }, -"Beds of ferns and palm leaves make several cozy nests along the walls. In the\n\ -center of the room is a throne of gold and silver which pulls out into a bed\n\ -of enormous size.*** A passageway leads down to the -.\n" }, - { "You are walking along the edge of a huge abyss.", - { 0, 0, 268, 0, 268, 1, 270, 0 }, -"Steam is rising in great clouds from the immeasurable depths. A very narrow\n\ -trail winds down.** There is a tunnel +.*\n" }, - { "You are on the edge of a huge abyss.", - { 0, 0, 0, 0, 269, 1, 271, 0 }, -"The trail winds farther down.****\n" }, - { "You are winding your way along the abyss.", - { 0, 0, 0, 0, 270, 1, 272, 0 }, -"The trail continues up and down.****\n" }, - { "You are on a wide shelf near the steamy abyss.", - { 0, 273, 0, 0, 271, 1, 0, 0 }, -"The stifling hot cave seems even hotter to me, staring down into this misty \n\ -abyss. A trail winds up.* A passageway leads -.**\n" }, - { "You are in a wide tunnel leading to a fuming abyss.", - { 272, 274, 0, 0, 0, 0, 0, 0 }, -"The passageway winds through many beautiful formations of crystals and\n\ -sparkling minerals. The tunnel continues - and -.**\n" }, - { "You are in a tunnel.", - { 273, 231, 0, 0, 0, 0, 0, 0 }, -"It is very warm in here. The smell of steam and hot rocks permeates the place.\n\ -The cave continues - and -.**\n" }, - { "You are at the bottom of a pit.", - { 0, 0, 0, 0, 232, 0, 0, 0 }, -"I can see daylight far up at the mouth of the pit. A cool draft wafts down.\n\ -There doesn't seem to be any way out, and I don't remember how we came in.\n\ -If you had a rope it might be possible to climb out. ****\n" }, -}; diff --git a/games/battlestar/dayobjs.c b/games/battlestar/dayobjs.c deleted file mode 100644 index 801c65af4a82..000000000000 --- a/games/battlestar/dayobjs.c +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) 1983, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)dayobjs.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include "externs.h" - -const struct objs dayobjs[] = { - { 236, HORSE }, - { 237, CAR }, - { 275, POT }, - { 275, BAR }, - { 275, BLOCK }, - { 260, COINS }, - { 266, DARK }, - { 235, TIMER }, - { 51, 51 }, - { 59, 51 }, - { 48, 51 }, - { 66, 52 }, - { 65, 52 }, - { 19, BOMB }, - { 167, NATIVE }, - { 21, KNIFE }, - { 30, KNIFE }, - { 30, CLEAVER }, - { 260, SWORD }, - { 70, LAND }, - { 71, LAND }, - { 72, LAND }, - { 73, LAND }, - { 74, LAND }, - { 75, LAND }, - { 76, LAND }, - { 77, LAND }, - { 78, LAND }, - { 79, LAND }, - { 81, LAND }, - { 82, LAND }, - { 83, LAND }, - { 84, LAND }, - { 85, LAND }, - { 86, LAND }, - { 87, LAND }, - { 88, LAND }, - { 90, LAND }, - { 95, LAND }, - { 96, LAND }, - { 97, LAND }, - { 99, LAND }, - { 100, LAND }, - { 104, LAND }, - { 172, WOODSMAN }, - { 172, DEADWOOD }, - { 172, MALLET }, - { 146, ELF }, - { 146, HALBERD }, - { 146, SHIELD }, - { 190, TWO_HANDED }, - { 190, POTION }, - { 142, BROAD }, - { 258, MAIL }, - { 258, HELM }, - { 21, MAID }, - { 7, VIPER }, - { 216, SHOES }, - { 64, CYLON }, - { 36, CYLON }, - { 49, CYLON }, - { 8, ROBE }, - { 13, AMULET }, - { 20, LASER }, - { 126, BATHGOD }, - { 26, GRENADE }, - { 256, GRENADE }, - { 237, CHAIN }, - { 237, COMPASS }, - { 218, LEVIS }, - { 164, MACE }, - { 137, SHOVEL }, - { 11, COINS }, - { 24, MATCHES }, - { 235, MATCHES }, - { 93, MAN }, - { 109, PAPAYAS }, - { 110, PINEAPPLE }, - { 152, PINEAPPLE }, - { 154, PINEAPPLE }, - { 111, KIWI }, - { 149, MANGO }, - { 112, COCONUTS }, - { 150, COCONUTS }, - { 151, COCONUTS }, - { 153, COCONUTS }, - { 192, COCONUTS }, - { 204, COCONUTS }, - { 207, COCONUTS }, - { 209, COCONUTS }, - { 213, COCONUTS }, - { 240, COCONUTS }, - { 218, RING }, - { 130, BRACELET }, - { 93, GIRL }, - { 268, LAMPON }, - { 0 , 0 } -}; diff --git a/games/battlestar/externs.h b/games/battlestar/externs.h deleted file mode 100644 index 0755e803069b..000000000000 --- a/games/battlestar/externs.h +++ /dev/null @@ -1,361 +0,0 @@ -/* - * Copyright (c) 1983, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)externs.h 8.1 (Berkeley) 5/31/93 - * - * $FreeBSD$ - */ - -#include -#include -#include -#include -#include -#include -#include - -#define BITS (8) - -#define OUTSIDE (position > 68 && position < 246 && position != 218) -#define rnd(x) (random() % (x)) -#define max(a,b) ((a) < (b) ? (b) : (a)) -#define testbit(array, index) (array[index/BITS] & (1 << (index % BITS))) -#ifndef setbit -#define setbit(array, index) (array[index/BITS] |= (1 << (index % BITS))) -#endif -#define clearbit(array, index) (array[index/BITS] &= ~(1 << (index % BITS))) - - /* well known rooms */ -#define FINAL 275 -#define GARDEN 197 -#define POOLS 126 -#define DOCK 93 - - /* word types */ -#define VERB 0 -#define OBJECT 1 -#define NOUNS 2 -#define PREPS 3 -#define ADJS 4 -#define CONJ 5 - - /* words numbers */ -#define KNIFE 0 -#define SWORD 1 -#define LAND 2 -#define WOODSMAN 3 -#define TWO_HANDED 4 -#define CLEAVER 5 -#define BROAD 6 -#define MAIL 7 -#define HELM 8 -#define SHIELD 9 -#define MAID 10 -#define BODY 10 -#define VIPER 11 -#define LAMPON 12 -#define SHOES 13 -#define CYLON 14 -#define PAJAMAS 15 -#define ROBE 16 -#define AMULET 17 -#define MEDALION 18 -#define TALISMAN 19 -#define DEADWOOD 20 -#define MALLET 21 -#define LASER 22 -#define BATHGOD 23 -#define NORMGOD 24 -#define GRENADE 25 -#define CHAIN 26 -#define ROPE 27 -#define LEVIS 28 -#define MACE 29 -#define SHOVEL 30 -#define HALBERD 31 -#define COMPASS 32 -#define CRASH 33 -#define ELF 34 -#define FOOT 35 -#define COINS 36 -#define MATCHES 37 -#define MAN 38 -#define PAPAYAS 39 -#define PINEAPPLE 40 -#define KIWI 41 -#define COCONUTS 42 -#define MANGO 43 -#define RING 44 -#define POTION 45 -#define BRACELET 46 -#define GIRL 47 -#define GIRLTALK 48 -#define DARK 49 -#define TIMER 50 -#define CHAR 53 -#define BOMB 54 -#define DEADGOD 55 -#define DEADTIME 56 -#define DEADNATIVE 57 -#define NATIVE 58 -#define HORSE 59 -#define CAR 60 -#define POT 61 -#define BAR 62 -#define BLOCK 63 -#define NUMOFOBJECTS 64 - /* non-objects below */ -#define UP 1000 -#define DOWN 1001 -#define AHEAD 1002 -#define BACK 1003 -#define RIGHT 1004 -#define LEFT 1005 -#define TAKE 1006 -#define USE 1007 -#define LOOK 1008 -#define QUIT 1009 -#define NORTH 1010 -#define SOUTH 1011 -#define EAST 1012 -#define WEST 1013 -#define SU 1014 -#define DROP 1015 -#define TAKEOFF 1016 -#define DRAW 1017 -#define PUTON 1018 -#define WEARIT 1019 -#define PUT 1020 -#define INVEN 1021 -#define EVERYTHING 1022 -#define AND 1023 -#define KILL 1024 -#define RAVAGE 1025 -#define UNDRESS 1026 -#define THROW 1027 -#define LAUNCH 1028 -#define LANDIT 1029 -#define LIGHT 1030 -#define FOLLOW 1031 -#define KISS 1032 -#define LOVE 1033 -#define GIVE 1034 -#define SMITE 1035 -#define SHOOT 1036 -#define ON 1037 -#define OFF 1038 -#define TIME 1039 -#define SLEEP 1040 -#define DIG 1041 -#define EAT 1042 -#define SWIM 1043 -#define DRINK 1044 -#define DOOR 1045 -#define SAVE 1046 -#define RIDE 1047 -#define DRIVE 1048 -#define SCORE 1049 -#define BURY 1050 -#define JUMP 1051 -#define KICK 1052 - - /* injuries */ -#define ARM 6 /* broken arm */ -#define RIBS 7 /* broken ribs */ -#define SPINE 9 /* broken back */ -#define SKULL 11 /* fractured skull */ -#define INCISE 10 /* deep incisions */ -#define NECK 12 /* broken NECK */ -#define NUMOFINJURIES 13 - - /* notes */ -#define CANTLAUNCH 0 -#define LAUNCHED 1 -#define CANTSEE 2 -#define CANTMOVE 3 -#define JINXED 4 -#define DUG 5 -#define NUMOFNOTES 6 - - /* fundamental constants */ -#define NUMOFROOMS 275 -#define NUMOFWORDS ((NUMOFOBJECTS + BITS - 1) / BITS) -#define LINELENGTH 81 - -#define TODAY 0 -#define TONIGHT 1 -#define CYCLE 100 - - /* initial variable values */ -#define TANKFULL 250 -#define TORPEDOES 10 -#define MAXWEIGHT 60 -#define MAXCUMBER 10 - -struct room { - const char *name; - int link[8]; -#define north link[0] -#define south link[1] -#define east link[2] -#define west link[3] -#define up link[4] -#define access link[5] -#define down link[6] -#define flyhere link[7] - const char *desc; - unsigned int objects[NUMOFWORDS]; -}; -extern struct room dayfile[]; -extern struct room nightfile[]; -struct room *location; - - /* object characteristics */ -extern const char *const objdes[NUMOFOBJECTS]; -extern const char *const objsht[NUMOFOBJECTS]; -extern const char *const ouch[NUMOFINJURIES]; -extern const int objwt[NUMOFOBJECTS]; -extern const int objcumber[NUMOFOBJECTS]; - - /* current input line */ -#define NWORD 20 /* words per line */ -char words[NWORD][15]; -int wordvalue[NWORD]; -int wordtype[NWORD]; -int wordcount, wordnumber; - - -int battlestar_move(int, int); -void bury(void); -int card(const char *, int); -void chime(void); -void crash(void); -int cypher(void); -void die(int); -void dig(void); -int draw(void); -void drink(void); -int drive(void); -int drop(const char *name); -int eat(void); -int fight(int, int); -int follow(void); -char *getcom(char *, int, const char *, const char *); -char *getword(char *, char *, int); -int give(void); -void initialize(int); -int jump(void); -void kiss(void); -int land(void); -int launch(void); -void light(void); -void live(void); -void love(void); -void murder(void); -void news(void); -void newway (int); -void open_score_file(void); -void parse(void); -void printobjs(void); -int put(void); -int puton(void); -void ravage(void); -const char *rate(void); -void restore(void); -int ride(void); -void save(void); -int shoot(void); -int take(unsigned int from[]); -int takeoff(void); -int throw(const char *name); -const char *truedirec(int, unsigned int); -int ucard(const unsigned int *); -int use(void); -int visual(void); -int wearit(void); -void whichway(struct room); -void wordinit(void); -void writedes(void); -int zzz(void); - - /* state of the game */ -extern int gclock; -int gtime; -int position; -int direction; -int left, right, ahead, back; -int fuel, torps; -int carrying, encumber; -int rythmn; -extern int followfight; -int ate; -int snooze; -int meetgirl; -extern int followgod; -int godready; -extern int bs_win; -int wintime; -int wiz; -int tempwiz; -int matchlight; -extern int matchcount; -int loved; -int pleasure, power, ego; -extern int WEIGHT; -extern int CUMBER; -int notes[NUMOFNOTES]; -unsigned int inven[NUMOFWORDS]; -u_int wear[NUMOFWORDS]; -char beenthere[NUMOFROOMS+1]; -char injuries[NUMOFINJURIES]; - -char uname[MAXLOGNAME]; - -struct wlist { - const char *string; - int value, article; - struct wlist *next; -}; -#define HASHSIZE 256 -#define HASHMUL 81 -#define HASHMASK (HASHSIZE - 1) -struct wlist *hashtab[HASHSIZE]; -extern struct wlist wlist[]; - -struct objs { - short room; - short obj; -}; -extern const struct objs dayobjs[]; -extern const struct objs nightobjs[]; - -extern gid_t egid; diff --git a/games/battlestar/fly.c b/games/battlestar/fly.c deleted file mode 100644 index e2048073da3f..000000000000 --- a/games/battlestar/fly.c +++ /dev/null @@ -1,307 +0,0 @@ -/* - * Copyright (c) 1983, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)fly.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include "externs.h" -#undef UP -#include -#include - -#define abs(a) ((a) < 0 ? -(a) : (a)) -#define MIDR (LINES/2 - 1) -#define MIDC (COLS/2 - 1) - -int row, column; -int dr = 0, dc = 0; -char destroyed; -int gclock = 120; /* gtime for all the flights in the game */ -char cross = 0; -sig_t oldsig; - -static void blast(void); -static void endfly(void); -static void moveenemy(int); -static void notarget(void); -static void succumb(int); -static void screen(void); -static void target(void); - -void -succumb(sig) - int sig; -{ - - sig = 0; - if (oldsig == SIG_DFL) { - endfly(); - exit(1); - } - if (oldsig != SIG_IGN) { - endfly(); - (*oldsig)(SIGINT); - } -} - -int -visual() -{ - - destroyed = 0; - if(initscr() == NULL){ - puts("Whoops! No more memory..."); - return(0); - } - oldsig = signal(SIGINT, succumb); - crmode(); - noecho(); - screen(); - row = rnd(LINES-3) + 1; - column = rnd(COLS-2) + 1; - moveenemy(0); - for (;;) { - switch(getchar()){ - - case 'h': - case 'r': - dc = -1; - fuel--; - break; - - case 'H': - case 'R': - dc = -5; - fuel -= 10; - break; - - case 'l': - dc = 1; - fuel--; - break; - - case 'L': - dc = 5; - fuel -= 10; - break; - - case 'j': - case 'u': - dr = 1; - fuel--; - break; - - case 'J': - case 'U': - dr = 5; - fuel -= 10; - break; - - case 'k': - case 'd': - dr = -1; - fuel--; - break; - - case 'K': - case 'D': - dr = -5; - fuel -= 10; - break; - - case '+': - if (cross){ - cross = 0; - notarget(); - } - else - cross = 1; - break; - - case ' ': - case 'f': - if (torps){ - torps -= 2; - blast(); - if (row == MIDR && column - MIDC < 2 && MIDC - column < 2){ - destroyed = 1; - alarm(0); - } - } - else - mvaddstr(0,0,"*** Out of torpedoes. ***"); - break; - - case 'q': - endfly(); - return(0); - - default: - mvaddstr(0,26,"Commands = r,R,l,L,u,U,d,D,f,+,q"); - continue; - - case EOF: - break; - } - if (destroyed){ - endfly(); - return(1); - } - if (gclock <= 0){ - endfly(); - die(0); - } - } - /* NOTREACHED */ - return(1); -} - -void -screen() -{ - int r,c,n; - int i; - - clear(); - i = rnd(100); - for (n=0; n < i; n++){ - r = rnd(LINES-3) + 1; - c = rnd(COLS); - mvaddch(r, c, '.'); - } - mvaddstr(LINES-1-1,21,"TORPEDOES FUEL TIME"); - refresh(); -} - -void -target() -{ - int n; - - move(MIDR,MIDC-10); - addstr("------- + -------"); - for (n = MIDR-4; n < MIDR-1; n++){ - mvaddch(n,MIDC,'|'); - mvaddch(n+6,MIDC,'|'); - } -} - -void -notarget() -{ - int n; - - move(MIDR,MIDC-10); - addstr(" "); - for (n = MIDR-4; n < MIDR-1; n++){ - mvaddch(n,MIDC,' '); - mvaddch(n+6,MIDC,' '); - } -} - -void -blast() -{ - int n; - - alarm(0); - move(LINES-1, 24); - printw((char *)(uintptr_t)(const void *)"%3d", torps); - for(n = LINES-1-2; n >= MIDR + 1; n--){ - mvaddch(n, MIDC+MIDR-n, '/'); - mvaddch(n, MIDC-MIDR+n, '\\'); - refresh(); - } - mvaddch(MIDR,MIDC,'*'); - for(n = LINES-1-2; n >= MIDR + 1; n--){ - mvaddch(n, MIDC+MIDR-n, ' '); - mvaddch(n, MIDC-MIDR+n, ' '); - refresh(); - } - alarm(1); -} - -void -moveenemy(int sig) -{ - double d; - int oldr, oldc; - - sig = 0; - oldr = row; - oldc = column; - if (fuel > 0){ - if (row + dr <= LINES-3 && row + dr > 0) - row += dr; - if (column + dc < COLS-1 && column + dc > 0) - column += dc; - } else if (fuel < 0){ - fuel = 0; - mvaddstr(0,60,"*** Out of fuel ***"); - } - d = (double) ((row - MIDR)*(row - MIDR) + (column - MIDC)*(column - MIDC)); - if (d < 16){ - row += (rnd(9) - 4) % (4 - abs(row - MIDR)); - column += (rnd(9) - 4) % (4 - abs(column - MIDC)); - } - gclock--; - mvaddstr(oldr, oldc - 1, " "); - if (cross) - target(); - mvaddstr(row, column - 1, "/-\\"); - move(LINES-1, 24); - printw((char *)(uintptr_t)(const void *)"%3d", torps); - move(LINES-1, 42); - printw((char *)(uintptr_t)(const void *)"%3d", fuel); - move(LINES-1, 57); - printw((char *)(uintptr_t)(const void *)"%3d", gclock); - refresh(); - signal(SIGALRM, moveenemy); - alarm(1); -} - -void -endfly() -{ - alarm(0); - signal(SIGALRM, SIG_DFL); - mvcur(0,COLS-1,LINES-1,0); - endwin(); - signal(SIGTSTP, SIG_DFL); - signal(SIGINT, oldsig); -} diff --git a/games/battlestar/getcom.c b/games/battlestar/getcom.c deleted file mode 100644 index c815f2f73d0f..000000000000 --- a/games/battlestar/getcom.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (c) 1983, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)getcom.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include -#include "externs.h" - -char * -getcom(buf, size, prompt, error) - char *buf; - int size; - const char *prompt, *error; -{ - for (;;) { - fputs(prompt, stdout); - if (fgets(buf, size, stdin) == 0) { - clearerr(stdin); - continue; - } - while (isspace(*buf)) - buf++; - if (*buf) - break; - if (error) - puts(error); - } - return (buf); -} - - -/* - * shifts to UPPERCASE if flag > 0, lowercase if flag < 0, - * and leaves it unchanged if flag = 0 - */ -char * -getword(buf1, buf2, flag) - char *buf1, *buf2; - int flag; -{ - while (isspace(*buf1)) - buf1++; - if (*buf1 != ',') { - if (!*buf1) { - *buf2 = 0; - return (0); - } - while (*buf1 && !isspace(*buf1) && *buf1 != ',') - if (flag < 0) - if (isupper(*buf1)) - *buf2++ = tolower(*buf1++); - else - *buf2++ = *buf1++; - else if (flag > 0) - if (islower(*buf1)) - *buf2++ = toupper(*buf1++); - else - *buf2++ = *buf1++; - else - *buf2++ = *buf1++; - } else - *buf2++ = *buf1++; - *buf2 = 0; - while (isspace(*buf1)) - buf1++; - return (*buf1 ? buf1 : 0); -} diff --git a/games/battlestar/globals.c b/games/battlestar/globals.c deleted file mode 100644 index 447c193b990a..000000000000 --- a/games/battlestar/globals.c +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Copyright (c) 1983, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)globals.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include "externs.h" - -int WEIGHT = MAXWEIGHT; -int CUMBER = MAXCUMBER; - -const char *const objdes[NUMOFOBJECTS] = { - "There is a knife here", - "There is an exquisitely crafted sword and scabbard here.", - 0, /* can land from here */ - "There is a fierce woodsman here brandishing a heavy mallet.", - "There is an unwieldy two-handed sword here.", - "There is a bloody meat cleaver here.", - "A rusty broadsword is lying here.", - "There is an ancient coat of finely woven mail here.", - "There is a old dented helmet with an ostrich plume here.", - "There is a shield of some native tribe here.", - "The maid's body is lying here. She was murdered!", - "There is a Viper ready for launch here.", - "A kerosene lantern is burning luridly here.", - "An old pair of shoes has been discarded here.", - 0, /* cylon */ - "There is a pair of pajamas here.", - "A kingly robe of royal purple and spun gold is draped here.", - "There is a strange golden amulet on the floor here.", - "A medallion of solid gold shimmers on the ground nearby.", - "A talisman of gold is lying here.", - "A dead woodsman has fallen here. He was savagely murdered.", - "A heavy wooden mallet lies nearby.", - "There is a laser pistol here.", - "A flower-like young goddess is bathing in the hot mineral pools. She is \nwatching you, but continues to steep and sing softly.", - "The goddess is reclining on a bed of ferns and studying you intently.", - "There is a grenade here", - "There is a length of heavy chain here.", - "There is a stout rope here.", - "There is a pair of Levi's here.", - "A bloody mace is lying on the ground here.", - "There is a shovel here.", - "A long, sharp halberd is propped up here.", - "There is a compass here", - "Wreckage and smoldering debris from a crash litter the ground here.", - "A woodland Elf armed with a shield and deadly halberd lunges toward you!", - "I think I hear footsteps behind us.", - "There are a few coins here.", - "There are some matches here.", - "An unctuous man in a white suit and a dwarf are standing here.", - "There are some ripe papayas here.", - "There is a ripe pineapple here.", - "There are some kiwi fruit here.", - "There are some coconuts here.", - "There is a ripe mango here.", - "There is a sparkling diamond ring here.", - "There is a colorful pink potion in a small crystal vial here.", - "A gold bracelet is on the ground here.", - "A swarthy woman with stern features pulls you aside from the crowd,\n'I must talk to you -- but not here. Meet me at midnight in the gardens.'", - "The swarthy woman has been awaiting you anxiously. 'I must warn you that the\nIsland has anticipated your Quest. You will not be welcomed. The Darkness is\nstrong where you must search. Seek not the shadows save only at night, for\nthen are they the weakest. In the mountains far from here a canyon winds\nwith ferns and streams and forgotten vines. There you must go. Take this\nrope.'", - "Out from the shadows a figure leaps! His black cape swirls around, and he\nholds a laser sword at your chest. 'So, you have come to fulfill the Quest.\nHa! Your weapons are no match for me!'", - "An old timer with one eye missing and no money for a drink sits at the bar.", - "You are flying through an asteroid field!", - "A planet is nearby.", - "The ground is charred here.", - "There is a thermonuclear warhead here.", - "The fragile, beautiful young goddess lies here. You murdered her horribly.", - "The old timer is lying here. He is dead.", - "The native girl's body is lying here.", - "A native girl is sitting here.", - "A gorgeous white stallion is standing here.", - "The keys are in the ignition.", - "A pot of pearls and jewels is sitting here.", - "A bar of solid gold is here.", - "There is a 10 kilogram diamond block here." - -}; - -const char *const objsht[NUMOFOBJECTS] = { - "knife", - "fine sword", - 0, - "Woodsman", - "two-handed sword", - "meat cleaver", - "broadsword", - "coat of mail", - "plumed helmet", - "shield", - "maid's body", - "viper", - "lantern", - "shoes", - 0, - "pajamas", - "robe", - "amulet", - "medallion", - "talisman", - "woodsman's body", - "wooden mallet", - "laser", - 0, - 0, - "grenade", - "chain", - "rope", - "levis", - "mace", - "shovel", - "halberd", - "compass", - 0, - "Elf", - 0, - "coins", - "match book", - 0, - "papayas", - "pineapple", - "kiwi", - "coconuts", - "mango", - "ring", - "potion", - "bracelet", - 0, - 0, - "Dark Lord", - 0, - 0, - 0, - 0, - "warhead", - "goddess's body", - "old timer's body", - "girl's body", - 0, - "stallion", - "car", - "pot of jewels", - "bar of gold", - "diamond block" -}; - -const char *const ouch[NUMOFINJURIES] = { - "some minor abrasions", - "some minor lacerations", - "a minor puncture wound", - "a minor amputation", - "a sprained wrist", - "a fractured ankle and shattered kneecap", - "a broken arm and dislocated shoulder", - "a few broken ribs", - "a broken leg and torn ligaments", - "a broken back and ruptured spleen", - "some deep incisions and a loss of blood", - "a fractured skull and mashed face", - "a broken neck" -}; - -const int objwt[NUMOFOBJECTS] = { - 1, 5, 0, 10, 15, 2, 10, 10, - 3, 5, 50, 2500, 2, 1, 100, 1, - 2, 1, 1, 1, 60, 10, 5, 0, - 50, 5, 15, 5, 1, 20, 10, 10, - 0, 0, 0, 0, 1, 0, 0, 1, - 1, 1, 2, 1, 0, 0, 0, 0, - 0, 0, 100, 0, 0, 0, 55, 47, - 50, 45, 45, 100, 2000, 30, 20, 10 -}; - -const int objcumber[NUMOFOBJECTS] = { - 1, 5, 0, 150, 10, 1, 5, 2, - 2, 1, 5, 10, 1, 1, 10, 1, - 1, 1, 1, 1, 7, 5, 4, 0, - 0, 1, 1, 1, 1, 5, 4, 4, - 1, 0, 0, 0, 1, 0, 0, 1, - 1, 1, 3, 1, 0, 0, 1, 0, - 0, 0, 10, 0, 0, 0, 7, 8, - 10, 8, 8, 10, 10, 3, 1, 2 -}; - -int bs_win = 1; -int matchcount = 20; -int followgod = -1; -int followfight = -1; diff --git a/games/battlestar/init.c b/games/battlestar/init.c deleted file mode 100644 index 85ee6f200177..000000000000 --- a/games/battlestar/init.c +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (c) 1983, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)init.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include -#include -#include -#include "externs.h" - -static int checkout(const char *); -static void getutmp(char *); -static int wizard(const char *); - -void -initialize(startup) - int startup; -{ - const struct objs *p; - - puts("Version 4.2, fall 1984."); - puts("First Adventure game written by His Lordship, the honorable"); - puts("Admiral D.W. Riggle\n"); - srandomdev(); - getutmp(uname); - if (startup) - location = dayfile; - wiz = wizard(uname); - wordinit(); - if (startup) { - direction = NORTH; - gtime = 0; - snooze = CYCLE * 1.5; - position = 22; - setbit(wear, PAJAMAS); - fuel = TANKFULL; - torps = TORPEDOES; - for (p = dayobjs; p->room != 0; p++) - setbit(location[p->room].objects, p->obj); - } else - restore(); - signal(SIGINT, die); -} - -void -getutmp(battlestar_uname) - char *battlestar_uname; -{ - struct passwd *ptr; - - ptr = getpwuid(getuid()); - strcpy(battlestar_uname, ptr ? ptr->pw_name : ""); -} - -const char *const list[] = { /* hereditary wizards */ - "riggle", - "chris", - "edward", - "comay", - "yee", - "dmr", - "ken", - 0 -}; - -const char *const badguys[] = { - "wnj", - "root", - "ted", - 0 -}; - -int -wizard(battlestar_uname) - const char *battlestar_uname; -{ - char flag; - - if ((flag = checkout(battlestar_uname)) > 0) - printf("You are the Great wizard %s.\n", battlestar_uname); - return flag; -} - -int -checkout(battlestar_uname) - const char *battlestar_uname; -{ - const char *const *ptr; - - for (ptr = list; *ptr; ptr++) - if (strcmp(*ptr, battlestar_uname) == 0) - return 1; - for (ptr = badguys; *ptr; ptr++) - if (strcmp(*ptr, battlestar_uname) == 0) { - printf("You are the Poor anti-wizard %s. Good Luck!\n", - battlestar_uname); - if (location != NULL) { - CUMBER = 3; - WEIGHT = 9; /* that'll get him! */ - gclock = 10; - setbit(location[7].objects, WOODSMAN); /* viper room */ - setbit(location[20].objects, WOODSMAN); /* laser " */ - setbit(location[13].objects, DARK); /* amulet " */ - setbit(location[8].objects, ELF); /* closet */ - } - return 0; /* anything else, Chris? */ - } - return 0; -} diff --git a/games/battlestar/misc.c b/games/battlestar/misc.c deleted file mode 100644 index e55e347033b8..000000000000 --- a/games/battlestar/misc.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 1983, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)misc.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include "externs.h" - -int -card(array, size) /* for beenthere, injuries */ - const char *array; - int size; -{ - const char *end = array + size; - int i = 0; - - while (array < end) - if (*array++) - i++; - return (i); -} - -int -ucard(array) - const unsigned int *array; -{ - int j = 0, n; - - for (n = 0; n < NUMOFOBJECTS; n++) - if (testbit(array, n)) - j++; - return (j); -} diff --git a/games/battlestar/nightfile.c b/games/battlestar/nightfile.c deleted file mode 100644 index 3d1ee17f154f..000000000000 --- a/games/battlestar/nightfile.c +++ /dev/null @@ -1,1181 +0,0 @@ -/* - * Copyright (c) 1983, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)nightfile.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include "externs.h" - -struct room nightfile[] = { - { 0 }, - { "You are in the main hangar.", - { 5, 2, 9, 3, 3, 1, 0, 0 }, -"This is a huge bay where many fighters and cargo craft lie. Alarms are \n\ -sounding and fighter pilots are running to their ships. Above is a gallery\n\ -overlooking the bay. The scream of turbo engines is coming from +. The rest\n\ -of the hangar is +. There is an exit +.*\n" }, - { "This is the landing bay.", - { 1, 0, 10, 0, 0, 0, 0, 0 }, -"Ships are landing here, some heavily damaged. Enemy fighters continually\n\ -strafe this vulnerable port. The main hangar is +, *\n\ -There is an exit +.*\n" }, - { "You are in the gallery.", - { 4, 0, 0, 0, 0, 0, 1, 0 }, -"From here a view of the entire landing bay reveals that our battlestar\n\ -is near destruction. Fires are spreading out of control and laser blasts\n\ -lick at the shadows. The control room is +. ***\n" }, - { "You are in the control room.", - { 0, 3, 0, 0, 0, 0, 5, 0 }, -"Several frantic technicians are flipping switches wildly but otherwise\n\ -this room seems fairly deserted. A weapons locker has been left open.\n\ -A staircase leads down. * There is a way -. ** \n" }, - { "This is the launch room.", - { 6, 1, 7, 0, 4, 1, 0, 0 }, -"From the launch tubes here fighters blast off into space. Only one is left,\n\ -and it is guarded by two fierce men. A staircase leads up from here.\n\ -There is a cluttered workbench +. From the main hangar come sounds of great\n\ -explosions. The main hangar is +. The viper launch tubes are to the -.*\n" }, - { "You are at the workbench.", - { 0, 5, 7, 0, 0, 0, 0, 0 }, -"Strange and unwieldy tools are arranged here including a lunch box \n\ -and pneumatic wrenches and turbo sprocket rockets.*\n\ -The launch room is +. The remaining viper is +.*\n" }, - { "You are in the viper launch tube.", - { 0, 5, 0, 5, 32, 0, 0, 0 }, -"The two guards are eyeing you warily! ****\n" }, - { "This is a walk in closet.", - { 22, 0, 0, 0, 0, 0, 0, 0 }, -"A wardrobe of immense magnitude greets the eye. Furs and robes of kings\n\ -hang on rack after rack. Silken gowns, capes woven with spun gold, and \n\ -delicate synthetic fabrics are stowed here. The bedroom is +.***\n" }, - { "You are in a wide hallway leading to the main hangar.", - { 0, 0, 11, 1, 0, 0, 0, 0 }, -"The walls and ceiling here have been blasted through in several places.\n\ -It looks as if quite a battle has been fought for possession of the landing bay\n\ -Gaping corpses litter the floor.** The hallway continues +.\n\ -The main hangar is +.\n" }, - { "You are in a wide hallway leading to the landing bay.", - { 0, 0, 12, 2, 0, 0, 0, 0 }, -"Most of the men and supplies needed in the main hangar come through this\n\ -corridor, but the wounded are forced to use it too. It very dank and\n\ -crowded here, and the floor is slippery with blood.**\n\ -The hallway continues -. The landing bay is +.\n" }, - { "The hallway is very congested with rubble here.", - { 0, 0, 0, 9, 13, 1, 0, 0 }, -"It is too choked with broken steel girders and other debris to continue\n\ -on much farther. Above, the ceiling has caved in and it is possible to \n\ -climb up. There is not much chance to go -, -, or -.\n\ -But the hallway seems clearer +.\n" }, - { "A wide hallway and a more narrow walkway meet here.", - { 14, 15, 0, 10, 0, 0, 0, 0 }, -"The intersection is crowded with the many wounded who have come up\n\ -the wide hallway and continued +. The walkway is less crowded +.\n\ -The wide hallway goes *-.\n" }, - { "You are in what was once an elegant stateroom.", - { 16, 0, 0, 0, 0, 0, 11, 0 }, -"Whoever lived in this stateroom, he and his female companion\n\ -were mercilessly slain in their sleep. Clothes, trinkets and personal\n\ -belongings are scattered all across the floor. Through a hole in the\n\ -collapsed floor I can see a hallway below. A door is +.***\n" }, - { "You're at the entrance to the sick bay.", - { 17, 12, 18, 0, 0, 0, 0, 0 }, -"The wounded are entering the sick bay in loudly moaning files.\n\ -The walkway continues - and +. A doctor is motioning for you to \n\ -come to the -. *\n" }, - { "You're in the walkway.", - { 12, 19, 0, 0, 0, 0, 0, 0 }, -"Most of the men and supplies were coming from the armory. The walkway\n\ -continues -. The armory is +.**\n" }, - { "These are the executive suites of the battlestar.", - { 20, 13, 21, 22, 23, 1, 24, 0 }, -"Luxurious staterooms carpeted with crushed velvet and adorned with beaten\n\ -gold open onto this parlor. A wide staircase with ivory banisters leads\n\ -up or down. This parlor leads into a hallway +. The bridal suite is +.\n\ -Other rooms lie - and +.\n" }, - { "You're in a long dimly lit hallway.", - { 0, 14, 25, 0, 0, 0, 0, 0 }, -"This part of the walkway is deserted. There is a dead end +. The\n\ -entrance to the sickbay is +. The walkway turns sharply -.*\n" }, - { "This is the sick bay.", - { 0, 0, 0, 14, 0, 0, 0, 0 }, -"Sinister nurses with long needles and pitiful aim probe the depths of suffering\n\ -here. Only the mortally wounded receive medical attention on a battlestar,\n\ -but afterwards they are thrown into the incinerators along with the rest.**\n\ -Nothing but death and suffering +. The walkway is +.\n" }, - { "You're in the armory.", - { 15, 26, 0, 0, 0, 0, 0, 0 }, -"An armed guard is stationed here 365 sectars a yarn to protect the magazine.\n\ -The walkway is +. The magazine is +.**\n" }, - { "The hallway ends here at the presidential suite.", - { 27, 16, 0, 0, 0, 0, 0, 0 }, -"The door to this suite is made from solid magnesium, and the entryway is\n\ -inlaid with diamonds and fire opals. The door is ajar +. The hallway\n\ -goes -.**\n" }, - { "This is the maid's utility room.", - { 0, 0, 0, 16, 0, 0, 0, 0 }, -"What a gruesome sight! The maid has been brutally drowned in a bucket of\n\ -Pine Sol and repeatedly stabbed in the back with a knife.***\n\ -The hallway is +.\n" }, - { "This is a luxurious stateroom.", - { 0, 8, 16, 0, 0, 0, 0, 0 }, -"The floor is carpeted with a soft animal fur and the great wooden furniture\n\ -is inlaid with strips of platinum and gold. Electronic equipment built\n\ -into the walls and ceiling is flashing wildly. The floor shudders and\n\ -the sounds of dull explosions rumble though the room. From a window in\n\ -the wall + comes a view of darkest space. There is a small adjoining\n\ -room +, and a doorway +.*\n" }, - { "You are at the entrance to the dining hall.", - { 0, 0, 28, 0, 0, 0, 16, 0 }, -"A wide staircase with ebony banisters leads down here.**\n\ -The dining hall is to the -.*\n" }, - { "This was once the first class lounge.", - { 0, 0, 29, 0, 16, 1, 0, 0 }, -"There is much rubble and destruction here that was not apparent elsewhere.\n\ -The walls and ceilings have broken in in some places. A staircase with\n\ -red coral banisters leads up. It is impossible to go - or -.\n\ -It seems a little clearer +.*\n" }, - { "You are in a narrow stairwell.", - { 0, 17, 0, 0, 30, 1, 0, 0 }, -"These dusty and decrepit stairs lead up. There is no way -. The\n\ -hallway turns sharply -.**\n" }, - { "You are in the magazine.", - { 19, 0, 0, 0, 0, 0, 0, 0 }, -"Rows and rows of neatly stacked ammunition for laser pistols and grenade\n\ -launchers are here. The armory is +.***\n" }, - { "You're in the presidential suite.", - { 0, 20, 0, 0, 0, 0, 0, 0 }, -"Apparently the president has been assassinated. A scorched figure lies\n\ -face downward on the carpet clutching his chest.*\n\ -The hallway leads -.**\n" }, - { "You are in the dining hall.", - { 0, 30, 31, 23, 0, 0, 0, 0 }, -"This was the scene of a mass suicide. Hundreds of ambassadors and assorted\n\ -dignitaries sit slumped over their breakfast cereal. I suppose the news\n\ -of the cylon attack killed them. There is a strange chill in this room. I\n\ -would not linger here. * The kitchen is +. Entrances + and +.\n" }, - { "The debris is very thick here.", - { 0, 11, 0, 24, 0, 0, 0, 0 }, -"Broken furniture, fallen girders, and other rubble block the way.\n\ -There is not much chance to continue -, -, or -.\n\ -It would be best to go -.\n" }, - { "You are in the kitchen.", - { 28, 0, 0, 0, 0, 0, 0, 0 }, -"This room is full of shining stainless steel and burnished bronze cookware. An \n\ -assortment of tropical fruits and vegetables as well as fine meats and cheeses \n\ -lies on a sterling platter. The chef, unfortunately, has been skewered like a \n\ -side of beef. The dining room is +. ** There is a locked door +.\n" }, - { "You are in an arched entry leading to the dining room.", - { 0, 0, 0, 28, 0, 0, 0, 0 }, -"The door leading out is bolted shut from the outside and is very strong.***\n\ -The dining room is +.\n" }, - { "You are in space.", - { 33, 34, 35, 36, 37, 1, 33, 1}, -"****\n" }, - { "You are in space.", - { 38, 32, 39, 40, 41, 1, 42, 1}, -"****\n" }, - { "You are in space.", - { 32, 44, 45, 46, 47, 1, 48, 1}, -"****\n" }, - { "You are in space.", - { 40, 45, 49, 32, 50, 1, 51, 1}, -"****\n" }, - { "You are in space.", - { 41, 46, 32, 52, 53, 1, 54, 1}, -"****\n" }, - { "You are in space.", - { 42, 47, 50, 53, 55, 1, 32, 1}, -"****\n" }, - { "You are in space.", - { 43, 48, 51, 54, 32, 1, 56, 1}, -"****\n" }, - { "You are in space.", - { 57, 33, 40, 41, 42, 1, 43, 1}, -"****\n" }, - { "You are in space.", - { 39, 35, 57, 33, 58, 1, 59, 1}, -"****\n" }, - { "You are in space.", - { 39, 36, 33, 59, 60, 1, 61, 1}, -"****\n" }, - { "You are in space.", - { 39, 37, 58, 60, 62, 1, 33, 1}, -"****\n" }, - { "You are in space.", - { 39, 38, 59, 61, 33, 1, 63, 1}, -"****\n" }, - { "You are in space.", - { 34, 64, 45, 46, 47, 1, 48, 1}, -"****\n" }, - { "You are in space.", - { 35, 44, 49, 34, 50, 1, 51, 1}, -"****\n" }, - { "You are in space.", - { 36, 44, 34, 52, 53, 1, 54, 1}, -"****\n" }, - { "You are in space.", - { 37, 44, 50, 53, 55, 1, 34, 1}, -"****\n" }, - { "You are in space.", - { 38, 44, 51, 54, 34, 1, 56, 1}, -"****\n" }, - { "You are in space.", - { 49, 49, 52, 35, 49, 1, 49, 1}, -"****\n" }, - { "You are in space.", - { 58, 47, 49, 37, 55, 1, 35, 1}, -"****\n" }, - { "You are in space.", - { 59, 48, 49, 38, 35, 1, 56, 1}, -"****\n" }, - { "You are in space.", - { 52, 52, 36, 49, 52, 1, 52, 1}, -"****\n" }, - { "You are in space.", - { 60, 46, 37, 52, 55, 1, 36, 1}, -"****\n" }, - { "You are in space.", - { 61, 48, 38, 52, 36, 1, 56, 1}, -"****\n" }, - { "You are in space.", - { 62, 55, 55, 55, 56, 1, 37, 1}, -"****\n" }, - { "You are in space.", - { 56, 56, 56, 56, 38, 1, 55, 1}, -"****\n" }, - { "You are in space.", - { 65, 39, 57, 57, 57, 1, 57, 1}, -"****\n" }, - { "You are in space.", - { 39, 50, 49, 42, 62, 1, 40, 1}, -"****\n" }, - { "You are in space.", - { 39, 51, 49, 43, 40, 1, 63, 1}, -"****\n" }, - { "You are in space.", - { 39, 53, 43, 59, 62, 1, 41, 1}, -"****\n" }, - { "You are in space.", - { 39, 54, 43, 59, 41, 1, 56, 1}, -"****\n" }, - { "You are in space.", - { 39, 55, 62, 62, 56, 1, 42, 1}, -"****\n" }, - { "You are in space.", - { 39, 56, 35, 36, 43, 1, 55, 1}, -"****\n" }, - { "You are in space.", - { 44, 66, 66, 66, 66, 1, 66, 1}, -"****\n" }, - { "You are in space.", - { 67, 57, 67, 67, 67, 1, 67, 1}, -"****\n" }, - { "You are in space.", - { 64, 68, 68, 68, 68, 1, 68, 1}, -"****\n" }, - { "You are orbiting a small blue planet.", - { 67, 67, 67, 67, 65, 1, 69, 1}, -"****\n" }, - { "You are orbiting a tropical planet.", - { 68, 68, 68, 68, 66, 1, 70, 1}, -"****\n" }, - { "You are flying through a dense fog.", - { 69, 69, 69, 69, 69, 1, 69, 1}, -"A cold grey sea of mist is swirling around the windshield and water droplets\n\ -are spewing from the wingtips. Ominous shadows loom in the darkness and it\n\ -feels as if a trap is closing around us. I have lost all sense of direction.\n\ -****\n" }, - { "You are approaching an island.", - { 71, 72, 73, 74, 68, 1, 0, 1}, -"Feather palms outlined by mellow moonlight and a silvery black ocean line\n\ -the perimeter of the island. Mighty mountains of emerald and amethyst rise\n\ -like jagged teeth from black gums. The land rises sharply +. The shore\n\ -line stretches on *+.*\n" }, - { "You are flying over a mountainous region.", - { 75, 73, 76, 77, 68, 1, 0, 1}, -"Below is a shadow filled canyon with luminous waterfalls plummeting down beyond sight and looming spires and pinnacles. **The ocean is +.*\n" }, - { "You are flying over the ocean.", - { 74, 78, 78, 78, 68, 1, 0, 1}, -"You bank over the water and your wingtips dip low to the green waves. The\n\ -sea is very shallow here and the white coral beds beneath us teem with \n\ -shadowy fish.****\n" }, - { "You are flying over the beach.", - { 71, 72, 79, 74, 68, 1, 80, 1}, -"A warm gentle surf caresses the beach here. The land rises\n\ -sharply +.* The beach is lost in low cliffs +.*\n" }, - { "You are flying over a large lagoon.", - { 81, 72, 73, 82, 68, 1, 0, 1}, -"The water's brink winds tortuously inland. There are some lights +.***\n" }, - { "You are flying over a gently sloping plane.", - { 83, 71, 84, 85, 68, 1, 0, 1}, -"The ground appears to be choked with vegetation.* The terrain is more\n\ -rugged +.**\n" }, - { "You are flying through a gorge.", - { 0, 0, 86, 71, 68, 1, 102, 1}, -"This is a narrow, steep sided canyon lined with plants. The stars above\n\ -glisten through the over hanging trees. The gorge leads to the\n\ -sea** +, and to a tumultuous origin +.\n" }, - { "You are flying over a plantation.", - { 85, 81, 71, 88, 68, 1, 89, 1}, -"It might be possible to land here, but not in the dark.* There are some lights\n\ -+ and *+.\n" }, - { "You are over the ocean.", - { 72, 78, 79, 74, 68, 1, 0, 1}, -"The deep green swells foam and roll into the shore **+*.\n" }, - { "You are flying along the coast.", - { 86, 72, 90, 73, 68, 1, 91, 1}, -"The coastline here is very rocky. The surf in some places is violent\n\ -and explodes in a shower of sparkling, moonlit spray. ****\n" }, - { "This is a beautiful coral beach.", - { 106, 0, 107, 108, 73, 0, 0, 0 }, -"Fine silver sand kissed lightly by warm tropical waters and illuminated\n\ -by a huge tropical moon stretches at least 30 meters inland.\n\ -Gently swaying palm trees are +.***\n" }, - { "You are flying over a small fishing village.", - { 77, 74, 71, 82, 68, 1, 92, 1}, -"A few thatched huts lit with torches and bonfires line a road below.\n\ -The road continues on ***+.\n" }, - { "You are flying over a clearing.", - { 88, 72, 74, 87, 68, 1, 93, 1}, -"There is a dock here (big enough for a seaplane) leading to a clearing.\n\ -The still waters of the lagoon reflects our orange turbo thrusters.****\n" }, - { "You are flying over the shore.", - { 94, 75, 95, 96, 68, 1, 0, 1}, -"Rocky lava flows have overtaken the beach here.****\n" }, - { "You are flying in a wide valley.", - { 95, 97, 86, 75, 68, 1, 98, 1}, -"This is a shallow valley yet the floor is obscured by a thick mist.\n\ -The valley opens into blackness +. The mist grows thicker +.**\n" }, - { "You are flying near the shore.", - { 96, 77, 75, 99, 68, 1, 0, 1}, -"Very tall trees growing in neatly planted rows march off from the \n\ -water here towards the hills and down to the flat lands *+.**\n" }, - { "You are flying around the very tip of the island.", - { 95, 79, 90, 84, 68, 1, 0, 1}, -"Sheer cliffs rise several hundred feet to a tree covered summit. Far below,\n\ -the grey sea gnaws voraciously at the roots of these cliffs. The island bends\n\ -around +** and +.\n" }, - { "You are flying along the coastline.", - { 99, 82, 88, 100, 68, 1, 101, 1}, -"This is a narrow strip of sand lined with very few trees. The stars above\n\ -flicker through wisps of clouds. The beach continues on -.* There\n\ -are some lights +.*\n" }, - { "You are flying over several cottages and buildings", - { 99, 82, 77, 87, 68, 1, 103, 1}, -"Directly below is small ornate house lit up with spot lights and decorative\n\ -bulbs. A bell tower and a spurting fountain are nearby. Small dirt roads go\n\ -+ and +.**\n" }, - { "You are in a field of sugar cane.", - { 109, 110, 111, 112, 77, 0, 0, 0 }, -"These strong, thick canes give little shelter but many cuts and scrapes.\n\ -There are some large trees ***+.\n" }, - { "You are flying over the ocean.", - { 95, 78, 90, 86, 68, 1, 0, 1}, -"The water is a placid ebony.****\n" }, - { "You are on the coast road.", - { 113, 114, 115, 116, 79, 0, 0, 0 }, -"The road winds close to the shore here. The trees on either side press close\n\ -in the darkness and seem to be watching us.** The road continues -\n\ -and -.\n" }, - { "You are on the main street of the village.", - { 117, 118, 119, 120, 81, 0, 0, 0 }, -"The natives are having a festive luau here. Beautiful dancers gyrate in the\n\ -torchlight to the rhythm of wooden drums. A suckling pig is sizzling in a\n\ -bed of coals and ti leaves are spread with poi and tropical fruits. Several\n\ -natives have come over to you and want you to join in the festivities.\n\ -There is a light burning in a bungalow +.***\n" }, - { "You are at the sea plane dock.", - { 121, 122, 123, 124, 82, 0, 0, 0 }, -"The clearing is deserted. The grass is wet with the evening dew +.*\n\ -There is something set up +.*\n" }, - { "You are flying over the ocean.", - { 94, 83, 95, 96, 68, 1, 0, 1}, -"The black waves surge off shore here. The ocean becomes much calmer +.***\n" }, - { "You are flying along the coast.", - { 94, 84, 86, 83, 68, 1, 0, 1}, -"The land is very low here with a river running into the sea +. There\n\ -is a wide valley opening up +, but a strange mist is flowing out of it.\n\ -The very tip of the island is +.*\n" }, - { "You are flying along the coast.", - { 94, 85, 83, 99, 68, 1, 0, 1}, -"The coast here is cluttered with rocky outcroppings.****\n" }, - { "You are lost in a sea of fog.", - { 97, 104, 97, 97, 97, 1, 0, 1}, -"What have you gotten us into?\n\ -I can't see a thing! ****\n" }, - { "You are on a gravel wash.", - { 125, 126, 127, 128, 84, 0, 0, 0 }, -"It is very dark here. A cool breeze is blowing from +. No moonlight can\n\ -reach below a thick canopy of fog above. The sound of cascading water is\n\ -coming from +.**\n" }, - { "You are flying over a wide beach.", - { 96, 88, 85, 87, 68, 1, 105, 1}, -"There are some lighted buildings *+. Some trees are growing +.*\n" }, - { "You are flying over the ocean.", - { 100, 100, 87, 100, 68, 1, 0, 1}, -"The black waves surge and splash against the rocky shore.****\n" }, - { "You are on a narrow strip of sand.", - { 129, 130, 131, 0, 87, 0, 0, 0 }, -"Rather coarse sand makes this beach very steep and only a few meters wide.\n\ -A fresh ocean breeze is rustling the ferns **+.*\n" }, - { "This is Fern Canyon.", - { 0, 0, 132, 133, 76, 0, 0, 0 }, -"Delicate waving ferns flourish here, suckled by warm water dripping from \n\ -every fissure and crevice in the solid rock walls. The stars above sparkle\n\ -through a thin mist. The canyon winds **-, and -.\n" }, - { "This is the front lawn.", - { 134, 135, 136, 137, 88, 0, 0, 0 }, -"There is a small fountain lighted with green and yellow bulbs here where\n\ -the driveway meets the lawn. Across the driveway, +, is an ornate white\n\ -house lit with gas lamps. A bell tower here is awash in pale blue.* There\n\ -is a road + which turns into the driveway.*\n" }, - { "You have just crossed the crest of a mountain.", - { 97, 79, 86, 71, 68, 1, 0, 1}, -"The fog vanished mysteriously as we flew over the crest.*\n\ -Far + I can see the ocean sparkling in the moonlight.**\n" }, - { "You are on a sandy beach.", - { 138, 139, 140, 0, 99, 0, 0, 0 }, -"Fine coral sand, a fresh sea breeze, and dramatic surf add to this beach's\n\ -appeal.** Stone steps lead to a lighted path in the gardens +.*\n" }, - { "You are among palm trees near the shore.", - { 141, 80, 142, 143, 73, 0, 0, 0 }, -"Arching coconut palms laden with fruit provide a canopy for the glistening\n\ -white sand and sparse, dew covered grasses growing here. The forest grows\n\ -denser +. Crickets are chirping loudly here. The ocean is +.**\n" }, - { "You are walking along the beach.", - { 144, 0, 145, 80, 73, 0, 0, 0 }, -"The warm tropical waters nuzzle your ankles as you walk. Above is a gorgeous\n\ -starscape. The battlestar must be up there somewhere. The slope of the sand\n\ -is so gentle that the surf only slides up the sand.** There are some rocks\n\ -+.*\n" }, - { "You are walking along the beach.", - { 146, 0, 80, 147, 73, 0, 0, 0 }, -"The tide is out very far tonight, and it is possible to explore hidden rocks\n\ -and caves not ordinarily accessible. Rich beds of seaweed have been exposed\n\ -to the cool night air.****\n" }, - { "You are in a papaya grove.", - { 148, 89, 149, 150, 77, 0, 0, 0 }, -"Slender trees with their large seven lobed leaves bulge with succulent fruit.\n\ -There are some tall trees +.***\n" }, - { "You are in a field of pineapple.", - { 89, 151, 152, 153, 77, 0, 0, 0 }, -"The sharp dagger like pineapple leaves can pierce the flesh and hold fast\n\ -a skewered victim with tiny barbs.* The field ends +.**\n" }, - { "You are in a field of kiwi plants.", - { 149, 154, 155, 89, 77, 0, 0, 0 }, -"Round hairy fruit hang from staked vines here. There are some trees +\n\ -and +. The field ends in a road +.*\n" }, - { "You are in a large grove of coconuts.", - { 150, 153, 89, 156, 77, 0, 0, 0 }, -"These trees are much taller than any growing near the shore and the shadows\n\ -are also deeper. It's hard to keep my sense of direction.****\n" }, - { "You are in the woods.", - { 157, 91, 158, 116, 79, 0, 0, 0 }, -"Tropical undergrowth makes the going rough here. Sword ferns give no strong\n\ -foot hold and the dangling vines would gladly throttle one. The darkness is\n\ -so intense here that we stand in utter blackness.****\n" }, - { "You are at the shore.", - { 91, 0, 159, 145, 79, 0, 160, 0 }, -"The low minus tide tonight might make it possible to climb down to a\n\ -small cave entrance below. Large rocks would usually churn the waves\n\ -asunder.*** The beach goes -.\n" }, - { "You are on the coast road.", - { 158, 161, 162, 91, 79, 0, 0, 0 }, -"The road is beginning to turn slightly -. I can hear the surf +. The road\n\ -continues into the dark forest +.*\n" }, - { "The road winds deeper into the trees.", - { 163, 142, 91, 164, 79, 0, 0, 0 }, -"Only narrow moonbeams filter through the dense foliage above. The moist rich\n\ -earth has nurtured a myriad of slugs, snakes, and spiders to grow here. The\n\ -road continues - and *- into the shadows.*\n" }, - { "This is the front porch of the bungalow.", - { 165, 92, 0, 0, 81, 0, 0, 0 }, -"The veranda is lit by a small yellow bug light. The door leads -.\n\ -The stone walk down to the luau is lined with burning torches +. That\n\ -roast pig smells good.**\n" }, - { "You are on a path leading to the lagoon.", - { 92, 166, 167, 168, 81, 0, 0, 0 }, -"This path winds through the underbrush and towards the lagoon *+. The\n\ -broad faced moon peeps though the branches above. The sound of drums echos\n\ -in the woods.**\n" }, - { "This is a dirt road.", - { 169, 118, 170, 92, 81, 0, 0, 0 }, -"**The road continues on - here for some distance. A bonfire and party light\n\ -up the night sky +.\n" }, - { "You are on a dirt road.", - { 171, 118, 92, 172, 81, 0, 0, 0 }, -"**There is a village +. A huge bonfire licks at the trees, and a celebration\n\ -of some sort is going on there. The smell of luscious cooking is tantalizing\n\ -my flared nostrils. The road continues +.\n" }, - { "You are on a dirt road.", - { 173, 93, 174, 175, 82, 0, 0, 0 }, -"This is a wide grassy clearing bedewed with droplets of evening mist. The\n\ -trees alongside the road moan and whisper as we pass. They seem annoyed at\n\ -our presence. **The road continues - and -.\n" }, - { "You are at the seaplane dock.", - { 93, 0, 176, 177, 82, 0, 0, 0 }, -"Not a living thing stirs the calm surface of the lagoon. The wooden planks\n\ -creak unnaturally as we tread on them. The dock reaches a clearing +.\n\ -A dark trail leads around the lagoon **+.\n" }, - { "There are some tables on the lawn here.", - { 121, 122, 123, 93, 82, 0, 0, 0 }, -"Some tables are strewn on the wet lawn.****\n" }, - { "You are nosing around in the bushes.", - { 124, 124, 93, 124, 82, 0, 0, 0 }, -"There is little here but some old beer cans. It is damp and dirty in here.\n\ -I think I stepped in something unpleasant. It would be best to go **-.*\n" }, - { "You are walking in a dry stream bed.", - { 178, 98, 179, 0, 84, 0, 0, 0 }, -"The large cobblestones are difficult to walk on. No starlight reaches\n\ -below a black canopy of fog seemingly engulfing the whole island. A dirt\n\ -path along the wash is **+. The high bank is impossible to climb +.\n" }, - { "You are at the thermal pools.", - { 98, 0, 180, 181, 84, 0, 0, 0 }, -"Odd spluttering and belching water splashes up around the rocks here.\n\ -A spectacular waterfall nearby tumbles down as a river of effervescent\n\ -bubbles. The air is quite warm and a cave entrance ***+ spews steam.\n" }, - { "You are in the woods.", - { 127, 180, 182, 98, 84, 0, 0, 0 }, -"It is pitch black in the forest here and my pant leg is caught on something.\n\ -There may be poison oak here. What was that? A lantern just flickered by in\n\ -the dark! The sound of rushing water is coming from *+.**\n" }, - { "You are on a dirt trail.", - { 179, 181, 98, 0, 84, 0, 0, 0 }, -"The trail seems to start here and head towards the forest +.** High, dark\n\ -cliffs border the trail +. Some crickets are chirping noisily.\n" }, - { "You are walking along the beach.", - { 183, 101, 184, 0, 87, 0, 0, 0 }, -"The surf is rather tame tonight. The beach continues + and +.**\n" }, - { "You are walking along the beach.", - { 101, 185, 186, 0, 87, 0, 0, 0 }, -"This is not a very nice beach. The coarse sand hurts my feet.****\n" }, - { "You are walking through some ferns.", - { 184, 186, 187, 101, 87, 0, 0, 0 }, -"This is a wide field growing only ferns and small shrubs.** In the dark\n\ -it would be all to easy to stumble into a venomous snake. The ocean is\n\ -*+.\n" }, - { "You are in a narrow canyon.", - { 0, 0, 188, 102, 76, 0, 0, 0 }, -"The steep sides here squeeze a little freshet through a gauntlet like\n\ -series of riffles and pools. The cool mountain air is refreshing.****\n" }, - { "The canyon is much wider here.", - { 0, 0, 102, 189, 76, 0, 0, 0 }, -"The sheer rock walls rise 10 meters into darkness. A slender waterfall\n\ -careens away from the face of the rock high above and showers the gravel\n\ -floor with sparkling raindrops.** The canyon continues -\n\ -and -.\n" }, - { "You are on the front porch of the cottage.", - { 190, 103, 0, 0, 0, 0, 0, 0 }, -"The veranda is deserted. A table and chair are the only things on the porch.\n\ -Inside the house is a parlor lighted with an elegant chandelier. The door\n\ -leads -. The lawn and fountain are +.**\n" }, - { "You are in a palm grove.", - { 103, 191, 192, 105, 88, 0, 0, 0 }, -"Crickets are chirping in the cool night air.****\n" }, - { "You are on a dirt road.", - { 193, 192, 245, 103, 88, 0, 0, 0 }, -"There are many bright lights +. The road cleaves the darkness +.\n\ -A small dirt road goes -, and a drive way peals off +.\n" }, - { "You are in a field of small shrubs.", - { 184, 186, 103, 187, 88, 0, 0, 0 }, -"**Pine and other coniferous saplings are growing here. The rich brown\n\ -soil is well watered. Across a large lawn +, there is a small cottage lighted\n\ -with spot lights and gas lamps. A cool land breeze is blowing.*\n" }, - { "The beach is pretty rocky here.", - { 194, 105, 195, 0, 96, 0, 0, 0 }, -"The tide is very low tonight. The beach is nicer *+.**\n" }, - { "The beach is almost 10 meters wide here.", - { 105, 183, 196, 0, 99, 0, 0, 0 }, -"The sand has become more coarse and the beach steeper.****\n" }, - { "You are in the gardens.", - { 195, 196, 197, 105, 99, 0, 0, 0 }, -"Shadowy expanses of lawn and leaf have been groomed and manicured here.\n\ -The night sky is glowing with a full moon.** A lighted path leads -.\n\ -Stone steps lead down to the beach +.\n" }, - { "You are on the coast road.", - { 198, 106, 163, 199, 73, 0, 0, 0 }, -"The forest is dense on either side. The trees seem to be actually squeezing\n\ -together to keep us from passing. A feeling of enmity is in the air.**\n\ -The road continues - and -.\n" }, - { "You are in the forest.", - { 116, 107, 91, 106, 73, 0, 0, 0 }, -"I suppose there are trees and ferns all around, but it is too dark to see.****\n" }, - { "You are in the forest.", - { 199, 108, 106, 146, 73, 0, 0, 0 }, -"There are shadowy trees and ferns all around.****\n" }, - { "You are in a copse.", - { 142, 107, 145, 80, 0, 0, 0, 0 }, -"This is a secret hidden thicket only noticeable from the beach. In the\n\ -moonlight, I can tell that someone has been digging here recently.****\n" }, - { "You are at the tide pools.", - { 91, 0, 114, 107, 79, 0, 0, 0 }, -"These rocks and pools are the home for many sea anemones and crustaceans.\n\ -They are exposed because of the low tide. There is a beach ***+.\n" }, - { "You are in the forest.", - { 199, 108, 143, 0, 73, 0, 0, 0 }, -"This is a shallow depression sheltered from the wind by a thick growth of \n\ -thorny shrubs. It looks like someone is camping here. There is a fire pit\n\ -with warm, crackling flames and coals here.* The beach is +.* The thorny\n\ -shrubs block the way -.\n" }, - { "You are at the mouth of the lagoon.", - { 200, 0, 108, 201, 74, 0, 0, 0 }, -"The beach ends here where the coral reef rises to form a wide lagoon.\n\ -A path winds around the lagoon to the -.* The beach continues\n\ -on -. Only water lies +.\n" }, - { "You are in a breadfruit grove.", - { 202, 109, 203, 204, 77, 0, 0, 0 }, -"The tall trees bend leisurely in the breeze, holding many round breadfruits\n\ -close to their large serrated leaves. There are coconut palms +,\n\ -*+, and +.\n" }, - { "You are in a grove of mango trees.", - { 203, 111, 205, 109, 77, 0, 0, 0 }, -"The trees are not tall enough to obscure the view and the bright moonlight\n\ -makes it fairly easy to see.****\n" }, - { "You are in a grove of coconut palms.", - { 204, 112, 109, 206, 77, 0, 0, 0 }, -"All I can see around us are trees and ominous shapes darting in and out of the\n\ -shadows.****\n" }, - { "You are in a coconut grove.", - { 110, 207, 208, 209, 77, 0, 0, 0 }, -"There are countless trees here.****\n" }, - { "You are in a field of pineapple.", - { 154, 208, 210, 110, 77, 0, 0, 0 }, -"The sharp leaves are cutting me to ribbons. There is a road **+.*\n" }, - { "You are in a coconut grove.", - { 112, 209, 110, 211, 77, 0, 0, 0 }, -"There is a field of something **+.*\n" }, - { "You are on the edge of a kiwi and pineapple field.", - { 111, 152, 155, 110, 77, 0, 0, 0 }, -"An irrigation ditch separates the two fields here. There is a road **+.*\n" }, - { "This is a dirt road.", - { 205, 210, 212, 111, 77, 0, 0, 0 }, -"The road runs - and - here. It is very dark in the forest.**\n" }, - { "You are in a palm grove.", - { 206, 211, 112, 213, 77, 0, 0, 0 }, -"There are trees all around us.****\n" }, - { "You are on the edge of a small clearing.", - { 157, 113, 157, 157, 79, 0, 0, 0 }, -"The ground is rather marshy here and the darkness is intense. A swarm of\n\ -ravenous mosquitoes has descended upon you and has sent you quaking to your\n\ -knees.****\n" }, - { "You are in the woods.", - { 158, 115, 215, 113, 79, 0, 0, 0 }, -"You have walked a long way and found only spider webs. ****\n" }, - { "You are walking along the shore.", - { 115, 0, 214, 114, 86, 0, 0, 0 }, -"You are now about 10 meters above the surf on a gently rising cliffside.**\n\ -The land rises +. There is a beach far +.\n" }, - { "You are just inside the entrance to the sea cave.", - { 246, 114, 0, 0, 114, 1, 0, 0 }, -"The sound of water dripping in darkness and the roar of the ocean just outside\n\ -create a very unwelcoming atmosphere inside this cave. Only on rare occasions\n\ -such as this is it possible to enter the forbidden catacombs... The cave\n\ -continues -.***\n" }, - { "You are in a secret nook beside the road.", - { 115, 159, 162, 91, 79, 0, 0, 0 }, -"This little thicket is hidden from the road in the shadows of the forest.\n\ -From here we have a clear view of any traffic along the road. A great hollow\n\ -tree stuffed with something is nearby. The road is +.***\n" }, - { "You are on the coast road.", - { 215, 214, 0, 115, 86, 0, 0, 0 }, -"The road turns abruptly - here, wandering deeper into the black forest.***\n" }, - { "You are on a dirt road.", - { 216, 116, 113, 141, 79, 0, 0, 0 }, -"We are walking through a tunnel of unfriendly trees and shrubs. The tall\n\ -ones bend over the roadway and reach down with their branches to grab us.\n\ -Broad leafed plants at the roadside whisper in the darkness. Something\n\ -just darted across the road and into the bushes *+. Let's go *-.\n" }, - { "You have discovered a hidden thicket near the road.", - { 163, 142, 116, 106, 73, 0, 0, 0 }, -"I would think it best to stay n the road. The forest seems very unfriendly\n\ -at night. The road is **+.*\n" }, - { "You are in the living room.", - { 0, 117, 217, 218, 0, 0, 0, 0 }, -"A decorative entry with fresh flowers and wall to wall carpeting leads into\n\ -the living room here where a couch and two chairs converse with an end table.\n\ -*The exit is +.* The bedroom is +.\n" }, - { "You are at the lagoon.", - { 118, 0, 167, 168, 81, 0, 0, 0 }, -"A small beach here is deserted except for some fishing nets. It is very\n\ -peaceful at the lagoon at night. The sound of native drums is carried on\n\ -the night breeze. There are paths leading off into darkness +,\n\ -*+, and +.\n" }, - { "You are at the lagoon.", - { 118, 0, 170, 166, 81, 0, 0, 0 }, -"The grass near the water is moist with the refreshing evening dew. Far away,\n\ -drums reverberate in the forest.** The path continues + and +.\n" }, - { "You are at the lagoon.", - { 118, 0, 166, 172, 81, 0, 0, 0 }, -"The path meanders through shadows of tussocks of grass, ferns, and thorny\n\ -bushes here and continues on **- and -.\n" }, - { "You are in the woods.", - { 219, 119, 220, 92, 81, 0, 0, 0 }, -"There are plenty of ferns and thorny bushes here! Spider webs and probing\n\ -branches snare us as we stumble along in the pitch black night.****\n" }, - { "You are on a dirt road.", - { 220, 167, 199, 119, 74, 0, 0, 0 }, -"The road winds rather close to a large lagoon here and many sedges and tall\n\ -loom in the darkness *+. The road continues - and -.\n" }, - { "You are in the woods beside the road.", - { 221, 120, 92, 222, 81, 0, 0, 0 }, -"The forest grows darker +. The road is +.**\n" }, - { "The road crosses the lagoon here.", - { 222, 0, 120, 174, 81, 0, 0, 0 }, -"Strange mists rising from the water engulf a rickety old enclosed bridge here.\n\ -Spider webs catch our hair as we pass through its rotting timbers. I felt\n\ -something drop on my neck. The road delves into the accursed forest\n\ -**+ and +.\n" }, - { "You are in a coconut palm grove.", - { 223, 121, 224, 225, 82, 0, 0, 0 }, -"The tall palms are planted about 30 feet apart and the stary sky is clearly\n\ -visible above. A low growing grass carpets the ground all around. The grove\n\ -continues +.***\n" }, - { "You are walking along a dirt road.", - { 224, 176, 172, 121, 82, 0, 0, 0 }, -"You are near misty patch of the roadway **+. The road continues -.\n" }, - { "You are on a dirt road.", - { 225, 177, 121, 226, 82, 0, 0, 0 }, -"The road turns abruptly - here, splitting a grove of palm trees.* In the\n\ -starlight I can also discern that the road continues - toward the lagoon.*\n" }, - { "You are on a trail running around the lagoon.", - { 172, 0, 0, 122, 82, 0, 0, 0 }, -"The dark waters brush the trail here and the path crosses an old bridge\n\ -+. There is deep water + and +. The trail continues -.\n" }, - { "This is the mouth of the lagoon.", - { 175, 0, 122, 227, 82, 0, 0, 0 }, -"The coral reef wraps around a natural bay here to create a wide lagoon which\n\ -winds tortuously inland.** A trail goes around the lagoon +.\n\ -The beach is -.\n" }, - { "You are in a dry stream bed.", - { 0, 125, 0, 0, 84, 0, 0, 0 }, -"The dry wash drains over a tall precipice here into a turbid morass below. The\n\ -most noisome stench imaginable is wafting up to defile our nostrils. Above,\n\ -the blackness is intense and a strange mist engulfs the island.* Let's go\n\ --.**\n" }, - { "You are on a dirt path along the wash.", - { 0, 128, 125, 228, 84, 0, 0, 0 }, -"The trail winds along the gravel wash and delves into the forest ***+.\n" }, - { "The thermal pools flow into a stream here.", - { 127, 0, 229, 126, 84, 0, 0, 0 }, -"The gurgling hot waters pour over boulders into a swiftly flowing\n\ -stream **+. The pools are +.\n" }, - { "You are at the entrance to a cave.", - { 128, 230, 126, 0, 84, 0, 0, 0 }, -"A torch lights the entrance to the cave. Deep inside I can see shadows moving.\n\ -A path goes + from here. The entrance is +.**\n" }, - { "You are in the woods.", - { 182, 229, 182, 127, 84, 0, 0, 0 }, -"Thorns tangle your every effort to proceed.* The sound of rushing water is\n\ -+.**\n" }, - { "You are walking along the beach.", - { 139, 129, 184, 0, 99, 0, 0, 0 }, -"Some dunes here progress inland and make it impossible to get very far in that\n\ -direction. The beach continues - and -.* The ocean is +.\n" }, - { "You are in the dunes.", - { 183, 101, 184, 129, 87, 0, 0, 0 }, -"The endless rolling and pitching sand dunes are enough to make one very queasy!\n\ -The sand is cool and the stars are bright at the ocean. The only way I'm going\n\ -is ***+.\n" }, - { "This is a lousy beach.", - { 130, 0, 0, 0, 87, 0, 0, 0 }, -"Volcanic and viciously sharp bitted grains of sand here bite like cold steel\n\ -into my tender feet. I refuse to continue on. Let's get out of here. The\n\ -beach is better +.***\n" }, - { "You are in a field of sparse ferns.", - { 131, 185, 187, 130, 87, 0, 0, 0 }, -"The lava rock outcroppings here will support few plants. There is more \n\ -vegetation +.** The ocean is +.\n" }, - { "You are in the woods.", - { 131, 131, 137, 131, 87, 0, 0, 0 }, -"Young trees and tall shrubs grow densely together here.\n\ -They grow thicker **+.*\n" }, - { "The canyon is no wider than a foot here.", - { 0, 0, 0, 132, 0, 0, 0, 0 }, -"The freshet is gushing through the narrow trough, but the canyon has grown\n\ -too narrow to follow it any farther.*** I guess we'll have to go -.\n" }, - { "You are in a narrow part of the canyon.", - { 0, 0, 133, 232, 76, 0, 0, 0 }, -"The two sheer sides are no more than a few meters apart here. There is a stone\n\ -door in the wall +. The gravelly floor runs with tiny rivulets seeping \n\ -from the ground itself.* The canyon continues - and -.\n" }, - { "You are in the drawing room.", - { 0, 134, 0, 0, 0, 0, 0, 0 }, -"Exquisitely decorated with plants and antique furniture of superb\n\ -craftsmanship, the parlor reflects its owners impeccable taste. The tropical\n\ -night air pours in through open shutters *+. There doesn't seem \n\ -to be anybody around. A large immaculate oaken desk is visible in the\n\ -study and it even has a old fashioned telephone to complete the decor.**\n" }, - { "You are in a palm grove.", - { 135, 191, 233, 191, 88, 0, 0, 0 }, -"Grassy rows of dew covered palms stretch as far as I can see.**\n\ -There is a road +.*\n" }, - { "You are on a dirt road.", - { 136, 233, 234, 135, 88, 0, 0, 0 }, -"The road winds through a coconut palm grove here. It continues on - \n\ -and -.**\n" }, - { "The road leads to several large buildings here.", - { 235, 136, 236, 237, 88, 0, 0, 0 }, -"There is a lighted clubhouse +,* a large barn and stable +, and a\n\ -garage of similar construct to the barn +.\n" }, - { "This part of the beach is impassable.", - { 0, 138, 0, 0, 96, 0, 0, 0 }, -"The see is calm tonight. The beach goes *-.**\n" }, - { "You are in the gardens.", - { 195, 140, 197, 138, 96, 0, 0, 0 }, -"Dew beaded grass sparkles in the moonlight. Tiny lamps beside the path light\n\ -the way to the ocean ***+.\n" }, - { "You are in the gardens.", - { 140, 183, 197, 139, 99, 0, 0, 0 }, -"Beautiful flowers and shrubs surround a lighted goldfish pond.****\n" }, - { "You are on a stone walk in the garden.", - { 195, 196, 238, 140, 99, 0, 0, 0 }, -"The walk leads to a road **+.*\n" }, - { "You are in the forest near the road.", - { 198, 141, 216, 198, 73, 0, 0, 0 }, -"There are many thorny bushes here!****\n" }, - { "You are at a fork in the road.", - { 239, 146, 141, 170, 73, 0, 0, 0 }, -"Two roads come together in the darkness here. One runs -,* the other \n\ -runs - and -.\n" }, - { "You are on a dirt path around the lagoon.", - { 170, 147, 146, 0, 74, 0, 0, 0 }, -"The still waters reflect bending palms and a stary sky. It looks like\n\ -the path runs into a clearing +. The path continues -.**\n" }, - { "You are drowning in the lagoon.", - { 201, 201, 147, 201, 74, 0, 0, 0 }, -"I suggest you get out before you become waterlogged.****\n" }, - { "You are in a coconut palm grove.", - { 202, 148, 203, 204, 77, 0, 0, 0 }, -"****\n" }, - { "You are in a palm grove.", - { 202, 149, 205, 148, 77, 0, 0, 0 }, -"****\n" }, - { "You are in a palm grove.", - { 202, 150, 148, 206, 77, 0, 0, 0 }, -"****\n" }, - { "You are on a dirt road.", - { 203, 155, 212, 149, 77, 0, 0, 0 }, -"*This road ends here at a palm grove but continues on - for quite\n\ -some way.**\n" }, - { "You are in a coconut palm grove.", - { 204, 156, 150, 213, 77, 0, 0, 0 }, -"****\n" }, - { "You are in a coconut grove.", - { 151, 219, 208, 209, 77, 0, 0, 0 }, -"*The grove ends +.**\n" }, - { "You are in a coconut grove.", - { 152, 207, 239, 151, 77, 0, 0, 0 }, -"**There is a dirt road +.*\n" }, - { "You are in a coconut grove.", - { 153, 207, 151, 211, 77, 0, 0, 0 }, -"****\n" }, - { "This is a dirt road.", - { 205, 239, 212, 154, 77, 0, 0, 0 }, -"The road continues - and -.**\n" }, - { "You are in a coconut grove.", - { 153, 209, 153, 213, 77, 0, 0, 0 }, -"****\n" }, - { "You are in the woods near the road.", - { 205, 210, 212, 155, 77, 0, 0, 0 }, -"There are many thorny bushes here!****\n" }, - { "You are in a coconut grove.", - { 213, 213, 156, 234, 88, 0, 0, 0 }, -"***The grove ends in a clearing +.\n" }, - { "You are walking along some high cliffs.", - { 162, 0, 0, 159, 86, 0, 0, 0 }, -"The island bends sharply + here with high cliffs -\n\ -and -. The cliffs are lower +.\n" }, - { "You are at the coast road turn around.", - { 0, 162, 0, 158, 90, 0, 0, 0 }, -"The coast road ends here in a lookout with a view of the ocean.\n\ -Far below, the waves crash against the rocks.\n\ -****\n" }, - { "You are in the woods near the road.", - { 216, 163, 216, 198, 79, 0, 257, 0 }, -"These thorny bushes are killing me.****\n" }, - { "You are in the kitchen.", - { 0, 0, 0, 165, 0, 0, 0, 0 }, -"A small gas stove and a refrigerator are all the only appliances here. The\n\ -gas oven has been left on and the whole room is reeking with natural gas.\n\ -One spark from a match and.... The door out is ***+.\n" }, - { "You are in the bedroom.", - { 0, 0, 165, 0, 0, 0, 0, 0 }, -"A soft feather comforter on top of layers of Answer blankets make this a very\n\ -luxurious place to sleep indeed. There are also some end tables and a dresser\n\ -here.** The living room is +.*\n" }, - { "You are in the woods.", - { 207, 169, 220, 221, 81, 0, 0, 0 }, -"The darkness is intense, but there seems to be a clearing +.***\n" }, - { "You are in the woods near the road.", - { 219, 170, 239, 169, 81, 0, 0, 0 }, -"*As far as I can tell, there are two roads + and +.*\n" }, - { "You are in the woods.", - { 207, 171, 219, 222, 81, 0, 0, 0 }, -"The spider webs thin out and the forest is clearer +.***\n" }, - { "You are on the lagoon's inland finger.", - { 0, 172, 171, 172, 81, 0, 0, 0 }, -"It is impossible to follow the lagoon any farther inland because of sharp\n\ -and very painful sedges.* The road is +.**\n" }, - { "You are in a grassy coconut grove.", - { 240, 173, 224, 241, 82, 0, 0, 0 }, -"The tall palms provide a ghostly canopy for the sandy ground covering.****\n" }, - { "You are near the lagoon's inland finger.", - { 0, 174, 0, 173, 82, 0, 0, 0 }, -"Very sharp sedges make it impossible to follow the lagoon any farther inland.\n\ -*There is a road +.**\n" }, - { "You are on a dirt road.", - { 241, 175, 173, 226, 82, 0, 0, 0 }, -"The road winds through a coconut grove here and continues - and -.**\n" }, - { "You are in the woods near the road.", - { 226, 226, 175, 226, 82, 0, 0, 0 }, -"**The road is +.*\n" }, - { "This is a beach?", - { 227, 227, 177, 0, 82, 0, 0, 0 }, -"Hard jagged rocks that pierce with every footstep hardly comprise a beach.**\n\ -Let's go -.*\n" }, - { "The trail is lost in the woods here.", - { 241, 241, 179, 241, 84, 0, 0, 0 }, -"The trail goes **-.*\n" }, - { "You are on the bank of a stream.", - { 182, 0, 242, 180, 84, 0, 0, 0 }, -"The stream falls over several small boulders here and continues on **-.*\n" }, - { "You are just inside the cave.", - { 181, 267, 0, 0, 0, 0, 0, 0 }, -"A steamy hot breath is belching from the depths of the earth within.* The\n\ -cave continues -.**\n" }, - { "You are just inside the cave entrance.", - { 274, 0, 0, 0, 0, 0, 0, 0 }, -"The air is hot and sticky inside. The cave continues -. There is a \n\ -stone door in the wall +. A wooden sign in the dust warns in old elven\n\ -runes, \"GSRF KDIRE NLVEMP!\".**\n" }, - { "You are at the edge of a huge chasm.", - { 0, 0, 189, 0, 76, 0, 0, 0 }, -"Several hundred feet down I can see the glimmer of placid water. The\n\ -rivulets drain over the edge and trickle down into the depths. It is \n\ -impossible to climb down.** The canyon continues -.*\n" }, - { "You are on a dirt road.", - { 192, 241, 240, 191, 88, 0, 0, 0 }, -"The road winds through a coconut grove here. The road continues on into the\n\ -shadows - and -.**\n" }, - { "You are in a coconut palm grove near the road.", - { 193, 233, 213, 192, 88, 0, 0, 0 }, -"***The road is +.\n" }, - { "You are at the clubhouse.", - { 0, 193, 0, 0, 0, 0, 0, 0 }, -"The clubhouse is built over the most inland part of the lagoon. Tropical\n\ -bananas and fragrant frangipani grow along the grassy shore. Walking across\n\ -the short wooden bridge, we enter. Along one wall is a bar crowded with people.\n\ -The restaurant and disco dance floor are filled to capacity. A rock group\n\ -electrocutes itself to the satisfaction of the audience.****\n" }, - { "You are in the stables.", - { 0, 0, 0, 193, 0, 0, 0, 0 }, -"Neighing horses snacking on hay and oats fill the stalls on both sides of\n\ -the barn. It is rather warm in here but that is not the most offensive\n\ -part.****\n" }, - { "You are in the old garage.", - { 0, 0, 193, 0, 0, 0, 0, 0 }, -"This is an old wooden building of the same vintage as the stables. Beneath\n\ -a sagging roof stand gardening tools and greasy rags. Parked in the center\n\ -is an underpowered Plymouth Volare' with a red and white striped golf cart\n\ -roof. ****\n" }, - { "You are on a dirt road.", - { 197, 197, 243, 197, 85, 0, 0, 0 }, -"The road leads to a formal garden laced with lighted stone walks and tropical\n\ -flowers and trees.** The road continues -. A walk leads -.\n" }, - { "You are on a dirt road.", - { 210, 199, 198, 220, 73, 0, 0, 0 }, -"The road runs - and -.**\n" }, - { "You are in a coconut grove near the road.", - { 234, 223, 234, 233, 88, 0, 0, 0 }, -"***The road is +.\n" }, - { "You are on a dirt road.", - { 233, 225, 223, 226, 82, 0, 0, 0 }, -"The road continues - and -.**\n" }, - { "The stream plummets over a cliff here.", - { 182, 0, 0, 229, 84, 0, 0, 0 }, -"Falling 10 agonizing meters into darkness, only droplets of the stream must\n\ -be left to dance off the floor below. There is no way down, even with a\n\ -strong rope. ****\n" }, - { "You are on a dirt road.", - { 0, 0, 244, 238, 85, 0, 0, 0 }, -"**The road continues - and -.\n" }, - { "You are on a dirt road.", - { 0, 245, 0, 243, 88, 0, 0, 0 }, -"*The road continues -* and -.\n" }, - { "You are on a dirt road.", - { 244, 234, 213, 136, 88, 0, 0, 0 }, -"The road goes -* and *-.\n" }, - { "You are in a low passage.", - { 247, 160, 0, 0, 0, 0, 0, 0 }, -"The ceiling here sparkles with iridescent gems and minerals. Colorful starfish\n\ -and sea anemones cling to the slippery walls and floor. The passage continues\n\ -+.***\n" }, - { "The walls are very close together here.", - { 248, 246, 0, 0, 0, 0, 0, 0 }, -"I can barely squeeze through the jagged opening. Slimy sea weeds provide\n\ -no footing at all. This tunnel seems to be an ancient lava tube. There is\n\ -a large room +.***\n" }, - { "You are in the cathedral room.", - { 249, 247, 250, 251, 0, 0, 0, 0 }, -"Your light casts ghostly shadows on the walls but cannot pierce the \n\ -engulfing darkness overhead. The sound of water dripping echoes in the void.\n\ -*I can see no passages leading out of this room.*** \n" }, - { "You are walking through a very round tunnel.", - { 252, 248, 0, 0, 252, 1, 0, 0 }, -"The round walls of this tunnel are amazingly smooth to the touch. A little\n\ -trickle of water flows down the center. The tunnel climbs steadily +.\n\ -There is a large room +.**\n" }, - { "You are in the cathedral anteroom.", - { 0, 0, 0, 248, 253, 1, 0, 0 }, -"This small chamber with a flat stone floor is to one side of the cathedral \n\ -room. We appear to be at the bottom of a tall narrow shaft. There are many \n\ -puddles of water here. A staircase hewn from solid rock and black lava \n\ -leads up.*** The cathedral room is -.\n" }, - { "You are in a wide chamber.", - { 0, 0, 248, 254, 0, 0, 0, 0 }, -"Water is sprinkling from the ceiling here. A shallow pool populated by a \n\ -myriad of blind white creatures sparkles in your light. Tiny shrimp and\n\ -crabs scurry away, frightened by the blinding rays.** The cave \n\ -continues + and +.\n" }, - { "You are at the top of a sloping passage.", - { 0, 249, 255, 256, 257, 1, 249, 0 }, -"There is much algae growing here, both green and brown specimens. I suspect\n\ -that we are near the high tide zone, but no light can get in here. The walls\n\ -glisten with shiny minerals.** A hallway here runs + and -.\n" }, - { "You are in an elaborately tiled room.", - { 0, 0, 258, 0, 0, 0, 250, 0 }, -"Large colorful tiles plate the floor and walls. The ceiling is a mosaic\n\ -of gems set in gold. Hopefully it is only our footsteps that are echoing in\n\ -this hollow chamber.** The room continues -. A stone staircase leads\n\ -down.*\n" }, - { "You are at a dead end.", - { 0, 0, 251, 0, 0, 0, 0, 0 }, -"The walls here are alive with dark mussels. They click their shells menacingly\n\ -if we disturb them.** The only exit is +.*\n" }, - { "The tunnel is very low here.", - { 0, 0, 259, 252, 0, 0, 0, 0 }, -"You practically have to crawl on your knees to pass through this opening. The\n\ -air is stiflingly damp, but you can't hear any sounds of water dripping.**\n\ -The crawlspace continues -. The tunnel seems wider +.\n" }, - { "This is the supply room.", - { 0, 0, 252, 0, 0, 0, 0, 0 }, -"Picks and shovels line the walls here, as well as hard hats, boxes of\n\ -dynamite, and a cartload of very high grade gold and silver ore.** \n\ -A tunnel leads off +.*\n" }, - { "You have found a secret entrance to the catacombs", - { 0, 0, 0, 0, 216, 1, 252, 0 }, -"Below is a wet, seaweed covered floor. Above is a way out.****\n" }, - { "You are in the catacombs.", - { 0, 0, 260, 253, 0, 0, 0, 0 }, -"Ornate tombs and piles of treasure line the walls. Long spears with many\n\ -blades, fine swords and coats of mail, heaps of coins, jewelry, pottery, \n\ -and golden statues are tribute past kings and queens.** The catacombs\n\ -continue - and -.\n" }, - { "You are crawling on your stomach.", - { 0, 0, 261, 255, 0, 0, 0, 0 }, -"The passage is quite narrow and jagged, but the rock is no longer lava.\n\ -It appears to be a form of granite.** The crawlspace continues -, \n\ -but I would just as soon go -.\n" }, - { "You are in the Sepulcher.", - { 0, 0, 0, 258, 0, 0, 0, 0 }, -"A single tomb is here. Encrusted with diamonds and opals, and secured with \n\ -straps of a very hard, untarnished silver, this tomb must be of a great king.\n\ -Vases overflowing with gold coins stand nearby. A line of verse on the wall\n\ -reads, \"Three he made and gave them to his daughters.\"****\n" }, - { "The passage is wider here.", - { 0, 0, 0, 259, 0, 0, 262, 0 }, -"A ladder goes down into darkness here.*** A small crawlspace goes -.\n" }, - { "You are at the bottom of a ladder.", - { 0, 0, 0, 0, 261, 1, 263, 0 }, -"This is a narrow platform to rest on before we continue either up or down this\n\ -rickety wooden ladder.****\n" }, - { "You are standing in several inches of water.", - { 264, 0, 265, 266, 262, 1, 0, 0 }, -"This seems to be a working mine. Many different tunnels wander off following\n\ -glowing veins of precious metal. The floor is flooded here since we must\n\ -be nearly at sea level. A ladder leads up.****\n" }, - { "The tunnel here is blocked by broken rocks.", - { 0, 263, 0, 0, 0, 0, 0, 0 }, -"The way is blocked, but if you had some dynamite, we might be able to blast our\n\ -way through.* The passage goes -.**\n" }, - { "The tunnel is too flooded to proceed.", - { 0, 0, 0, 263, 0, 0, 0, 0 }, -"Hidden shafts could swallow us if we tried to continue on down this tunnel.\n\ -The flooding is already up to my waist. Large crystals overhead shimmer\n\ -rainbows of reflected light.*** Let's go -.\n" }, - { "The mine is less flooded here.", - { 0, 0, 263, 0, 0, 0, 0, 0 }, -"A meandering gold laden vein of quartz and blooming crystals of diamonds\n\ -and topaz burst from the walls of the cave. A passage goes -.***\n" }, - { "You are inside the cave.", - { 230, 268, 0, 0, 0, 0, 0, 0 }, -"A hot steam swirls around our heads, and the walls are warm to the touch.\n\ -The trail winds - and -.**\n" }, - { "You are in a rather large chamber.", - { 267, 0, 0, 269, 0, 0, 269, 0 }, -"Beds of ferns and palm leaves make several cozy nests along the walls. In the\n\ -center of the room is a throne of gold and silver.*** A passageway leads\n\ -down and +.\n" }, - { "You are walking along the edge of a huge abyss.", - { 0, 0, 268, 0, 268, 1, 270, 0 }, -"Steam is rising in great clouds from the immeasurable depths. A very narrow\n\ -trail winds down.** There is a tunnel -.*\n" }, - { "You are on the edge of a huge abyss.", - { 0, 0, 0, 0, 269, 1, 271, 0 }, -"The trail winds farther down.****\n" }, - { "You are winding your way along the abyss.", - { 0, 0, 0, 0, 270, 1, 272, 0 }, -"The trail continues up and down.****\n" }, - { "You are on a wide shelf near the steamy abyss.", - { 0, 273, 0, 0, 271, 1, 0, 0 }, -"The stifling hot cave seems even hotter to me, staring down into this misty \n\ -abyss. A trail winds up.* A passageway leads -.**\n" }, - { "You are in a wide tunnel leading to a fuming abyss.", - { 272, 274, 0, 0, 0, 0, 0, 0 }, -"The passageway winds through many beautiful formations of crystals and\n\ -sparkling minerals. The tunnel continues - and -.**\n" }, - { "You are in a tunnel.", - { 273, 231, 0, 0, 0, 0, 0, 0 }, -"It is very warm in here. The smell of steam and hot rocks permeates the place.\n\ -The cave continues - and -.**\n" }, - { "You are at the bottom of a pit.", - { 0, 0, 0, 0, 232, 0, 0, 0 }, -"At the top of the pit, a single star can be seen in the night sky. There\n\ -doesn't appear to be any way to get out without a rope. I don't remember\n\ -how we got here.****\n" }, -}; diff --git a/games/battlestar/nightobjs.c b/games/battlestar/nightobjs.c deleted file mode 100644 index 20a374230451..000000000000 --- a/games/battlestar/nightobjs.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 1983, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)nightobjs.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include "externs.h" - -const struct objs nightobjs[] = { - { 218, PAJAMAS }, - { 235, NATIVE }, - { 92, PAPAYAS }, - { 92, PINEAPPLE }, - { 92, KIWI }, - { 92, MANGO }, - { 92, NATIVE }, - { 92, MAN }, - { 181, LAMPON }, - { 236, LAMPON }, - { 92, LAMPON }, - { 216, WOODSMAN }, - { 216, DEADWOOD }, - { 216, MALLET }, - { 168, WOODSMAN }, - { 168, DEADWOOD }, - { 168, MALLET }, - { 170, WOODSMAN }, - { 170, DEADWOOD }, - { 170, MALLET }, - { 124, SHIELD }, - { 124, HALBERD }, - { 124, ELF }, - { 144, SHIELD }, - { 144, HALBERD }, - { 144, ELF }, - { 113, SHIELD }, - { 113, HALBERD }, - { 113, ELF }, - { 161, SHIELD }, - { 161, HALBERD }, - { 161, ELF }, - { 169, SHIELD }, - { 169, HALBERD }, - { 169, ELF }, - { 182, SHIELD }, - { 182, HALBERD }, - { 182, ELF }, - { 198, SHIELD }, - { 198, HALBERD }, - { 198, ELF }, - { 212, SHIELD }, - { 212, HALBERD }, - { 212, ELF }, - { 216, SHIELD }, - { 216, HALBERD }, - { 216, ELF }, - { 226, SHIELD }, - { 226, HALBERD }, - { 226, ELF }, - { 228, SHIELD }, - { 228, HALBERD }, - { 228, ELF }, - { 68, CYLON }, - { 144, SHOVEL }, - { 249, FOOT }, - { 250, FOOT }, - { 93, PAPAYAS }, - { 0, 0 } -}; diff --git a/games/battlestar/parse.c b/games/battlestar/parse.c deleted file mode 100644 index e705b637bd74..000000000000 --- a/games/battlestar/parse.c +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (c) 1983, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)parse.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include "externs.h" - -static int hash (const char *); -static void install(struct wlist *); -struct wlist *lookup(const char *); - -void -wordinit() -{ - struct wlist *w; - - for (w = wlist; w->string; w++) - install(w); -} - -int -hash(s) - const char *s; -{ - int hashval = 0; - - while (*s) { - hashval += *s++; - hashval *= HASHMUL; - hashval &= HASHMASK; - } - return hashval; -} - -struct wlist * -lookup(s) - const char *s; -{ - struct wlist *wp; - - for (wp = hashtab[hash(s)]; wp != NULL; wp = wp->next) - if (*s == *wp->string && strcmp(s, wp->string) == 0) - return wp; - return NULL; -} - -void -install(wp) - struct wlist *wp; -{ - int hashval; - - if (lookup(wp->string) == NULL) { - hashval = hash(wp->string); - wp->next = hashtab[hashval]; - hashtab[hashval] = wp; - } else - printf("Multiply defined %s.\n", wp->string); -} - -void -parse() -{ - struct wlist *wp; - int n; - - wordnumber = 0; /* for cypher */ - for (n = 0; n <= wordcount; n++) { - if ((wp = lookup(words[n])) == NULL) { - wordvalue[n] = -1; - wordtype[n] = -1; - } else { - wordvalue[n] = wp -> value; - wordtype[n] = wp -> article; - } - } -} diff --git a/games/battlestar/pathnames.h b/games/battlestar/pathnames.h deleted file mode 100644 index 25901945d5f0..000000000000 --- a/games/battlestar/pathnames.h +++ /dev/null @@ -1,36 +0,0 @@ -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)pathnames.h 8.1 (Berkeley) 5/31/93 - */ - -#define _PATH_SCORE "/var/games/battlestar.log" diff --git a/games/battlestar/room.c b/games/battlestar/room.c deleted file mode 100644 index 90f95e2486c6..000000000000 --- a/games/battlestar/room.c +++ /dev/null @@ -1,234 +0,0 @@ -/* - * Copyright (c) 1983, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)room.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include "externs.h" - -void -writedes() -{ - int compass; - const char *p; - unsigned int c; - - printf("\n\t%s\n", location[position].name); - if (beenthere[position] < 3) { - compass = NORTH; - for ((p = location[position].desc); (c = *p++);) - if (c != '-' && c != '*' && c != '+') - putchar((int)c); - else { - if (c != '*') - printf("%s", truedirec(compass, c)); - compass++; - } - } -} - -void -printobjs() -{ - unsigned int *p = location[position].objects; - int n; - - printf("\n"); - for (n = 0; n < NUMOFOBJECTS; n++) - if (testbit(p, n) && objdes[n]) - puts(objdes[n]); -} - -void -whichway(here) -struct room here; -{ - switch(direction) { - - case NORTH: - left = here.west; - right = here.east; - ahead = here.north; - back = here.south; - break; - - case SOUTH: - left = here.east; - right = here.west; - ahead = here.south; - back = here.north; - break; - - case EAST: - left = here.north; - right = here.south; - ahead = here.east; - back = here.west; - break; - - case WEST: - left = here.south; - right = here.north; - ahead = here.west; - back = here.east; - break; - - } -} - -const char * -truedirec(way, option) -int way; -unsigned int option; -{ - switch(way) { - - case NORTH: - switch(direction) { - case NORTH: - return("ahead"); - case SOUTH: - return(option == '+' ? "behind you" : "back"); - case EAST: - return("left"); - case WEST: - return("right"); - } - - case SOUTH: - switch(direction) { - case NORTH: - return(option == '+' ? "behind you" : "back"); - case SOUTH: - return("ahead"); - case EAST: - return("right"); - case WEST: - return("left"); - } - - case EAST: - switch(direction) { - case NORTH: - return("right"); - case SOUTH: - return("left"); - case EAST: - return("ahead"); - case WEST: - return(option == '+' ? "behind you" : "back"); - } - - case WEST: - switch(direction) { - case NORTH: - return("left"); - case SOUTH: - return("right"); - case EAST: - return(option == '+' ? "behind you" : "back"); - case WEST: - return("ahead"); - } - - default: - printf("Error: room %d. More than four directions wanted.", position); - return("!!"); - } -} - -void -newway(thisway) -int thisway; -{ - switch(direction){ - - case NORTH: - switch(thisway){ - case LEFT: - direction = WEST; - break; - case RIGHT: - direction = EAST; - break; - case BACK: - direction = SOUTH; - break; - } - break; - case SOUTH: - switch(thisway){ - case LEFT: - direction = EAST; - break; - case RIGHT: - direction = WEST; - break; - case BACK: - direction = NORTH; - break; - } - break; - case EAST: - switch(thisway){ - case LEFT: - direction = NORTH; - break; - case RIGHT: - direction = SOUTH; - break; - case BACK: - direction = WEST; - break; - } - break; - case WEST: - switch(thisway){ - case LEFT: - direction = SOUTH; - break; - case RIGHT: - direction = NORTH; - break; - case BACK: - direction = EAST; - break; - } - break; - } -} diff --git a/games/battlestar/save.c b/games/battlestar/save.c deleted file mode 100644 index f675b8c98a1e..000000000000 --- a/games/battlestar/save.c +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Copyright (c) 1983, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)save.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include -#include -#include /* MAXPATHLEN */ -#include -#include -#include -#include "externs.h" - -void -restore() -{ - char *home; - char home1[MAXPATHLEN]; - int n; - int tmp; - FILE *fp; - - if ( (home = getenv("HOME")) != NULL) - sprintf(home1, "%.*s/Bstar", MAXPATHLEN - 7, home); - else return; - - if ((fp = fopen(home1, "r")) == 0) { - perror(home1); - return; - } - fread(&WEIGHT, sizeof WEIGHT, 1, fp); - fread(&CUMBER, sizeof CUMBER, 1, fp); - fread(&gclock, sizeof gclock, 1, fp); - fread(&tmp, sizeof tmp, 1, fp); - location = tmp ? dayfile : nightfile; - for (n = 1; n <= NUMOFROOMS; n++) { - fread(location[n].link, sizeof location[n].link, 1, fp); - fread(location[n].objects, sizeof location[n].objects, 1, fp); - } - fread(inven, sizeof inven, 1, fp); - fread(wear, sizeof wear, 1, fp); - fread(injuries, sizeof injuries, 1, fp); - fread(notes, sizeof notes, 1, fp); - fread(&direction, sizeof direction, 1, fp); - fread(&position, sizeof position, 1, fp); - fread(>ime, sizeof gtime, 1, fp); - fread(&fuel, sizeof fuel, 1, fp); - fread(&torps, sizeof torps, 1, fp); - fread(&carrying, sizeof carrying, 1, fp); - fread(&encumber, sizeof encumber, 1, fp); - fread(&rythmn, sizeof rythmn, 1, fp); - fread(&followfight, sizeof followfight, 1, fp); - fread(&ate, sizeof ate, 1, fp); - fread(&snooze, sizeof snooze, 1, fp); - fread(&meetgirl, sizeof meetgirl, 1, fp); - fread(&followgod, sizeof followgod, 1, fp); - fread(&godready, sizeof godready, 1, fp); - fread(&bs_win, sizeof bs_win, 1, fp); - fread(&wintime, sizeof wintime, 1, fp); - fread(&matchlight, sizeof matchlight, 1, fp); - fread(&matchcount, sizeof matchcount, 1, fp); - fread(&loved, sizeof loved, 1, fp); - fread(&pleasure, sizeof pleasure, 1, fp); - fread(&power, sizeof power, 1, fp); - /* We must check the last read, to catch truncated save files. */ - if (fread(&ego, sizeof ego, 1, fp) < 1) - errx(1, "save file %s too short", home1); - fclose(fp); -} - -void -save() -{ - struct stat sbuf; - char *home; - char home1[MAXPATHLEN]; - int n; - int tmp, fd; - FILE *fp; - - home = getenv("HOME"); - if (home == 0) - return; - sprintf(home1, "%.*s/Bstar", MAXPATHLEN - 7, home); - - /* Try to open the file safely. */ - if (stat(home1, &sbuf) < 0) { - fd = open(home1, O_WRONLY|O_CREAT|O_EXCL, 0600); - if (fd < 0) { - fprintf(stderr, "Can't create %s\n", home1); - return; - } - } else { - if ((sbuf.st_mode & S_IFLNK) == S_IFLNK) { - fprintf(stderr, "No symlinks!\n"); - return; - } - - fd = open(home1, O_WRONLY|O_EXCL); - if (fd < 0) { - fprintf(stderr, "Can't open %s for writing\n", home1); - return; - } - } - - if ((fp = fdopen(fd, "w")) == 0) { - perror(home1); - return; - } - - printf("Saved in %s.\n", home1); - fwrite(&WEIGHT, sizeof WEIGHT, 1, fp); - fwrite(&CUMBER, sizeof CUMBER, 1, fp); - fwrite(&gclock, sizeof gclock, 1, fp); - tmp = location == dayfile; - fwrite(&tmp, sizeof tmp, 1, fp); - for (n = 1; n <= NUMOFROOMS; n++) { - fwrite(location[n].link, sizeof location[n].link, 1, fp); - fwrite(location[n].objects, sizeof location[n].objects, 1, fp); - } - fwrite(inven, sizeof inven, 1, fp); - fwrite(wear, sizeof wear, 1, fp); - fwrite(injuries, sizeof injuries, 1, fp); - fwrite(notes, sizeof notes, 1, fp); - fwrite(&direction, sizeof direction, 1, fp); - fwrite(&position, sizeof position, 1, fp); - fwrite(>ime, sizeof gtime, 1, fp); - fwrite(&fuel, sizeof fuel, 1, fp); - fwrite(&torps, sizeof torps, 1, fp); - fwrite(&carrying, sizeof carrying, 1, fp); - fwrite(&encumber, sizeof encumber, 1, fp); - fwrite(&rythmn, sizeof rythmn, 1, fp); - fwrite(&followfight, sizeof followfight, 1, fp); - fwrite(&ate, sizeof ate, 1, fp); - fwrite(&snooze, sizeof snooze, 1, fp); - fwrite(&meetgirl, sizeof meetgirl, 1, fp); - fwrite(&followgod, sizeof followgod, 1, fp); - fwrite(&godready, sizeof godready, 1, fp); - fwrite(&bs_win, sizeof bs_win, 1, fp); - fwrite(&wintime, sizeof wintime, 1, fp); - fwrite(&matchlight, sizeof matchlight, 1, fp); - fwrite(&matchcount, sizeof matchcount, 1, fp); - fwrite(&loved, sizeof loved, 1, fp); - fwrite(&pleasure, sizeof pleasure, 1, fp); - fwrite(&power, sizeof power, 1, fp); - fwrite(&ego, sizeof ego, 1, fp); -} diff --git a/games/battlestar/words.c b/games/battlestar/words.c deleted file mode 100644 index 440936ac9b19..000000000000 --- a/games/battlestar/words.c +++ /dev/null @@ -1,210 +0,0 @@ -/* - * Copyright (c) 1983, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)words.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include "externs.h" - -struct wlist wlist[] = { - { "knife", KNIFE, OBJECT }, - { "sword", SWORD, NOUNS }, - { "scabbard", SWORD, OBJECT }, - { "fine", SWORD, OBJECT }, - { "two-handed", TWO_HANDED, OBJECT }, - { "cleaver", CLEAVER, OBJECT }, - { "broadsword", BROAD, OBJECT }, - { "mail", MAIL, OBJECT }, - { "coat", MAIL, OBJECT }, - { "helmet", HELM, OBJECT }, - { "shield", SHIELD, OBJECT }, - { "maid", MAID, OBJECT }, - { "maid's", MAID, OBJECT }, - { "body", BODY, NOUNS }, - { "viper", VIPER, OBJECT }, - { "lamp", LAMPON, OBJECT }, - { "lantern", LAMPON, OBJECT }, - { "shoes", SHOES, OBJECT }, - { "pajamas", PAJAMAS, OBJECT }, - { "robe", ROBE, OBJECT }, - { "amulet", AMULET, NOUNS }, - { "medallion", MEDALION, NOUNS }, - { "talisman", TALISMAN, NOUNS }, - { "woodsman", DEADWOOD, OBJECT }, - { "woodsman's", DEADWOOD, OBJECT }, - { "mallet", MALLET, OBJECT }, - { "laser", LASER, OBJECT }, - { "pistol", LASER, OBJECT }, - { "blaster", LASER, OBJECT }, - { "gun", LASER, OBJECT }, - { "goddess", NORMGOD, NOUNS }, - { "grenade", GRENADE, OBJECT }, - { "chain", CHAIN, OBJECT }, - { "rope", ROPE, OBJECT }, - { "levis", LEVIS, OBJECT }, - { "pants", LEVIS, OBJECT }, - { "mace", MACE, OBJECT }, - { "shovel", SHOVEL, OBJECT }, - { "halberd", HALBERD, OBJECT }, - { "compass", COMPASS, OBJECT }, - { "elf", ELF, OBJECT }, - { "coins", COINS, OBJECT }, - { "matches", MATCHES, OBJECT }, - { "match", MATCHES, OBJECT }, - { "book", MATCHES, OBJECT }, - { "man", MAN, NOUNS }, - { "papayas", PAPAYAS, OBJECT }, - { "pineapple", PINEAPPLE, OBJECT }, - { "kiwi", KIWI, OBJECT }, - { "coconuts", COCONUTS, OBJECT }, - { "mango", MANGO, OBJECT }, - { "ring", RING, OBJECT }, - { "potion", POTION, OBJECT }, - { "bracelet", BRACELET, OBJECT }, - { "timer", TIMER, NOUNS }, - { "bomb", BOMB, OBJECT }, - { "warhead", BOMB, OBJECT }, - { "girl", NATIVE, NOUNS }, - { "native", NATIVE, NOUNS }, - { "horse", HORSE, OBJECT }, - { "stallion", HORSE, OBJECT }, - { "car", CAR, OBJECT }, - { "volare", CAR, OBJECT }, - { "pot", POT, OBJECT }, - { "jewels", POT, OBJECT }, - { "bar", BAR, OBJECT }, - { "diamond", BLOCK, OBJECT }, - { "block", BLOCK, OBJECT }, - { "up", UP, VERB }, - { "u", UP, VERB }, - { "down", DOWN, VERB }, - { "d", DOWN, VERB }, - { "ahead", AHEAD, VERB }, - { "a", AHEAD, VERB }, - { "back", BACK, VERB }, - { "b", BACK, VERB }, - { "right", RIGHT, VERB }, - { "r", RIGHT, VERB }, - { "left", LEFT, VERB }, - { "l", LEFT, VERB }, - { "take", TAKE, VERB }, - { "get", TAKE, VERB }, - { "use", USE, VERB }, - { "look", LOOK, VERB }, - { "lo", LOOK, VERB }, - { "quit", QUIT, VERB }, - { "q", QUIT, VERB }, - { "su", SU, VERB }, - { "drop", DROP, VERB }, - { "draw", DRAW, VERB }, - { "pull", DRAW, VERB }, - { "carry", DRAW, VERB }, - { "wear", WEARIT, VERB }, - { "sheathe", WEARIT, VERB }, - { "put", PUT, VERB }, - { "buckle", PUT, VERB }, - { "strap", PUT, VERB }, - { "tie", PUT, VERB }, - { "inven", INVEN, VERB }, - { "i", INVEN, VERB }, - { "everything", EVERYTHING, OBJECT }, - { "all", EVERYTHING, OBJECT }, - { "and", AND, CONJ }, - { "kill", KILL, VERB }, - { "fight", KILL, VERB }, - { "ravage", RAVAGE, VERB }, - { "rape", RAVAGE, VERB }, - { "undress", UNDRESS, VERB }, - { "throw", THROW, VERB }, - { "launch", LAUNCH, VERB }, - { "land", LANDIT, VERB }, - { "light", LIGHT, VERB }, - { "strike", LIGHT, VERB }, - { "follow", FOLLOW, VERB }, - { "chase", FOLLOW, VERB }, - { "kiss", KISS, VERB }, - { "love", LOVE, VERB }, - { "fuck", LOVE, VERB }, - { "give", GIVE, VERB }, - { "smite", SMITE, VERB }, - { "attack", SMITE, VERB }, - { "swing", SMITE, VERB }, - { "stab", SMITE, VERB }, - { "slice", SMITE, VERB }, - { "cut", SMITE, VERB }, - { "hack", SMITE, VERB }, - { "shoot", SHOOT, VERB }, - { "blast", SHOOT, VERB }, - { "on", ON, PREPS }, - { "off", OFF, PREPS }, - { "time", TIME, VERB }, - { "sleep", SLEEP, VERB }, - { "dig", DIG, VERB }, - { "eat", EAT, VERB }, - { "swim", SWIM, VERB }, - { "drink", DRINK, VERB }, - { "door", DOOR, NOUNS }, - { "save", SAVE, VERB }, - { "ride", RIDE, VERB }, - { "mount", RIDE, VERB }, - { "drive", DRIVE, VERB }, - { "start", DRIVE, VERB }, - { "score", SCORE, VERB }, - { "points", SCORE, VERB }, - { "bury", BURY, VERB }, - { "jump", JUMP, VERB }, - { "kick", KICK, VERB }, - { "kerosene", 0, ADJS }, - { "plumed", 0, ADJS }, - { "ancient", 0, ADJS }, - { "golden", 0, ADJS }, - { "gold", 0, ADJS }, - { "ostrich", 0, ADJS }, - { "rusty", 0, ADJS }, - { "old", 0, ADJS }, - { "dented", 0, ADJS }, - { "blue", 0, ADJS }, - { "purple", 0, ADJS }, - { "kingly", 0, ADJS }, - { "the", 0, ADJS }, - { "climb", 0, ADJS }, - { "move", 0, ADJS }, - { "make", 0, ADJS }, - { "to", 0, ADJS }, - { 0, 0, 0 } -}; diff --git a/games/bs/Makefile b/games/bs/Makefile deleted file mode 100644 index 5a6ca34bfe53..000000000000 --- a/games/bs/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -# $FreeBSD$ - -PROG= bs -MAN= bs.6 -DPADD= ${LIBNCURSES} -LDADD= -lncurses -HIDEGAME=hidegame - -.include diff --git a/games/bs/bs.6 b/games/bs/bs.6 deleted file mode 100644 index da52e285d1a7..000000000000 --- a/games/bs/bs.6 +++ /dev/null @@ -1,43 +0,0 @@ -.\" $FreeBSD$ -.TH BATTLESHIPS 6 "Aug 23, 1989" -.SH NAME -bs \- battleships game -.SH SYNOPSIS -bs [ -b | -s ] [ -c ] -.SH DESCRIPTION -This program allows you to play the familiar Battleships game against the -computer on a 10x10 board. The interface is visual and largely -self-explanatory; you place your ships and pick your shots by moving the -cursor around the `sea' with the rogue/hack motion keys hjklyubn. -.PP -Note that when selecting a ship to place, you must type the capital letter -(these are, after all, capital ships). During ship placement, the `r' command -may be used to ignore the current position and randomly place your currently -selected ship. The `R' command will place all remaining ships randomly. The ^L -command (form feed, ASCII 12) will force a screen redraw). -.PP -The command-line arguments control game modes. - -.nf - -b selects a `blitz' variant - -s selects a `salvo' variant - -c permits ships to be placed adjacently -.fi - -The `blitz' variant allows a side to shoot for as long as it continues to -score hits. -.PP -The `salvo' game allows a player one shot per turn for each of his/her ships -still afloat. This puts a premium scoring hits early and knocking out some -ships and also makes much harder the situation where you face a superior force -with only your PT-boat. -.PP -Normally, ships must be separated by at least one square of open water. The --c option disables this check and allows them to close-pack. -.PP -The algorithm the computer uses once it has found a ship to sink is provably -optimal. The dispersion criterion for the random-fire algorithm may not be. -.SH AUTHORS -Originally written by one Bruce Holloway in 1986. Salvo mode added by Chuck A. -DeGaul (cbosgd!cad). Visual user interface, `closepack' option, code rewrite -and manual page by Eric S. Raymond August 1989. diff --git a/games/bs/bs.c b/games/bs/bs.c deleted file mode 100644 index 4a16379988b6..000000000000 --- a/games/bs/bs.c +++ /dev/null @@ -1,1246 +0,0 @@ -/* - * bs.c - original author: Bruce Holloway - * salvo option by: Chuck A DeGaul - * with improved user interface, autoconfiguration and code cleanup - * by Eric S. Raymond - * v1.2 with color support and minor portability fixes, November 1990 - * v2.0 featuring strict ANSI/POSIX conformance, November 1993. - * - * $FreeBSD$ - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#ifndef A_UNDERLINE /* BSD curses */ -#define beep() write(1,"\007",1); -#define cbreak crmode -#define saveterm savetty -#define resetterm resetty -#define nocbreak nocrmode -#define strchr index -#endif /* !A_UNDERLINE */ - - -/* - * Constants for tuning the random-fire algorithm. It prefers moves that - * diagonal-stripe the board with a stripe separation of srchstep. If - * no such preferred moves are found, srchstep is decremented. - */ -#define BEGINSTEP 3 /* initial value of srchstep */ - -/* miscellaneous constants */ -#define SHIPTYPES 5 -#define OTHER (1-turn) -#define PLAYER 0 -#define COMPUTER 1 -#define MARK_HIT 'H' -#define MARK_MISS 'o' -#define CTRLC '\003' /* used as terminate command */ -#define FF '\014' /* used as redraw command */ - -/* coordinate handling */ -#define BWIDTH 10 -#define BDEPTH 10 - -/* display symbols */ -#define SHOWHIT '*' -#define SHOWSPLASH ' ' -#define IS_SHIP(c) isupper(c) - -/* how to position us on player board */ -#define PYBASE 3 -#define PXBASE 3 -#define PY(y) (PYBASE + (y)) -#define PX(x) (PXBASE + (x)*3) -#define pgoto(y, x) (void)move(PY(y), PX(x)) - -/* how to position us on cpu board */ -#define CYBASE 3 -#define CXBASE 48 -#define CY(y) (CYBASE + (y)) -#define CX(x) (CXBASE + (x)*3) -#define cgoto(y, x) (void)move(CY(y), CX(x)) - -#define ONBOARD(x, y) (x >= 0 && x < BWIDTH && y >= 0 && y < BDEPTH) - -/* other board locations */ -#define COLWIDTH 80 -#define PROMPTLINE 21 /* prompt line */ -#define SYBASE CYBASE + BDEPTH + 3 /* move key diagram */ -#define SXBASE 63 -#define MYBASE SYBASE - 1 /* diagram caption */ -#define MXBASE 64 -#define HYBASE SYBASE - 1 /* help area */ -#define HXBASE 0 - -/* this will need to be changed if BWIDTH changes */ -static char numbers[] = " 0 1 2 3 4 5 6 7 8 9"; - -static char carrier[] = "Aircraft Carrier"; -static char battle[] = "Battleship"; -static char sub[] = "Submarine"; -static char destroy[] = "Destroyer"; -static char ptboat[] = "PT Boat"; - -static char name[40]; -static char dftname[] = "stranger"; - -/* direction constants */ -enum directions { E, SE, S, SW, W, NW, N, NE }; -static int xincr[8] = {1, 1, 0, -1, -1, -1, 0, 1}; -static int yincr[8] = {0, 1, 1, 1, 0, -1, -1, -1}; - -/* current ship position and direction */ -static int curx = (BWIDTH / 2); -static int cury = (BDEPTH / 2); - -typedef struct -{ - char *name; /* name of the ship type */ - unsigned int hits; /* how many times has this ship been hit? */ - char symbol; /* symbol for game purposes */ - char length; /* length of ship */ - char x, y; /* coordinates of ship start point */ - enum directions dir;/* direction of `bow' */ - bool placed; /* has it been placed on the board? */ -} -ship_t; - -ship_t plyship[SHIPTYPES] = -{ - { carrier, 0, 'A', 5}, - { battle, 0, 'B', 4}, - { destroy, 0, 'D', 3}, - { sub, 0, 'S', 3}, - { ptboat, 0, 'P', 2}, -}; - -ship_t cpuship[SHIPTYPES] = -{ - { carrier, 0, 'A', 5}, - { battle, 0, 'B', 4}, - { destroy, 0, 'D', 3}, - { sub, 0, 'S', 3}, - { ptboat, 0, 'P', 2}, -}; - -/* "Hits" board, and main board. */ -static char hits[2][BWIDTH][BDEPTH], board[2][BWIDTH][BDEPTH]; - -static int turn; /* 0=player, 1=computer */ -static int plywon=0, cpuwon=0; /* How many games has each won? */ - -static int salvo, blitz, closepack; - -#define PR (void)addstr - -static bool checkplace(int, ship_t *, int); -static int getcoord(int); -int playagain(void); - -static void uninitgame(sig) -/* end the game, either normally or due to signal */ -int sig; -{ - clear(); - (void)refresh(); - (void)resetterm(); - (void)echo(); - (void)endwin(); - exit(0); -} - -static void announceopts() -/* announce which game options are enabled */ -{ - if (salvo || blitz || closepack) - { - (void) printw("Playing optional game ("); - if (salvo) - (void) printw("salvo, "); - else - (void) printw("nosalvo, "); - if (blitz) - (void) printw("blitz "); - else - (void) printw("noblitz, "); - if (closepack) - (void) printw("closepack)"); - else - (void) printw("noclosepack)"); - } - else - (void) printw( - "Playing standard game (noblitz, nosalvo, noclosepack)"); -} - -static void intro() -{ - char *tmpname; - - srandomdev(); - - tmpname = getlogin(); - (void) signal(SIGINT,uninitgame); - (void) signal(SIGINT,uninitgame); - (void) signal(SIGIOT,uninitgame); /* for assert(3) */ - if(signal(SIGQUIT,SIG_IGN) != SIG_IGN) - (void)signal(SIGQUIT,uninitgame); - - if(tmpname != '\0') - { - (void)strcpy(name,tmpname); - name[0] = toupper(name[0]); - } - else - (void)strcpy(name,dftname); - - (void)initscr(); -#ifdef KEY_MIN - keypad(stdscr, TRUE); -#endif /* KEY_MIN */ - (void)saveterm(); - (void)nonl(); - (void)cbreak(); - (void)noecho(); - -#ifdef PENGUIN - (void)clear(); - (void)mvaddstr(4,29,"Welcome to Battleship!"); - (void)move(8,0); - PR(" \\\n"); - PR(" \\ \\ \\\n"); - PR(" \\ \\ \\ \\ \\_____________\n"); - PR(" \\ \\ \\_____________ \\ \\/ |\n"); - PR(" \\ \\/ \\ \\/ |\n"); - PR(" \\/ \\_____/ |__\n"); - PR(" ________________/ |\n"); - PR(" \\ S.S. Penguin |\n"); - PR(" \\ /\n"); - PR(" \\___________________________________________________/\n"); - - (void) mvaddstr(22,27,"Hit any key to continue..."); (void)refresh(); - (void) getch(); -#endif /* PENGUIN */ - -#ifdef A_COLOR - start_color(); - - init_pair(COLOR_BLACK, COLOR_BLACK, COLOR_BLACK); - init_pair(COLOR_GREEN, COLOR_GREEN, COLOR_BLACK); - init_pair(COLOR_RED, COLOR_RED, COLOR_BLACK); - init_pair(COLOR_CYAN, COLOR_CYAN, COLOR_BLACK); - init_pair(COLOR_WHITE, COLOR_WHITE, COLOR_BLACK); - init_pair(COLOR_MAGENTA, COLOR_MAGENTA, COLOR_BLACK); - init_pair(COLOR_BLUE, COLOR_BLUE, COLOR_BLACK); - init_pair(COLOR_YELLOW, COLOR_YELLOW, COLOR_BLACK); -#endif /* A_COLOR */ - -} - -/* VARARGS1 */ -static void prompt(n, f, s) -/* print a message at the prompt line */ -int n; -char *f, *s; -{ - (void) move(PROMPTLINE + n, 0); - (void) clrtoeol(); - (void) printw(f, s); - (void) refresh(); -} - -static void error(s) -char *s; -{ - (void) move(PROMPTLINE + 2, 0); - (void) clrtoeol(); - if (s) - { - (void) addstr(s); - (void) beep(); - } -} - -static void placeship(b, ss, vis) -int b; -ship_t *ss; -int vis; -{ - int l; - - for(l = 0; l < ss->length; ++l) - { - int newx = ss->x + l * xincr[ss->dir]; - int newy = ss->y + l * yincr[ss->dir]; - - board[b][newx][newy] = ss->symbol; - if (vis) - { - pgoto(newy, newx); - (void) addch((chtype)ss->symbol); - } - } - ss->hits = 0; -} - -static int rnd(n) -int n; -{ - return(random() % n); -} - -static void randomplace(b, ss) -/* generate a valid random ship placement into px,py */ -int b; -ship_t *ss; -{ - int bwidth = BWIDTH - ss->length; - int bdepth = BDEPTH - ss->length; - - do { - ss->y = rnd(bdepth); - ss->x = rnd(bwidth); - ss->dir = rnd(2) ? E : S; - } while - (!checkplace(b, ss, FALSE)); -} - -static void initgame() -{ - int i, j, unplaced; - ship_t *ss; - - (void) clear(); - (void) mvaddstr(0,35,"BATTLESHIPS"); - (void) move(PROMPTLINE + 2, 0); - announceopts(); - - bzero(board, sizeof(char) * BWIDTH * BDEPTH * 2); - bzero(hits, sizeof(char) * BWIDTH * BDEPTH * 2); - for (i = 0; i < SHIPTYPES; i++) - { - ss = cpuship + i; - ss->x = ss->y = ss->dir = ss->hits = ss->placed = 0; - ss = plyship + i; - ss->x = ss->y = ss->dir = ss->hits = ss->placed = 0; - } - - /* draw empty boards */ - (void) mvaddstr(PYBASE - 2, PXBASE + 5, "Main Board"); - (void) mvaddstr(PYBASE - 1, PXBASE - 3,numbers); - for(i=0; i < BDEPTH; ++i) - { - (void) mvaddch(PYBASE + i, PXBASE - 3, i + 'A'); -#ifdef A_COLOR - if (has_colors()) - attron(COLOR_PAIR(COLOR_BLUE)); -#endif /* A_COLOR */ - (void) addch(' '); - for (j = 0; j < BWIDTH; j++) - (void) addstr(" . "); -#ifdef A_COLOR - attrset(0); -#endif /* A_COLOR */ - (void) addch(' '); - (void) addch(i + 'A'); - } - (void) mvaddstr(PYBASE + BDEPTH, PXBASE - 3,numbers); - (void) mvaddstr(CYBASE - 2, CXBASE + 7,"Hit/Miss Board"); - (void) mvaddstr(CYBASE - 1, CXBASE - 3, numbers); - for(i=0; i < BDEPTH; ++i) - { - (void) mvaddch(CYBASE + i, CXBASE - 3, i + 'A'); -#ifdef A_COLOR - if (has_colors()) - attron(COLOR_PAIR(COLOR_BLUE)); -#endif /* A_COLOR */ - (void) addch(' '); - for (j = 0; j < BWIDTH; j++) - (void) addstr(" . "); -#ifdef A_COLOR - attrset(0); -#endif /* A_COLOR */ - (void) addch(' '); - (void) addch(i + 'A'); - } - - (void) mvaddstr(CYBASE + BDEPTH,CXBASE - 3,numbers); - - (void) mvprintw(HYBASE, HXBASE, - "To position your ships: move the cursor to a spot, then"); - (void) mvprintw(HYBASE+1,HXBASE, - "type the first letter of a ship type to select it, then"); - (void) mvprintw(HYBASE+2,HXBASE, - "type a direction ([hjkl] or [4862]), indicating how the"); - (void) mvprintw(HYBASE+3,HXBASE, - "ship should be pointed. You may also type a ship letter"); - (void) mvprintw(HYBASE+4,HXBASE, - "followed by `r' to position it randomly, or type `R' to"); - (void) mvprintw(HYBASE+5,HXBASE, - "place all remaining ships randomly."); - - (void) mvaddstr(MYBASE, MXBASE, "Aiming keys:"); - (void) mvaddstr(SYBASE, SXBASE, "y k u 7 8 9"); - (void) mvaddstr(SYBASE+1, SXBASE, " \\|/ \\|/ "); - (void) mvaddstr(SYBASE+2, SXBASE, "h-+-l 4-+-6"); - (void) mvaddstr(SYBASE+3, SXBASE, " /|\\ /|\\ "); - (void) mvaddstr(SYBASE+4, SXBASE, "b j n 1 2 3"); - - /* have the computer place ships */ - for(ss = cpuship; ss < cpuship + SHIPTYPES; ss++) - { - randomplace(COMPUTER, ss); - placeship(COMPUTER, ss, FALSE); - } - - ss = (ship_t *)NULL; - do { - char c, docked[SHIPTYPES + 2], *cp = docked; - - /* figure which ships still wait to be placed */ - *cp++ = 'R'; - for (i = 0; i < SHIPTYPES; i++) - if (!plyship[i].placed) - *cp++ = plyship[i].symbol; - *cp = '\0'; - - /* get a command letter */ - prompt(1, "Type one of [%s] to pick a ship.", docked+1); - do { - c = getcoord(PLAYER); - } while - (!strchr(docked, c)); - - if (c == 'R') - (void) ungetch('R'); - else - { - /* map that into the corresponding symbol */ - for (ss = plyship; ss < plyship + SHIPTYPES; ss++) - if (ss->symbol == c) - break; - - prompt(1, "Type one of [hjklrR] to place your %s.", ss->name); - pgoto(cury, curx); - } - - do { - c = getch(); - } while - (!strchr("hjklrR", c) || c == FF); - - if (c == FF) - { - (void)clearok(stdscr, TRUE); - (void)refresh(); - } - else if (c == 'r') - { - prompt(1, "Random-placing your %s", ss->name); - randomplace(PLAYER, ss); - placeship(PLAYER, ss, TRUE); - error((char *)NULL); - ss->placed = TRUE; - } - else if (c == 'R') - { - prompt(1, "Placing the rest of your fleet at random..."); - for (ss = plyship; ss < plyship + SHIPTYPES; ss++) - if (!ss->placed) - { - randomplace(PLAYER, ss); - placeship(PLAYER, ss, TRUE); - ss->placed = TRUE; - } - error((char *)NULL); - } - else if (strchr("hjkl8462", c)) - { - ss->x = curx; - ss->y = cury; - - switch(c) - { - case 'k': case '8': ss->dir = N; break; - case 'j': case '2': ss->dir = S; break; - case 'h': case '4': ss->dir = W; break; - case 'l': case '6': ss->dir = E; break; - } - - if (checkplace(PLAYER, ss, TRUE)) - { - placeship(PLAYER, ss, TRUE); - error((char *)NULL); - ss->placed = TRUE; - } - } - - for (unplaced = i = 0; i < SHIPTYPES; i++) - unplaced += !plyship[i].placed; - } while - (unplaced); - - turn = rnd(2); - - (void) mvprintw(HYBASE, HXBASE, - "To fire, move the cursor to your chosen aiming point "); - (void) mvprintw(HYBASE+1, HXBASE, - "and strike any key other than a motion key. "); - (void) mvprintw(HYBASE+2, HXBASE, - " "); - (void) mvprintw(HYBASE+3, HXBASE, - " "); - (void) mvprintw(HYBASE+4, HXBASE, - " "); - (void) mvprintw(HYBASE+5, HXBASE, - " "); - - (void) prompt(0, "Press any key to start..."); - (void) getch(); -} - -static int getcoord(atcpu) -int atcpu; -{ - int ny, nx, c; - - if (atcpu) - cgoto(cury,curx); - else - pgoto(cury, curx); - (void)refresh(); - for (;;) - { - if (atcpu) - { - (void) mvprintw(CYBASE + BDEPTH+1, CXBASE+11, "(%d, %c)", curx, 'A'+cury); - cgoto(cury, curx); - } - else - { - (void) mvprintw(PYBASE + BDEPTH+1, PXBASE+11, "(%d, %c)", curx, 'A'+cury); - pgoto(cury, curx); - } - - switch(c = getch()) - { - case 'k': case '8': -#ifdef KEY_MIN - case KEY_UP: -#endif /* KEY_MIN */ - ny = cury+BDEPTH-1; nx = curx; - break; - case 'j': case '2': -#ifdef KEY_MIN - case KEY_DOWN: -#endif /* KEY_MIN */ - ny = cury+1; nx = curx; - break; - case 'h': case '4': -#ifdef KEY_MIN - case KEY_LEFT: -#endif /* KEY_MIN */ - ny = cury; nx = curx+BWIDTH-1; - break; - case 'l': case '6': -#ifdef KEY_MIN - case KEY_RIGHT: -#endif /* KEY_MIN */ - ny = cury; nx = curx+1; - break; - case 'y': case '7': -#ifdef KEY_MIN - case KEY_A1: -#endif /* KEY_MIN */ - ny = cury+BDEPTH-1; nx = curx+BWIDTH-1; - break; - case 'b': case '1': -#ifdef KEY_MIN - case KEY_C1: -#endif /* KEY_MIN */ - ny = cury+1; nx = curx+BWIDTH-1; - break; - case 'u': case '9': -#ifdef KEY_MIN - case KEY_A3: -#endif /* KEY_MIN */ - ny = cury+BDEPTH-1; nx = curx+1; - break; - case 'n': case '3': -#ifdef KEY_MIN - case KEY_C3: -#endif /* KEY_MIN */ - ny = cury+1; nx = curx+1; - break; - case FF: - nx = curx; ny = cury; - (void)clearok(stdscr, TRUE); - (void)refresh(); - break; - default: - if (atcpu) - (void) mvaddstr(CYBASE + BDEPTH + 1, CXBASE + 11, " "); - else - (void) mvaddstr(PYBASE + BDEPTH + 1, PXBASE + 11, " "); - return(c); - } - - curx = nx % BWIDTH; - cury = ny % BDEPTH; - } -} - -static int collidecheck(b, y, x) -/* is this location on the selected zboard adjacent to a ship? */ -int b; -int y, x; -{ - int collide; - - /* anything on the square */ - if ((collide = IS_SHIP(board[b][x][y])) != 0) - return(collide); - - /* anything on the neighbors */ - if (!closepack) - { - int i; - - for (i = 0; i < 8; i++) - { - int xend, yend; - - yend = y + yincr[i]; - xend = x + xincr[i]; - if (ONBOARD(xend, yend)) - collide += IS_SHIP(board[b][xend][yend]); - } - } - return(collide); -} - -static bool checkplace(b, ss, vis) -int b; -ship_t *ss; -int vis; -{ - int l, xend, yend; - - /* first, check for board edges */ - xend = ss->x + ss->length * xincr[ss->dir]; - yend = ss->y + ss->length * yincr[ss->dir]; - if (!ONBOARD(xend, yend)) - { - if (vis) - switch(rnd(3)) - { - case 0: - error("Ship is hanging from the edge of the world"); - break; - case 1: - error("Try fitting it on the board"); - break; - case 2: - error("Figure I won't find it if you put it there?"); - break; - } - return(0); - } - - for(l = 0; l < ss->length; ++l) - { - if(collidecheck(b, ss->y+l*yincr[ss->dir], ss->x+l*xincr[ss->dir])) - { - if (vis) - switch(rnd(3)) - { - case 0: - error("There's already a ship there"); - break; - case 1: - error("Collision alert! Aaaaaagh!"); - break; - case 2: - error("Er, Admiral, what about the other ship?"); - break; - } - return(FALSE); - } - } - return(TRUE); -} - -static int awinna() -{ - int i, j; - ship_t *ss; - - for(i=0; i<2; ++i) - { - ss = (i) ? cpuship : plyship; - for(j=0; j < SHIPTYPES; ++j, ++ss) - if(ss->length > ss->hits) - break; - if (j == SHIPTYPES) - return(OTHER); - } - return(-1); -} - -static ship_t *hitship(x, y) -/* a hit on the targeted ship */ -int x, y; -{ - ship_t *sb, *ss; - char sym; - int oldx, oldy; - - getyx(stdscr, oldy, oldx); - sb = (turn) ? plyship : cpuship; - if(!(sym = board[OTHER][x][y])) - return((ship_t *)NULL); - for(ss = sb; ss < sb + SHIPTYPES; ++ss) - if(ss->symbol == sym) - { - if (++ss->hits < ss->length) /* still afloat? */ - return((ship_t *)NULL); - else /* sunk! */ - { - int i, j; - - if (!closepack) - for (j = -1; j <= 1; j++) - { - int bx = ss->x + j * xincr[(ss->dir + 2) % 8]; - int by = ss->y + j * yincr[(ss->dir + 2) % 8]; - - for (i = -1; i <= ss->length; ++i) - { - int x, y; - - x = bx + i * xincr[ss->dir]; - y = by + i * yincr[ss->dir]; - if (ONBOARD(x, y)) - { - hits[turn][x][y] = MARK_MISS; - if (turn % 2 == PLAYER) - { - cgoto(y, x); -#ifdef A_COLOR - if (has_colors()) - attron(COLOR_PAIR(COLOR_GREEN)); -#endif /* A_COLOR */ - (void)addch(MARK_MISS); -#ifdef A_COLOR - attrset(0); -#endif /* A_COLOR */ - } - } - } - } - - for (i = 0; i < ss->length; ++i) - { - int x = ss->x + i * xincr[ss->dir]; - int y = ss->y + i * yincr[ss->dir]; - - hits[turn][x][y] = ss->symbol; - if (turn % 2 == PLAYER) - { - cgoto(y, x); - (void) addch(ss->symbol); - } - } - - (void) move(oldy, oldx); - return(ss); - } - } - (void) move(oldy, oldx); - return((ship_t *)NULL); -} - -static int plyturn() -{ - ship_t *ss; - bool hit; - char *m; - - m = NULL; - prompt(1, "Where do you want to shoot? "); - for (;;) - { - (void) getcoord(COMPUTER); - if (hits[PLAYER][curx][cury]) - { - prompt(1, "You shelled this spot already! Try again."); - beep(); - } - else - break; - } - hit = IS_SHIP(board[COMPUTER][curx][cury]); - hits[PLAYER][curx][cury] = hit ? MARK_HIT : MARK_MISS; - cgoto(cury, curx); -#ifdef A_COLOR - if (has_colors()) { - if (hit) - attron(COLOR_PAIR(COLOR_RED)); - else - attron(COLOR_PAIR(COLOR_GREEN)); - } -#endif /* A_COLOR */ - (void) addch((chtype)hits[PLAYER][curx][cury]); -#ifdef A_COLOR - attrset(0); -#endif /* A_COLOR */ - - prompt(1, "You %s.", hit ? "scored a hit" : "missed"); - if(hit && (ss = hitship(curx, cury))) - { - switch(rnd(5)) - { - case 0: - m = " You sank my %s!"; - break; - case 1: - m = " I have this sinking feeling about my %s...."; - break; - case 2: - m = " My %s has gone to Davy Jones's locker!"; - break; - case 3: - m = " Glub, glub -- my %s is headed for the bottom!"; - break; - case 4: - m = " You'll pick up survivors from my %s, I hope...!"; - break; - } - (void)printw(m, ss->name); - (void)beep(); - return(awinna() == -1); - } - return(hit); -} - -static int sgetc(s) -char *s; -{ - char *s1; - int ch; - - (void)refresh(); - for(;;) - { - ch = getch(); - if (islower(ch)) - ch = toupper(ch); - if (ch == CTRLC) - uninitgame(); - for (s1=s; *s1 && ch != *s1; ++s1) - continue; - if (*s1) - { - (void) addch((chtype)ch); - (void)refresh(); - return(ch); - } - } -} - - -static void randomfire(px, py) -/* random-fire routine -- implements simple diagonal-striping strategy */ -int *px, *py; -{ - static int turncount = 0; - static int srchstep = BEGINSTEP; - static int huntoffs; /* Offset on search strategy */ - int ypossible[BWIDTH * BDEPTH], xpossible[BWIDTH * BDEPTH], nposs; - int ypreferred[BWIDTH * BDEPTH], xpreferred[BWIDTH * BDEPTH], npref; - int x, y, i; - - if (turncount++ == 0) - huntoffs = rnd(srchstep); - - /* first, list all possible moves */ - nposs = npref = 0; - for (x = 0; x < BWIDTH; x++) - for (y = 0; y < BDEPTH; y++) - if (!hits[COMPUTER][x][y]) - { - xpossible[nposs] = x; - ypossible[nposs] = y; - nposs++; - if (((x+huntoffs) % srchstep) != (y % srchstep)) - { - xpreferred[npref] = x; - ypreferred[npref] = y; - npref++; - } - } - - if (npref) - { - i = rnd(npref); - - *px = xpreferred[i]; - *py = ypreferred[i]; - } - else if (nposs) - { - i = rnd(nposs); - - *px = xpossible[i]; - *py = ypossible[i]; - - if (srchstep > 1) - --srchstep; - } - else - { - error("No moves possible?? Help!"); - exit(1); - /*NOTREACHED*/ - } -} - -#define S_MISS 0 -#define S_HIT 1 -#define S_SUNK -1 - -static bool cpufire(x, y) -/* fire away at given location */ -int x, y; -{ - bool hit, sunk; - ship_t *ss; - - ss = NULL; - hits[COMPUTER][x][y] = (hit = (board[PLAYER][x][y])) ? MARK_HIT : MARK_MISS; - (void) mvprintw(PROMPTLINE, 0, - "I shoot at %c%d. I %s!", y + 'A', x, hit ? "hit" : "miss"); - ss = hitship(x, y); - sunk = hit && ss; - if (sunk) - (void) printw(" I've sunk your %s", ss->name); - (void)clrtoeol(); - - pgoto(y, x); -#ifdef A_COLOR - if (has_colors()) { - if (hit) - attron(COLOR_PAIR(COLOR_RED)); - else - attron(COLOR_PAIR(COLOR_GREEN)); - } -#endif /* A_COLOR */ - (void)addch((chtype)(hit ? SHOWHIT : SHOWSPLASH)); -#ifdef A_COLOR - attrset(0); -#endif /* A_COLOR */ - - return(hit ? (sunk ? S_SUNK : S_HIT) : S_MISS); -} - -/* - * This code implements a fairly irregular FSM, so please forgive the rampant - * unstructuredness below. The five labels are states which need to be held - * between computer turns. - */ -static bool cputurn() -{ -#define POSSIBLE(x, y) (ONBOARD(x, y) && !hits[COMPUTER][x][y]) -#define RANDOM_FIRE 0 -#define RANDOM_HIT 1 -#define HUNT_DIRECT 2 -#define FIRST_PASS 3 -#define REVERSE_JUMP 4 -#define SECOND_PASS 5 - static int next = RANDOM_FIRE; - static bool used[4]; - static ship_t ts; - int navail, x, y, d, n, hit = S_MISS; - - switch(next) - { - case RANDOM_FIRE: /* last shot was random and missed */ - refire: - randomfire(&x, &y); - if (!(hit = cpufire(x, y))) - next = RANDOM_FIRE; - else - { - ts.x = x; ts.y = y; - ts.hits = 1; - next = (hit == S_SUNK) ? RANDOM_FIRE : RANDOM_HIT; - } - break; - - case RANDOM_HIT: /* last shot was random and hit */ - used[E/2] = used[S/2] = used[W/2] = used[N/2] = FALSE; - /* FALLTHROUGH */ - - case HUNT_DIRECT: /* last shot hit, we're looking for ship's long axis */ - for (d = navail = 0; d < 4; d++) - { - x = ts.x + xincr[d*2]; y = ts.y + yincr[d*2]; - if (!used[d] && POSSIBLE(x, y)) - navail++; - else - used[d] = TRUE; - } - if (navail == 0) /* no valid places for shots adjacent... */ - goto refire; /* ...so we must random-fire */ - else - { - for (d = 0, n = rnd(navail) + 1; n; n--) - while (used[d]) - d++; - - assert(d <= 4); - - used[d] = FALSE; - x = ts.x + xincr[d*2]; - y = ts.y + yincr[d*2]; - - assert(POSSIBLE(x, y)); - - if (!(hit = cpufire(x, y))) - next = HUNT_DIRECT; - else - { - ts.x = x; ts.y = y; ts.dir = d*2; ts.hits++; - next = (hit == S_SUNK) ? RANDOM_FIRE : FIRST_PASS; - } - } - break; - - case FIRST_PASS: /* we have a start and a direction now */ - x = ts.x + xincr[ts.dir]; - y = ts.y + yincr[ts.dir]; - if (POSSIBLE(x, y) && (hit = cpufire(x, y))) - { - ts.x = x; ts.y = y; ts.hits++; - next = (hit == S_SUNK) ? RANDOM_FIRE : FIRST_PASS; - } - else - next = REVERSE_JUMP; - break; - - case REVERSE_JUMP: /* nail down the ship's other end */ - d = ts.dir + 4; - x = ts.x + ts.hits * xincr[d]; - y = ts.y + ts.hits * yincr[d]; - if (POSSIBLE(x, y) && (hit = cpufire(x, y))) - { - ts.x = x; ts.y = y; ts.dir = d; ts.hits++; - next = (hit == S_SUNK) ? RANDOM_FIRE : SECOND_PASS; - } - else - next = RANDOM_FIRE; - break; - - case SECOND_PASS: /* kill squares not caught on first pass */ - x = ts.x + xincr[ts.dir]; - y = ts.y + yincr[ts.dir]; - if (POSSIBLE(x, y) && (hit = cpufire(x, y))) - { - ts.x = x; ts.y = y; ts.hits++; - next = (hit == S_SUNK) ? RANDOM_FIRE: SECOND_PASS; - break; - } - else - next = RANDOM_FIRE; - break; - } - - /* check for continuation and/or winner */ - if (salvo) - { - (void)refresh(); - (void)sleep(1); - } - if (awinna() != -1) - return(FALSE); - -#ifdef DEBUG - (void) mvprintw(PROMPTLINE + 2, 0, - "New state %d, x=%d, y=%d, d=%d", - next, x, y, d); -#endif /* DEBUG */ - return(hit); -} - -int -playagain() -{ - int j; - ship_t *ss; - - for (ss = cpuship; ss < cpuship + SHIPTYPES; ss++) - for(j = 0; j < ss->length; j++) - { - cgoto(ss->y + j * yincr[ss->dir], ss->x + j * xincr[ss->dir]); - (void)addch((chtype)ss->symbol); - } - - if(awinna()) - ++cpuwon; - else - ++plywon; - j = 18 + strlen(name); - if(plywon >= 10) - ++j; - if(cpuwon >= 10) - ++j; - (void) mvprintw(1,(COLWIDTH-j)/2, - "%s: %d Computer: %d",name,plywon,cpuwon); - - prompt(2, (awinna()) ? "Want to be humiliated again, %s [yn]? " - : "Going to give me a chance for revenge, %s [yn]? ",name); - return(sgetc("YN") == 'Y'); -} - -static void do_options(c,op) -int c; -char *op[]; -{ - int i; - - if (c > 1) - { - for (i=1; ihits >= sp->length) - continue; /* dead ship */ - else - shots++; - } - return(shots); -} - -int -main(argc, argv) -int argc; -char *argv[]; -{ - /* revoke */ - setgid(getgid()); - - do_options(argc, argv); - - intro(); - do { - initgame(); - while(awinna() == -1) - { - if (!blitz) - { - if (!salvo) - { - if(turn) - (void) cputurn(); - else - (void) plyturn(); - } - else - { - int i; - - i = scount(turn); - while (i--) - { - if (turn) - { - if (cputurn() && awinna() != -1) - i = 0; - } - else - { - if (plyturn() && awinna() != -1) - i = 0; - } - } - } - } - else - while(turn ? cputurn() : plyturn()) - continue; - turn = OTHER; - } - } while - (playagain()); - uninitgame(); - /*NOTREACHED*/ - exit(0); - /*NOTREACHED*/ -} - -/* bs.c ends here */ diff --git a/games/canfield/Makefile b/games/canfield/Makefile deleted file mode 100644 index 98ccdca7094a..000000000000 --- a/games/canfield/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -# @(#)Makefile 8.1 (Berkeley) 5/31/93 - -SUBDIR= canfield cfscores - -.include diff --git a/games/canfield/canfield/Makefile b/games/canfield/canfield/Makefile deleted file mode 100644 index 421bb7cf25cc..000000000000 --- a/games/canfield/canfield/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -# @(#)Makefile 8.1 (Berkeley) 5/31/93 -# $FreeBSD$ - -PROG= canfield -MAN= canfield.6 -DPADD= ${LIBCURSES} ${LIBCOMPAT} -LDADD= -lcurses -lcompat -HIDEGAME=hidegame -MLINKS= canfield.6 cfscores.6 - -beforeinstall: -.if !exists(${DESTDIR}/var/games/cfscores) - ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 664 /dev/null \ - ${DESTDIR}/var/games/cfscores -.endif - -.include "../../Makefile.inc" -.include diff --git a/games/canfield/canfield/canfield.6 b/games/canfield/canfield/canfield.6 deleted file mode 100644 index 37de31b4cedf..000000000000 --- a/games/canfield/canfield/canfield.6 +++ /dev/null @@ -1,118 +0,0 @@ -.\" Copyright (c) 1983, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" 3. All advertising materials mentioning features or use of this software -.\" must display the following acknowledgement: -.\" This product includes software developed by the University of -.\" California, Berkeley and its contributors. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" @(#)canfield.6 8.1 (Berkeley) 5/31/93 -.\" $FreeBSD$ -.\" -.TH CANFIELD 6 "May 31, 1993" -.UC 5 -.SH NAME -canfield, cfscores \- the solitaire card game canfield -.SH SYNOPSIS -.B canfield -.br -.B cfscores -.SH DESCRIPTION -If you have never played solitaire before, it is recommended -that you consult a solitaire instruction book. In -Canfield, tableau cards may be built on each other downward -in alternate colors. An entire pile must be moved as a unit -in building. Top cards of the piles are available -to be played on foundations, but never into empty spaces. -.PP -Spaces must be filled from the stock. The top card of -the stock also is available to be played on foundations or -built on tableau piles. After the stock is exhausted, -tableau spaces may be filled from the talon and the player may -keep them open until he wishes to use them. -.PP -Cards are dealt from the hand to the talon by threes -and this repeats until there are no more cards in the hand -or the player quits. To have cards dealt onto the talon the -player types 'ht' for his move. Foundation base cards are -also automatically moved to the foundation when they become -available. -.PP -The command 'c' causes -.I canfield -to maintain card counting statistics -on the bottom of the screen. -When properly used this can greatly increase one's chances of -winning. -.PP -The rules for betting are somewhat less strict than -those used in the official version of the game. -The initial deal costs $13. -You may quit at this point or inspect the game. -Inspection costs $13 and allows you to make as many -moves as possible without moving any cards from your hand -to the talon. -(The initial deal places three cards on the talon; -if all these cards are used, -three more are made available.) -Finally, if the game seems interesting, -you must pay the final installment of $26. -At this point you are -credited at the rate of $5 for each card on the foundation; -as the game progresses you are credited with $5 for each -card that is moved to the foundation. -Each run through the hand after the first costs $5. -The card counting feature -costs $1 for each unknown card that is identified. -If the information is toggled on, -you are only charged for cards -that became visible since it was last turned on. -Thus the maximum cost of information is $34. -Playing time is charged at a rate of $1 per minute. -.PP -With no arguments, the program -.I cfscores -prints out the current status of your canfield account. -If a user name is specified, -it prints out the status of their canfield account. -If the -.B \-a -flag is specified, -it prints out the canfield accounts for all users that have -played the game since the database was set up. -.SH FILES -/usr/games/canfield the game itself -.br -/usr/games/cfscores the database printer -.br -/var/games/cfscores the database of scores -.SH BUGS -It is impossible to cheat. -.SH AUTHORS -Originally written: Steve Levine -.br -Further random hacking by: Steve Feldman, Kirk McKusick, -Mikey Olson, and Eric Allman. diff --git a/games/canfield/canfield/canfield.c b/games/canfield/canfield/canfield.c deleted file mode 100644 index 4b270284cd72..000000000000 --- a/games/canfield/canfield/canfield.c +++ /dev/null @@ -1,1810 +0,0 @@ -/* - * Copyright (c) 1980, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -static const char copyright[] = -"@(#) Copyright (c) 1980, 1993\n\ - The Regents of the University of California. All rights reserved.\n"; -#endif /* not lint */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)canfield.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -/* - * The canfield program - * - * Authors: - * Originally written: Steve Levine - * Converted to use curses and debugged: Steve Feldman - * Card counting: Kirk McKusick and Mikey Olson - * User interface cleanups: Eric Allman and Kirk McKusick - * Betting by Kirk McKusick - */ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "pathnames.h" - -#define decksize 52 -#define originrow 0 -#define origincol 0 -#define basecol 1 -#define boxcol 42 -#define tboxrow 2 -#define bboxrow 17 -#define movecol 43 -#define moverow 16 -#define msgcol 43 -#define msgrow 15 -#define titlecol 30 -#define titlerow 0 -#define sidecol 1 -#define ottlrow 6 -#define foundcol 11 -#define foundrow 3 -#define stockcol 2 -#define stockrow 8 -#define fttlcol 10 -#define fttlrow 1 -#define taloncol 2 -#define talonrow 13 -#define tabrow 8 -#define ctoprow 21 -#define cbotrow 23 -#define cinitcol 14 -#define cheightcol 1 -#define cwidthcol 4 -#define handstatrow 21 -#define handstatcol 7 -#define talonstatrow 22 -#define talonstatcol 7 -#define stockstatrow 23 -#define stockstatcol 7 -#define Ace 1 -#define Jack 11 -#define Queen 12 -#define King 13 -#define atabcol 11 -#define btabcol 18 -#define ctabcol 25 -#define dtabcol 32 - -#define spades 's' -#define clubs 'c' -#define hearts 'h' -#define diamonds 'd' -#define black 'b' -#define red 'r' - -#define stk 1 -#define tal 2 -#define tab 3 -#define INCRHAND(row, col) {\ - row -= cheightcol;\ - if (row < ctoprow) {\ - row = cbotrow;\ - col += cwidthcol;\ - }\ -} -#define DECRHAND(row, col) {\ - row += cheightcol;\ - if (row > cbotrow) {\ - row = ctoprow;\ - col -= cwidthcol;\ - }\ -} - - -struct cardtype { - char suit; - char color; - bool visible; - bool paid; - int rank; - struct cardtype *next; -}; - -#define NIL ((struct cardtype *) -1) - -struct cardtype *deck[decksize]; -struct cardtype cards[decksize]; -struct cardtype *bottom[4], *found[4], *tableau[4]; -struct cardtype *talon, *hand, *stock, *basecard; -int length[4]; -int cardsoff, base, cinhand, taloncnt, stockcnt, timesthru; -char suitmap[4] = {spades, clubs, hearts, diamonds}; -char colormap[4] = {black, black, red, red}; -char pilemap[4] = {atabcol, btabcol, ctabcol, dtabcol}; -char srcpile, destpile; -int mtforigin, tempbase; -int coldcol, cnewcol, coldrow, cnewrow; -bool errmsg, done; -bool mtfdone, Cflag = FALSE; -#define INSTRUCTIONBOX 1 -#define BETTINGBOX 2 -#define NOBOX 3 -int status = INSTRUCTIONBOX; -int uid; - -/* - * Basic betting costs - */ -#define costofhand 13 -#define costofinspection 13 -#define costofgame 26 -#define costofrunthroughhand 5 -#define costofinformation 1 -#define secondsperdollar 60 -#define maxtimecharge 3 -#define valuepercardup 5 -/* - * Variables associated with betting - */ -struct betinfo { - long hand; /* cost of dealing hand */ - long inspection; /* cost of inspecting hand */ - long game; /* cost of buying game */ - long runs; /* cost of running through hands */ - long information; /* cost of information */ - long thinktime; /* cost of thinking time */ - long wins; /* total winnings */ - long worth; /* net worth after costs */ -}; -struct betinfo this, game, total; -bool startedgame = FALSE, infullgame = FALSE; -time_t acctstart; -int dbfd = -1; - -void askquit(int); -void cleanup(int); -void cleanupboard(void); -void clearabovemovebox(void); -void clearbelowmovebox(void); -void clearmsg(void); -void clearstat(void); -void destinerror(void); -bool diffcolor(struct cardtype *, struct cardtype *); -void dumberror(void); -bool finish(void); -void fndbase(struct cardtype **, int, int); -void getcmd(int, int, char *); -void initall(void); -void initdeck(struct cardtype *[]); -void initgame(void); -void instruct(void); -void makeboard(void); -void movebox(void); -void movecard(void); -void movetofound(struct cardtype **, int); -void movetotalon(void); -bool notempty(struct cardtype *); -void printbottombettingbox(void); -void printbottominstructions(void); -void printcard(int, int, struct cardtype *); -void printrank(int, int, struct cardtype *, bool); -void printtopbettingbox(void); -void printtopinstructions(void); -bool rankhigher(struct cardtype *, int); -bool ranklower(struct cardtype *, struct cardtype *); -void removecard(int, int); -bool samesuit(struct cardtype *, int); -void showcards(void); -void showstat(void); -void shuffle(struct cardtype *[]); -void simpletableau(struct cardtype **, int); -void startgame(void); -void suspend(void); -bool tabok(struct cardtype *, int); -void tabprint(int, int); -void tabtotab(int, int); -void transit(struct cardtype **, struct cardtype **); -void updatebettinginfo(void); -void usedstock(void); -void usedtalon(void); - -/* - * The following procedures print the board onto the screen using the - * addressible cursor. The end of these procedures will also be - * separated from the rest of the program. - * - * procedure to set the move command box - */ -void -movebox() -{ - switch (status) { - case BETTINGBOX: - printtopbettingbox(); - break; - case NOBOX: - clearabovemovebox(); - break; - case INSTRUCTIONBOX: - printtopinstructions(); - break; - } - move(moverow, boxcol); - printw("| |"); - move(msgrow, boxcol); - printw("| |"); - switch (status) { - case BETTINGBOX: - printbottombettingbox(); - break; - case NOBOX: - clearbelowmovebox(); - break; - case INSTRUCTIONBOX: - printbottominstructions(); - break; - } - refresh(); -} - -/* - * print directions above move box - */ -void -printtopinstructions() -{ - move(tboxrow, boxcol); - printw("*----------------------------------*"); - move(tboxrow + 1, boxcol); - printw("| MOVES |"); - move(tboxrow + 2, boxcol); - printw("|s# = stock to tableau |"); - move(tboxrow + 3, boxcol); - printw("|sf = stock to foundation |"); - move(tboxrow + 4, boxcol); - printw("|t# = talon to tableau |"); - move(tboxrow + 5, boxcol); - printw("|tf = talon to foundation |"); - move(tboxrow + 6, boxcol); - printw("|## = tableau to tableau |"); - move(tboxrow + 7, boxcol); - printw("|#f = tableau to foundation |"); - move(tboxrow + 8, boxcol); - printw("|ht = hand to talon |"); - move(tboxrow + 9, boxcol); - printw("|c = toggle card counting |"); - move(tboxrow + 10, boxcol); - printw("|b = present betting information |"); - move(tboxrow + 11, boxcol); - printw("|q = quit to end the game |"); - move(tboxrow + 12, boxcol); - printw("|==================================|"); -} - -/* - * Print the betting box. - */ -void -printtopbettingbox() -{ - - move(tboxrow, boxcol); - printw("*----------------------------------*"); - move(tboxrow + 1, boxcol); - printw("|Costs Hand Game Total |"); - move(tboxrow + 2, boxcol); - printw("| Hands |"); - move(tboxrow + 3, boxcol); - printw("| Inspections |"); - move(tboxrow + 4, boxcol); - printw("| Games |"); - move(tboxrow + 5, boxcol); - printw("| Runs |"); - move(tboxrow + 6, boxcol); - printw("| Information |"); - move(tboxrow + 7, boxcol); - printw("| Think time |"); - move(tboxrow + 8, boxcol); - printw("|Total Costs |"); - move(tboxrow + 9, boxcol); - printw("|Winnings |"); - move(tboxrow + 10, boxcol); - printw("|Net Worth |"); - move(tboxrow + 11, boxcol); - printw("|Return |"); - move(tboxrow + 12, boxcol); - printw("|==================================|"); -} - -/* - * clear info above move box - */ -void -clearabovemovebox() -{ - int i; - - for (i = 0; i <= 11; i++) { - move(tboxrow + i, boxcol); - printw(" "); - } - move(tboxrow + 12, boxcol); - printw("*----------------------------------*"); -} - -/* - * print instructions below move box - */ -void -printbottominstructions() -{ - move(bboxrow, boxcol); - printw("|Replace # with the number of the |"); - move(bboxrow + 1, boxcol); - printw("|tableau you want. |"); - move(bboxrow + 2, boxcol); - printw("*----------------------------------*"); -} - -/* - * print betting information below move box - */ -void -printbottombettingbox() -{ - move(bboxrow, boxcol); - printw("|x = toggle information box |"); - move(bboxrow + 1, boxcol); - printw("|i = list playing instructions |"); - move(bboxrow + 2, boxcol); - printw("*----------------------------------*"); -} - -/* - * clear info below move box - */ -void -clearbelowmovebox() -{ - int i; - - move(bboxrow, boxcol); - printw("*----------------------------------*"); - for (i = 1; i <= 2; i++) { - move(bboxrow + i, boxcol); - printw(" "); - } -} - -/* - * procedure to put the board on the screen using addressable cursor - */ -void -makeboard() -{ - clear(); - refresh(); - move(titlerow, titlecol); - printw("=-> CANFIELD <-="); - move(fttlrow, fttlcol); - printw("foundation"); - move(foundrow - 1, fttlcol); - printw("=---= =---= =---= =---="); - move(foundrow, fttlcol); - printw("| | | | | | | |"); - move(foundrow + 1, fttlcol); - printw("=---= =---= =---= =---="); - move(ottlrow, sidecol); - printw("stock tableau"); - move(stockrow - 1, sidecol); - printw("=---="); - move(stockrow, sidecol); - printw("| |"); - move(stockrow + 1, sidecol); - printw("=---="); - move(talonrow - 2, sidecol); - printw("talon"); - move(talonrow - 1, sidecol); - printw("=---="); - move(talonrow, sidecol); - printw("| |"); - move(talonrow + 1, sidecol); - printw("=---="); - move(tabrow - 1, atabcol); - printw("-1- -2- -3- -4-"); - movebox(); -} - -/* - * clean up the board for another game - */ -void -cleanupboard() -{ - int cnt, row, col; - struct cardtype *ptr; - - col = 0; - if (Cflag) { - clearstat(); - for(ptr = stock, row = stockrow; - ptr != NIL; - ptr = ptr->next, row++) { - move(row, sidecol); - printw(" "); - } - move(row, sidecol); - printw(" "); - move(stockrow + 1, sidecol); - printw("=---="); - move(talonrow - 2, sidecol); - printw("talon"); - move(talonrow - 1, sidecol); - printw("=---="); - move(talonrow + 1, sidecol); - printw("=---="); - } - move(stockrow, sidecol); - printw("| |"); - move(talonrow, sidecol); - printw("| |"); - move(foundrow, fttlcol); - printw("| | | | | | | |"); - for (cnt = 0; cnt < 4; cnt++) { - switch(cnt) { - case 0: - col = atabcol; - break; - case 1: - col = btabcol; - break; - case 2: - col = ctabcol; - break; - case 3: - col = dtabcol; - break; - } - for(ptr = tableau[cnt], row = tabrow; - ptr != NIL; - ptr = ptr->next, row++) - removecard(col, row); - } -} - -/* - * procedure to create a deck of cards - */ -void -initdeck(deck) - struct cardtype *deck[]; -{ - int i; - int scnt; - char s; - int r; - - i = 0; - for (scnt=0; scnt<4; scnt++) { - s = suitmap[scnt]; - for (r=Ace; r<=King; r++) { - deck[i] = &cards[i]; - cards[i].rank = r; - cards[i].suit = s; - cards[i].color = colormap[scnt]; - cards[i].next = NIL; - i++; - } - } -} - -/* - * procedure to shuffle the deck - */ -void -shuffle(deck) - struct cardtype *deck[]; -{ - int i,j; - struct cardtype *temp; - - for (i=0; ivisible = FALSE; - deck[i]->paid = FALSE; - } - for (i = decksize-1; i>=0; i--) { - j = random() % decksize; - if (i != j) { - temp = deck[i]; - deck[i] = deck[j]; - deck[j] = temp; - } - } -} - -/* - * procedure to remove the card from the board - */ -void -removecard(a, b) -{ - move(b, a); - printw(" "); -} - -/* - * procedure to print the cards on the board - */ -void -printrank(a, b, cp, inverse) - struct cardtype *cp; - bool inverse; -{ - move(b, a); - if (cp->rank != 10) - addch(' '); - if (inverse) - standout(); - switch (cp->rank) { - case 2: case 3: case 4: case 5: case 6: case 7: - case 8: case 9: case 10: - printw("%d", cp->rank); - break; - case Ace: - addch('A'); - break; - case Jack: - addch('J'); - break; - case Queen: - addch('Q'); - break; - case King: - addch('K'); - } - if (inverse) - standend(); -} - -/* - * procedure to print out a card - */ -void -printcard(a, b, cp) - int a,b; - struct cardtype *cp; -{ - if (cp == NIL) - removecard(a, b); - else if (cp->visible == FALSE) { - move(b, a); - printw(" ? "); - } else { - bool inverse = (cp->suit == 'd' || cp->suit == 'h'); - - printrank(a, b, cp, inverse); - if (inverse) - standout(); - addch(cp->suit); - if (inverse) - standend(); - } -} - -/* - * procedure to move the top card from one location to the top - * of another location. The pointers always point to the top - * of the piles. - */ -void -transit(source, dest) - struct cardtype **source, **dest; -{ - struct cardtype *temp; - - temp = *source; - *source = (*source)->next; - temp->next = *dest; - *dest = temp; -} - -/* - * Procedure to set the cards on the foundation base when available. - * Note that it is only called on a foundation pile at the beginning of - * the game, so the pile will have exactly one card in it. - */ -void -fndbase(cp, column, row) - struct cardtype **cp; -{ - bool nomore; - - if (*cp != NIL) - do { - if ((*cp)->rank == basecard->rank) { - base++; - printcard(pilemap[base], foundrow, *cp); - if (*cp == tableau[0]) - length[0] = length[0] - 1; - if (*cp == tableau[1]) - length[1] = length[1] - 1; - if (*cp == tableau[2]) - length[2] = length[2] - 1; - if (*cp == tableau[3]) - length[3] = length[3] - 1; - transit(cp, &found[base]); - if (cp == &talon) - usedtalon(); - if (cp == &stock) - usedstock(); - if (*cp != NIL) { - printcard(column, row, *cp); - nomore = FALSE; - } else { - removecard(column, row); - nomore = TRUE; - } - cardsoff++; - if (infullgame) { - this.wins += valuepercardup; - game.wins += valuepercardup; - total.wins += valuepercardup; - } - } else - nomore = TRUE; - } while (nomore == FALSE); -} - -/* - * procedure to initialize the things necessary for the game - */ -void -initgame() -{ - int i; - - for (i=0; i<18; i++) { - deck[i]->visible = TRUE; - deck[i]->paid = TRUE; - } - stockcnt = 13; - stock = deck[12]; - for (i=12; i>=1; i--) - deck[i]->next = deck[i - 1]; - deck[0]->next = NIL; - found[0] = deck[13]; - deck[13]->next = NIL; - for (i=1; i<4; i++) - found[i] = NIL; - basecard = found[0]; - for (i=14; i<18; i++) { - tableau[i - 14] = deck[i]; - deck[i]->next = NIL; - } - for (i=0; i<4; i++) { - bottom[i] = tableau[i]; - length[i] = tabrow; - } - hand = deck[18]; - for (i=18; inext = deck[i + 1]; - deck[decksize-1]->next = NIL; - talon = NIL; - base = 0; - cinhand = 34; - taloncnt = 0; - timesthru = 0; - cardsoff = 1; - coldrow = ctoprow; - coldcol = cinitcol; - cnewrow = ctoprow; - cnewcol = cinitcol + cwidthcol; -} - -/* - * procedure to print the beginning cards and to start each game - */ -void -startgame() -{ - int j; - - shuffle(deck); - initgame(); - this.hand = costofhand; - game.hand += costofhand; - total.hand += costofhand; - this.inspection = 0; - this.game = 0; - this.runs = 0; - this.information = 0; - this.wins = 0; - this.thinktime = 0; - infullgame = FALSE; - startedgame = FALSE; - printcard(foundcol, foundrow, found[0]); - printcard(stockcol, stockrow, stock); - printcard(atabcol, tabrow, tableau[0]); - printcard(btabcol, tabrow, tableau[1]); - printcard(ctabcol, tabrow, tableau[2]); - printcard(dtabcol, tabrow, tableau[3]); - printcard(taloncol, talonrow, talon); - move(foundrow - 2, basecol); - printw("Base"); - move(foundrow - 1, basecol); - printw("Rank"); - printrank(basecol, foundrow, found[0], 0); - for (j=0; j<=3; j++) - fndbase(&tableau[j], pilemap[j], tabrow); - fndbase(&stock, stockcol, stockrow); - showstat(); /* show card counting info to cheaters */ - movetotalon(); - updatebettinginfo(); -} - -/* - * procedure to clear the message printed from an error - */ -void -clearmsg() -{ - int i; - - if (errmsg == TRUE) { - errmsg = FALSE; - move(msgrow, msgcol); - for (i=0; i<25; i++) - addch(' '); - refresh(); - } -} - -/* - * procedure to print an error message if the move is not listed - */ -void -dumberror() -{ - errmsg = TRUE; - move(msgrow, msgcol); - printw("Not a proper move "); -} - -/* - * procedure to print an error message if the move is not possible - */ -void -destinerror() -{ - errmsg = TRUE; - move(msgrow, msgcol); - printw("Error: Can't move there"); -} - -/* - * function to see if the source has cards in it - */ -bool -notempty(cp) -struct cardtype *cp; -{ - if (cp == NIL) { - errmsg = TRUE; - move(msgrow, msgcol); - printw("Error: no cards to move"); - return (FALSE); - } else - return (TRUE); -} - -/* - * function to see if the rank of one card is less than another - */ -bool -ranklower(cp1, cp2) - struct cardtype *cp1, *cp2; -{ - if (cp2->rank == Ace) - if (cp1->rank == King) - return (TRUE); - else - return (FALSE); - else if (cp1->rank + 1 == cp2->rank) - return (TRUE); - else - return (FALSE); -} - -/* - * function to check the cardcolor for moving to a tableau - */ -bool -diffcolor(cp1, cp2) - struct cardtype *cp1, *cp2; -{ - if (cp1->color == cp2->color) - return (FALSE); - else - return (TRUE); -} - -/* - * function to see if the card can move to the tableau - */ -bool -tabok(cp, des) - struct cardtype *cp; -{ - if ((cp == stock) && (tableau[des] == NIL)) - return (TRUE); - else if (tableau[des] == NIL) - if (stock == NIL && - cp != bottom[0] && cp != bottom[1] && - cp != bottom[2] && cp != bottom[3]) - return (TRUE); - else - return (FALSE); - else if (ranklower(cp, tableau[des]) && diffcolor(cp, tableau[des])) - return (TRUE); - else - return (FALSE); -} - -/* - * procedure to turn the cards onto the talon from the deck - */ -void -movetotalon() -{ - int i, fin; - - if (cinhand <= 3 && cinhand > 0) { - move(msgrow, msgcol); - printw("Hand is now empty "); - } - if (cinhand >= 3) - fin = 3; - else if (cinhand > 0) - fin = cinhand; - else if (talon != NIL) { - timesthru++; - errmsg = TRUE; - move(msgrow, msgcol); - if (timesthru != 4) { - printw("Talon is now the new hand"); - this.runs += costofrunthroughhand; - game.runs += costofrunthroughhand; - total.runs += costofrunthroughhand; - while (talon != NIL) { - transit(&talon, &hand); - cinhand++; - } - if (cinhand >= 3) - fin = 3; - else - fin = cinhand; - taloncnt = 0; - coldrow = ctoprow; - coldcol = cinitcol; - cnewrow = ctoprow; - cnewcol = cinitcol + cwidthcol; - clearstat(); - showstat(); - } else { - fin = 0; - done = TRUE; - printw("I believe you have lost"); - refresh(); - sleep(5); - } - } else { - errmsg = TRUE; - move(msgrow, msgcol); - printw("Talon and hand are empty"); - fin = 0; - } - for (i=0; ivisible = TRUE; - if (Cflag) { - if (talon->paid == FALSE && talon->visible == TRUE) { - this.information += costofinformation; - game.information += costofinformation; - total.information += costofinformation; - talon->paid = TRUE; - } - printcard(coldcol, coldrow, talon); - } - } - if (fin != 0) { - printcard(taloncol, talonrow, talon); - cinhand -= fin; - taloncnt += fin; - if (Cflag) { - move(handstatrow, handstatcol); - printw("%3d", cinhand); - move(talonstatrow, talonstatcol); - printw("%3d", taloncnt); - } - fndbase(&talon, taloncol, talonrow); - } -} - - -/* - * procedure to print card counting info on screen - */ -void -showstat() -{ - int row, col; - struct cardtype *ptr; - - if (!Cflag) - return; - move(talonstatrow, talonstatcol - 7); - printw("Talon: %3d", taloncnt); - move(handstatrow, handstatcol - 7); - printw("Hand: %3d", cinhand); - move(stockstatrow, stockstatcol - 7); - printw("Stock: %3d", stockcnt); - for ( row = coldrow, col = coldcol, ptr = talon; - ptr != NIL; - ptr = ptr->next ) { - if (ptr->paid == FALSE && ptr->visible == TRUE) { - ptr->paid = TRUE; - this.information += costofinformation; - game.information += costofinformation; - total.information += costofinformation; - } - printcard(col, row, ptr); - DECRHAND(row, col); - } - for ( row = cnewrow, col = cnewcol, ptr = hand; - ptr != NIL; - ptr = ptr->next ) { - if (ptr->paid == FALSE && ptr->visible == TRUE) { - ptr->paid = TRUE; - this.information += costofinformation; - game.information += costofinformation; - total.information += costofinformation; - } - INCRHAND(row, col); - printcard(col, row, ptr); - } -} - -/* - * procedure to clear card counting info from screen - */ -void -clearstat() -{ - int row; - - move(talonstatrow, talonstatcol - 7); - printw(" "); - move(handstatrow, handstatcol - 7); - printw(" "); - move(stockstatrow, stockstatcol - 7); - printw(" "); - for ( row = ctoprow ; row <= cbotrow ; row++ ) { - move(row, cinitcol); - printw("%56s", " "); - } -} - -/* - * procedure to update card counting base - */ -void -usedtalon() -{ - removecard(coldcol, coldrow); - DECRHAND(coldrow, coldcol); - if (talon != NIL && (talon->visible == FALSE)) { - talon->visible = TRUE; - if (Cflag) { - this.information += costofinformation; - game.information += costofinformation; - total.information += costofinformation; - talon->paid = TRUE; - printcard(coldcol, coldrow, talon); - } - } - taloncnt--; - if (Cflag) { - move(talonstatrow, talonstatcol); - printw("%3d", taloncnt); - } -} - -/* - * procedure to update stock card counting base - */ -void -usedstock() -{ - stockcnt--; - if (Cflag) { - move(stockstatrow, stockstatcol); - printw("%3d", stockcnt); - } -} - -/* - * let 'em know how they lost! - */ -void -showcards() -{ - struct cardtype *ptr; - int row; - - if (!Cflag || cardsoff == 52) - return; - for (ptr = talon; ptr != NIL; ptr = ptr->next) { - ptr->visible = TRUE; - ptr->paid = TRUE; - } - for (ptr = hand; ptr != NIL; ptr = ptr->next) { - ptr->visible = TRUE; - ptr->paid = TRUE; - } - showstat(); - move(stockrow + 1, sidecol); - printw(" "); - move(talonrow - 2, sidecol); - printw(" "); - move(talonrow - 1, sidecol); - printw(" "); - move(talonrow, sidecol); - printw(" "); - move(talonrow + 1, sidecol); - printw(" "); - for (ptr = stock, row = stockrow; ptr != NIL; ptr = ptr->next, row++) { - move(row, stockcol - 1); - printw("| |"); - printcard(stockcol, row, ptr); - } - if (stock == NIL) { - move(row, stockcol - 1); - printw("| |"); - row++; - } - move(handstatrow, handstatcol - 7); - printw(" "); - move(row, stockcol - 1); - printw("=---="); - if ( cardsoff == 52 ) - getcmd(moverow, movecol, "Hit return to exit"); -} - -/* - * procedure to update the betting values - */ -void -updatebettinginfo() -{ - long thiscosts, gamecosts, totalcosts; - double thisreturn, gamereturn, totalreturn; - time_t now; - long dollars; - - time(&now); - dollars = (now - acctstart) / secondsperdollar; - if (dollars > 0) { - acctstart += dollars * secondsperdollar; - if (dollars > maxtimecharge) - dollars = maxtimecharge; - this.thinktime += dollars; - game.thinktime += dollars; - total.thinktime += dollars; - } - thiscosts = this.hand + this.inspection + this.game + - this.runs + this.information + this.thinktime; - gamecosts = game.hand + game.inspection + game.game + - game.runs + game.information + game.thinktime; - totalcosts = total.hand + total.inspection + total.game + - total.runs + total.information + total.thinktime; - this.worth = this.wins - thiscosts; - game.worth = game.wins - gamecosts; - total.worth = total.wins - totalcosts; - thisreturn = ((double)this.wins / (double)thiscosts - 1.0) * 100.0; - gamereturn = ((double)game.wins / (double)gamecosts - 1.0) * 100.0; - totalreturn = ((double)total.wins / (double)totalcosts - 1.0) * 100.0; - if (status != BETTINGBOX) - return; - move(tboxrow + 2, boxcol + 13); - printw("%4d%8d%9d", this.hand, game.hand, total.hand); - move(tboxrow + 3, boxcol + 13); - printw("%4d%8d%9d", this.inspection, game.inspection, total.inspection); - move(tboxrow + 4, boxcol + 13); - printw("%4d%8d%9d", this.game, game.game, total.game); - move(tboxrow + 5, boxcol + 13); - printw("%4d%8d%9d", this.runs, game.runs, total.runs); - move(tboxrow + 6, boxcol + 13); - printw("%4d%8d%9d", this.information, game.information, - total.information); - move(tboxrow + 7, boxcol + 13); - printw("%4d%8d%9d", this.thinktime, game.thinktime, total.thinktime); - move(tboxrow + 8, boxcol + 13); - printw("%4d%8d%9d", thiscosts, gamecosts, totalcosts); - move(tboxrow + 9, boxcol + 13); - printw("%4d%8d%9d", this.wins, game.wins, total.wins); - move(tboxrow + 10, boxcol + 13); - printw("%4d%8d%9d", this.worth, game.worth, total.worth); - move(tboxrow + 11, boxcol + 13); - printw("%4.0f%%%7.1f%%%8.1f%%", thisreturn, gamereturn, totalreturn); -} - -/* - * procedure to move a card from the stock or talon to the tableau - */ -void -simpletableau(cp, des) -struct cardtype **cp; -{ - int origin; - - if (notempty(*cp)) { - if (tabok(*cp, des)) { - if (*cp == stock) - origin = stk; - else - origin = tal; - if (tableau[des] == NIL) - bottom[des] = *cp; - transit(cp, &tableau[des]); - length[des]++; - printcard(pilemap[des], length[des], tableau[des]); - timesthru = 0; - if (origin == stk) { - usedstock(); - printcard(stockcol, stockrow, stock); - } else { - usedtalon(); - printcard(taloncol, talonrow, talon); - } - } else - destinerror(); - } -} - -/* - * print the tableau - */ -void -tabprint(sour, des) -{ - int dlength, slength, i; - struct cardtype *tempcard; - - for (i=tabrow; i<=length[sour]; i++) - removecard(pilemap[sour], i); - dlength = length[des] + 1; - slength = length[sour]; - if (slength == tabrow) - printcard(pilemap[des], dlength, tableau[sour]); - else - while (slength != tabrow - 1) { - tempcard = tableau[sour]; - for (i=1; i<=slength-tabrow; i++) - tempcard = tempcard->next; - printcard(pilemap[des], dlength, tempcard); - slength--; - dlength++; - } -} - -/* - * procedure to move from the tableau to the tableau - */ -void -tabtotab(sour, des) - int sour, des; -{ - struct cardtype *temp; - - if (notempty(tableau[sour])) { - if (tabok(bottom[sour], des)) { - tabprint(sour, des); - temp = bottom[sour]; - bottom[sour] = NIL; - if (bottom[des] == NIL) - bottom[des] = temp; - temp->next = tableau[des]; - tableau[des] = tableau[sour]; - tableau[sour] = NIL; - length[des] = length[des] + (length[sour] - (tabrow - 1)); - length[sour] = tabrow - 1; - timesthru = 0; - } else - destinerror(); - } -} - -/* - * functions to see if the card can go onto the foundation - */ -bool -rankhigher(cp, let) - struct cardtype *cp; -{ - if (found[let]->rank == King) - if (cp->rank == Ace) - return(TRUE); - else - return(FALSE); - else if (cp->rank - 1 == found[let]->rank) - return(TRUE); - else - return(FALSE); -} - -/* - * function to determine if two cards are the same suit - */ -bool -samesuit(cp, let) - struct cardtype *cp; -{ - if (cp->suit == found[let]->suit) - return (TRUE); - else - return (FALSE); -} - -/* - * procedure to move a card to the correct foundation pile - */ -void -movetofound(cp, source) - struct cardtype **cp; -{ - tempbase = 0; - mtfdone = FALSE; - if (notempty(*cp)) { - do { - if (found[tempbase] != NIL) - if (rankhigher(*cp, tempbase) - && samesuit(*cp, tempbase)) { - if (*cp == stock) - mtforigin = stk; - else if (*cp == talon) - mtforigin = tal; - else - mtforigin = tab; - transit(cp, &found[tempbase]); - printcard(pilemap[tempbase], - foundrow, found[tempbase]); - timesthru = 0; - if (mtforigin == stk) { - usedstock(); - printcard(stockcol, stockrow, stock); - } else if (mtforigin == tal) { - usedtalon(); - printcard(taloncol, talonrow, talon); - } else { - removecard(pilemap[source], length[source]); - length[source]--; - } - cardsoff++; - if (infullgame) { - this.wins += valuepercardup; - game.wins += valuepercardup; - total.wins += valuepercardup; - } - mtfdone = TRUE; - } else - tempbase++; - else - tempbase++; - } while ((tempbase != 4) && !mtfdone); - if (!mtfdone) - destinerror(); - } -} - -/* - * procedure to get a command - */ -void -getcmd(row, col, cp) - int row, col; - char *cp; -{ - char cmd[2], ch; - int i; - - i = 0; - move(row, col); - printw("%-24s", cp); - col += 1 + strlen(cp); - move(row, col); - refresh(); - do { - ch = getch() & 0177; - if (ch >= 'A' && ch <= 'Z') - ch += ('a' - 'A'); - if (ch == '\f') { - wrefresh(curscr); - refresh(); - } else if (i >= 2 && ch != erasechar() && ch != killchar()) { - if (ch != '\n' && ch != '\r' && ch != ' ') - write(1, "\007", 1); - } else if (ch == erasechar() && i > 0) { - printw("\b \b"); - refresh(); - i--; - } else if (ch == killchar() && i > 0) { - while (i > 0) { - printw("\b \b"); - i--; - } - refresh(); - } else if (ch == '\032') { /* Control-Z */ - suspend(); - move(row, col + i); - refresh(); - } else if (isprint(ch)) { - cmd[i++] = ch; - addch(ch); - refresh(); - } - } while (ch != '\n' && ch != '\r' && ch != ' '); - srcpile = cmd[0]; - destpile = cmd[1]; -} - -/* - * Suspend the game (shell escape if no process control on system) - */ -void -suspend() -{ -#ifndef SIGTSTP - char *sh; -#endif - - updatebettinginfo(); - move(21, 0); - refresh(); - if (dbfd != -1) { - lseek(dbfd, uid * sizeof(struct betinfo), SEEK_SET); - write(dbfd, (char *)&total, sizeof(total)); - } - kill(getpid(), SIGTSTP); - raw(); - noecho(); -} - -/* - * procedure to evaluate and make the specific moves - */ -void -movecard() -{ - int source, dest; - char osrcpile, odestpile; - - source = 0; - dest = 0; - done = FALSE; - errmsg = FALSE; - do { - if (talon == NIL && hand != NIL) - movetotalon(); - if (cardsoff == 52) { - refresh(); - srcpile = 'q'; - } else if (!startedgame) { - move(msgrow, msgcol); - errmsg = TRUE; - switch (34 - taloncnt - cinhand) { - default: - errmsg = FALSE; - break; - case 1: - printw("One card used from talon "); - break; - case 2: - printw("Two cards used from talon "); - break; - case 3: - printw(">3< cards used from talon "); - break; - } - getcmd(moverow, movecol, "Move:"); - } else - getcmd(moverow, movecol, "Move:"); - clearmsg(); - if (srcpile >= '1' && srcpile <= '4') - source = (int) (srcpile - '1'); - if (destpile >= '1' && destpile <= '4') - dest = (int) (destpile - '1'); - if (!startedgame && - (srcpile == 't' || srcpile == 's' || srcpile == 'h' || - srcpile == '1' || srcpile == '2' || srcpile == '3' || - srcpile == '4')) { - startedgame = TRUE; - osrcpile = srcpile; - odestpile = destpile; - if (status != BETTINGBOX) - srcpile = 'y'; - else do { - getcmd(moverow, movecol, "Inspect game?"); - } while (srcpile != 'y' && srcpile != 'n'); - if (srcpile == 'n') { - srcpile = 'q'; - } else { - this.inspection += costofinspection; - game.inspection += costofinspection; - total.inspection += costofinspection; - srcpile = osrcpile; - destpile = odestpile; - } - } - switch (srcpile) { - case 't': - if (destpile == 'f' || destpile == 'F') - movetofound(&talon, source); - else if (destpile >= '1' && destpile <= '4') - simpletableau(&talon, dest); - else - dumberror(); - break; - case 's': - if (destpile == 'f' || destpile == 'F') - movetofound(&stock, source); - else if (destpile >= '1' && destpile <= '4') - simpletableau(&stock, dest); - else dumberror(); - break; - case 'h': - if (destpile != 't' && destpile != 'T') { - dumberror(); - break; - } - if (infullgame) { - movetotalon(); - break; - } - if (status == BETTINGBOX) { - do { - getcmd(moverow, movecol, - "Buy game?"); - } while (srcpile != 'y' && - srcpile != 'n'); - if (srcpile == 'n') { - showcards(); - done = TRUE; - break; - } - } - infullgame = TRUE; - this.wins += valuepercardup * cardsoff; - game.wins += valuepercardup * cardsoff; - total.wins += valuepercardup * cardsoff; - this.game += costofgame; - game.game += costofgame; - total.game += costofgame; - movetotalon(); - break; - case 'q': - showcards(); - done = TRUE; - break; - case 'b': - printtopbettingbox(); - printbottombettingbox(); - status = BETTINGBOX; - break; - case 'x': - clearabovemovebox(); - clearbelowmovebox(); - status = NOBOX; - break; - case 'i': - printtopinstructions(); - printbottominstructions(); - status = INSTRUCTIONBOX; - break; - case 'c': - Cflag = !Cflag; - if (Cflag) - showstat(); - else - clearstat(); - break; - case '1': case '2': case '3': case '4': - if (destpile == 'f' || destpile == 'F') - movetofound(&tableau[source], source); - else if (destpile >= '1' && destpile <= '4') - tabtotab(source, dest); - else dumberror(); - break; - default: - dumberror(); - } - fndbase(&stock, stockcol, stockrow); - fndbase(&talon, taloncol, talonrow); - updatebettinginfo(); - } while (!done); -} - -char *basicinstructions[] = { - "Here are brief instuctions to the game of Canfield:\n\n", - " If you have never played solitaire before, it is recom-\n", - "mended that you consult a solitaire instruction book. In\n", - "Canfield, tableau cards may be built on each other downward\n", - "in alternate colors. An entire pile must be moved as a unit\n", - "in building. Top cards of the piles are available to be able\n", - "to be played on foundations, but never into empty spaces.\n\n", - " Spaces must be filled from the stock. The top card of\n", - "the stock also is available to be played on foundations or\n", - "built on tableau piles. After the stock is exhausted, ta-\n", - "bleau spaces may be filled from the talon and the player may\n", - "keep them open until he wishes to use them.\n\n", - " Cards are dealt from the hand to the talon by threes\n", - "and this repeats until there are no more cards in the hand\n", - "or the player quits. To have cards dealt onto the talon the\n", - "player types 'ht' for his move. Foundation base cards are\n", - "also automatically moved to the foundation when they become\n", - "available.\n\n", - "push any key when you are finished: ", - 0 }; - -char *bettinginstructions[] = { - " The rules for betting are somewhat less strict than\n", - "those used in the official version of the game. The initial\n", - "deal costs $13. You may quit at this point or inspect the\n", - "game. Inspection costs $13 and allows you to make as many\n", - "moves as is possible without moving any cards from your hand\n", - "to the talon. (the initial deal places three cards on the\n", - "talon; if all these cards are used, three more are made\n", - "available) Finally, if the game seems interesting, you must\n", - "pay the final installment of $26. At this point you are\n", - "credited at the rate of $5 for each card on the foundation;\n", - "as the game progresses you are credited with $5 for each\n", - "card that is moved to the foundation. Each run through the\n", - "hand after the first costs $5. The card counting feature\n", - "costs $1 for each unknown card that is identified. If the\n", - "information is toggled on, you are only charged for cards\n", - "that became visible since it was last turned on. Thus the\n", - "maximum cost of information is $34. Playing time is charged\n", - "at a rate of $1 per minute.\n\n", - "push any key when you are finished: ", - 0 }; - -/* - * procedure to printout instructions - */ -void -instruct() -{ - char **cp; - - move(originrow, origincol); - printw("This is the game of solitaire called Canfield. Do\n"); - printw("you want instructions for the game?"); - do { - getcmd(originrow + 3, origincol, "y or n?"); - } while (srcpile != 'y' && srcpile != 'n'); - if (srcpile == 'n') - return; - clear(); - for (cp = basicinstructions; *cp != 0; cp++) - printw(*cp); - refresh(); - getch(); - clear(); - move(originrow, origincol); - printw("Do you want instructions for betting?"); - do { - getcmd(originrow + 2, origincol, "y or n?"); - } while (srcpile != 'y' && srcpile != 'n'); - if (srcpile == 'n') - return; - clear(); - for (cp = bettinginstructions; *cp != 0; cp++) - printw(*cp); - refresh(); - getch(); -} - -/* - * procedure to initialize the game - */ -void -initall() -{ - int i; - - if (dbfd < 0) - return; - srandomdev(); - time(&acctstart); - initdeck(deck); - uid = getuid(); - - i = lseek(dbfd, uid * sizeof(struct betinfo), SEEK_SET); - if (i < 0) { - close(dbfd); - dbfd = -1; - return; - } - i = read(dbfd, (char *)&total, sizeof(total)); - if (i < 0) { - close(dbfd); - dbfd = -1; - return; - } -} - -/* - * procedure to end the game - */ -bool -finish() -{ - int row, col; - - if (cardsoff == 52) { - getcmd(moverow, movecol, "Hit return to exit"); - clear(); - refresh(); - move(originrow, origincol); - printw("CONGRATULATIONS!\n"); - printw("You won the game. That is a feat to be proud of.\n"); - row = originrow + 5; - col = origincol; - } else { - move(msgrow, msgcol); - printw("You got %d card", cardsoff); - if (cardsoff > 1) - printw("s"); - printw(" off "); - move(msgrow, msgcol); - row = moverow; - col = movecol; - } - do { - getcmd(row, col, "Play again (y or n)?"); - } while (srcpile != 'y' && srcpile != 'n'); - errmsg = TRUE; - clearmsg(); - if (srcpile == 'y') - return (FALSE); - else - return (TRUE); -} - -/* - * procedure to clean up and exit - */ -void -cleanup(sig) - int sig; -{ - - total.thinktime += 1; - status = NOBOX; - updatebettinginfo(); - if (dbfd != -1) { - lseek(dbfd, uid * sizeof(struct betinfo), SEEK_SET); - write(dbfd, (char *)&total, sizeof(total)); - close(dbfd); - } - clear(); - move(22,0); - refresh(); - endwin(); - exit(0); - /* NOTREACHED */ -} - -/* - * Field an interrupt. - */ -void -askquit(sig) - int sig; -{ - move(msgrow, msgcol); - printw("Really wish to quit? "); - do { - getcmd(moverow, movecol, "y or n?"); - } while (srcpile != 'y' && srcpile != 'n'); - clearmsg(); - if (srcpile == 'y') - cleanup(0); - signal(SIGINT, askquit); -} - -/* - * Can you tell that this used to be a Pascal program? - */ -int -main() -{ - dbfd = open(_PATH_SCORE, O_RDWR); - - /* revoke */ - setgid(getgid()); - -#ifdef MAXLOAD - double vec[3]; - - loadav(vec); - if (vec[2] >= MAXLOAD) { - puts("The system load is too high. Try again later."); - exit(0); - } -#endif - signal(SIGINT, askquit); - signal(SIGHUP, cleanup); - signal(SIGTERM, cleanup); - initscr(); - raw(); - noecho(); - initall(); - - instruct(); - makeboard(); - for (;;) { - startgame(); - movecard(); - if (finish()) - break; - if (cardsoff == 52) - makeboard(); - else - cleanupboard(); - } - cleanup(0); - /* NOTREACHED */ - exit (EXIT_FAILURE); -} diff --git a/games/canfield/canfield/pathnames.h b/games/canfield/canfield/pathnames.h deleted file mode 100644 index e187698c80ef..000000000000 --- a/games/canfield/canfield/pathnames.h +++ /dev/null @@ -1,37 +0,0 @@ -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)pathnames.h 8.1 (Berkeley) 5/31/93 - */ - -#define _PATH_SCORE "/var/games/cfscores" - diff --git a/games/canfield/cfscores/Makefile b/games/canfield/cfscores/Makefile deleted file mode 100644 index 565b6c3cafbe..000000000000 --- a/games/canfield/cfscores/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -# @(#)Makefile 8.1 (Berkeley) 5/31/93 - -PROG= cfscores -CFLAGS+=-I${.CURDIR}/../canfield -NOMAN= noman - -.include "../../Makefile.inc" -.include diff --git a/games/canfield/cfscores/cfscores.c b/games/canfield/cfscores/cfscores.c deleted file mode 100644 index c13b90525799..000000000000 --- a/games/canfield/cfscores/cfscores.c +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Copyright (c) 1983, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -static const char copyright[] = -"@(#) Copyright (c) 1983, 1993\n\ - The Regents of the University of California. All rights reserved.\n"; -#endif /* not lint */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)cfscores.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include -#include -#include -#include -#include -#include "pathnames.h" - -struct betinfo { - long hand; /* cost of dealing hand */ - long inspection; /* cost of inspecting hand */ - long game; /* cost of buying game */ - long runs; /* cost of running through hands */ - long information; /* cost of information */ - long thinktime; /* cost of thinking time */ - long wins; /* total winnings */ - long worth; /* net worth after costs */ -}; - -int dbfd; - -void printuser(struct passwd *, int); - -int -main(argc, argv) - int argc; - char *argv[]; -{ - struct passwd *pw; - int uid; - - if (argc > 2) { - printf("usage: cfscores [user]\n"); - exit(1); - } - dbfd = open(_PATH_SCORE, O_RDONLY); - if (dbfd < 0) { - perror(_PATH_SCORE); - exit(2); - } - - setpwent(); - if (argc == 1) { - uid = getuid(); - pw = getpwuid(uid); - if (pw == 0) { - printf("You are not listed in the password file?!?\n"); - exit(2); - } - printuser(pw, 1); - exit(0); - } - if (strcmp(argv[1], "-a") == 0) { - while ((pw = getpwent()) != 0) - printuser(pw, 0); - exit(0); - } - pw = getpwnam(argv[1]); - if (pw == 0) { - printf("User %s unknown\n", argv[1]); - exit(3); - } - printuser(pw, 1); - exit(0); -} - -/* - * print out info for specified password entry - */ -void -printuser(pw, printfail) - struct passwd *pw; - int printfail; -{ - struct betinfo total; - int i; - - if (pw->pw_uid < 0) { - printf("Bad uid %d\n", pw->pw_uid); - return; - } - i = lseek(dbfd, pw->pw_uid * sizeof(struct betinfo), SEEK_SET); - if (i < 0) { - perror("lseek"); - return; - } - i = read(dbfd, (char *)&total, sizeof(total)); - if (i < 0) { - perror("read"); - return; - } - if (i == 0 || total.hand == 0) { - if (printfail) - printf("%s has never played canfield.\n", pw->pw_name); - return; - } - printf("*----------------------*\n"); - if (total.worth >= 0) - printf("* Winnings for %-8s*\n", pw->pw_name); - else - printf("* Losses for %-10s*\n", pw->pw_name); - printf("*======================*\n"); - printf("|Costs Total |\n"); - printf("| Hands %8ld |\n", total.hand); - printf("| Inspections %8ld |\n", total.inspection); - printf("| Games %8ld |\n", total.game); - printf("| Runs %8ld |\n", total.runs); - printf("| Information %8ld |\n", total.information); - printf("| Think time %8ld |\n", total.thinktime); - printf("|Total Costs %8ld |\n", total.wins - total.worth); - printf("|Winnings %8ld |\n", total.wins); - printf("|Net Worth %8ld |\n", total.worth); - printf("*----------------------*\n\n"); -} diff --git a/games/cribbage/Makefile b/games/cribbage/Makefile deleted file mode 100644 index 5faeccd25458..000000000000 --- a/games/cribbage/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -# @(#)Makefile 8.1 (Berkeley) 5/31/93 -# $FreeBSD$ - -PROG= cribbage -DPADD= ${LIBCURSES} ${LIBCOMPAT} -LDADD= -lcurses -lcompat -SRCS= extern.c crib.c cards.c instr.c io.c score.c support.c -FILES= cribbage.n -FILESNAME_cribbage.n= cribbage.instr -MAN= cribbage.6 -HIDEGAME=hidegame - -beforeinstall: -.if !exists(${DESTDIR}/var/games/criblog) - ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 664 /dev/null \ - ${DESTDIR}/var/games/criblog -.endif - -.include diff --git a/games/cribbage/cards.c b/games/cribbage/cards.c deleted file mode 100644 index ba846aed6398..000000000000 --- a/games/cribbage/cards.c +++ /dev/null @@ -1,151 +0,0 @@ -/*- - * Copyright (c) 1980, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)cards.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include -#include -#include -#include - -#include "deck.h" -#include "cribbage.h" - - -/* - * Initialize a deck of cards to contain one of each type. - */ -void -makedeck(d) - CARD d[]; -{ - int i, j, k; - - srandomdev(); - k = 0; - for (i = 0; i < RANKS; i++) - for (j = 0; j < SUITS; j++) { - d[k].suit = j; - d[k++].rank = i; - } -} - -/* - * Given a deck of cards, shuffle it -- i.e. randomize it - * see Knuth, vol. 2, page 125. - */ -void -shuffle(d) - CARD d[]; -{ - int j, k; - CARD c; - - for (j = CARDS; j > 0; --j) { - k = random() % j; /* random 0 <= k < j */ - c = d[j - 1]; /* exchange (j - 1) and k */ - d[j - 1] = d[k]; - d[k] = c; - } -} - -/* - * return true if the two cards are equal... - */ -int -eq(a, b) - CARD a, b; -{ - return ((a.rank == b.rank) && (a.suit == b.suit)); -} - -/* - * isone returns TRUE if a is in the set of cards b - */ -int -isone(a, b, n) - CARD a, b[]; - int n; -{ - int i; - - for (i = 0; i < n; i++) - if (eq(a, b[i])) - return (TRUE); - return (FALSE); -} - -/* - * remove the card a from the deck d of n cards - */ -void -cremove(a, d, n) - CARD a, d[]; - int n; -{ - int i, j; - - for (i = j = 0; i < n; i++) - if (!eq(a, d[i])) - d[j++] = d[i]; - if (j < n) - d[j].suit = d[j].rank = EMPTY; -} - -/* - * sorthand: - * Sort a hand of n cards - */ -void -sorthand(h, n) - CARD h[]; - int n; -{ - CARD *cp, *endp; - CARD c; - - for (endp = &h[n]; h < endp - 1; h++) - for (cp = h + 1; cp < endp; cp++) - if ((cp->rank < h->rank) || - (cp->rank == h->rank && cp->suit < h->suit)) { - c = *h; - *h = *cp; - *cp = c; - } -} diff --git a/games/cribbage/crib.c b/games/cribbage/crib.c deleted file mode 100644 index fc3c3df6ad68..000000000000 --- a/games/cribbage/crib.c +++ /dev/null @@ -1,633 +0,0 @@ -/*- - * Copyright (c) 1980, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -static const char copyright[] = -"@(#) Copyright (c) 1980, 1993\n\ - The Regents of the University of California. All rights reserved.\n"; -#endif /* not lint */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)crib.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include -#include -#include -#include -#include -#include - -#include "deck.h" -#include "cribbage.h" -#include "cribcur.h" -#include "pathnames.h" - -int -main(argc, argv) - int argc; - char *argv[]; -{ - BOOLEAN playing; - FILE *f; - int ch; - - f = fopen(_PATH_LOG, "a"); - - /* revoke */ - setgid(getgid()); - - while ((ch = getopt(argc, argv, "eqr")) != -1) - switch (ch) { - case 'e': - explain = TRUE; - break; - case 'q': - quiet = TRUE; - break; - case 'r': - rflag = TRUE; - break; - case '?': - default: - (void) fprintf(stderr, "usage: cribbage [-eqr]\n"); - exit(1); - } - - initscr(); - (void)signal(SIGINT, rint); - crmode(); - noecho(); - - Playwin = subwin(stdscr, PLAY_Y, PLAY_X, 0, 0); - Tablewin = subwin(stdscr, TABLE_Y, TABLE_X, 0, PLAY_X); - Compwin = subwin(stdscr, COMP_Y, COMP_X, 0, TABLE_X + PLAY_X); - Msgwin = subwin(stdscr, MSG_Y, MSG_X, Y_MSG_START, SCORE_X + 1); - leaveok(Playwin, TRUE); - leaveok(Tablewin, TRUE); - leaveok(Compwin, TRUE); - clearok(stdscr, FALSE); - - if (!quiet) { - msg("Do you need instructions for cribbage? "); - if (getuchar() == 'Y') { - endwin(); - clear(); - mvcur(0, COLS - 1, LINES - 1, 0); - fflush(stdout); - instructions(); - crmode(); - noecho(); - clear(); - refresh(); - msg("For cribbage rules, use \"man cribbage\""); - } - } - playing = TRUE; - do { - wclrtobot(Msgwin); - msg(quiet ? "L or S? " : "Long (to 121) or Short (to 61)? "); - if (glimit == SGAME) - glimit = (getuchar() == 'L' ? LGAME : SGAME); - else - glimit = (getuchar() == 'S' ? SGAME : LGAME); - game(); - msg("Another game? "); - playing = (getuchar() == 'Y'); - } while (playing); - - if (f != NULL) { - (void)fprintf(f, "%s: won %5.5d, lost %5.5d\n", - getlogin(), cgames, pgames); - (void) fclose(f); - } - bye(); - if (!f) { - (void) fprintf(stderr, "\ncribbage: can't open %s.\n", - _PATH_LOG); - exit(1); - } - exit(0); -} - -/* - * makeboard: - * Print out the initial board on the screen - */ -void -makeboard() -{ - mvaddstr(SCORE_Y + 0, SCORE_X, - "+---------------------------------------+"); - mvaddstr(SCORE_Y + 1, SCORE_X, - "| Score: 0 YOU |"); - mvaddstr(SCORE_Y + 2, SCORE_X, - "| *.....:.....:.....:.....:.....:..... |"); - mvaddstr(SCORE_Y + 3, SCORE_X, - "| *.....:.....:.....:.....:.....:..... |"); - mvaddstr(SCORE_Y + 4, SCORE_X, - "| |"); - mvaddstr(SCORE_Y + 5, SCORE_X, - "| *.....:.....:.....:.....:.....:..... |"); - mvaddstr(SCORE_Y + 6, SCORE_X, - "| *.....:.....:.....:.....:.....:..... |"); - mvaddstr(SCORE_Y + 7, SCORE_X, - "| Score: 0 ME |"); - mvaddstr(SCORE_Y + 8, SCORE_X, - "+---------------------------------------+"); - gamescore(); -} - -/* - * gamescore: - * Print out the current game score - */ -void -gamescore() -{ - - if (pgames || cgames) { - mvprintw(SCORE_Y + 1, SCORE_X + 28, "Games: %3d", pgames); - mvprintw(SCORE_Y + 7, SCORE_X + 28, "Games: %3d", cgames); - } - Lastscore[0] = -1; - Lastscore[1] = -1; -} - -/* - * game: - * Play one game up to glimit points. Actually, we only ASK the - * player what card to turn. We do a random one, anyway. - */ -void -game() -{ - int i, j; - BOOLEAN flag; - BOOLEAN compcrib; - - compcrib = FALSE; - makedeck(deck); - shuffle(deck); - if (gamecount == 0) { - flag = TRUE; - do { - if (!rflag) { /* player cuts deck */ - msg(quiet ? "Cut for crib? " : - "Cut to see whose crib it is -- low card wins? "); - getline(); - } - i = random() % CARDS; /* random cut */ - do { /* comp cuts deck */ - j = random() % CARDS; - } while (j == i); - addmsg(quiet ? "You cut " : "You cut the "); - msgcard(deck[i], FALSE); - endmsg(); - addmsg(quiet ? "I cut " : "I cut the "); - msgcard(deck[j], FALSE); - endmsg(); - flag = (deck[i].rank == deck[j].rank); - if (flag) { - msg(quiet ? "We tied..." : - "We tied and have to try again..."); - shuffle(deck); - continue; - } else - compcrib = (deck[i].rank > deck[j].rank); - } while (flag); - clear(); - makeboard(); - refresh(); - } else { - werase(Tablewin); - wrefresh(Tablewin); - werase(Compwin); - wrefresh(Compwin); - msg("Loser (%s) gets first crib", (iwon ? "you" : "me")); - compcrib = !iwon; - } - - pscore = cscore = 0; - flag = TRUE; - do { - shuffle(deck); - flag = !playhand(compcrib); - compcrib = !compcrib; - } while (flag); - ++gamecount; - if (cscore < pscore) { - if (glimit - cscore > 60) { - msg("YOU DOUBLE SKUNKED ME!"); - pgames += 4; - } else - if (glimit - cscore > 30) { - msg("YOU SKUNKED ME!"); - pgames += 2; - } else { - msg("YOU WON!"); - ++pgames; - } - iwon = FALSE; - } else { - if (glimit - pscore > 60) { - msg("I DOUBLE SKUNKED YOU!"); - cgames += 4; - } else - if (glimit - pscore > 30) { - msg("I SKUNKED YOU!"); - cgames += 2; - } else { - msg("I WON!"); - ++cgames; - } - iwon = TRUE; - } - gamescore(); -} - -/* - * playhand: - * Do up one hand of the game - */ -int -playhand(mycrib) - BOOLEAN mycrib; -{ - int deckpos; - - werase(Compwin); - - knownum = 0; - deckpos = deal(mycrib); - sorthand(chand, FULLHAND); - sorthand(phand, FULLHAND); - makeknown(chand, FULLHAND); - prhand(phand, FULLHAND, Playwin, FALSE); - discard(mycrib); - if (cut(mycrib, deckpos)) - return TRUE; - if (peg(mycrib)) - return TRUE; - werase(Tablewin); - wrefresh(Tablewin); - if (score(mycrib)) - return TRUE; - return FALSE; -} - -/* - * deal cards to both players from deck - */ -int -deal(mycrib) - BOOLEAN mycrib; -{ - int i, j; - - for (i = j = 0; i < FULLHAND; i++) { - if (mycrib) { - phand[i] = deck[j++]; - chand[i] = deck[j++]; - } else { - chand[i] = deck[j++]; - phand[i] = deck[j++]; - } - } - return (j); -} - -/* - * discard: - * Handle players discarding into the crib... - * Note: we call cdiscard() after prining first message so player doesn't wait - */ -void -discard(mycrib) - BOOLEAN mycrib; -{ - char *prompt; - CARD crd; - - prcrib(mycrib, TRUE); - prompt = (quiet ? "Discard --> " : "Discard a card --> "); - cdiscard(mycrib); /* puts best discard at end */ - crd = phand[infrom(phand, FULLHAND, prompt)]; - cremove(crd, phand, FULLHAND); - prhand(phand, FULLHAND, Playwin, FALSE); - crib[0] = crd; - - /* Next four lines same as last four except for cdiscard(). */ - crd = phand[infrom(phand, FULLHAND - 1, prompt)]; - cremove(crd, phand, FULLHAND - 1); - prhand(phand, FULLHAND, Playwin, FALSE); - crib[1] = crd; - crib[2] = chand[4]; - crib[3] = chand[5]; - chand[4].rank = chand[4].suit = chand[5].rank = chand[5].suit = EMPTY; -} - -/* - * cut: - * Cut the deck and set turnover. Actually, we only ASK the - * player what card to turn. We do a random one, anyway. - */ -int -cut(mycrib, pos) - BOOLEAN mycrib; - int pos; -{ - int i; - BOOLEAN win; - - win = FALSE; - if (mycrib) { - if (!rflag) { /* random cut */ - msg(quiet ? "Cut the deck? " : - "How many cards down do you wish to cut the deck? "); - getline(); - } - i = random() % (CARDS - pos); - turnover = deck[i + pos]; - addmsg(quiet ? "You cut " : "You cut the "); - msgcard(turnover, FALSE); - endmsg(); - if (turnover.rank == JACK) { - msg("I get two for his heels"); - win = chkscr(&cscore, 2); - } - } else { - i = random() % (CARDS - pos) + pos; - turnover = deck[i]; - addmsg(quiet ? "I cut " : "I cut the "); - msgcard(turnover, FALSE); - endmsg(); - if (turnover.rank == JACK) { - msg("You get two for his heels"); - win = chkscr(&pscore, 2); - } - } - makeknown(&turnover, 1); - prcrib(mycrib, FALSE); - return (win); -} - -/* - * prcrib: - * Print out the turnover card with crib indicator - */ -void -prcrib(mycrib, blank) - BOOLEAN mycrib, blank; -{ - int y, cardx; - - if (mycrib) - cardx = CRIB_X; - else - cardx = 0; - - mvaddstr(CRIB_Y, cardx + 1, "CRIB"); - prcard(stdscr, CRIB_Y + 1, cardx, turnover, blank); - - if (mycrib) - cardx = 0; - else - cardx = CRIB_X; - - for (y = CRIB_Y; y <= CRIB_Y + 5; y++) - mvaddstr(y, cardx, " "); -} - -/* - * peg: - * Handle all the pegging... - */ -static CARD Table[14]; -static int Tcnt; - -int -peg(mycrib) - BOOLEAN mycrib; -{ - static CARD ch[CINHAND], ph[CINHAND]; - int i, j, k; - int l; - int cnum, pnum, sum; - BOOLEAN myturn, mego, ugo, last, played; - CARD crd; - - cnum = pnum = CINHAND; - for (i = 0; i < CINHAND; i++) { /* make copies of hands */ - ch[i] = chand[i]; - ph[i] = phand[i]; - } - Tcnt = 0; /* index to table of cards played */ - sum = 0; /* sum of cards played */ - played = mego = ugo = FALSE; - myturn = !mycrib; - for (;;) { - last = TRUE; /* enable last flag */ - prhand(ph, pnum, Playwin, FALSE); - prhand(ch, cnum, Compwin, TRUE); - prtable(sum); - if (myturn) { /* my tyrn to play */ - if (!anymove(ch, cnum, sum)) { /* if no card to play */ - if (!mego && cnum) { /* go for comp? */ - msg("GO"); - mego = TRUE; - } - /* can player move? */ - if (anymove(ph, pnum, sum)) - myturn = !myturn; - else { /* give him his point */ - msg(quiet ? "You get one" : - "You get one point"); - if (chkscr(&pscore, 1)) - return TRUE; - sum = 0; - mego = ugo = FALSE; - Tcnt = 0; - } - } else { - played = TRUE; - j = -1; - k = 0; - /* maximize score */ - for (i = 0; i < cnum; i++) { - l = pegscore(ch[i], Table, Tcnt, sum); - if (l > k) { - k = l; - j = i; - } - } - if (j < 0) /* if nothing scores */ - j = cchose(ch, cnum, sum); - crd = ch[j]; - cremove(crd, ch, cnum--); - sum += VAL(crd.rank); - Table[Tcnt++] = crd; - if (k > 0) { - addmsg(quiet ? "I get %d playing " : - "I get %d points playing ", k); - msgcard(crd, FALSE); - endmsg(); - if (chkscr(&cscore, k)) - return TRUE; - } - myturn = !myturn; - } - } else { - if (!anymove(ph, pnum, sum)) { /* can player move? */ - if (!ugo && pnum) { /* go for player */ - msg("You have a GO"); - ugo = TRUE; - } - /* can computer play? */ - if (anymove(ch, cnum, sum)) - myturn = !myturn; - else { - msg(quiet ? "I get one" : - "I get one point"); - do_wait(); - if (chkscr(&cscore, 1)) - return TRUE; - sum = 0; - mego = ugo = FALSE; - Tcnt = 0; - } - } else { /* player plays */ - played = FALSE; - if (pnum == 1) { - crd = ph[0]; - msg("You play your last card"); - } else - for (;;) { - prhand(ph, - pnum, Playwin, FALSE); - crd = ph[infrom(ph, - pnum, "Your play: ")]; - if (sum + VAL(crd.rank) <= 31) - break; - else - msg("Total > 31 -- try again"); - } - makeknown(&crd, 1); - cremove(crd, ph, pnum--); - i = pegscore(crd, Table, Tcnt, sum); - sum += VAL(crd.rank); - Table[Tcnt++] = crd; - if (i > 0) { - msg(quiet ? "You got %d" : - "You got %d points", i); - if (chkscr(&pscore, i)) - return TRUE; - } - myturn = !myturn; - } - } - if (sum >= 31) { - if (!myturn) - do_wait(); - sum = 0; - mego = ugo = FALSE; - Tcnt = 0; - last = FALSE; /* disable last flag */ - } - if (!pnum && !cnum) - break; /* both done */ - } - prhand(ph, pnum, Playwin, FALSE); - prhand(ch, cnum, Compwin, TRUE); - prtable(sum); - if (last) { - if (played) { - msg(quiet ? "I get one for last" : - "I get one point for last"); - do_wait(); - if (chkscr(&cscore, 1)) - return TRUE; - } else { - msg(quiet ? "You get one for last" : - "You get one point for last"); - if (chkscr(&pscore, 1)) - return TRUE; - } - } - return (FALSE); -} - -/* - * prtable: - * Print out the table with the current score - */ -void -prtable(score) - int score; -{ - prhand(Table, Tcnt, Tablewin, FALSE); - mvwprintw(Tablewin, (Tcnt + 2) * 2, Tcnt + 1, "%2d", score); - wrefresh(Tablewin); -} - -/* - * score: - * Handle the scoring of the hands - */ -int -score(mycrib) - BOOLEAN mycrib; -{ - sorthand(crib, CINHAND); - if (mycrib) { - if (plyrhand(phand, "hand")) - return (TRUE); - if (comphand(chand, "hand")) - return (TRUE); - do_wait(); - if (comphand(crib, "crib")) - return (TRUE); - } else { - if (comphand(chand, "hand")) - return (TRUE); - if (plyrhand(phand, "hand")) - return (TRUE); - if (plyrhand(crib, "crib")) - return (TRUE); - } - return (FALSE); -} diff --git a/games/cribbage/cribbage.6 b/games/cribbage/cribbage.6 deleted file mode 100644 index 14e9755b4f71..000000000000 --- a/games/cribbage/cribbage.6 +++ /dev/null @@ -1,130 +0,0 @@ -.\" Copyright (c) 1980, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" 3. All advertising materials mentioning features or use of this software -.\" must display the following acknowledgement: -.\" This product includes software developed by the University of -.\" California, Berkeley and its contributors. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" @(#)cribbage.6 8.1 (Berkeley) 5/31/93 -.\" $FreeBSD$ -.\" -.TH CRIBBAGE 6 "May 31, 1993" -.UC 4 -.SH NAME -cribbage \- the card game cribbage -.SH SYNOPSIS -.B /usr/games/cribbage -[ -.B \-req -] -.I name ... -.SH DESCRIPTION -.I Cribbage -plays the card game cribbage, with the program playing one hand -and the user the other. The program will initially ask the user if -the rules of the game are needed \- if so, it will print out -the appropriate section from -.I According to Hoyle -with -.I more (I). -.PP -.I Cribbage -options include: -.TP -.B \-e -When the player makes a mistake scoring his hand or crib, provide an -explanation of the correct score. (This is especially useful for -beginning players.) -.TP -.B \-q -Print a shorter form of all messages \- this is only recommended for -users who have played the game without specifying this option. -.TP -.B \-r -Instead of asking the player to cut the deck, the program will randomly -cut the deck. -.PP -.I Cribbage -first asks the player whether he wishes to play a short game -(\*(lqonce around\*(rq, to 61) or a long game (\*(lqtwice around\*(rq, to 121). A -response of `s' will result in a short game, any other response will -play a long game. -.PP -At the start of the first game, the program -asks the player to cut the deck to determine who gets the -first crib. The user should respond with a number between 0 and -51, indicating how many cards down the deck is to be cut. The player -who cuts the lower ranked card gets the first crib. -If more than one game is played, the -loser of the previous game gets the first crib in the current game. -.PP -For each hand, the program first prints the player's hand, -whose crib it is, and then asks the player -to discard two cards into the crib. The cards are prompted for -one per line, and are typed as explained below. -.PP -After discarding, the program cuts the deck (if it is the player's -crib) or asks the player to cut the deck (if it's its crib); in the latter -case, the appropriate response is a number from 0 to 39 indicating -how far down the remaining 40 cards are to be cut. -.PP -After cutting the deck, play starts with the non-dealer (the person -who doesn't have the crib) leading the first card. -Play continues, as per cribbage, until all cards are exhausted. The -program keeps track of the scoring of all points and the total of -the cards on the table. -.PP -After play, the hands are scored. The program requests the player to -score his hand (and the crib, if it is his) by printing out the -appropriate cards (and the cut card enclosed in brackets). -Play continues until one player reaches the game limit (61 or 121). -.PP -A carriage return when a numeric input is expected is equivalent -to typing the lowest legal value; when cutting the deck this -is equivalent to choosing the top card. -.PP -Cards are specified as rank followed by suit. The ranks may be specified -as one of: -`a', `2', `3', `4', `5', `6', `7', `8', `9', `t', `j', `q', and `k', -or alternatively, one of: \*(lqace\*(rq, \*(lqtwo\*(rq, \*(lqthree\*(rq, \*(lqfour\*(rq, \*(lqfive\*(rq, \*(lqsix\*(rq, -\*(lqseven\*(rq, \*(lqeight\*(rq, \*(lqnine\*(rq, \*(lqten\*(rq, \*(lqjack\*(rq, \*(lqqueen\*(rq, and \*(lqking\*(rq. -Suits may be specified as: `s', `h', `d', and `c', or alternatively as: -\*(lqspades\*(rq, \*(lqhearts\*(rq, \*(lqdiamonds\*(rq, and \*(lqclubs\*(rq. -A card may be specified as: \*(lq \*(rq , or: \*(lq of \*(rq . -If the single letter rank and suit designations are used, the space -separating the suit and rank may be left out. Also, if only one card -of the desired rank is playable, typing the rank is sufficient. -For example, if your hand was \*(lq2H, 4D, 5C, 6H, JC, KD\*(rq and it was -desired to discard the king of diamonds, any of the following could be typed: -\*(lqk\*(rq, \*(lqking\*(rq, \*(lqkd\*(rq, \*(lqk d\*(rq, \*(lqk of d\*(rq, \*(lqking d\*(rq, \*(lqking of d\*(rq, \*(lqk diamonds\*(rq, -\*(lqk of diamonds\*(rq, \*(lqking diamonds\*(rq, or \*(lqking of diamonds\*(rq. -.SH FILES -.ta 2i -/usr/games/cribbage -.SH AUTHORS -Earl T. Cohen wrote the logic. -Ken Arnold added the screen oriented interface. diff --git a/games/cribbage/cribbage.h b/games/cribbage/cribbage.h deleted file mode 100644 index 4a09a231c760..000000000000 --- a/games/cribbage/cribbage.h +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (c) 1980, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)cribbage.h 8.1 (Berkeley) 5/31/93 - */ - -#include - -__FBSDID("$FreeBSD$"); - -extern CARD deck[ CARDS ]; /* a deck */ -extern CARD phand[ FULLHAND ]; /* player's hand */ -extern CARD chand[ FULLHAND ]; /* computer's hand */ -extern CARD crib[ CINHAND ]; /* the crib */ -extern CARD turnover; /* the starter */ - -extern CARD known[ CARDS ]; /* cards we have seen */ -extern int knownum; /* # of cards we know */ - -extern int pscore; /* player's score */ -extern int cscore; /* comp's score */ -extern int glimit; /* points to win game */ - -extern int pgames; /* player's games won */ -extern int cgames; /* comp's games won */ -extern int gamecount; /* # games played */ -extern int Lastscore[2]; /* previous score for each */ - -extern BOOLEAN iwon; /* if comp won last */ -extern BOOLEAN explain; /* player mistakes explained */ -extern BOOLEAN rflag; /* if all cuts random */ -extern BOOLEAN quiet; /* if suppress random mess */ -extern BOOLEAN playing; /* currently playing game */ - -extern char expl[]; /* string for explanation */ - -void addmsg(const char *, ...) __printflike(1, 2); -int adjust(CARD [], CARD); -int anymove(CARD [], int, int); -int anysumto(CARD [], int, int, int); -void bye(void); -int cchose(CARD [], int, int); -void cdiscard(BOOLEAN); -int chkscr(int *, int); -int comphand(CARD [], char *); -void cremove(CARD, CARD [], int); -int cut(BOOLEAN, int); -int deal(int); -void discard(BOOLEAN); -void do_wait(void); -void endmsg(void); -int eq(CARD, CARD); -int fifteens(CARD [], int); -void game(void); -void gamescore(void); -char *getline(void); -int getuchar(void); -int incard(CARD *); -int infrom(CARD [], int, char *); -void instructions(void); -int isone(CARD, CARD [], int); -void makeboard(void); -void makedeck(CARD []); -void makeknown(CARD [], int); -void msg(const char *, ...) __printflike(1, 2); -int msgcard(CARD, BOOLEAN); -int msgcrd(CARD, BOOLEAN, char *, BOOLEAN); -int number(int, int, char *); -int numofval(CARD [], int, int); -int pairuns(CARD [], int); -int peg(BOOLEAN); -int pegscore(CARD, CARD [], int, int); -int playhand(BOOLEAN); -int plyrhand(CARD [], char *); -void prcard(WINDOW *, int, int, CARD, BOOLEAN); -void prcrib(BOOLEAN, BOOLEAN); -void prhand(CARD [], int, WINDOW *, BOOLEAN); -void printcard(WINDOW *, int, CARD, BOOLEAN); -void prpeg(int, int, BOOLEAN); -void prtable(int); -int readchar(void); -void rint(int); -int score(BOOLEAN); -int scorehand(CARD [], CARD, int, BOOLEAN, BOOLEAN); -void shuffle(CARD []); -void sorthand(CARD [], int); -void wait_for(int); diff --git a/games/cribbage/cribbage.n b/games/cribbage/cribbage.n deleted file mode 100644 index 084e0917bc2f..000000000000 --- a/games/cribbage/cribbage.n +++ /dev/null @@ -1,226 +0,0 @@ - - CRIBBAGE - from - According to Hoyle - -Cribbage is believed to have been invented by Sir John Suckling (1609-1642). -Probably it is an elaboration of an older game, Noddy. The original game -was played with hands of five cards; the modern game gives each player -six. That is virtually the only change from Suckling's directions. - -Players: - - Two. There are variants for three and four players, described - later. - -Cards: - - The pack of 52. The cards in each suit rank: K (high), Q, J, 10, -9, 8, 7, 6, 5, 4, 3, 2, A. The counting values are: K, Q, J, 10, each 10 -(wherefore these are called tenth cards); ace, 1; each other card, its -index value. - -Cribbage Board: - - Indispensable to scoring (unless you have a computer!, ed.) is -the device known as the cribbage board. This is a rectangular panel, long -and narrow, in which are four rows of 30 holes each. (See illustration.) -At one end, or in the center, are two or four additional holes, called -game holes. The board is placed between the two players, and each keeps -his own score on the two rows of holes nearest himself. Each is supplied -with two pegs. Before the first hand, the pegs are placed in the game -holes. On making his first score, the player advances one peg an -appropriate number of holes (one per point) away from the game end of the -board. The second score is recorded by placing the second peg an -appropriate distance ahead of the first. For each subsequent score, the -rear peg is jumped ahead of the other, the distance between the two pegs -always showing the amount of this last score. - - The traditional mode of scoring is down (away from the game end) -the outer row, and up the inner row. "Once around" is a game of 61 points. -"Twice around" is a game of 121 points. - -Preliminaries: - - Cards are drawn; the lower deals first. If cards of equal rank -are drawn, both players draw again. Dealer has the right to shuffle last. -Nondealer cuts, and must leave at least four cards in each packet. - -Dealing: - - Each player receives six cards, dealt one at a time face down, -beginning with the nondealer. The turn to deal alternates. The dealer -has an advantage. - -Laying Away: - - After seeing his hand, each player lays away two cards face down. -The four cards laid away, placed in one pile, form the crib. The crib -counts for the dealer. Nondealer therefore tries to lay away balking -cards -- cards that are least likely to create a score in the crib. - -The Starter: - - After both hands have laid away, nondealer lifts off a packet from -the top of the stock (the rest of the pack). Again, each packet must -contain at least four cards. Dealer turns up the top card of the lower -packer, which is then placed on top of the stock when the packets are -reunited. The card thus turned up is called 1 the starter. If it is a -jack, dealer immediately pegs 2, called 2 for his heels. - -The Play: - - Nondealer begins the play by laying a card from his hand face up -on the table, announcing its counting value. Dealer then shows a card, -announcing the total count of the two cards. Play continues in the same -way, by alternate exposure of cards, each player announcing the new total -count. The total may be carried only to 31, no further. If a player adds -a card that brings the total exactly to 31, he pegs 2. If a player is -unable to play another card without exceeding 31, he must say "Go," and -his opponent pegs 1, but before doing so, opponent must lay down any -additional cards he can without exceeding 31. If such additional cards -bring the total to exactly 31, he pegs 2 instead of 1. - - Whenever a go occurs, the opponent of the player who played the -last card must lead for a new count starting at zero. Playing the last -card of all counts as a go. (Since nondealer makes the opening lead, -dealer is bound to peg at least 1 in play.) - - Besides pegging for 31 and go, the player may also peg for certain -combinations made in play, as follows: - - Fifteen: - Making the count total 15 pegs 2. - Pair: - Playing a card of same rank as that previously played pegs - 2. Playing a third card of the same rank makes pair royal - and pegs 6. Playing the fourth card of the same rank - makes double pair royal and pegs 12. - - The tenth cards pair strictly by rank, a king with a king, - a queen with a queen, and so on. (King and jack do not - make a pair, although each has the counting value 10.) - Run: - Playing a card which, with the two or more played - immediately previously, makes a sequence of three or more - cards, pegs 1 for each card in the run. Runs depend on - rank alone; the suits do not matter. Nor does the score - for run depend upon playing the cards in strict sequence, - so long as the three or more last cards played can be - arranged in a run. Example: 7, 6, 8 played in that order - score 3 for run; 5, 2, 4, 3 played in that order score 4 - for run. - - Any of the foregoing combinations count, whether the cards - are played alternately or one player plays several times - in succession in consequence of a go. But a combination - does not score if it is interrupted by a go. - - Showing: - After the play, the hands are shown (counted). Nondealer - shows first, then dealer's hand, then crib. The starter - is deemed to belong to each hand, so that each hand includes - five cards. Combinations of scoring value are as follows: - - Fifteen: - Each combinations of two or more cards that total - fifteen scores 2. - Pair: - Each pair of cards of the same rank scores 2. - - Run: - Each combination of three or more cards in sequence - scores 1 for each card in the run. - Flush: - Four cards of the same suit in hand score 4; four - cards in hand or crib of same suit as the starter - score 5. (No count for four-flush in crib.) - His Nobs: - Jack of same suit as the starter, in hand or crib, - scores 1. - - It is important to note that every separate grouping of cards that -makes a fifteen, pair, or run counts separately. Three of a kind, pair -royal, counts 6 because three sets of pairs can be made; similarly, four -of a kind, double pair royal, contain six pairs and count 12. - - The highest possible hand is J, 5, 5, 5 with the starter the 5 of -the same suit as the jack. There are four fifteens by combining the jack -with a five, four more by combinations of three fives (a total of 16 for -fifteens); the double pair royal adds 12 for a total of 28; and his nobs -adds 1 for a maximum score of 29. (the score of 2 for his heels does not -count in the total of the hand, since it is pegged before the play.) - - A double run is a run with one card duplicated, as 4-3-3-2. -Exclusive of fifteens, a double run of three cards counts 8; of four cards, -10. A triple run is a run of three with one card triplicated, as K-K-K-Q-J. -Exclusive of fifteens, it counts 15. A quadruple run is a run of three -with two different cards duplicated, as the example 8-8-7-6-6 previously -given. Exclusive of fifteens, it counts 16. - - No hand can be constructed that counts 19, 25, 26 or 27. A -time-honored way of showing a hand with not a single counting combination -is to say "I have nineteen." - - The customary order in showing is to count fifteens first, then -runs, then pairs, but there is no compulsion of law. Example: A hand -(with starter) of 9-6-5-4-4 will usually be counted "Fifteen 2, fifteen -4, fifteen 6 and double run makes 14," or simply "Fifteen 6 and 8 is 14." - -Muggins: - - The hands and crib are counted aloud, and if a player claims a -greater total than is due him, his opponent may require correction. In -some localities, if a player claims less than is due, his opponent may -say "Muggins" and himself score the points overlooked. - -Scoring: - - The usual game is 121, but it may be set at 61 by agreement. -Since the player wins who first returns to the game hole by going "twice -around," the scores must be pegged strictly in order: his heels, pegging -in play, non-dealer's hand, dealer's hand, crib. Thus, if nondealer goes -out on showing his hand, he wins, even though dealer might have gone out -with a greater total if allowed to count his hand and crib. - - When the game of 121 is played for a stake, a player wins a single -game if the loser makes 61 points or more. If the loser fails to reach -61, he is lurched, and the other wins a double game. - -Irregularities: - - Misdeal. There must be a new deal by the same dealer if a card -is found faced in the pack, if a card is exposed in dealing, or if the -pack be found imperfect. - - Wrong Number of Cards. If one hand (not crib) is found to have -the wrong number of cards after laying away for the crib, the other hand -and crib being correct, the opponent may either demand a new deal or may -peg 2 and rectify the hand. If the crib is incorrect, both hands being -correct, nondealer pegs 2 and the crib is corrected. - -Error in Pegging: - - If a player places a peg short of the amount to which he is -entitled, he may not correct his error after he has played the next card -or after the cut for the next deal. If he pegs more than his announced -score, the error must be corrected on demand at any time before the cut -for the next deal and his opponent pegs 2. - -Strategy: - - The best balking cards are kings and aces, because they have the -least chance of producing sequences. Tenth cards are generally good, -provided that the two cards laid away are not too near (likely to make a -sequence). When nothing better offers, give two wide cards -- at least -three apart in rank. - - Proverbially the safest lead is a 4. The next card cannot make -a 15. Lower cards are also safe from this point of view, but are better -treasured for go and 31. The most dangerous leads are 7 and 8, but may -be made to trap the opponent when they are backed with other close cards. -Generally speaking, play on (toward a sequence) when you have close cards -and off when you do not. However, the state of the score is a -consideration. If far behind, play on when there is any chance of building -a score for yourself; if well ahead, balk your opponent by playing off -unless you will surely peg as much as he by playing on. diff --git a/games/cribbage/cribcur.h b/games/cribbage/cribcur.h deleted file mode 100644 index 5e8bfd408e19..000000000000 --- a/games/cribbage/cribcur.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 1980, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)cribcur.h 8.1 (Berkeley) 5/31/93 - */ - -# define PLAY_Y 15 /* size of player's hand window */ -# define PLAY_X 12 -# define TABLE_Y 21 /* size of table window */ -# define TABLE_X 14 -# define COMP_Y 15 /* size of computer's hand window */ -# define COMP_X 12 -# define Y_SCORE_SZ 9 /* Y size of score board */ -# define X_SCORE_SZ 41 /* X size of score board */ -# define SCORE_Y 0 /* starting position of scoring board */ -# define SCORE_X (PLAY_X + TABLE_X + COMP_X) -# define CRIB_Y 17 /* position of crib (cut card) */ -# define CRIB_X (PLAY_X + TABLE_X) -# define MSG_Y (LINES - (Y_SCORE_SZ + 1)) -# define MSG_X (COLS - SCORE_X - 1) -# define Y_MSG_START (Y_SCORE_SZ + 1) - -# define PEG '*' /* what a peg looks like on the board */ - -extern WINDOW *Compwin; /* computer's hand window */ -extern WINDOW *Msgwin; /* message window */ -extern WINDOW *Playwin; /* player's hand window */ -extern WINDOW *Tablewin; /* table window */ diff --git a/games/cribbage/deck.h b/games/cribbage/deck.h deleted file mode 100644 index 2479ecf86047..000000000000 --- a/games/cribbage/deck.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 1980, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)deck.h 8.1 (Berkeley) 5/31/93 - * $FreeBSD$ - */ - -/* - * define structure of a deck of cards and other related things - */ - - -#define CARDS 52 /* number cards in deck */ -#define RANKS 13 /* number ranks in deck */ -#define SUITS 4 /* number suits in deck */ - -#define CINHAND 4 /* # cards in cribbage hand */ -#define FULLHAND 6 /* # cards in dealt hand */ - -#define LGAME 121 /* number points in a game */ -#define SGAME 61 /* # points in a short game */ - -#define SPADES 0 /* value of each suit */ -#define HEARTS 1 -#define DIAMONDS 2 -#define CLUBS 3 - -#define ACE 0 /* value of each rank */ -#define TWO 1 -#define THREE 2 -#define FOUR 3 -#define FIVE 4 -#define SIX 5 -#define SEVEN 6 -#define EIGHT 7 -#define NINE 8 -#define TEN 9 -#define JACK 10 -#define QUEEN 11 -#define KING 12 -#define EMPTY 13 - -#define VAL(c) ( (c) < 9 ? (c)+1 : 10 ) /* val of rank */ - - -#ifndef TRUE -# define TRUE 1 -# define FALSE 0 -#endif - -typedef struct { - int rank; - int suit; - } CARD; - -typedef bool BOOLEAN; - diff --git a/games/cribbage/extern.c b/games/cribbage/extern.c deleted file mode 100644 index 97516df9d9fe..000000000000 --- a/games/cribbage/extern.c +++ /dev/null @@ -1,72 +0,0 @@ -/*- - * Copyright (c) 1980, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)extern.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include - -#include "deck.h" -#include "cribbage.h" - -bool explain = FALSE; /* player mistakes explained */ -bool iwon = FALSE; /* if comp won last game */ -bool quiet = FALSE; /* if suppress random mess */ -bool rflag = FALSE; /* if all cuts random */ - -char expl[128]; /* explanation */ - -int cgames = 0; /* number games comp won */ -int cscore = 0; /* comp score in this game */ -int gamecount = 0; /* number games played */ -int glimit = LGAME; /* game playe to glimit */ -int knownum = 0; /* number of cards we know */ -int pgames = 0; /* number games player won */ -int pscore = 0; /* player score in this game */ - -CARD chand[FULLHAND]; /* computer's hand */ -CARD crib[CINHAND]; /* the crib */ -CARD deck[CARDS]; /* a deck */ -CARD known[CARDS]; /* cards we have seen */ -CARD phand[FULLHAND]; /* player's hand */ -CARD turnover; /* the starter */ - -WINDOW *Compwin; /* computer's hand window */ -WINDOW *Msgwin; /* messages for the player */ -WINDOW *Playwin; /* player's hand window */ -WINDOW *Tablewin; /* table window */ diff --git a/games/cribbage/instr.c b/games/cribbage/instr.c deleted file mode 100644 index ed06ce84cf6c..000000000000 --- a/games/cribbage/instr.c +++ /dev/null @@ -1,90 +0,0 @@ -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)instr.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include "deck.h" -#include "cribbage.h" -#include "pathnames.h" - -void -instructions() -{ - struct stat sb; - pid_t pid; - int pstat; - char *pager, *path; - - if (stat(_PATH_INSTR, &sb)) { - (void)fprintf(stderr, "cribbage: %s: %s.\n", _PATH_INSTR, - strerror(errno)); - exit(1); - } - switch (pid = vfork()) { - case -1: - (void)fprintf(stderr, "cribbage: %s.\n", strerror(errno)); - exit(1); - case 0: - if (!(path = getenv("PAGER"))) - path = _PATH_MORE; - if ((pager = rindex(path, '/')) != NULL) - ++pager; - pager = path; - execlp(path, pager, _PATH_INSTR, (char *)NULL); - (void)fprintf(stderr, "cribbage: %s.\n", strerror(errno)); - _exit(1); - default: - do { - pid = waitpid(pid, (int *)&pstat, 0); - } while (pid == -1 && errno == EINTR); - if (pid == -1 || WEXITSTATUS(pstat) || WTERMSIG(pstat)) - exit(1); - } -} diff --git a/games/cribbage/io.c b/games/cribbage/io.c deleted file mode 100644 index fd30a080d48f..000000000000 --- a/games/cribbage/io.c +++ /dev/null @@ -1,604 +0,0 @@ -/*- - * Copyright (c) 1980, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)io.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include -#include -#include -#include -#include -#include -#include -#include - - -#include "deck.h" -#include "cribbage.h" -#include "cribcur.h" - -#define LINESIZE 128 - -#ifdef CTRL -#undef CTRL -#endif -#define CTRL(X) (X - 'A' + 1) - -char linebuf[LINESIZE]; - -char *rankname[RANKS] = { - "ACE", "TWO", "THREE", "FOUR", "FIVE", "SIX", "SEVEN", - "EIGHT", "NINE", "TEN", "JACK", "QUEEN", "KING" -}; - -char *rankchar[RANKS] = { - "A", "2", "3", "4", "5", "6", "7", "8", "9", "T", "J", "Q", "K" -}; - -char *suitname[SUITS] = {"SPADES", "HEARTS", "DIAMONDS", "CLUBS"}; - -char *suitchar[SUITS] = {"S", "H", "D", "C"}; - -/* - * msgcard: - * Call msgcrd in one of two forms - */ -int -msgcard(c, brief) - CARD c; - BOOLEAN brief; -{ - if (brief) - return (msgcrd(c, TRUE, NULL, TRUE)); - else - return (msgcrd(c, FALSE, " of ", FALSE)); -} - -/* - * msgcrd: - * Print the value of a card in ascii - */ -int -msgcrd(c, brfrank, mid, brfsuit) - CARD c; - BOOLEAN brfrank, brfsuit; - char *mid; -{ - if (c.rank == EMPTY || c.suit == EMPTY) - return (FALSE); - if (brfrank) - addmsg("%1.1s", rankchar[c.rank]); - else - addmsg("%s", rankname[c.rank]); - if (mid != NULL) - addmsg("%s", mid); - if (brfsuit) - addmsg("%1.1s", suitchar[c.suit]); - else - addmsg("%s", suitname[c.suit]); - return (TRUE); -} - -/* - * printcard: - * Print out a card. - */ -void -printcard(win, cardno, c, blank) - WINDOW *win; - int cardno; - CARD c; - BOOLEAN blank; -{ - prcard(win, cardno * 2, cardno, c, blank); -} - -/* - * prcard: - * Print out a card on the window at the specified location - */ -void -prcard(win, y, x, c, blank) - WINDOW *win; - int y, x; - CARD c; - BOOLEAN blank; -{ - if (c.rank == EMPTY) - return; - - mvwaddstr(win, y + 0, x, "+-----+"); - mvwaddstr(win, y + 1, x, "| |"); - mvwaddstr(win, y + 2, x, "| |"); - mvwaddstr(win, y + 3, x, "| |"); - mvwaddstr(win, y + 4, x, "+-----+"); - if (!blank) { - mvwaddch(win, y + 1, x + 1, rankchar[c.rank][0]); - waddch(win, suitchar[c.suit][0]); - mvwaddch(win, y + 3, x + 4, rankchar[c.rank][0]); - waddch(win, suitchar[c.suit][0]); - } -} - -/* - * prhand: - * Print a hand of n cards - */ -void -prhand(h, n, win, blank) - CARD h[]; - int n; - WINDOW *win; - BOOLEAN blank; -{ - int i; - - werase(win); - for (i = 0; i < n; i++) - printcard(win, i, *h++, blank); - wrefresh(win); -} - -/* - * infrom: - * reads a card, supposedly in hand, accepting unambigous brief - * input, returns the index of the card found... - */ -int -infrom(hand, n, prompt) - CARD hand[]; - int n; - char *prompt; -{ - int i, j; - CARD crd; - - if (n < 1) { - printf("\nINFROM: %d = n < 1!!\n", n); - exit(74); - } - for (;;) { - msg("%s", prompt); - if (incard(&crd)) { /* if card is full card */ - if (!isone(crd, hand, n)) - msg("That's not in your hand"); - else { - for (i = 0; i < n; i++) - if (hand[i].rank == crd.rank && - hand[i].suit == crd.suit) - break; - if (i >= n) { - printf("\nINFROM: isone or something messed up\n"); - exit(77); - } - return (i); - } - } else /* if not full card... */ - if (crd.rank != EMPTY) { - for (i = 0; i < n; i++) - if (hand[i].rank == crd.rank) - break; - if (i >= n) - msg("No such rank in your hand"); - else { - for (j = i + 1; j < n; j++) - if (hand[j].rank == crd.rank) - break; - if (j < n) - msg("Ambiguous rank"); - else - return (i); - } - } else - msg("Sorry, I missed that"); - } - /* NOTREACHED */ -} - -/* - * incard: - * Inputs a card in any format. It reads a line ending with a CR - * and then parses it. - */ -int -incard(crd) - CARD *crd; -{ - int i; - int rnk, sut; - char *line, *p, *p1; - BOOLEAN retval; - - retval = FALSE; - rnk = sut = EMPTY; - if (!(line = getline())) - goto gotit; - p = p1 = line; - while (*p1 != ' ' && *p1 != '\0') - ++p1; - *p1++ = '\0'; - if (*p == '\0') - goto gotit; - - /* IMPORTANT: no real card has 2 char first name */ - if (strlen(p) == 2) { /* check for short form */ - rnk = EMPTY; - for (i = 0; i < RANKS; i++) { - if (*p == *rankchar[i]) { - rnk = i; - break; - } - } - if (rnk == EMPTY) - goto gotit; /* it's nothing... */ - ++p; /* advance to next char */ - sut = EMPTY; - for (i = 0; i < SUITS; i++) { - if (*p == *suitchar[i]) { - sut = i; - break; - } - } - if (sut != EMPTY) - retval = TRUE; - goto gotit; - } - rnk = EMPTY; - for (i = 0; i < RANKS; i++) { - if (!strcmp(p, rankname[i]) || !strcmp(p, rankchar[i])) { - rnk = i; - break; - } - } - if (rnk == EMPTY) - goto gotit; - p = p1; - while (*p1 != ' ' && *p1 != '\0') - ++p1; - *p1++ = '\0'; - if (*p == '\0') - goto gotit; - if (!strcmp("OF", p)) { - p = p1; - while (*p1 != ' ' && *p1 != '\0') - ++p1; - *p1++ = '\0'; - if (*p == '\0') - goto gotit; - } - sut = EMPTY; - for (i = 0; i < SUITS; i++) { - if (!strcmp(p, suitname[i]) || !strcmp(p, suitchar[i])) { - sut = i; - break; - } - } - if (sut != EMPTY) - retval = TRUE; -gotit: - (*crd).rank = rnk; - (*crd).suit = sut; - return (retval); -} - -/* - * getuchar: - * Reads and converts to upper case - */ -int -getuchar() -{ - int c; - - c = readchar(); - if (islower(c)) - c = toupper(c); - waddch(Msgwin, c); - return (c); -} - -/* - * number: - * Reads in a decimal number and makes sure it is between "lo" and - * "hi" inclusive. - */ -int -number(lo, hi, prompt) - int lo, hi; - char *prompt; -{ - char *p; - int sum; - - for (sum = 0;;) { - msg("%s", prompt); - if (!(p = getline()) || *p == '\0') { - msg(quiet ? "Not a number" : - "That doesn't look like a number"); - continue; - } - sum = 0; - - if (!isdigit(*p)) - sum = lo - 1; - else - while (isdigit(*p)) { - sum = 10 * sum + (*p - '0'); - ++p; - } - - if (*p != ' ' && *p != '\t' && *p != '\0') - sum = lo - 1; - if (sum >= lo && sum <= hi) - break; - if (sum == lo - 1) - msg("that doesn't look like a number, try again --> "); - else - msg("%d is not between %d and %d inclusive, try again --> ", - sum, lo, hi); - } - return (sum); -} - -/* - * msg: - * Display a message at the top of the screen. - */ -char Msgbuf[BUFSIZ] = {'\0'}; -int Mpos = 0; -static int Newpos = 0; - -void -msg(const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - (void)vsprintf(&Msgbuf[Newpos], fmt, ap); - va_end(ap); - endmsg(); -} - -/* - * addmsg: - * Add things to the current message - */ -void -addmsg(const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - (void)vsprintf(&Msgbuf[Newpos], fmt, ap); - va_end(ap); -} - -/* - * endmsg: - * Display a new msg. - */ -int Lineno = 0; - -void -endmsg() -{ - static int lastline = 0; - int len; - char *mp, *omp; - - /* All messages should start with uppercase */ - mvaddch(lastline + Y_MSG_START, SCORE_X, ' '); - if (islower(Msgbuf[0]) && Msgbuf[1] != ')') - Msgbuf[0] = toupper(Msgbuf[0]); - mp = Msgbuf; - len = strlen(mp); - if (len / MSG_X + Lineno >= MSG_Y) { - while (Lineno < MSG_Y) { - wmove(Msgwin, Lineno++, 0); - wclrtoeol(Msgwin); - } - Lineno = 0; - } - mvaddch(Lineno + Y_MSG_START, SCORE_X, '*'); - lastline = Lineno; - do { - mvwaddstr(Msgwin, Lineno, 0, mp); - if ((len = strlen(mp)) > MSG_X) { - omp = mp; - for (mp = &mp[MSG_X - 1]; *mp != ' '; mp--) - continue; - while (*mp == ' ') - mp--; - mp++; - wmove(Msgwin, Lineno, mp - omp); - wclrtoeol(Msgwin); - } - if (++Lineno >= MSG_Y) - Lineno = 0; - } while (len > MSG_X); - wclrtoeol(Msgwin); - Mpos = len; - Newpos = 0; - wrefresh(Msgwin); - refresh(); - wrefresh(Msgwin); -} - -/* - * do_wait: - * Wait for the user to type ' ' before doing anything else - */ -void -do_wait() -{ - static char prompt[] = {'-', '-', 'M', 'o', 'r', 'e', '-', '-', '\0'}; - - if (Mpos + sizeof prompt < MSG_X) - wmove(Msgwin, Lineno > 0 ? Lineno - 1 : MSG_Y - 1, Mpos); - else { - mvwaddch(Msgwin, Lineno, 0, ' '); - wclrtoeol(Msgwin); - if (++Lineno >= MSG_Y) - Lineno = 0; - } - waddstr(Msgwin, prompt); - wrefresh(Msgwin); - wait_for(' '); -} - -/* - * wait_for - * Sit around until the guy types the right key - */ -void -wait_for(ch) - int ch; -{ - char c; - - if (ch == '\n') - while ((c = readchar()) != '\n') - continue; - else - while (readchar() != ch) - continue; -} - -/* - * readchar: - * Reads and returns a character, checking for gross input errors - */ -int -readchar() -{ - int cnt; - char c; - -over: - cnt = 0; - while (read(STDIN_FILENO, &c, sizeof(char)) <= 0) - if (cnt++ > 100) { /* if we are getting infinite EOFs */ - bye(); /* quit the game */ - exit(1); - } - if (c == CTRL('L')) { - wrefresh(curscr); - goto over; - } - if (c == '\r') - return ('\n'); - else - return (c); -} - -/* - * getline: - * Reads the next line up to '\n' or EOF. Multiple spaces are - * compressed to one space; a space is inserted before a ',' - */ -char * -getline() -{ - char *sp; - int c, oy, ox; - WINDOW *oscr; - - oscr = stdscr; - stdscr = Msgwin; - getyx(stdscr, oy, ox); - refresh(); - /* loop reading in the string, and put it in a temporary buffer */ - for (sp = linebuf; (c = readchar()) != '\n'; clrtoeol(), refresh()) { - if (c == -1) - continue; - else - if (c == erasechar()) { /* process erase character */ - if (sp > linebuf) { - int i; - - sp--; - for (i = strlen(unctrl(*sp)); i; i--) - addch('\b'); - } - continue; - } else - if (c == killchar()) { /* process kill - * character */ - sp = linebuf; - move(oy, ox); - continue; - } else - if (sp == linebuf && c == ' ') - continue; - if (sp >= &linebuf[LINESIZE - 1] || !(isprint(c) || c == ' ')) - putchar(CTRL('G')); - else { - if (islower(c)) - c = toupper(c); - *sp++ = c; - addstr(unctrl(c)); - Mpos++; - } - } - *sp = '\0'; - stdscr = oscr; - return (linebuf); -} - -void -rint(signo) - int signo; -{ - bye(); - exit(1); -} - -/* - * bye: - * Leave the program, cleaning things up as we go. - */ -void -bye() -{ - signal(SIGINT, SIG_IGN); - mvcur(0, COLS - 1, LINES - 1, 0); - fflush(stdout); - endwin(); - putchar('\n'); -} diff --git a/games/cribbage/pathnames.h b/games/cribbage/pathnames.h deleted file mode 100644 index 5c30f73ae058..000000000000 --- a/games/cribbage/pathnames.h +++ /dev/null @@ -1,38 +0,0 @@ -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)pathnames.h 8.1 (Berkeley) 5/31/93 - */ - -#define _PATH_INSTR "/usr/share/games/cribbage.instr" -#define _PATH_LOG "/var/games/criblog" -#define _PATH_MORE "/usr/bin/more" diff --git a/games/cribbage/score.c b/games/cribbage/score.c deleted file mode 100644 index a2a7d0b66e36..000000000000 --- a/games/cribbage/score.c +++ /dev/null @@ -1,373 +0,0 @@ -/*- - * Copyright (c) 1980, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)score.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include -#include -#include -#include - -#include "deck.h" -#include "cribbage.h" - -/* - * the following arrays give the sum of the scores of the (50 2)*48 = 58800 - * hands obtainable for the crib given the two cards whose ranks index the - * array. the two arrays are for the case where the suits are equal and - * not equal respectively - */ -long crbescr[169] = { - -10000, 271827, 278883, 332319, 347769, 261129, 250653, 253203, 248259, - 243435, 256275, 237435, 231051, -10000, -10000, 412815, 295707, 349497, - 267519, 262521, 259695, 254019, 250047, 262887, 244047, 237663, -10000, - -10000, -10000, 333987, 388629, 262017, 266787, 262971, 252729, 254475, - 267315, 248475, 242091, -10000, -10000, -10000, -10000, 422097, 302787, - 256437, 263751, 257883, 254271, 267111, 248271, 241887, -10000, -10000, - -10000, -10000, -10000, 427677, 387837, 349173, 347985, 423861, 436701, - 417861, 411477, -10000, -10000, -10000, -10000, -10000, -10000, 336387, - 298851, 338667, 236487, 249327, 230487, 224103, -10000, -10000, -10000, - -10000, -10000, -10000, -10000, 408483, 266691, 229803, 246195, 227355, - 220971, -10000, -10000, -10000, -10000, -10000, -10000, -10000, -10000, - 300675, 263787, 241695, 226407, 220023, -10000, -10000, -10000, -10000, - -10000, -10000, -10000, -10000, -10000, 295635, 273543, 219771, 216939, - -10000, -10000, -10000, -10000, -10000, -10000, -10000, -10000, -10000, - -10000, 306519, 252747, 211431, -10000, -10000, -10000, -10000, -10000, - -10000, -10000, -10000, -10000, -10000, -10000, 304287, 262971, -10000, - -10000, -10000, -10000, -10000, -10000, -10000, -10000, -10000, -10000, - -10000, -10000, 244131, -10000, -10000, -10000, -10000, -10000, -10000, - -10000, -10000, -10000, -10000, -10000, -10000, -10000 -}; - -long crbnescr[169] = { - 325272, 260772, 267828, 321264, 336714, 250074, 239598, 242148, 237204, - 232380, 246348, 226380, 219996, -10000, 342528, 401760, 284652, 338442, - 256464, 251466, 248640, 242964, 238992, 252960, 232992, 226608, -10000, - -10000, 362280, 322932, 377574, 250962, 255732, 251916, 241674, 243420, - 257388, 237420, 231036, -10000, -10000, -10000, 360768, 411042, 291732, - 245382, 252696, 246828, 243216, 257184, 237216, 230832, -10000, -10000, - -10000, -10000, 528768, 416622, 376782, 338118, 336930, 412806, 426774, - 406806, 400422, -10000, -10000, -10000, -10000, -10000, 369864, 325332, - 287796, 327612, 225432, 239400, 219432, 213048, -10000, -10000, -10000, - -10000, -10000, -10000, 359160, 397428, 255636, 218748, 236268, 216300, - 209916, -10000, -10000, -10000, -10000, -10000, -10000, -10000, 331320, - 289620, 252732, 231768, 215352, 208968, -10000, -10000, -10000, -10000, - -10000, -10000, -10000, -10000, 325152, 284580, 263616, 208716, 205884, - -10000, -10000, -10000, -10000, -10000, -10000, -10000, -10000, -10000, - 321240, 296592, 241692, 200376, -10000, -10000, -10000, -10000, -10000, - -10000, -10000, -10000, -10000, -10000, 348600, 294360, 253044, -10000, - -10000, -10000, -10000, -10000, -10000, -10000, -10000, -10000, -10000, - -10000, 308664, 233076, -10000, -10000, -10000, -10000, -10000, -10000, - -10000, -10000, -10000, -10000, -10000, -10000, 295896 -}; - -static int ichoose2[5] = { 0, 0, 2, 6, 12 }; -static int pairpoints, runpoints; /* Globals from pairuns. */ - -/* - * scorehand: - * Score the given hand of n cards and the starter card. - * n must be <= 4 - */ -int -scorehand(hand, starter, n, crb, do_explain) - CARD hand[]; - CARD starter; - int n; - BOOLEAN crb; /* true if scoring crib */ - BOOLEAN do_explain; /* true if must explain this hand */ -{ - int i, k; - int score; - BOOLEAN flag; - CARD h[(CINHAND + 1)]; - char buf[32]; - - expl[0] = '\0'; /* initialize explanation */ - score = 0; - flag = TRUE; - k = hand[0].suit; - for (i = 0; i < n; i++) { /* check for flush */ - flag = (flag && (hand[i].suit == k)); - if (hand[i].rank == JACK) /* check for his nibs */ - if (hand[i].suit == starter.suit) { - score++; - if (do_explain) - strcat(expl, "His Nobs"); - } - h[i] = hand[i]; - } - - if (flag && n >= CINHAND) { - if (do_explain && expl[0] != '\0') - strcat(expl, ", "); - if (starter.suit == k) { - score += 5; - if (do_explain) - strcat(expl, "Five-flush"); - } else - if (!crb) { - score += 4; - if (do_explain && expl[0] != '\0') - strcat(expl, ", Four-flush"); - else - strcpy(expl, "Four-flush"); - } - } - if (do_explain && expl[0] != '\0') - strcat(expl, ", "); - h[n] = starter; - sorthand(h, n + 1); /* sort by rank */ - i = 2 * fifteens(h, n + 1); - score += i; - if (do_explain) { - if (i > 0) { - (void) sprintf(buf, "%d points in fifteens", i); - strcat(expl, buf); - } else - strcat(expl, "No fifteens"); - } - i = pairuns(h, n + 1); - score += i; - if (do_explain) { - if (i > 0) { - (void) sprintf(buf, ", %d points in pairs, %d in runs", - pairpoints, runpoints); - strcat(expl, buf); - } else - strcat(expl, ", No pairs/runs"); - } - return (score); -} - -/* - * fifteens: - * Return number of fifteens in hand of n cards - */ -int -fifteens(hand, n) - CARD hand[]; - int n; -{ - int *sp, *np; - int i; - CARD *endp; - static int sums[15], nsums[15]; - - np = nsums; - sp = sums; - i = 16; - while (--i) { - *np++ = 0; - *sp++ = 0; - } - for (endp = &hand[n]; hand < endp; hand++) { - i = hand->rank + 1; - if (i > 10) - i = 10; - np = &nsums[i]; - np[-1]++; /* one way to make this */ - sp = sums; - while (i < 15) { - *np++ += *sp++; - i++; - } - sp = sums; - np = nsums; - i = 16; - while (--i) - *sp++ = *np++; - } - return sums[14]; -} - -/* - * pairuns returns the number of points in the n card sorted hand - * due to pairs and runs - * this routine only works if n is strictly less than 6 - * sets the globals pairpoints and runpoints appropriately - */ -int -pairuns(h, n) - CARD h[]; - int n; -{ - int i; - int runlength, runmult, lastmult, curmult; - int mult1, mult2, pair1, pair2; - BOOLEAN run; - - run = TRUE; - runlength = 1; - mult1 = 1; - pair1 = -1; - mult2 = 1; - pair2 = -1; - curmult = runmult = 1; - for (i = 1; i < n; i++) { - lastmult = curmult; - if (h[i].rank == h[i - 1].rank) { - if (pair1 < 0) { - pair1 = h[i].rank; - mult1 = curmult = 2; - } else { - if (h[i].rank == pair1) { - curmult = ++mult1; - } else { - if (pair2 < 0) { - pair2 = h[i].rank; - mult2 = curmult = 2; - } else { - curmult = ++mult2; - } - } - } - if (i == (n - 1) && run) { - runmult *= curmult; - } - } else { - curmult = 1; - if (h[i].rank == h[i - 1].rank + 1) { - if (run) { - ++runlength; - } else { - /* only if old short */ - if (runlength < 3) { - run = TRUE; - runlength = 2; - runmult = 1; - } - } - runmult *= lastmult; - } else { - /* if just ended */ - if (run) - runmult *= lastmult; - run = FALSE; - } - } - } - pairpoints = ichoose2[mult1] + ichoose2[mult2]; - runpoints = (runlength >= 3 ? runlength * runmult : 0); - return (pairpoints + runpoints); -} - -/* - * pegscore tells how many points crd would get if played after - * the n cards in tbl during pegging - */ -int -pegscore(crd, tbl, n, sum) - CARD crd, tbl[]; - int n, sum; -{ - BOOLEAN got[RANKS]; - int i, j, scr; - int k, lo, hi; - - sum += VAL(crd.rank); - if (sum > 31) - return (-1); - if (sum == 31 || sum == 15) - scr = 2; - else - scr = 0; - if (!n) - return (scr); - j = 1; - while ((crd.rank == tbl[n - j].rank) && (n - j >= 0)) - ++j; - if (j > 1) - return (scr + ichoose2[j]); - if (n < 2) - return (scr); - lo = hi = crd.rank; - for (i = 0; i < RANKS; i++) - got[i] = FALSE; - got[crd.rank] = TRUE; - k = -1; - for (i = n - 1; i >= 0; --i) { - if (got[tbl[i].rank]) - break; - got[tbl[i].rank] = TRUE; - if (tbl[i].rank < lo) - lo = tbl[i].rank; - if (tbl[i].rank > hi) - hi = tbl[i].rank; - for (j = lo; j <= hi; j++) - if (!got[j]) - break; - if (j > hi) - k = hi - lo + 1; - } - if (k >= 3) - return (scr + k); - else - return (scr); -} - -/* - * adjust takes a two card hand that will be put in the crib - * and returns an adjusted normalized score for the number of - * points such a crib will get. - */ -int -adjust(cb, tnv) - CARD cb[], tnv; -{ - long scr; - int i, c0, c1; - - c0 = cb[0].rank; - c1 = cb[1].rank; - if (c0 > c1) { - i = c0; - c0 = c1; - c1 = i; - } - if (cb[0].suit != cb[1].suit) - scr = crbnescr[RANKS * c0 + c1]; - else - scr = crbescr[RANKS * c0 + c1]; - if (scr <= 0) { - printf("\nADJUST: internal error %d %d\n", c0, c1); - exit(93); - } - return ((scr + 29400) / 58800); -} diff --git a/games/cribbage/support.c b/games/cribbage/support.c deleted file mode 100644 index bc22ca63826e..000000000000 --- a/games/cribbage/support.c +++ /dev/null @@ -1,362 +0,0 @@ -/*- - * Copyright (c) 1980, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)support.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include -#include - -#include "deck.h" -#include "cribbage.h" -#include "cribcur.h" - -#define NTV 10 /* number scores to test */ - -/* score to test reachability of, and order to test them in */ -int tv[NTV] = {8, 7, 9, 6, 11, 12, 13, 14, 10, 5}; - -/* - * computer chooses what to play in pegging... - * only called if no playable card will score points - */ -int -cchose(h, n, s) - CARD h[]; - int n, s; -{ - int i, j, l; - - if (n <= 1) - return (0); - if (s < 4) { /* try for good value */ - if ((j = anysumto(h, n, s, 4)) >= 0) - return (j); - if ((j = anysumto(h, n, s, 3)) >= 0 && s == 0) - return (j); - } - if (s > 0 && s < 20) { - /* try for retaliation to 31 */ - for (i = 1; i <= 10; i++) { - if ((j = anysumto(h, n, s, 21 - i)) >= 0) { - if ((l = numofval(h, n, i)) > 0) { - if (l > 1 || VAL(h[j].rank) != i) - return (j); - } - } - } - } - if (s < 15) { - /* for retaliation after 15 */ - for (i = 0; i < NTV; i++) { - if ((j = anysumto(h, n, s, tv[i])) >= 0) { - if ((l = numofval(h, n, 15 - tv[i])) > 0) { - if (l > 1 || - VAL(h[j].rank) != 15 - tv[i]) - return (j); - } - } - } - } - j = -1; - /* remember: h is sorted */ - for (i = n - 1; i >= 0; --i) { - l = s + VAL(h[i].rank); - if (l > 31) - continue; - if (l != 5 && l != 10 && l != 21) { - j = i; - break; - } - } - if (j >= 0) - return (j); - for (i = n - 1; i >= 0; --i) { - l = s + VAL(h[i].rank); - if (l > 31) - continue; - if (j < 0) - j = i; - if (l != 5 && l != 21) { - j = i; - break; - } - } - return (j); -} - -/* - * plyrhand: - * Evaluate and score a player hand or crib - */ -int -plyrhand(hand, s) - CARD hand[]; - char *s; -{ - static char prompt[BUFSIZ]; - int i, j; - BOOLEAN win; - - prhand(hand, CINHAND, Playwin, FALSE); - (void) sprintf(prompt, "Your %s scores ", s); - i = scorehand(hand, turnover, CINHAND, strcmp(s, "crib") == 0, explain); - if ((j = number(0, 29, prompt)) == 19) - j = 0; - if (i != j) { - if (i < j) { - win = chkscr(&pscore, i); - msg("It's really only %d points; I get %d", i, 2); - if (!win) - win = chkscr(&cscore, 2); - } else { - win = chkscr(&pscore, j); - msg("You should have taken %d, not %d!", i, j); - } - if (explain) - msg("Explanation: %s", expl); - do_wait(); - } else - win = chkscr(&pscore, i); - return (win); -} - -/* - * comphand: - * Handle scoring and displaying the computers hand - */ -int -comphand(h, s) - CARD h[]; - char *s; -{ - int j; - - j = scorehand(h, turnover, CINHAND, strcmp(s, "crib") == 0, FALSE); - prhand(h, CINHAND, Compwin, FALSE); - msg("My %s scores %d", s, (j == 0 ? 19 : j)); - return (chkscr(&cscore, j)); -} - -/* - * chkscr: - * Add inc to scr and test for > glimit, printing on the scoring - * board while we're at it. - */ -int Lastscore[2] = {-1, -1}; - -int -chkscr(scr, inc) - int *scr, inc; -{ - BOOLEAN myturn; - - myturn = (scr == &cscore); - if (inc != 0) { - prpeg(Lastscore[myturn ? 1 : 0], '.', myturn); - Lastscore[myturn ? 1 : 0] = *scr; - *scr += inc; - prpeg(*scr, PEG, myturn); - refresh(); - } - return (*scr >= glimit); -} - -/* - * prpeg: - * Put out the peg character on the score board and put the - * score up on the board. - */ -void -prpeg(score, peg, myturn) - int score; - int peg; - BOOLEAN myturn; -{ - int y, x; - - if (!myturn) - y = SCORE_Y + 2; - else - y = SCORE_Y + 5; - - if (score <= 0 || score >= glimit) { - if (peg == '.') - peg = ' '; - if (score == 0) - x = SCORE_X + 2; - else { - x = SCORE_X + 2; - y++; - } - } else { - x = (score - 1) % 30; - if (score > 90 || (score > 30 && score <= 60)) { - y++; - x = 29 - x; - } - x += x / 5; - x += SCORE_X + 3; - } - mvaddch(y, x, peg); - mvprintw(SCORE_Y + (myturn ? 7 : 1), SCORE_X + 10, "%3d", score); -} - -/* - * cdiscard -- the computer figures out what is the best discard for - * the crib and puts the best two cards at the end - */ -void -cdiscard(mycrib) - BOOLEAN mycrib; -{ - CARD d[CARDS], h[FULLHAND], cb[2]; - int i, j, k; - int nc, ns; - long sums[15]; - static int undo1[15] = {0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 3, 3, 4}; - static int undo2[15] = {1, 2, 3, 4, 5, 2, 3, 4, 5, 3, 4, 5, 4, 5, 5}; - - makedeck(d); - nc = CARDS; - for (i = 0; i < knownum; i++) { /* get all other cards */ - cremove(known[i], d, nc--); - } - for (i = 0; i < 15; i++) - sums[i] = 0L; - ns = 0; - for (i = 0; i < (FULLHAND - 1); i++) { - cb[0] = chand[i]; - for (j = i + 1; j < FULLHAND; j++) { - cb[1] = chand[j]; - for (k = 0; k < FULLHAND; k++) - h[k] = chand[k]; - cremove(chand[i], h, FULLHAND); - cremove(chand[j], h, FULLHAND - 1); - for (k = 0; k < nc; k++) { - sums[ns] += - scorehand(h, d[k], CINHAND, TRUE, FALSE); - if (mycrib) - sums[ns] += adjust(cb, d[k]); - else - sums[ns] -= adjust(cb, d[k]); - } - ++ns; - } - } - j = 0; - for (i = 1; i < 15; i++) - if (sums[i] > sums[j]) - j = i; - for (k = 0; k < FULLHAND; k++) - h[k] = chand[k]; - cremove(h[undo1[j]], chand, FULLHAND); - cremove(h[undo2[j]], chand, FULLHAND - 1); - chand[4] = h[undo1[j]]; - chand[5] = h[undo2[j]]; -} - -/* - * returns true if some card in hand can be played without exceeding 31 - */ -int -anymove(hand, n, sum) - CARD hand[]; - int n, sum; -{ - int i, j; - - if (n < 1) - return (FALSE); - j = hand[0].rank; - for (i = 1; i < n; i++) { - if (hand[i].rank < j) - j = hand[i].rank; - } - return (sum + VAL(j) <= 31); -} - -/* - * anysumto returns the index (0 <= i < n) of the card in hand that brings - * the s up to t, or -1 if there is none - */ -int -anysumto(hand, n, s, t) - CARD hand[]; - int n, s, t; -{ - int i; - - for (i = 0; i < n; i++) { - if (s + VAL(hand[i].rank) == t) - return (i); - } - return (-1); -} - -/* - * return the number of cards in h having the given rank value - */ -int -numofval(h, n, v) - CARD h[]; - int n, v; -{ - int i, j; - - j = 0; - for (i = 0; i < n; i++) { - if (VAL(h[i].rank) == v) - ++j; - } - return (j); -} - -/* - * makeknown remembers all n cards in h for future recall - */ -void -makeknown(h, n) - CARD h[]; - int n; -{ - int i; - - for (i = 0; i < n; i++) - known[knownum++] = h[i]; -} diff --git a/games/dm/Makefile b/games/dm/Makefile deleted file mode 100644 index 827352b5203a..000000000000 --- a/games/dm/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -# @(#)Makefile 8.1 (Berkeley) 5/31/93 -# $FreeBSD$ - -# -DLOG log games -PROG= dm -MAN= dm.8 dm.conf.5 -BINGRP= games -BINMODE=2555 - -.include diff --git a/games/dm/dm.8 b/games/dm/dm.8 deleted file mode 100644 index 3c9600bd5ea8..000000000000 --- a/games/dm/dm.8 +++ /dev/null @@ -1,110 +0,0 @@ -.\" Copyright (c) 1987, 1991, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" 3. All advertising materials mentioning features or use of this software -.\" must display the following acknowledgement: -.\" This product includes software developed by the University of -.\" California, Berkeley and its contributors. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" @(#)dm.8 8.1 (Berkeley) 5/31/93 -.\" $FreeBSD$ -.\" -.Dd May 31, 1993 -.Dt DM 8 -.Os -.Sh NAME -.Nm dm -.Nd dungeon master -.Sh SYNOPSIS -.Nm ln -.Fl s Cm dm Ar game -.Sh DESCRIPTION -.Nm Dm -is a program used to regulate game playing. -.Nm Dm -expects to be invoked with the name of a game that a user wishes to play. -This is done by creating symbolic links to -.Nm , -in the directory -.Pa /usr/games -for all of the regulated games. -The actual binaries for these games should be placed in a -.Dq hidden -directory, -.Pa /usr/games/hide , -that may only be accessed by the -.Nm -program. -.Nm Dm -determines if the requested game is available and, if so, runs it. -The file -.Pa /etc/dm.conf -controls the conditions under which games may -be run. -.Pp -The file -.Pa /etc/nogames -may be used to -.Dq turn off -game playing. -If the file exists, no game playing is allowed; the contents of the file -will be displayed to any user requesting a game. -.Sh FILES -.Bl -tag -width /var/log/games.log -compact -.It Pa /etc/dm.conf -configuration file -.It Pa /etc/nogames -turns off game playing -.It Pa /usr/games/hide -directory of ``real'' binaries -.It Pa /var/log/games.log -game logging file -.El -.Sh SEE ALSO -.Xr dm.conf 5 -.Sh BUGS -Two problems result from -.Nm -running the games setuid -.Dq games . -First, all games that allow users to run -.Tn UNIX -commands should carefully -set both the real and effective user id's immediately before executing -those commands. Probably more important is that -.Nm -never be setuid -anything but -.Dq games -so that compromising a game will result only in -the user's ability to play games at will. Secondly, games which previously -had no reason to run setuid and which accessed user files may have to -be modified. -.Sh HISTORY -The -.Nm -command appeared in -.Bx 4.3 tahoe . diff --git a/games/dm/dm.c b/games/dm/dm.c deleted file mode 100644 index 5648eb169804..000000000000 --- a/games/dm/dm.c +++ /dev/null @@ -1,357 +0,0 @@ -/* - * Copyright (c) 1987, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -static const char copyright[] = -"@(#) Copyright (c) 1987, 1993\n\ - The Regents of the University of California. All rights reserved.\n"; -#endif /* not lint */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)dm.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "pathnames.h" - -static time_t now; /* current time value */ -static int priority = 0; /* priority game runs at */ -static char *game, /* requested game */ - *gametty; /* from tty? */ - -void c_day(char *, char *, char *); -void c_tty(char *); -void c_game(char *, char *, char *, char *); -void hour(int); -double load(void); -void nogamefile(void); -void play(char **); -void read_config(void); -int users(void); - -int -main(argc, argv) - int argc; - char *argv[]; -{ - char *cp; - - nogamefile(); - game = (cp = strrchr(*argv, '/')) ? ++cp : *argv; - - if (!strcmp(game, "dm")) - exit(0); - - gametty = ttyname(0); - unsetenv("TZ"); - (void)time(&now); - read_config(); -#ifdef LOG - logfile(); -#endif - play(argv); - /*NOTREACHED*/ - exit(EXIT_FAILURE); -} - -/* - * play -- - * play the game - */ -void -play(args) - char **args; -{ - char pbuf[MAXPATHLEN]; - - if (sizeof(_PATH_HIDE) + strlen(game) > sizeof(pbuf)) { - (void)fprintf(stderr, "dm: %s/%s: %s\n", _PATH_HIDE, game, - strerror(ENAMETOOLONG)); - exit(1); - } - (void)strcpy(pbuf, _PATH_HIDE); - (void)strcpy(pbuf + sizeof(_PATH_HIDE) - 1, game); - if (priority > 0) /* < 0 requires root */ - (void)setpriority(PRIO_PROCESS, 0, priority); - execv(pbuf, args); - (void)fprintf(stderr, "dm: %s: %s\n", pbuf, strerror(errno)); - exit(1); -} - -/* - * read_config -- - * read through config file, looking for key words. - */ -void -read_config() -{ - FILE *cfp; - char lbuf[BUFSIZ], f1[40], f2[40], f3[40], f4[40], f5[40]; - - if (!(cfp = fopen(_PATH_CONFIG, "r"))) - return; - while (fgets(lbuf, sizeof(lbuf), cfp)) - switch(*lbuf) { - case 'b': /* badtty */ - if (sscanf(lbuf, "%s%s", f1, f2) != 2 || - strcasecmp(f1, "badtty")) - break; - c_tty(f2); - break; - case 'g': /* game */ - if (sscanf(lbuf, "%s%s%s%s%s", - f1, f2, f3, f4, f5) != 5 || strcasecmp(f1, "game")) - break; - c_game(f2, f3, f4, f5); - break; - case 't': /* time */ - if (sscanf(lbuf, "%s%s%s%s", f1, f2, f3, f4) != 4 || - strcasecmp(f1, "time")) - break; - c_day(f2, f3, f4); - } - (void)fclose(cfp); -} - -/* - * c_day -- - * if day is today, see if okay to play - */ -void -c_day(s_day, s_start, s_stop) - char *s_day, *s_start, *s_stop; -{ - static const char *days[] = { - "sunday", "monday", "tuesday", "wednesday", - "thursday", "friday", "saturday", - }; - static struct tm *ct; - int start, stop; - - if (!ct) - ct = localtime(&now); - if (strcasecmp(s_day, days[ct->tm_wday])) - return; - if (!isdigit(*s_start) || !isdigit(*s_stop)) - return; - start = atoi(s_start); - stop = atoi(s_stop); - if (ct->tm_hour >= start && ct->tm_hour < stop) { - (void)fputs("dm: Sorry, games are not available from ", stderr); - hour(start); - (void)fputs(" to ", stderr); - hour(stop); - (void)fputs(" today.\n", stderr); - exit(0); - } -} - -/* - * c_tty -- - * decide if this tty can be used for games. - */ -void -c_tty(tty) - char *tty; -{ - static int first = 1; - static char *p_tty; - - if (first) { - p_tty = strrchr(gametty, '/'); - first = 0; - } - - if (!strcmp(gametty, tty) || (p_tty && !strcmp(p_tty, tty))) { - (void)fprintf(stderr, "dm: Sorry, you may not play games on %s.\n", gametty); - exit(0); - } -} - -/* - * c_game -- - * see if game can be played now. - */ -void -c_game(s_game, s_load, s_users, s_priority) - char *s_game, *s_load, *s_users, *s_priority; -{ - static int found; - - if (found) - return; - if (strcmp(game, s_game) && strcasecmp("default", s_game)) - return; - ++found; - if (isdigit(*s_load) && atoi(s_load) < load()) { - (void)fputs("dm: Sorry, the load average is too high right now.\n", stderr); - exit(0); - } - if (isdigit(*s_users) && atoi(s_users) <= users()) { - (void)fputs("dm: Sorry, there are too many users logged on right now.\n", stderr); - exit(0); - } - if (isdigit(*s_priority)) - priority = atoi(s_priority); -} - -/* - * load -- - * return 15 minute load average - */ -double -load() -{ - double avenrun[3]; - - if (getloadavg(avenrun, sizeof(avenrun)/sizeof(avenrun[0])) < 0) { - (void)fputs("dm: getloadavg() failed.\n", stderr); - exit(1); - } - return(avenrun[2]); -} - -/* - * users -- - * return current number of users - * todo: check idle time; if idle more than X minutes, don't - * count them. - */ -int -users() -{ - - int nusers, utmp; - struct utmp buf; - - if ((utmp = open(_PATH_UTMP, O_RDONLY, 0)) < 0) { - (void)fprintf(stderr, "dm: %s: %s\n", - _PATH_UTMP, strerror(errno)); - exit(1); - } - for (nusers = 0; read(utmp, (char *)&buf, sizeof(struct utmp)) > 0;) - if (buf.ut_name[0] != '\0') - ++nusers; - return(nusers); -} - -void -nogamefile() -{ - int fd, n; - char buf[BUFSIZ]; - - if ((fd = open(_PATH_NOGAMES, O_RDONLY, 0)) >= 0) { -#define MESG "Sorry, no games right now.\n\n" - (void)write(2, MESG, sizeof(MESG) - 1); - while ((n = read(fd, buf, sizeof(buf))) > 0) - (void)write(2, buf, n); - exit(1); - } -} - -/* - * hour -- - * print out the hour in human form - */ -void -hour(h) - int h; -{ - switch(h) { - case 0: - (void)fputs("midnight", stderr); - break; - case 12: - (void)fputs("noon", stderr); - break; - default: - if (h > 12) - (void)fprintf(stderr, "%dpm", h - 12); - else - (void)fprintf(stderr, "%dam", h); - } -} - -#ifdef LOG -/* - * logfile -- - * log play of game - */ -logfile() -{ - struct passwd *pw; - FILE *lp; - uid_t uid; - int lock_cnt; - - if (lp = fopen(_PATH_LOG, "a")) { - for (lock_cnt = 0;; ++lock_cnt) { - if (!flock(fileno(lp), LOCK_EX)) - break; - if (lock_cnt == 4) { - perror("dm: log lock"); - (void)fclose(lp); - return; - } - sleep((u_int)1); - } - if (pw = getpwuid(uid = getuid())) - fputs(pw->pw_name, lp); - else - fprintf(lp, "%u", uid); - fprintf(lp, "\t%s\t%s\t%s", game, gametty, ctime(&now)); - (void)fclose(lp); - (void)flock(fileno(lp), LOCK_UN); - } -} -#endif /* LOG */ diff --git a/games/dm/dm.conf.5 b/games/dm/dm.conf.5 deleted file mode 100644 index 69473994d052..000000000000 --- a/games/dm/dm.conf.5 +++ /dev/null @@ -1,100 +0,0 @@ -.\" Copyright (c) 1988, 1991, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" 3. All advertising materials mentioning features or use of this software -.\" must display the following acknowledgement: -.\" This product includes software developed by the University of -.\" California, Berkeley and its contributors. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" @(#)dm.conf.5 8.1 (Berkeley) 5/31/93 -.\" $FreeBSD$ -.\" -.Dd May 31, 1993 -.Dt DM.CONF 5 -.Os -.Sh NAME -.Nm dm.conf -.Nd \&dm configuration file -.Sh DESCRIPTION -The -.Nm -file -is the configuration file for the -.Xr \&dm 8 -program. -It consists of lines beginning with one of three keywords, ``badtty'', -``game'', and ``time''. All other lines are ignored. -.Pp -Any tty listed after the keyword ``badtty'' may not have games played on -it. -Entries consist of two white-space separated fields: the string -``badtty'' and the ttyname as returned by -.Xr ttyname 3 . -For example, -to keep the uucp dialout, ``tty19'', from being used for games, the -entry would be: -.Bd -literal -offset indent -badtty /dev/tty19 -.Ed -.Pp -Any day/hour combination listed after the keyword ``time'' will disallow -games during those hours. Entries consist of four white-space separated -fields: the string ``time'', the unabbreviated day of the week and the -beginning and ending time of a period of the day when games may not be -played. The time fields are in a 0 based, 24-hour clock. For example, -the following entry allows games playing before 8AM and after 5PM on -Mondays. -.Bd -literal -offset indent -time Monday 8 17 -.Ed -.Pp -Any game listed after the keyword ``game'' will set parameters for a specific -game. Entries consist of five white-space separated fields: the keyword -``game'', the name of a game, the highest system load average at which the -game may be played, the maximum users allowed if the game is to be played, -and the priority at which the game is to be run. Any of these fields may -start with a non-numeric character, resulting in no game limitation or -priority based on that field. The game "default" controls the settings for -any game not otherwise listed, and must be the last ``game'' entry in the -file. Priorities may not be negative. For example, the following entries -limits the game ``hack'' to running only when the system has 10 or less -users and a load average of 5 or less; all other games may be run any time -the system has 15 or less users. -.Bd -literal -offset indent -game hack 5 10 * -game default * 15 * -.Ed -.Sh FILES -.Bl -tag -width /etc/dm.conf -compact -.It Pa /etc/dm.conf -The -.Xr \&dm 8 -configuration file. -.El -.Sh SEE ALSO -.Xr setpriority 2 , -.Xr ttyname 3 , -.Xr dm 8 diff --git a/games/dm/pathnames.h b/games/dm/pathnames.h deleted file mode 100644 index c54fef9b98da..000000000000 --- a/games/dm/pathnames.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 1989, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)pathnames.h 8.1 (Berkeley) 5/31/93 - */ - -#define _PATH_CONFIG "/etc/dm.conf" -#define _PATH_HIDE "/usr/games/hide/" -#define _PATH_LOG "/var/log/games.log" -#define _PATH_NOGAMES "/etc/nogames" diff --git a/games/fish/Makefile b/games/fish/Makefile deleted file mode 100644 index d2b503547ee8..000000000000 --- a/games/fish/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -# @(#)Makefile 8.1 (Berkeley) 5/31/93 -# $FreeBSD$ - -PROG= fish -FILES= fish.instr -MAN= fish.6 -HIDEGAME=hidegame - -.include diff --git a/games/fish/fish.6 b/games/fish/fish.6 deleted file mode 100644 index fd4d682611fe..000000000000 --- a/games/fish/fish.6 +++ /dev/null @@ -1,85 +0,0 @@ -.\" Copyright (c) 1990, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" 3. All advertising materials mentioning features or use of this software -.\" must display the following acknowledgement: -.\" This product includes software developed by the University of -.\" California, Berkeley and its contributors. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" @(#)fish.6 8.1 (Berkeley) 5/31/93 -.\" $FreeBSD$ -.\" -.TH FISH 6 "May 31, 1993" -.UC 4 -.SH NAME -fish \- play ``Go Fish'' -.SH SYNOPSIS -.ft B -fish [\-p] -.ft R -.SH DESCRIPTION -.I Fish -is the game -.IR "Go Fish" , -a traditional children's card game. -.PP -The computer deals the player and itself seven cards, and places -the rest of the deck face-down (figuratively). -The object of the game is to collect ``books'', or all of the members -of a single rank. -For example, collecting four 2's would give the player a ``book of -2's''. -.PP -The options are as follows: -.TP -\-p -Professional mode. -.PP -The computer makes a random decision as to who gets to start the -game, and then the computer and player take turns asking each other -for cards of a specified rank. -If the asked player has any cards of the requested rank, they give -them up to the asking player. -A player must have at least one of the cards of the rank they request -in their hand. -When a player asks for a rank of which the other player has no -cards, the asker is told to ``Go Fish!''. -Then, the asker draws a card from the non-dealt cards. -If they draw the card they asked for, they continue their turn, asking -for more ranks from the other player. -Otherwise, the other player gets a turn. -.PP -When a player completes a book, either by getting cards from the -other player or drawing from the deck, they set those cards aside and -the rank is no longer in play. -.PP -The game ends when either player no longer has any cards in their hand. -The player with the most books wins. -.PP -.I Fish -provides instructions as to what input it accepts. -.SH BUGS -The computer cheats only rarely. diff --git a/games/fish/fish.c b/games/fish/fish.c deleted file mode 100644 index 2a540226037f..000000000000 --- a/games/fish/fish.c +++ /dev/null @@ -1,466 +0,0 @@ -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Muffy Barkocy. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -static const char copyright[] = -"@(#) Copyright (c) 1990, 1993\n\ - The Regents of the University of California. All rights reserved.\n"; -#endif /* not lint */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)fish.c 8.1 (Berkeley) 5/31/93"; -#endif -static const char rcsid[] = - "$FreeBSD$"; -#endif /* not lint */ - -#include -#include -#include -#include -#include -#include -#include -#include "pathnames.h" - -#define RANKS 13 -#define HANDSIZE 7 -#define CARDS 4 - -#define USER 1 -#define COMPUTER 0 -#define OTHER(a) (1 - (a)) - -char *cards[] = { - "A", "2", "3", "4", "5", "6", "7", - "8", "9", "10", "J", "Q", "K", NULL, -}; -#define PRC(card) (void)printf(" %s", cards[card]) - -int promode; -int asked[RANKS], comphand[RANKS], deck[RANKS]; -int userasked[RANKS], userhand[RANKS]; - -void chkwinner(int player, int *hand); -int compmove(void); -int countbooks(int *hand); -int countcards(int *hand); -int drawcard(int player, int *hand); -int gofish(int askedfor, int player, int *hand); -void goodmove(int player, int move, int *hand, int *opphand); -void init(void); -void instructions(void); -int nrandom(int n); -void printhand(int *hand); -void printplayer(int player); -int promove(void); -void usage(void); -int usermove(void); - -int -main(argc, argv) - int argc; - char **argv; -{ - int ch, move; - - while ((ch = getopt(argc, argv, "p")) != -1) - switch(ch) { - case 'p': - promode = 1; - break; - case '?': - default: - (void)fprintf(stderr, "usage: fish [-p]\n"); - exit(1); - } - - srandomdev(); - instructions(); - init(); - - if (nrandom(2) == 1) { - printplayer(COMPUTER); - (void)printf("get to start.\n"); - goto istart; - } - printplayer(USER); - (void)printf("get to start.\n"); - - for (;;) { - move = usermove(); - if (!comphand[move]) { - if (gofish(move, USER, userhand)) - continue; - } else { - goodmove(USER, move, userhand, comphand); - continue; - } - -istart: for (;;) { - move = compmove(); - if (!userhand[move]) { - if (!gofish(move, COMPUTER, comphand)) - break; - } else - goodmove(COMPUTER, move, comphand, userhand); - } - } - /* NOTREACHED */ - return(EXIT_FAILURE); -} - -int -usermove() -{ - int n; - char **p; - char buf[256]; - - (void)printf("\nYour hand is:"); - printhand(userhand); - - for (;;) { - (void)printf("You ask me for: "); - (void)fflush(stdout); - if (fgets(buf, sizeof(buf), stdin) == NULL) - exit(0); - if (buf[0] == '\0') - continue; - if (buf[0] == '\n') { - (void)printf("%d cards in my hand, %d in the pool.\n", - countcards(comphand), countcards(deck)); - (void)printf("My books:"); - (void)countbooks(comphand); - continue; - } - buf[strlen(buf) - 1] = '\0'; - if (!strcasecmp(buf, "p") && !promode) { - promode = 1; - (void)printf("Entering pro mode.\n"); - continue; - } - if (!strcasecmp(buf, "quit")) - exit(0); - for (p = cards; *p; ++p) - if (!strcasecmp(*p, buf)) - break; - if (!*p) { - (void)printf("I don't understand!\n"); - continue; - } - n = p - cards; - if (userhand[n]) { - userasked[n] = 1; - return(n); - } - if (nrandom(3) == 1) - (void)printf("You don't have any of those!\n"); - else - (void)printf("You don't have any %s's!\n", cards[n]); - if (nrandom(4) == 1) - (void)printf("No cheating!\n"); - (void)printf("Guess again.\n"); - } - /* NOTREACHED */ -} - -int -compmove() -{ - static int lmove; - - if (promode) - lmove = promove(); - else { - do { - lmove = (lmove + 1) % RANKS; - } while (!comphand[lmove] || comphand[lmove] == CARDS); - } - asked[lmove] = 1; - - (void)printf("I ask you for: %s.\n", cards[lmove]); - return(lmove); -} - -int -promove() -{ - int i, max; - - for (i = 0; i < RANKS; ++i) - if (userasked[i] && - comphand[i] > 0 && comphand[i] < CARDS) { - userasked[i] = 0; - return(i); - } - if (nrandom(3) == 1) { - for (i = 0;; ++i) - if (comphand[i] && comphand[i] != CARDS) { - max = i; - break; - } - while (++i < RANKS) - if (comphand[i] != CARDS && - comphand[i] > comphand[max]) - max = i; - return(max); - } - if (nrandom(1024) == 0723) { - for (i = 0; i < RANKS; ++i) - if (userhand[i] && comphand[i]) - return(i); - } - for (;;) { - for (i = 0; i < RANKS; ++i) - if (comphand[i] && comphand[i] != CARDS && - !asked[i]) - return(i); - for (i = 0; i < RANKS; ++i) - asked[i] = 0; - } - /* NOTREACHED */ -} - -int -drawcard(player, hand) - int player; - int *hand; -{ - int card; - - while (deck[card = nrandom(RANKS)] == 0); - ++hand[card]; - --deck[card]; - if (player == USER || hand[card] == CARDS) { - printplayer(player); - (void)printf("drew %s", cards[card]); - if (hand[card] == CARDS) { - (void)printf(" and made a book of %s's!\n", - cards[card]); - chkwinner(player, hand); - } else - (void)printf(".\n"); - } - return(card); -} - -int -gofish(askedfor, player, hand) - int askedfor, player; - int *hand; -{ - printplayer(OTHER(player)); - (void)printf("say \"GO FISH!\"\n"); - if (askedfor == drawcard(player, hand)) { - printplayer(player); - (void)printf("drew the guess!\n"); - printplayer(player); - (void)printf("get to ask again!\n"); - return(1); - } - return(0); -} - -void -goodmove(player, move, hand, opphand) - int player, move; - int *hand, *opphand; -{ - printplayer(OTHER(player)); - (void)printf("have %d %s%s.\n", - opphand[move], cards[move], opphand[move] == 1 ? "": "'s"); - - hand[move] += opphand[move]; - opphand[move] = 0; - - if (hand[move] == CARDS) { - printplayer(player); - (void)printf("made a book of %s's!\n", cards[move]); - chkwinner(player, hand); - } - - chkwinner(OTHER(player), opphand); - - printplayer(player); - (void)printf("get another guess!\n"); -} - -void -chkwinner(player, hand) - int player; - int *hand; -{ - int cb, i, ub; - - for (i = 0; i < RANKS; ++i) - if (hand[i] > 0 && hand[i] < CARDS) - return; - printplayer(player); - (void)printf("don't have any more cards!\n"); - (void)printf("My books:"); - cb = countbooks(comphand); - (void)printf("Your books:"); - ub = countbooks(userhand); - (void)printf("\nI have %d, you have %d.\n", cb, ub); - if (ub > cb) { - (void)printf("\nYou win!!!\n"); - if (nrandom(1024) == 0723) - (void)printf("Cheater, cheater, pumpkin eater!\n"); - } else if (cb > ub) { - (void)printf("\nI win!!!\n"); - if (nrandom(1024) == 0723) - (void)printf("Hah! Stupid peasant!\n"); - } else - (void)printf("\nTie!\n"); - exit(0); -} - -void -printplayer(player) - int player; -{ - switch (player) { - case COMPUTER: - (void)printf("I "); - break; - case USER: - (void)printf("You "); - break; - } -} - -void -printhand(hand) - int *hand; -{ - int book, i, j; - - for (book = i = 0; i < RANKS; i++) - if (hand[i] < CARDS) - for (j = hand[i]; --j >= 0;) - PRC(i); - else - ++book; - if (book) { - (void)printf(" + Book%s of", book > 1 ? "s" : ""); - for (i = 0; i < RANKS; i++) - if (hand[i] == CARDS) - PRC(i); - } - (void)putchar('\n'); -} - -int -countcards(hand) - int *hand; -{ - int i, count; - - for (count = i = 0; i < RANKS; i++) - count += *hand++; - return(count); -} - -int -countbooks(hand) - int *hand; -{ - int i, count; - - for (count = i = 0; i < RANKS; i++) - if (hand[i] == CARDS) { - ++count; - PRC(i); - } - if (!count) - (void)printf(" none"); - (void)putchar('\n'); - return(count); -} - -void -init() -{ - int i, rank; - - for (i = 0; i < RANKS; ++i) - deck[i] = CARDS; - for (i = 0; i < HANDSIZE; ++i) { - while (!deck[rank = nrandom(RANKS)]); - ++userhand[rank]; - --deck[rank]; - } - for (i = 0; i < HANDSIZE; ++i) { - while (!deck[rank = nrandom(RANKS)]); - ++comphand[rank]; - --deck[rank]; - } -} - -int -nrandom(n) - int n; -{ - - return((int)random() % n); -} - -void -instructions() -{ - int input; - char buf[1024]; - - (void)printf("Would you like instructions (y or n)? "); - input = getchar(); - while (getchar() != '\n'); - if (input != 'y') - return; - - (void)sprintf(buf, "%s %s", _PATH_MORE, _PATH_INSTR); - (void)system(buf); - (void)printf("Hit return to continue...\n"); - while ((input = getchar()) != EOF && input != '\n'); -} - -void -usage() -{ - (void)fprintf(stderr, "usage: fish [-p]\n"); - exit(1); -} diff --git a/games/fish/fish.instr b/games/fish/fish.instr deleted file mode 100644 index b7e87a0a7b52..000000000000 --- a/games/fish/fish.instr +++ /dev/null @@ -1,29 +0,0 @@ -This is the traditional children's card game "Go Fish". We each get seven -cards, and the rest of the deck is kept to be drawn from later. The -object of the game is to collect "books", or all of the cards of a single -value. For example, getting four 2's would give you a "book of 2's". - -We take turns asking each other for cards, but you can't ask me for a card -value if you don't have one of them in your hand! If I have any cards of -the value you ask for, I have to give them to you. As long as I have one -of the cards you ask for, you get to keep asking. If you ask me for a -card of which I don't have any, then I'll tell you to "Go Fish!" This -means that you draw a card from the deck. If you draw the card you asked -me for, you get to keep asking me for cards. If not, it's my turn and I ask -you for a card. - -Sometimes you get to ask first, sometimes I do. I'll tell you when it's -your turn to move, I'll draw cards from the deck for you, and I'll tell -you what you have in your hand. (Don't worry, I don't look at your hand -when I'm trying to decide what card to ask for, honest!) - -Your input can be a card name ("A", "2", "3", "4", "5", "6", "7", "8", -"9", "10", "J", "Q" or "K") or the letter "p", or "quit". The letter "p" -makes my game much smarter, and the line "quit" stops the game. Just -hitting the carriage return key displays how many cards I have in my hand, -how many are left in the deck, and which books I've gotten. - -Normally, the game stops when one of us runs out of cards, and the winner -is whoever has the most books! - -Good luck! diff --git a/games/fish/pathnames.h b/games/fish/pathnames.h deleted file mode 100644 index 89b4bd737e74..000000000000 --- a/games/fish/pathnames.h +++ /dev/null @@ -1,37 +0,0 @@ -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)pathnames.h 8.1 (Berkeley) 5/31/93 - */ - -#define _PATH_INSTR "/usr/share/games/fish.instr" -#define _PATH_MORE "/usr/bin/more" diff --git a/games/hack/COPYRIGHT b/games/hack/COPYRIGHT deleted file mode 100644 index 71a94494a8a0..000000000000 --- a/games/hack/COPYRIGHT +++ /dev/null @@ -1,6 +0,0 @@ -This entire subtree is copyright the Stichting Mathematisch Centrum. -The following copyright notice applies to all files found here. None of -these files contain AT&T proprietary source code. -_____________________________________________________________________________ - -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ diff --git a/games/hack/Makefile b/games/hack/Makefile deleted file mode 100644 index eaf19e50c457..000000000000 --- a/games/hack/Makefile +++ /dev/null @@ -1,46 +0,0 @@ -# @(#)Makefile 8.1 (Berkeley) 5/31/93 -# $FreeBSD$ - -PROG= hack -SRCS= alloc.c hack.Decl.c hack.apply.c hack.bones.c hack.c hack.cmd.c \ - hack.do.c hack.do_name.c hack.do_wear.c hack.dog.c hack.eat.c \ - hack.end.c hack.engrave.c hack.fight.c hack.invent.c hack.ioctl.c \ - hack.lev.c hack.main.c hack.makemon.c hack.mhitu.c hack.mklev.c \ - hack.mkmaze.c hack.mkobj.c hack.mkshop.c hack.mon.c hack.monst.c \ - hack.o_init.c hack.objnam.c hack.options.c hack.pager.c hack.potion.c \ - hack.pri.c hack.read.c hack.rip.c hack.rumors.c hack.save.c \ - hack.search.c hack.shk.c hack.shknam.c hack.steal.c hack.termcap.c \ - hack.timeout.c hack.topl.c hack.track.c hack.trap.c hack.tty.c \ - hack.u_init.c hack.unix.c hack.vault.c hack.version.c hack.wield.c \ - hack.wizard.c hack.worm.c hack.worn.c hack.zap.c rnd.c \ - hack.onames.h -MAN= hack.6 -DPADD= ${LIBTERMCAP} ${LIBCOMPAT} -LDADD= -ltermcap -lcompat -CFLAGS+= -fwritable-strings -I${.CURDIR} -I. -FILES= rumors help hh data -FILESMODE_rumors= 440 -FILESGRP= ${BINGRP} -FILESDIR= /var/games/hackdir -HIDEGAME=hidegame -CLEANFILES=hack.onames.h makedefs makedefs.o - -build-tools: makedefs - -hack.onames.h: makedefs def.objects.h - ./makedefs ${.CURDIR}/def.objects.h > hack.onames.h - -makedefs: makedefs.o - ${CC} -static ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} - -beforeinstall: - ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} /dev/null \ - ${DESTDIR}/var/games/hackdir/perm -.if !exists(${DESTDIR}/var/games/hackdir/record) - ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 460 /dev/null \ - ${DESTDIR}/var/games/hackdir/record -.endif -# rm -f ${DESTDIR}/var/games/hackdir/bones* \ -# ${DESTDIR}/var/games/hackdir/save/* - -.include diff --git a/games/hack/Makequest b/games/hack/Makequest deleted file mode 100644 index 9271c2841c92..000000000000 --- a/games/hack/Makequest +++ /dev/null @@ -1,196 +0,0 @@ -# Hack or Quest Makefile. - -# on some systems the termcap library is in -ltermcap -TERMLIB = -ltermlib - - -# make hack -GAME = quest -GAMEDIR = /usr/games/lib/questdir -CFLAGS = -g -DQUEST -HACKCSRC = hack.Decl.c\ - hack.apply.c hack.bones.c hack.c hack.cmd.c hack.do.c\ - hack.do_name.c hack.do_wear.c hack.dog.c hack.eat.c hack.end.c\ - hack.engrave.c hack.fight.c hack.invent.c hack.ioctl.c\ - hack.lev.c hack.main.c hack.makemon.c hack.mhitu.c\ - hack.mklev.c hack.mkmaze.c hack.mkobj.c hack.mkshop.c\ - hack.mon.c hack.monst.c hack.o_init.c hack.objnam.c\ - hack.options.c hack.pager.c hack.potion.c hack.pri.c\ - hack.read.c hack.rip.c hack.rumors.c hack.save.c\ - hack.search.c hack.shk.c hack.shknam.c hack.steal.c\ - hack.termcap.c hack.timeout.c hack.topl.c\ - hack.track.c hack.trap.c hack.tty.c hack.unix.c\ - hack.u_init.c hack.vault.c\ - hack.wield.c hack.wizard.c hack.worm.c hack.worn.c hack.zap.c\ - hack.version.c rnd.c alloc.c - -CSOURCES = $(HACKCSRC) makedefs.c - -HSOURCES = hack.h hack.mfndpos.h config.h\ - def.edog.h def.eshk.h def.flag.h def.func_tab.h def.gold.h\ - def.mkroom.h\ - def.monst.h def.obj.h def.objclass.h def.objects.h\ - def.permonst.h def.rm.h def.trap.h def.wseg.h - -SOURCES = $(CSOURCES) $(HSOURCES) - -AUX = data help hh rumors hack.6 hack.sh - -DISTR = $(SOURCES) $(AUX) READ_ME Makefile date.h hack.onames.h - -HOBJ = hack.Decl.o hack.apply.o hack.bones.o hack.o hack.cmd.o hack.do.o\ - hack.do_name.o hack.do_wear.o hack.dog.o hack.eat.o hack.end.o\ - hack.engrave.o hack.fight.o hack.invent.o hack.ioctl.o\ - hack.lev.o hack.main.o hack.makemon.o hack.mhitu.o hack.mklev.o\ - hack.mkmaze.o hack.mkobj.o hack.mkshop.o hack.mon.o\ - hack.monst.o hack.o_init.o hack.objnam.o hack.options.o\ - hack.pager.o hack.potion.o hack.pri.o\ - hack.read.o hack.rip.o hack.rumors.o hack.save.o\ - hack.search.o hack.shk.o hack.shknam.o hack.steal.o\ - hack.termcap.o hack.timeout.o hack.topl.o\ - hack.track.o hack.trap.o\ - hack.tty.o hack.unix.o hack.u_init.o hack.vault.o hack.wield.o\ - hack.wizard.o hack.worm.o hack.worn.o hack.zap.o\ - hack.version.o rnd.o alloc.o - -$(GAME): $(HOBJ) Makefile - @echo "Loading ..." - @ld -X -o $(GAME) /lib/crt0.o $(HOBJ) $(TERMLIB) -lc - -all: $(GAME) lint - @echo "Done." - -makedefs: makedefs.c - cc -o makedefs makedefs.c - - -hack.onames.h: makedefs def.objects.h - makedefs > hack.onames.h - -lint: -# lint cannot have -p here because (i) capitals are meaningful: -# [Ww]izard, (ii) identifiers may coincide in the first six places: -# doweararm() versus dowearring(). -# _flsbuf comes from , a bug in the system libraries. - @echo lint -axbh -DLINT ... - @lint -axbh -DLINT $(HACKCSRC) | sed '/_flsbuf/d' - - -diff: - @- for i in $(SOURCES) $(AUX) ; do \ - cmp -s $$i $D/$$i || \ - ( echo diff $D/$$i $$i ; diff $D/$$i $$i ; echo ) ; done - -distribution: Makefile - @- for i in READ_ME $(SOURCES) $(AUX) Makefile date.h hack.onames.h\ - ; do \ - cmp -s $$i $D/$$i || \ - ( echo cp $$i $D ; cp $$i $D ) ; done -# the distribution directory also contains the empty files perm and record. - - -install: - rm -f $(GAMEDIR)/$(GAME) - cp $(GAME) $(GAMEDIR)/$(GAME) - chmod 04511 $(GAMEDIR)/$(GAME) - rm -f $(GAMEDIR)/bones* -# cp hack.6 /usr/man/man6 - -clean: - rm -f *.o - - -depend: -# For the moment we are lazy and disregard /usr/include files because -# the sources contain them conditionally. Perhaps we should use cpp. -# ( /bin/grep '^#[ ]*include' $$i | sed -n \ -# -e 's,<\(.*\)>,"/usr/include/\1",' \ -# - for i in ${CSOURCES}; do \ - ( /bin/grep '^#[ ]*include[ ]*"' $$i | sed -n \ - -e 's/[^"]*"\([^"]*\)".*/\1/' \ - -e H -e '$$g' -e '$$s/\n/ /g' \ - -e '$$s/.*/'$$i': &/' -e '$$s/\.c:/.o:/p' \ - >> makedep); done - for i in ${HSOURCES}; do \ - ( /bin/grep '^#[ ]*include[ ]*"' $$i | sed -n \ - -e 's/[^"]*"\([^"]*\)".*/\1/' \ - -e H -e '$$g' -e '$$s/\n/ /g' \ - -e '$$s/.*/'$$i': &\ - touch '$$i/p \ - >> makedep); done - @echo '/^# DO NOT DELETE THIS LINE/+2,$$d' >eddep - @echo '$$r makedep' >>eddep - @echo 'w' >>eddep - @cp Makefile Makefile.bak - ed - Makefile < eddep - @rm -f eddep makedep - @echo '# DEPENDENCIES MUST END AT END OF FILE' >> Makefile - @echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY' >> Makefile - @echo '# see make depend above' >> Makefile - - diff Makefile Makefile.bak - @rm -f Makefile.bak - -# DO NOT DELETE THIS LINE - -hack.Decl.o: hack.h def.mkroom.h -hack.apply.o: hack.h def.edog.h def.mkroom.h -hack.bones.o: hack.h -hack.o: hack.h -hack.cmd.o: hack.h def.func_tab.h -hack.do.o: hack.h -hack.do_name.o: hack.h -hack.do_wear.o: hack.h -hack.dog.o: hack.h hack.mfndpos.h def.edog.h def.mkroom.h -hack.eat.o: hack.h -hack.end.o: hack.h -hack.engrave.o: hack.h -hack.fight.o: hack.h -hack.invent.o: hack.h def.wseg.h -hack.ioctl.o: config.h -hack.lev.o: hack.h def.mkroom.h def.wseg.h -hack.main.o: hack.h -hack.makemon.o: hack.h -hack.mhitu.o: hack.h -hack.mklev.o: hack.h def.mkroom.h -hack.mkmaze.o: hack.h def.mkroom.h -hack.mkobj.o: hack.h -hack.mkshop.o: hack.h def.mkroom.h def.eshk.h -hack.mon.o: hack.h hack.mfndpos.h -hack.monst.o: hack.h def.eshk.h -hack.o_init.o: config.h def.objects.h hack.onames.h -hack.objnam.o: hack.h -hack.options.o: config.h hack.h -hack.pager.o: hack.h -hack.potion.o: hack.h -hack.pri.o: hack.h def.wseg.h -hack.read.o: hack.h -hack.rip.o: hack.h -hack.rumors.o: hack.h -hack.save.o: hack.h -hack.search.o: hack.h -hack.shk.o: hack.h hack.mfndpos.h def.mkroom.h def.eshk.h -hack.shknam.o: hack.h -hack.steal.o: hack.h -hack.termcap.o: config.h def.flag.h -hack.timeout.o: hack.h -hack.topl.o: hack.h -hack.track.o: hack.h -hack.trap.o: hack.h def.mkroom.h -hack.tty.o: hack.h -hack.unix.o: hack.h def.mkroom.h -hack.u_init.o: hack.h -hack.vault.o: hack.h def.mkroom.h -hack.wield.o: hack.h -hack.wizard.o: hack.h -hack.worm.o: hack.h def.wseg.h -hack.worn.o: hack.h -hack.zap.o: hack.h -hack.version.o: date.h -hack.h: config.h def.objclass.h def.monst.h def.gold.h def.trap.h def.obj.h def.flag.h def.rm.h def.permonst.h hack.onames.h - touch hack.h -def.objects.h: config.h def.objclass.h - touch def.objects.h -# DEPENDENCIES MUST END AT END OF FILE -# IF YOU PUT STUFF HERE IT WILL GO AWAY -# see make depend above diff --git a/games/hack/OWNER b/games/hack/OWNER deleted file mode 100644 index be2d1e530444..000000000000 --- a/games/hack/OWNER +++ /dev/null @@ -1,2 +0,0 @@ -Andries Brouwer -mcvax!aeb diff --git a/games/hack/Original_READ_ME b/games/hack/Original_READ_ME deleted file mode 100644 index 9d2070be09e4..000000000000 --- a/games/hack/Original_READ_ME +++ /dev/null @@ -1,61 +0,0 @@ -This is export hack, my first semester programming project. - -To set it up for your system, you will have to do the following: - 1: create a hack uid, to own the top ten list, etc. - 2: create a hack directory "/usr/lib/game/hack" is the default. - 2.5: make the directory 700 mode. /* sav files go in there...*/ - 3: modify hack.main.c to use the new directory. - 4: modify hack.main.c so it uses the new hack gid. Gid accounts can -go into magic mode without the password, can get cores with ^G, etc. -(make sure gid isn't checked anywhere else...) - 5: recompile hack. - 6: put it in games after making it set-uid hack. - 8: fix the bugs I undobtedly left in it. - 9: tell me what you think of it. - - Hack uses the UCB file /etc/termcap to get your terminal escape codes. -If you don't use it, you will have to make extensive changes to hack.pri.c - -If you find any bugs (That you think I don't know about), or have any -awesome new changes (Like a better save (One that works!)), or have ANY -questions, write me - Jay Fenlason - 29 East St. - Sudbury Mass. - 01776 - -or call me at (617) 443-5036. Since I have both a modem and a teen-age -sister, Good Luck. - - -Hack is split (roughly) into several source files that do different things. -I have tried to fit all the procedures having to do with a certain segment -of the game into a single file, but the job is not the best in the world. -The rough splits are: - -hack.c General random stuff and things I never got around to moving. -hack.main.c main() and other random procedures, also the lock file stuff. -hack.mon.c Monsters, moving, attacking, etc. -hack.do.c drink, eat, read, wield, save, etc. -hack.do1.c zap, wear, remove, etc... -hack.pri.c stuff having to do with the screen, most of the terminal - independant stuff is in here. -hack.lev.c temp files and calling of mklev. - -Because of the peculiar restraints on our system, I make mklev (create -a level) a separate procedure execd by hack when needed. The source for -mklev is (Naturaly) mklev.c. You may want to put mklev back into hack. -Good luck. - -Most of hack was written by me, with help from - Kenny Woodland (KW) (general random things including - the original BUZZ()) - Mike Thome (MT) (The original chamelian) - and Jon Payne (JP) (The original lock file kludge and - the massive CURS()) - -This entire program would not have been possible without the SFSU Logo -Workshop. I am eternally grateful to all of our students (Especially K.L.), -without whom I would never have seen Rogue. I am especially grateful to -Mike Clancy, without whose generous help I would never have gotten to play -ROGUE. diff --git a/games/hack/READ_ME b/games/hack/READ_ME deleted file mode 100644 index cfe6ca2fe3eb..000000000000 --- a/games/hack/READ_ME +++ /dev/null @@ -1,92 +0,0 @@ -Hack is a display oriented dungeons & dragons - like game. -Both display and command structure resemble rogue. -(For a game with the same structure but entirely different display - -a real cave instead of dull rectangles - try Quest) - -Hack was originally written by Jay Fenlason (at lincolnsudbury: - 29 East St., Sudbury Mass., 01776) with help from - Kenny Woodland, Mike Thome and Jon Payne. -Basically it was an implementation of Rogue, however, with 52+ instead of 26 - monster types. -The current version is more than thrice as large (with such new features as - the dog, the long worms, the shops, etc.) and almost entirely rewritten - (only the display routines are the original ones - I must rewrite these - too one day; especially when you are blind strange things still happen). - -Files for hack: - hack The actual game - record Top 100 list (just start with an empty file) - news Tells about recent changes in hack, or bugs found ... - (Just start with no news file.) - data Auxiliary file used by hack to give you the names - and sometimes some more information on the - objects and monsters. - help Introductory information (no doubt outdated). - hh Compactified version of help. - perm An empty file used for locking purposes. - rumors Texts for fortune cookies. - (Some of these contain information on the game, - others are just plain stupid. Additional rumors - are appreciated.) - hack.sh A shell script. - (We have hack.sh in /usr/games/hack and - hack in /usr/games/lib/hackdir/hack and all the other - hack stuff in /usr/games/lib/hackdir - perhaps this - will make the script clear. - There is no need for you to use it.) - READ_ME This file. - Original_READ_ME Jay Fenlason's READ_ME - -System files used: - /etc/termcap Used in conjunction with the environment variable - $TERM. - /bin/cat - /usr/ucb/more - /bin/sh Used when $SHELL is undefined. - -How to install hack: -0. Compile the sources. Perhaps you should first look at the file config.h - and define BSD if you are on a BSDtype system, - define STUPID if your C-compiler chokes on complicated expressions. - Make sure schar and uchar represent signed and unsigned types. - If your C compiler doesnt allow initialization of bit fields - change Bitfield. When config.h looks reasonable, say 'make'. - (Perhaps you have to change TERMLIB in the makefile.) -1. If it didnt exist already, introduce a loginname `play' . -2. The program hack resides in a directory so that it is executable - for everybody and is suid play: - ---s--s--x 1 play 206848 Apr 3 00:17 hack - Perhaps you wish to restrict playing to certain hours, or have games - running under nice; in that case you might write a program play.c - such that the program play is suid play and executable for everybody - while all the games in /usr/games are readable or executable for - play only; all the program play does is asking for the name of a game, - checking that time-of-day and system load do not forbid playing, - and then executing the game. Thus: - -r-sr-sr-x 1 play 13312 May 24 12:52 play - ---x------ 1 play 206848 Apr 3 00:17 hack - If you are worried about security you might let play do - chroot("/usr/games") so that no player can get access to the rest - of the system via shell escapes and the likes. - If you #define SECURE in config.h then hack will not setuid(getuid()) - before executing a chdir(). Hack will always do setuid(getuid()) with - a fork. If you do not define UNIX then hack will not fork. -3. The rest of the stuff belonging to hack sits in a subdirectory hackdir - (on our system /usr/games/lib/hackdir) with modes - drwx------ 3 play 1024 Aug 9 09:03 hackdir - Here all the temporary files will be created (with names like xlock.17 - or user.5). -4. If you are not really short on file space, creating a subdirectory - hackdir/save (modes again drwx------) will enable users to save their - unfinished games. - -The program hack is called -$ hack [-d hackdir] [maxnrofplayers] -(for playing) or -$ hack [-d hackdir] -s [listofusers | limit | all] -(for seeing part of the scorelist). -The shell file hack (in this kit called hack.sh) takes care of -calling hack with the right arguments. - -Send complaints, bug reports, suggestions for improvements to -mcvax!aeb - in real life Andries Brouwer. diff --git a/games/hack/alloc.c b/games/hack/alloc.c deleted file mode 100644 index 13379f6408a6..000000000000 --- a/games/hack/alloc.c +++ /dev/null @@ -1,48 +0,0 @@ -/* alloc.c - version 1.0.2 */ -/* $FreeBSD$ */ - -#include - -#ifdef LINT - -/* - a ridiculous definition, suppressing - "possible pointer alignment problem" for (long *) malloc() - "enlarg defined but never used" - "ftell defined (in ) but never used" - from lint -*/ -#include -long * -alloc(n) unsigned n; { -long dummy = ftell(stderr); - if(n) dummy = 0; /* make sure arg is used */ - return(&dummy); -} - -#else - -long * -alloc(lth) -unsigned lth; -{ - char *ptr; - - if(!(ptr = malloc(lth))) - panic("Cannot get %d bytes", lth); - return((long *) ptr); -} - -long * -enlarge(ptr,lth) -char *ptr; -unsigned lth; -{ - char *nptr; - - if(!(nptr = realloc(ptr,lth))) - panic("Cannot reallocate %d bytes", lth); - return((long *) nptr); -} - -#endif /* LINT */ diff --git a/games/hack/config.h b/games/hack/config.h deleted file mode 100644 index dd25cfab1a79..000000000000 --- a/games/hack/config.h +++ /dev/null @@ -1,140 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* config.h - version 1.0.3 */ -/* $FreeBSD$ */ - -#include "pathnames.h" - -#ifndef CONFIG /* make sure the compiler doesnt see the typedefs twice */ - -#define CONFIG -#define UNIX /* delete if no fork(), exec() available */ -#define CHDIR /* delete if no chdir() available */ - -/* - * Some include files are in a different place under SYSV - * BSD SYSV - * - * - * - * Some routines are called differently - * index strchr - * rindex strrchr - * Also, the code for suspend and various ioctls is only given for BSD4.2 - * (I do not have access to a SYSV system.) - */ -#define BSD /* delete this line on System V */ - -/* #define STUPID */ /* avoid some complicated expressions if - your C compiler chokes on them */ -/* #define PYRAMID_BUG */ /* avoid a bug on the Pyramid */ -/* #define NOWAITINCLUDE */ /* neither nor exists */ - -#define WIZARD "bruno" /* the person allowed to use the -D option */ -#define RECORD "record"/* the file containing the list of topscorers */ -#define NEWS "news" /* the file containing the latest hack news */ -#define HELP "help" /* the file containing a description of the commands */ -#define SHELP "hh" /* abbreviated form of the same */ -#define RUMORFILE "rumors" /* a file with fortune cookies */ -#define DATAFILE "data" /* a file giving the meaning of symbols used */ -#define FMASK 0660 /* file creation mask */ -#define HLOCK "perm" /* an empty file used for locking purposes */ -#define LLOCK "safelock" /* link to previous */ - -#ifdef UNIX -/* - * Define DEF_PAGER as your default pager, e.g. "/bin/cat" or "/usr/ucb/more" - * If defined, it can be overridden by the environment variable PAGER. - * Hack will use its internal pager if DEF_PAGER is not defined. - * (This might be preferable for security reasons.) - * #define DEF_PAGER ".../mydir/mypager" - */ - -/* - * If you define MAIL, then the player will be notified of new mail - * when it arrives. If you also define DEF_MAILREADER then this will - * be the default mail reader, and can be overridden by the environment - * variable MAILREADER; otherwise an internal pager will be used. - * A stat system call is done on the mailbox every MAILCKFREQ moves. - */ -/* #define MAIL */ -#define DEF_MAILREADER _PATH_MAIL /* or e.g. /bin/mail */ -#define MAILCKFREQ 100 - - -#define SHELL /* do not delete the '!' command */ - -#ifdef BSD -#define SUSPEND /* let ^Z suspend the game */ -#endif /* BSD */ -#endif /* UNIX */ - -#ifdef CHDIR -/* - * If you define HACKDIR, then this will be the default playground; - * otherwise it will be the current directory. - */ -#ifdef QUEST -#define HACKDIR _PATH_QUEST -#else /* QUEST */ -#define HACKDIR _PATH_HACK -#endif /* QUEST */ - -/* - * Some system administrators are stupid enough to make Hack suid root - * or suid daemon, where daemon has other powers besides that of reading or - * writing Hack files. In such cases one should be careful with chdir's - * since the user might create files in a directory of his choice. - * Of course SECURE is meaningful only if HACKDIR is defined. - */ -#define SECURE /* do setuid(getuid()) after chdir() */ - -/* - * If it is desirable to limit the number of people that can play Hack - * simultaneously, define HACKDIR, SECURE and MAX_NR_OF_PLAYERS. - * #define MAX_NR_OF_PLAYERS 100 - */ -#endif /* CHDIR */ - -/* size of terminal screen is (at least) (ROWNO+2) by COLNO */ -#define COLNO 80 -#define ROWNO 22 - -/* - * small signed integers (8 bits suffice) - * typedef char schar; - * will do when you have signed characters; otherwise use - * typedef short int schar; - */ -typedef char schar; - -/* - * small unsigned integers (8 bits suffice - but 7 bits do not) - * - these are usually object types; be careful with inequalities! - - * typedef unsigned char uchar; - * will be satisfactory if you have an "unsigned char" type; otherwise use - * typedef unsigned short int uchar; - */ -typedef unsigned char uchar; - -/* - * small integers in the range 0 - 127, usually coordinates - * although they are nonnegative they must not be declared unsigned - * since otherwise comparisons with signed quantities are done incorrectly - */ -typedef schar xchar; -typedef xchar boolean; /* 0 or 1 */ -#define TRUE 1 -#define FALSE 0 - -/* - * Declaration of bitfields in various structs; if your C compiler - * doesnt handle bitfields well, e.g., if it is unable to initialize - * structs containing bitfields, then you might use - * #define Bitfield(x,n) uchar x - * since the bitfields used never have more than 7 bits. (Most have 1 bit.) - */ -#define Bitfield(x,n) unsigned x:n - -#define SIZE(x) (int)(sizeof(x) / sizeof(x[0])) - -#endif /* CONFIG */ diff --git a/games/hack/data b/games/hack/data deleted file mode 100644 index 5d8d509b0fd9..000000000000 --- a/games/hack/data +++ /dev/null @@ -1,232 +0,0 @@ - Hack & Quest data file - version 1.0.3 -@ human (or you) -- a wall -| a wall -+ a door -. the floor of a room - a dark part of a room -# a corridor -} water filled area -< the staircase to the previous level -> the staircase to the next level -^ a trap -$ a pile, pot or chest of gold -%% a piece of food -! a potion -* a gem -? a scroll -= a ring -/ a wand -[ a suit of armor -) a weapon -( a useful item (camera, key, rope etc.) -0 an iron ball -_ an iron chain -` an enormous rock -" an amulet -, a trapper -: a chameleon -; a giant eel -' a lurker above -& a demon -A a giant ant -B a giant bat -C a centaur; - Of all the monsters put together by the Greek imagination - the Centaurs (Kentauroi) constituted a class in themselves. - Despite a strong streak of sensuality in their make-up, - their normal behaviour was moral, and they took a kindly - thought of man's welfare. The attempted outrage of Nessos on - Deianeira, and that of the whole tribe of Centaurs on the - Lapith women, are more than offset by the hospitality of - Pholos and by the wisdom of Cheiron, physician, prophet, - lyrist, and the instructor of Achilles. Further, the Cen- - taurs were peculiar in that their nature, which united the - body of a horse with the trunk and head of a man, involved - an unthinkable duplication of vital organs and important - members. So grotesque a combination seems almost un-Greek. - These strange creatures were said to live in the caves and - clefts of the mountains, myths associating them especially - with the hills of Thessaly and the range of Erymanthos. - [Mythology of all races, Vol. 1, pp. 270-271] -D a dragon; - In the West the dragon was the natural enemy of man. Although - preferring to live in bleak and desolate regions, whenever it was - seen among men it left in its wake a trail of destruction and - disease. Yet any attempt to slay this beast was a perilous under- - taking. For the dragon's assailant had to contend not only with - clouds of sulphurous fumes pouring from its fire-breathing nos- - trils, but also with the thrashings of its tail, the most deadly - part of its serpent-like body. - [From: Mythical Beasts by Deirdre Headon (The Leprechaun Library)] -E a floating eye -F a freezing sphere -G a gnome; - ... And then a gnome came by, carrying a bundle, an old fellow - three times as large as an imp and wearing clothes of a sort, - especially a hat. And he was clearly just as frightened as the - imps though he could not go so fast. Ramon Alonzo saw that there - must be some great trouble that was vexing magical things; and, - since gnomes speak the language of men, and will answer if spoken - to gently, he raised his hat, and asked of the gnome his name. - The gnome did not stop his hasty shuffle a moment as he answered - 'Alaraba' and grabbed the rim of his hat but forgot to doff it. - 'What is the trouble, Alaraba?' said Ramon Alonzo. - 'White magic. Run!' said the gnome ... - [From: The Charwoman's Shadow, by Lord Dunsany.] -H a hobgoblin; - Hobgoblin. Used by the Puritans and in later times for - wicked goblin spirits, as in Bunyan's 'Hobgoblin nor foul - friend', but its more correct use is for the friendly spir- - its of the brownie type. In 'A midsummer night's dream' a - fairy says to Shakespeare's Puck: - Those that Hobgoblin call you, and sweet Puck, - You do their work, and they shall have good luck: - Are you not he? - and obviously Puck would not wish to be called a hobgoblin - if that was an ill-omened word. - Hobgoblins are on the whole, good-humoured and ready to be - helpful, but fond of practical joking, and like most of the - fairies rather nasty people to annoy. Boggarts hover on the - verge of hobgoblindom. Bogles are just over the edge. - One Hob mentioned by Henderson, was Hob Headless who haunted - the road between Hurworth and Neasham, but could not cross - the little river Kent, which flowed into the Tess. He was - exorcised and laid under a large stone by the roadside for - ninety-nine years and a day. If anyone was so unwary as to - sit on that stone, he would be unable to quit it for ever. - The ninety-nine years is nearly up, so trouble may soon be - heard of on the road between Hurworth and Neasham. - [Katharine Briggs, A dictionary of Fairies] -I an invisible stalker -J a jackal -K a kobold -L a leprechaun; - The Irish Leprechaun is the Faeries' shoemaker and is known - under various names in different parts of Ireland: Cluri- - caune in Cork, Lurican in Kerry, Lurikeen in Kildare and Lu- - rigadaun in Tipperary. Although he works for the Faeries, - the Leprechaun is not of the same species. He is small, has - dark skin and wears strange clothes. His nature has some- - thing of the manic-depressive about it: first he is quite - happy, whistling merrily as he nails a sole on to a shoe; a - few minutes later, he is sullen and morose, drunk on his - home-made heather ale. The Leprechaun's two great loves are - tobacco and whiskey, and he is a first-rate con-man, impos- - sible to out-fox. No one, no matter how clever, has ever - managed to cheat him out of his hidden pot of gold or his - magic shilling. At the last minute he always thinks of some - way to divert his captor's attention and vanishes in the - twinkling of an eye. - [From: A Field Guide to the Little People - by Nancy Arrowsmith & George Moorse. ] -M a mimic -N a nymph -O an orc -P a purple worm -Q a quasit -R a rust monster -S a snake -T a troll -U an umber hulk -V a vampire -W a wraith -X a xorn -Y a yeti -Z a zombie -a an acid blob -b a giant beetle -c a cockatrice; - Once in a great while, when the positions of the stars are - just right, a seven-year-old rooster will lay an egg. Then, - along will come a snake, to coil around the egg, or a toad, - to squat upon the egg, keeping it warm and helping it to - hatch. When it hatches, out comes a creature called basil- - isk, or cockatrice, the most deadly of all creatures. A sin- - gle glance from its yellow, piercing toad's eyes will kill - both man and beast. Its power of destruction is said to be - so great that sometimes simply to hear its hiss can prove - fatal. Its breath is so venomenous that it causes all vege- - tation to wither. - There is, however, one creature which can withstand the - basilisk's deadly gaze, and this is the weasel. No one knows - why this is so, but although the fierce weasel can slay the - basilisk, it will itself be killed in the struggle. Perhaps - the weasel knows the basilisk's fatal weakness: if it ever - sees its own reflection in a mirror it will perish instant- - ly. But even a dead basilisk is dangerous, for it is said - that merely touching its lifeless body can cause a person to - sicken and die. - [From: Mythical Beasts by Deirdre Headon (The Leprechaun - Library) and other sources. ] -d a dog -e an ettin -f a fog cloud -g a gelatinous cube -h a homunculus -i an imp; - ... imps ... little creatures of two feet high that could - gambol and jump prodigiously; ... - [From: The Charwoman's Shadow, by Lord Dunsany.] - - An 'imp' is an off-shoot or cutting. Thus an 'ymp tree' was - a grafted tree, or one grown from a cutting, not from seed. - 'Imp' properly means a small devil, an off-shoot of Satan, - but the distinction between goblins or bogles and imps from - hell is hard to make, and many in the Celtic countries as - well as the English Puritans regarded all fairies as devils. - The fairies of tradition often hover uneasily between the - ghostly and the diabolic state. - [Katharine Briggs, A dictionary of Fairies] -j a jaguar -k a killer bee -l a leocrotta -m a minotaur -n a nurse -o an owlbear -p a piercer -q a quivering blob -r a giant rat -s a scorpion -t a tengu; - The tengu was the most troublesome creature of Japanese - legend. Part bird and part man, with red beak for a nose - and flashing eyes, the tengu was notorious for stirring up - feuds and prolonging enmity between families. Indeed, the - belligerent tengus were supposed to have been man's first - instructors in the use of arms. - [From: Mythical Beasts by Deirdre Headon - (The Leprechaun Library). ] -u a unicorn; - Men have always sought the elusive unicorn, for the single - twisted horn which projected from its forehead was thought - to be a powerful talisman. It was said that the unicorn had - simply to dip the tip of its horn in a muddy pool for the - water to become pure. Men also believed that to drink from - this horn was a protection against all sickness, and that if - the horn was ground to a powder it would act as an antidote - to all poisons. Less than 200 years ago in France, the horn - of a unicorn was used in a ceremony to test the royal food - for poison. - Although only the size of a small horse, the unicorn is a - very fierce beast, capable of killing an elephant with a - single thrust from its horn. Its fleetness of foot also - makes this solitary creature difficult to capture. However, - it can be tamed and captured by a maiden. Made gentle by the - sight of a virgin, the unicorn can be lured to lay its head - in her lap, and in this docile mood, the maiden may secure - it with a golden rope. - [From: Mythical Beasts by Deirdre Headon - (The Leprechaun Library). ] -v a violet fungi -w a long worm; - From its teeth the crysknife can be manufactured. -~ the tail of a long worm -x a xan; - The xan were animals sent to prick the legs of the Lords of Xibalba. -y a yellow light -z a zruty; - The zruty are wild and gigantic beings, living in the wildernesses - of the Tatra mountains. -1 The wizard of Yendor -2 The mail daemon diff --git a/games/hack/date.h b/games/hack/date.h deleted file mode 100644 index 9a7ef7688854..000000000000 --- a/games/hack/date.h +++ /dev/null @@ -1,2 +0,0 @@ - -char datestring[] = "Tue Jul 23 1985"; diff --git a/games/hack/def.edog.h b/games/hack/def.edog.h deleted file mode 100644 index a5c2b4616e01..000000000000 --- a/games/hack/def.edog.h +++ /dev/null @@ -1,12 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* def.edog.h - version 1.0.2 */ - -struct edog { - long hungrytime; /* at this time dog gets hungry */ - long eattime; /* dog is eating */ - long droptime; /* moment dog dropped object */ - unsigned dropdist; /* dist of drpped obj from @ */ - unsigned apport; /* amount of training */ - long whistletime; /* last time he whistled */ -}; -#define EDOG(mp) ((struct edog *)(&(mp->mextra[0]))) diff --git a/games/hack/def.eshk.h b/games/hack/def.eshk.h deleted file mode 100644 index 2ebf2804d348..000000000000 --- a/games/hack/def.eshk.h +++ /dev/null @@ -1,24 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* def.eshk.h - version 1.0.2 : added 'following' */ - -#define BILLSZ 200 -struct bill_x { - unsigned bo_id; - unsigned useup:1; - unsigned bquan:7; - unsigned price; /* price per unit */ -}; - -struct eshk { - long int robbed; /* amount stolen by most recent customer */ - boolean following; /* following customer since he owes us sth */ - schar shoproom; /* index in rooms; set by inshop() */ - coord shk; /* usual position shopkeeper */ - coord shd; /* position shop door */ - int shoplevel; /* level of his shop */ - int billct; - struct bill_x bill[BILLSZ]; - int visitct; /* nr of visits by most recent customer */ - char customer[PL_NSIZ]; /* most recent customer */ - char shknam[PL_NSIZ]; -}; diff --git a/games/hack/def.flag.h b/games/hack/def.flag.h deleted file mode 100644 index 221f33dd9166..000000000000 --- a/games/hack/def.flag.h +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* def.flag.h - version 1.0.3 */ - -struct flag { - unsigned ident; /* social security number for each monster */ - unsigned debug:1; /* in debugging mode */ -#define wizard flags.debug - unsigned toplin:2; /* a top line (message) has been printed */ - /* 0: top line empty; 2: no --More-- reqd. */ - unsigned cbreak:1; /* in cbreak mode, rogue format */ - unsigned standout:1; /* use standout for --More-- */ - unsigned nonull:1; /* avoid sending nulls to the terminal */ - unsigned time:1; /* display elapsed 'time' */ - unsigned nonews:1; /* suppress news printing */ - unsigned notombstone:1; - unsigned end_top, end_around; /* describe desired score list */ - unsigned end_own:1; /* idem (list all own scores) */ - unsigned no_rest_on_space:1; /* spaces are ignored */ - unsigned beginner:1; - unsigned female:1; - unsigned invlet_constant:1; /* let objects keep their - inventory symbol */ - unsigned move:1; - unsigned mv:1; - unsigned run:3; /* 0: h (etc), 1: H (etc), 2: fh (etc) */ - /* 3: FH, 4: ff+, 5: ff-, 6: FF+, 7: FF- */ - unsigned nopick:1; /* do not pickup objects */ - unsigned echo:1; /* 1 to echo characters */ - unsigned botl:1; /* partially redo status line */ - unsigned botlx:1; /* print an entirely new bottom line */ - unsigned nscrinh:1; /* inhibit nscr() in pline(); */ - unsigned made_amulet:1; - unsigned no_of_wizards:2;/* 0, 1 or 2 (wizard and his shadow) */ - /* reset from 2 to 1, but never to 0 */ - unsigned moonphase:3; -#define NEW_MOON 0 -#define FULL_MOON 4 - -}; - -extern struct flag flags; - diff --git a/games/hack/def.func_tab.h b/games/hack/def.func_tab.h deleted file mode 100644 index 63f74d2ef618..000000000000 --- a/games/hack/def.func_tab.h +++ /dev/null @@ -1,16 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* def.func_tab.h - version 1.0.2 */ - -struct func_tab { - char f_char; - int (*f_funct)(); -}; - -extern struct func_tab cmdlist[]; - -struct ext_func_tab { - char *ef_txt; - int (*ef_funct)(); -}; - -extern struct ext_func_tab extcmdlist[]; diff --git a/games/hack/def.gen.h b/games/hack/def.gen.h deleted file mode 100644 index f1e44fc98977..000000000000 --- a/games/hack/def.gen.h +++ /dev/null @@ -1,15 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* def.gen.h version 1.0.1: added ONCE flag */ - -struct gen { - struct gen *ngen; - xchar gx,gy; - unsigned gflag; /* 037: trap type; 040: SEEN flag */ - /* 0100: ONCE only */ -#define TRAPTYPE 037 -#define SEEN 040 -#define ONCE 0100 -}; -extern struct gen *fgold, *ftrap; -struct gen *g_at(); -#define newgen() (struct gen *) alloc(sizeof(struct gen)) diff --git a/games/hack/def.gold.h b/games/hack/def.gold.h deleted file mode 100644 index 808890883509..000000000000 --- a/games/hack/def.gold.h +++ /dev/null @@ -1,12 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* def.gold.h - version 1.0.2 */ - -struct gold { - struct gold *ngold; - xchar gx,gy; - long amount; -}; - -extern struct gold *fgold; -struct gold *g_at(); -#define newgold() (struct gold *) alloc(sizeof(struct gold)) diff --git a/games/hack/def.mkroom.h b/games/hack/def.mkroom.h deleted file mode 100644 index ddbb62be1b02..000000000000 --- a/games/hack/def.mkroom.h +++ /dev/null @@ -1,26 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* def.mkroom.h - version 1.0.3 */ - -struct mkroom { - schar lx,hx,ly,hy; /* usually xchar, but hx may be -1 */ - schar rtype,rlit,doorct,fdoor; -}; - -#define MAXNROFROOMS 15 -extern struct mkroom rooms[MAXNROFROOMS+1]; - -#define DOORMAX 100 -extern coord doors[DOORMAX]; - -/* various values of rtype */ -/* 0: ordinary room; 8-15: various shops */ -/* Note: some code assumes that >= 8 means shop, so be careful when adding - new roomtypes */ -#define SWAMP 3 -#define VAULT 4 -#define BEEHIVE 5 -#define MORGUE 6 -#define ZOO 7 -#define SHOPBASE 8 -#define WANDSHOP 9 -#define GENERAL 15 diff --git a/games/hack/def.monst.h b/games/hack/def.monst.h deleted file mode 100644 index 7a2d6e390611..000000000000 --- a/games/hack/def.monst.h +++ /dev/null @@ -1,61 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* def.monst.h - version 1.0.2 */ -/* $FreeBSD$ */ - -struct monst { - struct monst *nmon; - struct permonst *data; - unsigned m_id; - xchar mx,my; - xchar mdx,mdy; /* if mdispl then pos where last displayed */ -#define MTSZ 4 - coord mtrack[MTSZ]; /* monster track */ - schar mhp,mhpmax; - char mappearance; /* nonzero for undetected 'M's and for '1's */ - Bitfield(mimic,1); /* undetected mimic */ - Bitfield(mdispl,1); /* mdx,mdy valid */ - Bitfield(minvis,1); /* invisible */ - Bitfield(cham,1); /* shape-changer */ - Bitfield(mhide,1); /* hides beneath objects */ - Bitfield(mundetected,1); /* not seen in present hiding place */ - Bitfield(mspeed,2); - Bitfield(msleep,1); - Bitfield(mfroz,1); - Bitfield(mconf,1); - Bitfield(mflee,1); /* fleeing */ - Bitfield(mfleetim,7); /* timeout for mflee */ - Bitfield(mcan,1); /* has been cancelled */ - Bitfield(mtame,1); /* implies peaceful */ - Bitfield(mpeaceful,1); /* does not attack unprovoked */ - Bitfield(isshk,1); /* is shopkeeper */ - Bitfield(isgd,1); /* is guard */ - Bitfield(mcansee,1); /* cansee 1, temp.blinded 0, blind 0 */ - Bitfield(mblinded,7); /* cansee 0, temp.blinded n, blind 0 */ - Bitfield(mtrapped,1); /* trapped in a pit or bear trap */ - Bitfield(mnamelth,6); /* length of name (following mxlth) */ -#ifndef NOWORM - Bitfield(wormno,5); /* at most 31 worms on any level */ -#endif /* NOWORM */ - unsigned mtrapseen; /* bitmap of traps we've been trapped in */ - long mlstmv; /* prevent two moves at once */ - struct obj *minvent; - long mgold; - unsigned mxlth; /* length of following data */ - /* in order to prevent alignment problems mextra should - be (or follow) a long int */ - long mextra[1]; /* monster dependent info */ -}; - -#define newmonst(xl) (struct monst *) alloc((unsigned)(xl) + sizeof(struct monst)) - -extern struct monst *fmon; -extern struct monst *fallen_down; -struct monst *m_at(); - -/* these are in mspeed */ -#define MSLOW 1 /* slow monster */ -#define MFAST 2 /* speeded monster */ - -#define NAME(mtmp) (((char *) mtmp->mextra) + mtmp->mxlth) -#define MREGEN "TVi1" -#define UNDEAD "ZVW " diff --git a/games/hack/def.obj.h b/games/hack/def.obj.h deleted file mode 100644 index 50b21df1b8f0..000000000000 --- a/games/hack/def.obj.h +++ /dev/null @@ -1,48 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* def.obj.h - version 1.0.3 */ - -struct obj { - struct obj *nobj; - unsigned o_id; - unsigned o_cnt_id; /* id of container object is in */ - xchar ox,oy; - xchar odx,ody; - uchar otyp; - uchar owt; - uchar quan; /* use oextra for tmp gold objects */ - schar spe; /* quality of weapon, armor or ring (+ or -) - number of charges for wand ( >= -1 ) - special for uball and amulet %% BAH */ - char olet; - char invlet; - Bitfield(oinvis,1); /* not yet implemented */ - Bitfield(odispl,1); - Bitfield(known,1); /* exact nature known */ - Bitfield(dknown,1); /* color or text known */ - Bitfield(cursed,1); - Bitfield(unpaid,1); /* on some bill */ - Bitfield(rustfree,1); - Bitfield(onamelth,6); - long age; /* creation date */ - long owornmask; -#define W_ARM 01L -#define W_ARM2 02L -#define W_ARMH 04L -#define W_ARMS 010L -#define W_ARMG 020L -#define W_ARMOR (W_ARM | W_ARM2 | W_ARMH | W_ARMS | W_ARMG) -#define W_RINGL 010000L /* make W_RINGL = RING_LEFT (see uprop) */ -#define W_RINGR 020000L -#define W_RING (W_RINGL | W_RINGR) -#define W_WEP 01000L -#define W_BALL 02000L -#define W_CHAIN 04000L - long oextra[1]; /* used for name of ordinary objects - length - is flexible; amount for tmp gold objects */ -}; - -extern struct obj *fobj; - -#define newobj(xl) (struct obj *) alloc((unsigned)(xl) + sizeof(struct obj)) -#define ONAME(otmp) ((char *) otmp->oextra) -#define OGOLD(otmp) (otmp->oextra[0]) diff --git a/games/hack/def.objclass.h b/games/hack/def.objclass.h deleted file mode 100644 index 9e17de237ee7..000000000000 --- a/games/hack/def.objclass.h +++ /dev/null @@ -1,60 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* def.objclass.h - version 1.0.3 */ - -/* definition of a class of objects */ - -struct objclass { - char *oc_name; /* actual name */ - char *oc_descr; /* description when name unknown */ - char *oc_uname; /* called by user */ - Bitfield(oc_name_known,1); - Bitfield(oc_merge,1); /* merge otherwise equal objects */ - char oc_olet; - schar oc_prob; /* probability for mkobj() */ - schar oc_delay; /* delay when using such an object */ - uchar oc_weight; - schar oc_oc1, oc_oc2; - int oc_oi; -#define nutrition oc_oi /* for foods */ -#define a_ac oc_oc1 /* for armors - only used in ARM_BONUS */ -#define ARM_BONUS(obj) ((10 - objects[obj->otyp].a_ac) + obj->spe) -#define a_can oc_oc2 /* for armors */ -#define bits oc_oc1 /* for wands and rings */ - /* wands */ -#define NODIR 1 -#define IMMEDIATE 2 -#define RAY 4 - /* rings */ -#define SPEC 1 /* +n is meaningful */ -#define wldam oc_oc1 /* for weapons and PICK_AXE */ -#define wsdam oc_oc2 /* for weapons and PICK_AXE */ -#define g_val oc_oi /* for gems: value on exit */ -}; - -extern struct objclass objects[]; - -/* definitions of all object-symbols */ - -#define ILLOBJ_SYM '\\' -#define AMULET_SYM '"' -#define FOOD_SYM '%' -#define WEAPON_SYM ')' -#define TOOL_SYM '(' -#define BALL_SYM '0' -#define CHAIN_SYM '_' -#define ROCK_SYM '`' -#define ARMOR_SYM '[' -#define POTION_SYM '!' -#define SCROLL_SYM '?' -#define WAND_SYM '/' -#define RING_SYM '=' -#define GEM_SYM '*' -/* Other places with explicit knowledge of object symbols: - * ....shk.c: char shtypes[] = "=/)%?!["; - * mklev.c: "=/)%?![<>" - * hack.mkobj.c: char mkobjstr[] = "))[[!!!!????%%%%/=**"; - * hack.apply.c: otmp = getobj("0#%", "put in"); - * hack.eat.c: otmp = getobj("%", "eat"); - * hack.invent.c: if(index("!%?[)=*(0/\"", sym)){ - * hack.invent.c: || index("%?!*",otmp->olet))){ - */ diff --git a/games/hack/def.objects.h b/games/hack/def.objects.h deleted file mode 100644 index 9d21be6f2d45..000000000000 --- a/games/hack/def.objects.h +++ /dev/null @@ -1,288 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* def.objects.h - version 1.0.3 */ - -/* objects have letter " % ) ( 0 _ ` [ ! ? / = * */ -#include "config.h" -#include "def.objclass.h" - -struct objclass objects[] = { - - { "strange object", NULL, NULL, 1, 0, - ILLOBJ_SYM, 0, 0, 0, 0, 0, 0 }, - { "amulet of Yendor", NULL, NULL, 1, 0, - AMULET_SYM, 100, 0, 2, 0, 0, 0 }, - -#define FOOD(name,prob,delay,weight,nutrition) { name, NULL, NULL, 1, 1,\ - FOOD_SYM, prob, delay, weight, 0, 0, nutrition } - -/* dog eats foods 0-4 but prefers 1 above 0,2,3,4 */ -/* food 4 can be read */ -/* food 5 improves your vision */ -/* food 6 makes you stronger (like Popeye) */ -/* foods CORPSE up to CORPSE+52 are cadavers */ - - FOOD("food ration", 50, 5, 4, 800), - FOOD("tripe ration", 20, 1, 2, 200), - FOOD("pancake", 3, 1, 1, 200), - FOOD("dead lizard", 3, 0, 1, 40), - FOOD("fortune cookie", 7, 0, 1, 40), - FOOD("carrot", 2, 0, 1, 50), - FOOD("tin", 7, 0, 1, 0), - FOOD("orange", 1, 0, 1, 80), - FOOD("apple", 1, 0, 1, 50), - FOOD("pear", 1, 0, 1, 50), - FOOD("melon", 1, 0, 1, 100), - FOOD("banana", 1, 0, 1, 80), - FOOD("candy bar", 1, 0, 1, 100), - FOOD("egg", 1, 0, 1, 80), - FOOD("clove of garlic", 1, 0, 1, 40), - FOOD("lump of royal jelly", 0, 0, 1, 200), - - FOOD("dead human", 0, 4, 40, 400), - FOOD("dead giant ant", 0, 1, 3, 30), - FOOD("dead giant bat", 0, 1, 3, 30), - FOOD("dead centaur", 0, 5, 50, 500), - FOOD("dead dragon", 0, 15, 150, 1500), - FOOD("dead floating eye", 0, 1, 1, 10), - FOOD("dead freezing sphere", 0, 1, 1, 10), - FOOD("dead gnome", 0, 1, 10, 100), - FOOD("dead hobgoblin", 0, 2, 20, 200), - FOOD("dead stalker", 0, 4, 40, 400), - FOOD("dead jackal", 0, 1, 10, 100), - FOOD("dead kobold", 0, 1, 10, 100), - FOOD("dead leprechaun", 0, 4, 40, 400), - FOOD("dead mimic", 0, 4, 40, 400), - FOOD("dead nymph", 0, 4, 40, 400), - FOOD("dead orc", 0, 2, 20, 200), - FOOD("dead purple worm", 0, 7, 70, 700), - FOOD("dead quasit", 0, 2, 20, 200), - FOOD("dead rust monster", 0, 5, 50, 500), - FOOD("dead snake", 0, 1, 10, 100), - FOOD("dead troll", 0, 4, 40, 400), - FOOD("dead umber hulk", 0, 5, 50, 500), - FOOD("dead vampire", 0, 4, 40, 400), - FOOD("dead wraith", 0, 1, 1, 10), - FOOD("dead xorn", 0, 7, 70, 700), - FOOD("dead yeti", 0, 7, 70, 700), - FOOD("dead zombie", 0, 1, 3, 30), - FOOD("dead acid blob", 0, 1, 3, 30), - FOOD("dead giant beetle", 0, 1, 1, 10), - FOOD("dead cockatrice", 0, 1, 3, 30), - FOOD("dead dog", 0, 2, 20, 200), - FOOD("dead ettin", 0, 1, 3, 30), - FOOD("dead fog cloud", 0, 1, 1, 10), - FOOD("dead gelatinous cube", 0, 1, 10, 100), - FOOD("dead homunculus", 0, 2, 20, 200), - FOOD("dead imp", 0, 1, 1, 10), - FOOD("dead jaguar", 0, 3, 30, 300), - FOOD("dead killer bee", 0, 1, 1, 10), - FOOD("dead leocrotta", 0, 5, 50, 500), - FOOD("dead minotaur", 0, 7, 70, 700), - FOOD("dead nurse", 0, 4, 40, 400), - FOOD("dead owlbear", 0, 7, 70, 700), - FOOD("dead piercer", 0, 2, 20, 200), - FOOD("dead quivering blob", 0, 1, 10, 100), - FOOD("dead giant rat", 0, 1, 3, 30), - FOOD("dead giant scorpion", 0, 1, 10, 100), - FOOD("dead tengu", 0, 3, 30, 300), - FOOD("dead unicorn", 0, 3, 30, 300), - FOOD("dead violet fungi", 0, 1, 10, 100), - FOOD("dead long worm", 0, 5, 50, 500), -/* %% wt of long worm should be proportional to its length */ - FOOD("dead xan", 0, 3, 30, 300), - FOOD("dead yellow light", 0, 1, 1, 10), - FOOD("dead zruty", 0, 6, 60, 600), - -/* weapons ... - ROCK come several at a time */ -/* weapons ... - (ROCK-1) are shot using idem+(BOW-ARROW) */ -/* weapons AXE, SWORD, THSWORD are good for worm-cutting */ -/* weapons (PICK-)AXE, DAGGER, CRYSKNIFE are good for tin-opening */ -#define WEAPON(name,prob,wt,ldam,sdam) { name, NULL, NULL, 1, 0 /*%%*/,\ - WEAPON_SYM, prob, 0, wt, ldam, sdam, 0 } - - WEAPON("arrow", 7, 0, 6, 6), - WEAPON("sling bullet", 7, 0, 4, 6), - WEAPON("crossbow bolt", 7, 0, 4, 6), - WEAPON("dart", 7, 0, 3, 2), - WEAPON("rock", 6, 1, 3, 3), - WEAPON("boomerang", 2, 3, 9, 9), - WEAPON("mace", 9, 3, 6, 7), - WEAPON("axe", 6, 3, 6, 4), - WEAPON("flail", 6, 3, 6, 5), - WEAPON("long sword", 8, 3, 8, 12), - WEAPON("two handed sword", 6, 4, 12, 6), - WEAPON("dagger", 6, 3, 4, 3), - WEAPON("worm tooth", 0, 4, 2, 2), - WEAPON("crysknife", 0, 3, 10, 10), - WEAPON("spear", 6, 3, 6, 8), - WEAPON("bow", 6, 3, 4, 6), - WEAPON("sling", 5, 3, 6, 6), - WEAPON("crossbow", 6, 3, 4, 6), - - { "whistle", "whistle", NULL, 0, 0, - TOOL_SYM, 90, 0, 2, 0, 0, 0 }, - { "magic whistle", "whistle", NULL, 0, 0, - TOOL_SYM, 10, 0, 2, 0, 0, 0 }, - { "expensive camera", NULL, NULL, 1, 1, - TOOL_SYM, 0, 0, 3, 0, 0, 0 }, - { "ice box", "large box", NULL, 0, 0, - TOOL_SYM, 0, 0, 40, 0, 0, 0 }, - { "pick-axe", NULL, NULL, 1, 1, - TOOL_SYM, 0, 0, 5, 6, 3, 0 }, - { "can opener", NULL, NULL, 1, 1, - TOOL_SYM, 0, 0, 1, 0, 0, 0 }, - { "heavy iron ball", NULL, NULL, 1, 0, - BALL_SYM, 100, 0, 20, 0, 0, 0 }, - { "iron chain", NULL, NULL, 1, 0, - CHAIN_SYM, 100, 0, 20, 0, 0, 0 }, - { "enormous rock", NULL, NULL, 1, 0, - ROCK_SYM, 100, 0, 200 /* > MAX_CARR_CAP */, 0, 0, 0 }, - -#define ARMOR(name,prob,delay,ac,can) { name, NULL, NULL, 1, 0,\ - ARMOR_SYM, prob, delay, 8, ac, can, 0 } - ARMOR("helmet", 3, 1, 9, 0), - ARMOR("plate mail", 5, 5, 3, 2), - ARMOR("splint mail", 8, 5, 4, 1), - ARMOR("banded mail", 10, 5, 4, 0), - ARMOR("chain mail", 10, 5, 5, 1), - ARMOR("scale mail", 10, 5, 6, 0), - ARMOR("ring mail", 15, 5, 7, 0), - /* the armors below do not rust */ - ARMOR("studded leather armor", 13, 3, 7, 1), - ARMOR("leather armor", 17, 3, 8, 0), - ARMOR("elven cloak", 5, 0, 9, 3), - ARMOR("shield", 3, 0, 9, 0), - ARMOR("pair of gloves", 1, 1, 9, 0), - -#define POTION(name,color) { name, color, NULL, 0, 1,\ - POTION_SYM, 0, 0, 2, 0, 0, 0 } - - POTION("restore strength", "orange"), - POTION("booze", "bubbly"), - POTION("invisibility", "glowing"), - POTION("fruit juice", "smoky"), - POTION("healing", "pink"), - POTION("paralysis", "puce"), - POTION("monster detection", "purple"), - POTION("object detection", "yellow"), - POTION("sickness", "white"), - POTION("confusion", "swirly"), - POTION("gain strength", "purple-red"), - POTION("speed", "ruby"), - POTION("blindness", "dark green"), - POTION("gain level", "emerald"), - POTION("extra healing", "sky blue"), - POTION("levitation", "brown"), - POTION(NULL, "brilliant blue"), - POTION(NULL, "clear"), - POTION(NULL, "magenta"), - POTION(NULL, "ebony"), - -#define SCROLL(name,text,prob) { name, text, NULL, 0, 1,\ - SCROLL_SYM, prob, 0, 3, 0, 0, 0 } - SCROLL("mail", "KIRJE", 0), - SCROLL("enchant armor", "ZELGO MER", 6), - SCROLL("destroy armor", "JUYED AWK YACC", 5), - SCROLL("confuse monster", "NR 9", 5), - SCROLL("scare monster", "XIXAXA XOXAXA XUXAXA", 4), - SCROLL("blank paper", "READ ME", 3), - SCROLL("remove curse", "PRATYAVAYAH", 6), - SCROLL("enchant weapon", "DAIYEN FOOELS", 6), - SCROLL("damage weapon", "HACKEM MUCHE", 5), - SCROLL("create monster", "LEP GEX VEN ZEA", 5), - SCROLL("taming", "PRIRUTSENIE", 1), - SCROLL("genocide", "ELBIB YLOH",2), - SCROLL("light", "VERR YED HORRE", 10), - SCROLL("teleportation", "VENZAR BORGAVVE", 5), - SCROLL("gold detection", "THARR", 4), - SCROLL("food detection", "YUM YUM", 1), - SCROLL("identify", "KERNOD WEL", 18), - SCROLL("magic mapping", "ELAM EBOW", 5), - SCROLL("amnesia", "DUAM XNAHT", 3), - SCROLL("fire", "ANDOVA BEGARIN", 5), - SCROLL("punishment", "VE FORBRYDERNE", 1), - SCROLL(NULL, "VELOX NEB", 0), - SCROLL(NULL, "FOOBIE BLETCH", 0), - SCROLL(NULL, "TEMOV", 0), - SCROLL(NULL, "GARVEN DEH", 0), - -#define WAND(name,metal,prob,flags) { name, metal, NULL, 0, 0,\ - WAND_SYM, prob, 0, 3, flags, 0, 0 } - - WAND("light", "iridium", 10, NODIR), - WAND("secret door detection", "tin", 5, NODIR), - WAND("create monster", "platinum", 5, NODIR), - WAND("wishing", "glass", 1, NODIR), - WAND("striking", "zinc", 9, IMMEDIATE), - WAND("slow monster", "balsa", 5, IMMEDIATE), - WAND("speed monster", "copper", 5, IMMEDIATE), - WAND("undead turning", "silver", 5, IMMEDIATE), - WAND("polymorph", "brass", 5, IMMEDIATE), - WAND("cancellation", "maple", 5, IMMEDIATE), - WAND("teleportation", "pine", 5, IMMEDIATE), - WAND("make invisible", "marble", 9, IMMEDIATE), - WAND("digging", "iron", 5, RAY), - WAND("magic missile", "aluminium", 10, RAY), - WAND("fire", "steel", 5, RAY), - WAND("sleep", "curved", 5, RAY), - WAND("cold", "short", 5, RAY), - WAND("death", "long", 1, RAY), - WAND(NULL, "oak", 0, 0), - WAND(NULL, "ebony", 0, 0), - WAND(NULL, "runed", 0, 0), - -#define RING(name,stone,spec) { name, stone, NULL, 0, 0,\ - RING_SYM, 0, 0, 1, spec, 0, 0 } - - RING("adornment", "engagement", 0), - RING("teleportation", "wooden", 0), - RING("regeneration", "black onyx", 0), - RING("searching", "topaz", 0), - RING("see invisible", "pearl", 0), - RING("stealth", "sapphire", 0), - RING("levitation", "moonstone", 0), - RING("poison resistance", "agate", 0), - RING("aggravate monster", "tiger eye", 0), - RING("hunger", "shining", 0), - RING("fire resistance", "gold", 0), - RING("cold resistance", "copper", 0), - RING("protection from shape changers", "diamond", 0), - RING("conflict", "jade", 0), - RING("gain strength", "ruby", SPEC), - RING("increase damage", "silver", SPEC), - RING("protection", "granite", SPEC), - RING("warning", "wire", 0), - RING("teleport control", "iron", 0), - RING(NULL, "ivory", 0), - RING(NULL, "blackened", 0), - -/* gems ************************************************************/ -#define GEM(name,color,prob,gval) { name, color, NULL, 0, 1,\ - GEM_SYM, prob, 0, 1, 0, 0, gval } - GEM("diamond", "blue", 1, 4000), - GEM("ruby", "red", 1, 3500), - GEM("sapphire", "blue", 1, 3000), - GEM("emerald", "green", 1, 2500), - GEM("turquoise", "green", 1, 2000), - GEM("aquamarine", "blue", 1, 1500), - GEM("tourmaline", "green", 1, 1000), - GEM("topaz", "yellow", 1, 900), - GEM("opal", "yellow", 1, 800), - GEM("garnet", "dark", 1, 700), - GEM("amethyst", "violet", 2, 650), - GEM("agate", "green", 2, 600), - GEM("onyx", "white", 2, 550), - GEM("jasper", "yellowish brown", 2, 500), - GEM("jade", "green", 2, 450), - GEM("worthless piece of blue glass", "blue", 20, 0), - GEM("worthless piece of red glass", "red", 20, 0), - GEM("worthless piece of yellow glass", "yellow", 20, 0), - GEM("worthless piece of green glass", "green", 20, 0), - { NULL, NULL, NULL, 0, 0, ILLOBJ_SYM, 0, 0, 0, 0, 0, 0 } -}; - -char obj_symbols[] = { - ILLOBJ_SYM, AMULET_SYM, FOOD_SYM, WEAPON_SYM, TOOL_SYM, - BALL_SYM, CHAIN_SYM, ROCK_SYM, ARMOR_SYM, POTION_SYM, SCROLL_SYM, - WAND_SYM, RING_SYM, GEM_SYM, 0 }; -int bases[sizeof(obj_symbols)]; diff --git a/games/hack/def.permonst.h b/games/hack/def.permonst.h deleted file mode 100644 index b19efc6ae4bc..000000000000 --- a/games/hack/def.permonst.h +++ /dev/null @@ -1,25 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* def.permonst.h - version 1.0.2 */ - -struct permonst { - char *mname,mlet; - schar mlevel,mmove,ac,damn,damd; - unsigned pxlth; -}; - -extern struct permonst mons[]; -#define PM_ACID_BLOB &mons[7] -#define PM_ZOMBIE &mons[13] -#define PM_PIERCER &mons[17] -#define PM_KILLER_BEE &mons[26] -#define PM_WRAITH &mons[33] -#define PM_MIMIC &mons[37] -#define PM_VAMPIRE &mons[43] -#define PM_CHAMELEON &mons[47] -#define PM_DEMON &mons[54] -#define PM_MINOTAUR &mons[55] /* last in mons array */ -#define PM_SHK &mons[56] /* very last */ -#define PM_GHOST &pm_ghost -#define PM_EEL &pm_eel -#define PM_WIZARD &pm_wizard -#define CMNUM 55 /* number of common monsters */ diff --git a/games/hack/def.rm.h b/games/hack/def.rm.h deleted file mode 100644 index 162c10dc820d..000000000000 --- a/games/hack/def.rm.h +++ /dev/null @@ -1,53 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* def.rm.h - version 1.0.2 */ -/* $FreeBSD$ */ - -/* Level location types */ -#define HWALL 1 -#define VWALL 2 -#define SDOOR 3 -#define SCORR 4 -#define LDOOR 5 -#define POOL 6 /* not yet fully implemented */ - /* this should in fact be a bit like lit */ -#define DOOR 7 -#define CORR 8 -#define ROOM 9 -#define STAIRS 10 - -/* - * Avoid using the level types in inequalities: - * these types are subject to change. - * Instead, use one of the macros below. - */ -#define IS_WALL(typ) ((typ) <= VWALL) -#define IS_ROCK(typ) ((typ) < POOL) /* absolutely nonaccessible */ -#define ACCESSIBLE(typ) ((typ) >= DOOR) /* good position */ -#define IS_ROOM(typ) ((typ) >= ROOM) /* ROOM or STAIRS */ -#define ZAP_POS(typ) ((typ) > DOOR) - -/* - * A few of the associated symbols are not hardwired. - */ -#ifdef QUEST -#define CORR_SYM ':' -#else -#define CORR_SYM '#' -#endif /* QUEST */ -#define POOL_SYM '}' - -#define ERRCHAR '{' - -/* - * The structure describing a coordinate position. - * Before adding fields, remember that this will significantly affect - * the size of temporary files and save files. - */ -struct rm { - char scrsym; - unsigned typ:5; - unsigned new:1; - unsigned seen:1; - unsigned lit:1; -}; -extern struct rm levl[COLNO][ROWNO]; diff --git a/games/hack/def.trap.h b/games/hack/def.trap.h deleted file mode 100644 index 26946add76bb..000000000000 --- a/games/hack/def.trap.h +++ /dev/null @@ -1,27 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* def.trap.h - version 1.0.2 */ - -struct trap { - struct trap *ntrap; - xchar tx,ty; - unsigned ttyp:5; - unsigned tseen:1; - unsigned once:1; -}; - -extern struct trap *ftrap; -struct trap *t_at(); -#define newtrap() (struct trap *) alloc(sizeof(struct trap)) - -/* various kinds of traps */ -#define BEAR_TRAP 0 -#define ARROW_TRAP 1 -#define DART_TRAP 2 -#define TRAPDOOR 3 -#define TELEP_TRAP 4 -#define PIT 5 -#define SLP_GAS_TRAP 6 -#define PIERC 7 -#define MIMIC 8 /* used only in mklev.c */ -#define TRAPNUM 9 /* if not less than 32, change sizeof(ttyp) */ - /* see also mtrapseen (bit map) */ diff --git a/games/hack/def.wseg.h b/games/hack/def.wseg.h deleted file mode 100644 index 8b52277072bd..000000000000 --- a/games/hack/def.wseg.h +++ /dev/null @@ -1,14 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* def.wseg.h - version 1.0.2 */ -/* $FreeBSD$ */ - -#ifndef NOWORM -/* worm structure */ -struct wseg { - struct wseg *nseg; - xchar wx,wy; - unsigned wdispl:1; -}; - -#define newseg() (struct wseg *) alloc(sizeof(struct wseg)) -#endif /* NOWORM */ diff --git a/games/hack/hack.6 b/games/hack/hack.6 deleted file mode 100644 index de34120da8f5..000000000000 --- a/games/hack/hack.6 +++ /dev/null @@ -1,152 +0,0 @@ -.\" $FreeBSD$ -.TH HACK 6 "31 March 1985" -.UC 4 -.SH NAME -hack \- exploring The Dungeons of Doom -.SH SYNOPSIS -.B /usr/games/hack -[ -.B \-d -.I directory -] -[ -.B \-n -] -[ -.B \-u -.I playername -] -.br -.B /usr/games/hack -[ -.B \-d -.I directory -] -.B \-s -[ -.B \-X -] -[ -.I playernames -] -.SH DESCRIPTION -.I Hack -is a display oriented dungeons & dragons - like game. -Both display and command structure resemble rogue. -(For a game with the same structure but entirely different display - -a real cave instead of dull rectangles - try Quest.) -.PP -To get started you really only need to know two commands. The command -.B ? -will give you a list of the available commands and the command -.B / -will identify the things you see on the screen. -.PP -To win the game (as opposed to merely playing to beat other people high -scores) you must locate the Amulet of Yendor which is somewhere below -the 20th level of the dungeon and get it out. Nobody has achieved this -yet and if somebody does, he will probably go down in history as a hero -among heroes. -.PP -When the game ends, either by your death, when you quit, or if you escape -from the caves, -.I hack -will give you (a fragment of) the list of top scorers. The scoring -is based on many aspects of your behavior but a rough estimate is -obtained by taking the amount of gold you've found in the cave plus four -times your (real) experience. Precious stones may be worth a lot of gold -when brought to the exit. -There is a 10% penalty for getting yourself killed. -.PP -The administration of the game is kept in the directory specified with the -.B \-d -option, or, if no such option is given, in the directory specified by -the environment variable HACKDIR, or, if no such variable exists, in -the current directory. This same directory contains several auxiliary -files such as lockfiles and the list of top scorers and a subdirectory -.I save -where games are saved. -The game administrator may however choose to install hack with a fixed -playing ground, usually /usr/games/lib/hackdir. -.PP -The -.B \-n -option suppresses printing of the news. -.PP -The -.B \-u -.I playername -option supplies the answer to the question "Who are you?". -When -.I playername -has as suffix one of -.B \-T \-S \-K \-F \-C \-W -then this supplies the answer to the question "What kind of character ... ?". -.PP -The -.B \-s -option will print out the list of your scores. It may be followed by arguments -.B \-X -where X is one of the letters C, F, K, S, T, W to print the scores of -Cavemen, Fighters, Knights, Speleologists, Tourists or Wizards. -It may also be followed by one or more player names to print the scores of the -players mentioned. -.SH AUTHORS -Jay Fenlason (+ Kenny Woodland, Mike Thome and Jon Payne) wrote the -original hack, very much like rogue (but full of bugs). -.br -Andries Brouwer continuously deformed their sources into the current -version - in fact an entirely different game. -.SH FILES -.DT -.ta \w'data, rumors\ \ \ 'u -hack The hack program. -.br -data, rumors Data files used by hack. -.br -help, hh Help data files. -.br -record The list of top scorers. -.br -save A subdirectory containing the saved -.br - games. -.br -bones_dd Descriptions of the ghost and -.br - belongings of a deceased adventurer. -.br -xlock.dd Description of a dungeon level. -.br -safelock Lock file for xlock. -.br -record_lock Lock file for record. -.SH ENVIRONMENT -.DT -.ta \w'HACKPAGER, PAGER\ \ \ 'u -USER or LOGNAME Your login name. -.br -HOME Your home directory. -.br -SHELL Your shell. -.br -TERM The type of your terminal. -.br -HACKPAGER, PAGER Pager used instead of default pager. -.br -MAIL Mailbox file. -.br -MAILREADER Reader used instead of default. -.br -HACKDIR Playground. -.br -HACKOPTIONS String predefining several hack options -.br - (see help file). -.br - -Several other environment variables are used in debugging (wizard) mode, -like GENOCIDED, INVENT, MAGIC and SHOPTYPE. -.SH BUGS -Probably infinite. -Mail complaints to mcvax!aeb . diff --git a/games/hack/hack.Decl.c b/games/hack/hack.Decl.c deleted file mode 100644 index 840f4e02a768..000000000000 --- a/games/hack/hack.Decl.c +++ /dev/null @@ -1,44 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.Decl.c - version 1.0.3 */ -/* $FreeBSD$ */ - -#include "hack.h" -char nul[40]; /* contains zeros */ -char plname[PL_NSIZ]; /* player name */ -char lock[PL_NSIZ+4] = "1lock"; /* long enough for login name .99 */ - -boolean in_mklev, restoring; - -struct rm levl[COLNO][ROWNO]; /* level map */ -#ifndef QUEST -#include "def.mkroom.h" -struct mkroom rooms[MAXNROFROOMS+1]; -coord doors[DOORMAX]; -#endif /* QUEST */ -struct monst *fmon = 0; -struct trap *ftrap = 0; -struct gold *fgold = 0; -struct obj *fobj = 0, *fcobj = 0, *invent = 0, *uwep = 0, *uarm = 0, - *uarm2 = 0, *uarmh = 0, *uarms = 0, *uarmg = 0, *uright = 0, - *uleft = 0, *uchain = 0, *uball = 0; -struct flag flags; -struct you u; -struct monst youmonst; /* dummy; used as return value for boomhit */ - -xchar dlevel = 1; -xchar xupstair, yupstair, xdnstair, ydnstair; -char *save_cm = 0, *killer, *nomovemsg; - -long moves = 1; -long wailmsg = 0; - -int multi = 0; -char genocided[60]; -char fut_geno[60]; - -xchar curx,cury; -xchar seelx, seehx, seely, seehy; /* corners of lit room */ - -coord bhitpos; - -char quitchars[] = " \r\n\033"; diff --git a/games/hack/hack.apply.c b/games/hack/hack.apply.c deleted file mode 100644 index 0de483d8a8a4..000000000000 --- a/games/hack/hack.apply.c +++ /dev/null @@ -1,440 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.apply.c - version 1.0.3 */ - -#include -__FBSDID("$FreeBSD$"); - -#include "hack.h" -#include "def.edog.h" -#include "def.mkroom.h" -static struct monst *bchit(); -extern struct obj *addinv(); -extern struct trap *maketrap(); -extern int (*occupation)(); -extern char *occtxt; -extern char quitchars[]; -extern char pl_character[]; - -static void use_camera(), use_ice_box(), use_whistle(), use_magic_whistle(); -static int use_pick_axe(); - -doapply() { - struct obj *obj; - int res = 1; - - obj = getobj("(", "use or apply"); - if(!obj) return(0); - - switch(obj->otyp){ - case EXPENSIVE_CAMERA: - use_camera(obj); break; - case ICE_BOX: - use_ice_box(obj); break; - case PICK_AXE: - res = use_pick_axe(obj); - break; - - case MAGIC_WHISTLE: - if(pl_character[0] == 'W' || u.ulevel > 9) { - use_magic_whistle(obj); - break; - } - /* FALLTHROUGH */ - case WHISTLE: - use_whistle(obj); - break; - - case CAN_OPENER: - if(!carrying(TIN)) { - pline("You have no can to open."); - goto xit; - } - pline("You cannot open a tin without eating its contents."); - pline("In order to eat, use the 'e' command."); - if(obj != uwep) - pline("Opening the tin will be much easier if you wield the can-opener."); - goto xit; - - default: - pline("Sorry, I don't know how to use that."); - xit: - nomul(0); - return(0); - } - nomul(0); - return(res); -} - -/* ARGSUSED */ -static void -use_camera(obj) /* */ struct obj *obj; { -struct monst *mtmp; - if(!getdir(1)){ /* ask: in what direction? */ - flags.move = multi = 0; - return; - } - if(u.uswallow) { - pline("You take a picture of %s's stomach.", monnam(u.ustuck)); - return; - } - if(u.dz) { - pline("You take a picture of the %s.", - (u.dz > 0) ? "floor" : "ceiling"); - return; - } - if(mtmp = bchit(u.dx, u.dy, COLNO, '!')) { - if(mtmp->msleep){ - mtmp->msleep = 0; - pline("The flash awakens %s.", monnam(mtmp)); /* a3 */ - } else - if(mtmp->data->mlet != 'y') - if(mtmp->mcansee || mtmp->mblinded){ - int tmp = dist(mtmp->mx,mtmp->my); - int tmp2; - if(cansee(mtmp->mx,mtmp->my)) - pline("%s is blinded by the flash!", Monnam(mtmp)); - setmangry(mtmp); - if(tmp < 9 && !mtmp->isshk && rn2(4)) { - mtmp->mflee = 1; - if(rn2(4)) mtmp->mfleetim = rnd(100); - } - if(tmp < 3) mtmp->mcansee = mtmp->mblinded = 0; - else { - tmp2 = mtmp->mblinded; - tmp2 += rnd(1 + 50/tmp); - if(tmp2 > 127) tmp2 = 127; - mtmp->mblinded = tmp2; - mtmp->mcansee = 0; - } - } - } -} - -static -struct obj *current_ice_box; /* a local variable of use_ice_box, to be - used by its local procedures in/ck_ice_box */ -static -in_ice_box(obj) struct obj *obj; { - if(obj == current_ice_box || - (Punished && (obj == uball || obj == uchain))){ - pline("You must be kidding."); - return(0); - } - if(obj->owornmask & (W_ARMOR | W_RING)) { - pline("You cannot refrigerate something you are wearing."); - return(0); - } - if(obj->owt + current_ice_box->owt > 70) { - pline("It won't fit."); - return(1); /* be careful! */ - } - if(obj == uwep) { - if(uwep->cursed) { - pline("Your weapon is welded to your hand!"); - return(0); - } - setuwep((struct obj *) 0); - } - current_ice_box->owt += obj->owt; - freeinv(obj); - obj->o_cnt_id = current_ice_box->o_id; - obj->nobj = fcobj; - fcobj = obj; - obj->age = moves - obj->age; /* actual age */ - return(1); -} - -static -ck_ice_box(obj) struct obj *obj; { - return(obj->o_cnt_id == current_ice_box->o_id); -} - -static -out_ice_box(obj) struct obj *obj; { -struct obj *otmp; - if(obj == fcobj) fcobj = fcobj->nobj; - else { - for(otmp = fcobj; otmp->nobj != obj; otmp = otmp->nobj) - if(!otmp->nobj) panic("out_ice_box"); - otmp->nobj = obj->nobj; - } - current_ice_box->owt -= obj->owt; - obj->age = moves - obj->age; /* simulated point of time */ - (void) addinv(obj); -} - -static void -use_ice_box(obj) struct obj *obj; { -int cnt = 0; -struct obj *otmp; - current_ice_box = obj; /* for use by in/out_ice_box */ - for(otmp = fcobj; otmp; otmp = otmp->nobj) - if(otmp->o_cnt_id == obj->o_id) - cnt++; - if(!cnt) pline("Your ice-box is empty."); - else { - pline("Do you want to take something out of the ice-box? [yn] "); - if(readchar() == 'y') - if(askchain(fcobj, (char *) 0, 0, out_ice_box, ck_ice_box, 0)) - return; - pline("That was all. Do you wish to put something in? [yn] "); - if(readchar() != 'y') return; - } - /* call getobj: 0: allow cnt; #: allow all types; %: expect food */ - otmp = getobj("0#%", "put in"); - if(!otmp || !in_ice_box(otmp)) - flags.move = multi = 0; -} - -static -struct monst * -bchit(ddx,ddy,range,sym) int ddx,ddy,range; char sym; { - struct monst *mtmp = (struct monst *) 0; - int bchx = u.ux, bchy = u.uy; - - if(sym) Tmp_at(-1, sym); /* open call */ - while(range--) { - bchx += ddx; - bchy += ddy; - if(mtmp = m_at(bchx,bchy)) - break; - if(!ZAP_POS(levl[bchx][bchy].typ)) { - bchx -= ddx; - bchy -= ddy; - break; - } - if(sym) Tmp_at(bchx, bchy); - } - if(sym) Tmp_at(-1, -1); - return(mtmp); -} - -/* ARGSUSED */ -static void -use_whistle(obj) struct obj *obj; { -struct monst *mtmp = fmon; - pline("You produce a high whistling sound."); - while(mtmp) { - if(dist(mtmp->mx,mtmp->my) < u.ulevel*20) { - if(mtmp->msleep) - mtmp->msleep = 0; - if(mtmp->mtame) - EDOG(mtmp)->whistletime = moves; - } - mtmp = mtmp->nmon; - } -} - -/* ARGSUSED */ -static void -use_magic_whistle(obj) struct obj *obj; { -struct monst *mtmp = fmon; - pline("You produce a strange whistling sound."); - while(mtmp) { - if(mtmp->mtame) mnexto(mtmp); - mtmp = mtmp->nmon; - } -} - -static int dig_effort; /* effort expended on current pos */ -static uchar dig_level; -static coord dig_pos; -static boolean dig_down; - -static -dig() { - struct rm *lev; - int dpx = dig_pos.x, dpy = dig_pos.y; - - /* perhaps a nymph stole his pick-axe while he was busy digging */ - /* or perhaps he teleported away */ - if(u.uswallow || !uwep || uwep->otyp != PICK_AXE || - dig_level != dlevel || - ((dig_down && (dpx != u.ux || dpy != u.uy)) || - (!dig_down && dist(dpx,dpy) > 2))) - return(0); - - dig_effort += 10 + abon() + uwep->spe + rn2(5); - if(dig_down) { - if(!xdnstair) { - pline("The floor here seems too hard to dig in."); - return(0); - } - if(dig_effort > 250) { - dighole(); - return(0); /* done with digging */ - } - if(dig_effort > 50) { - struct trap *ttmp = t_at(dpx,dpy); - - if(!ttmp) { - ttmp = maketrap(dpx,dpy,PIT); - ttmp->tseen = 1; - pline("You have dug a pit."); - u.utrap = rn1(4,2); - u.utraptype = TT_PIT; - return(0); - } - } - } else - if(dig_effort > 100) { - char *digtxt; - struct obj *obj; - - lev = &levl[dpx][dpy]; - if(obj = sobj_at(ENORMOUS_ROCK, dpx, dpy)) { - fracture_rock(obj); - digtxt = "The rock falls apart."; - } else if(!lev->typ || lev->typ == SCORR) { - lev->typ = CORR; - digtxt = "You succeeded in cutting away some rock."; - } else if(lev->typ == HWALL || lev->typ == VWALL - || lev->typ == SDOOR) { - lev->typ = xdnstair ? DOOR : ROOM; - digtxt = "You just made an opening in the wall."; - } else - digtxt = "Now what exactly was it that you were digging in?"; - mnewsym(dpx, dpy); - prl(dpx, dpy); - pline("%s", digtxt); /* after mnewsym & prl */ - return(0); - } else { - if(IS_WALL(levl[dpx][dpy].typ)) { - int rno = inroom(dpx,dpy); - - if(rno >= 0 && rooms[rno].rtype >= 8) { - pline("This wall seems too hard to dig into."); - return(0); - } - } - pline("You hit the rock with all your might."); - } - return(1); -} - -/* When will hole be finished? Very rough indication used by shopkeeper. */ -holetime() { - return( (occupation == dig) ? (250 - dig_effort)/20 : -1); -} - -dighole() -{ - struct trap *ttmp = t_at(u.ux, u.uy); - - if(!xdnstair) { - pline("The floor here seems too hard to dig in."); - } else { - if(ttmp) - ttmp->ttyp = TRAPDOOR; - else - ttmp = maketrap(u.ux, u.uy, TRAPDOOR); - ttmp->tseen = 1; - pline("You've made a hole in the floor."); - if(!u.ustuck) { - if(inshop()) - shopdig(1); - pline("You fall through ..."); - if(u.utraptype == TT_PIT) { - u.utrap = 0; - u.utraptype = 0; - } - goto_level(dlevel+1, FALSE); - } - } -} - -static -use_pick_axe(obj) -struct obj *obj; -{ - char dirsyms[12]; - extern char sdir[]; - char *dsp = dirsyms, *sdp = sdir; - struct monst *mtmp; - struct rm *lev; - int rx, ry, res = 0; - - if(obj != uwep) { - if(uwep && uwep->cursed) { - /* Andreas Bormann - ihnp4!decvax!mcvax!unido!ab */ - pline("Since your weapon is welded to your hand,"); - pline("you cannot use that pick-axe."); - return(0); - } - pline("You now wield %s.", doname(obj)); - setuwep(obj); - res = 1; - } - while(*sdp) { - (void) movecmd(*sdp); /* sets u.dx and u.dy and u.dz */ - rx = u.ux + u.dx; - ry = u.uy + u.dy; - if(u.dz > 0 || (u.dz == 0 && isok(rx, ry) && - (IS_ROCK(levl[rx][ry].typ) - || sobj_at(ENORMOUS_ROCK, rx, ry)))) - *dsp++ = *sdp; - sdp++; - } - *dsp = 0; - pline("In what direction do you want to dig? [%s] ", dirsyms); - if(!getdir(0)) /* no txt */ - return(res); - if(u.uswallow && attack(u.ustuck)) /* return(1) */; - else - if(u.dz < 0) - pline("You cannot reach the ceiling."); - else - if(u.dz == 0) { - if(Confusion) - confdir(); - rx = u.ux + u.dx; - ry = u.uy + u.dy; - if((mtmp = m_at(rx, ry)) && attack(mtmp)) - return(1); - if(!isok(rx, ry)) { - pline("Clash!"); - return(1); - } - lev = &levl[rx][ry]; - if(lev->typ == DOOR) - pline("Your %s against the door.", - aobjnam(obj, "clang")); - else if(!IS_ROCK(lev->typ) - && !sobj_at(ENORMOUS_ROCK, rx, ry)) { - /* ACCESSIBLE or POOL */ - pline("You swing your %s through thin air.", - aobjnam(obj, (char *) 0)); - } else { - if(dig_pos.x != rx || dig_pos.y != ry - || dig_level != dlevel || dig_down) { - dig_down = FALSE; - dig_pos.x = rx; - dig_pos.y = ry; - dig_level = dlevel; - dig_effort = 0; - pline("You start digging."); - } else - pline("You continue digging."); - occupation = dig; - occtxt = "digging"; - } - } else if(Levitation) { - pline("You cannot reach the floor."); - } else { - if(dig_pos.x != u.ux || dig_pos.y != u.uy - || dig_level != dlevel || !dig_down) { - dig_down = TRUE; - dig_pos.x = u.ux; - dig_pos.y = u.uy; - dig_level = dlevel; - dig_effort = 0; - pline("You start digging in the floor."); - if(inshop()) - shopdig(0); - } else - pline("You continue digging in the floor."); - occupation = dig; - occtxt = "digging"; - } - return(1); -} diff --git a/games/hack/hack.bones.c b/games/hack/hack.bones.c deleted file mode 100644 index 97f8c260101a..000000000000 --- a/games/hack/hack.bones.c +++ /dev/null @@ -1,96 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.bones.c - version 1.0.3 */ -/* $FreeBSD$ */ - -#include "hack.h" -extern char plname[PL_NSIZ]; -extern long somegold(); -extern struct monst *makemon(); -extern struct permonst pm_ghost; - -char bones[] = "bones_xx"; - -/* save bones and possessions of a deceased adventurer */ -savebones(){ -int fd; -struct obj *otmp; -struct trap *ttmp; -struct monst *mtmp; - if(dlevel <= 0 || dlevel > MAXLEVEL) return; - if(!rn2(1 + dlevel/2)) return; /* not so many ghosts on low levels */ - bones[6] = '0' + (dlevel/10); - bones[7] = '0' + (dlevel%10); - if((fd = open(bones,0)) >= 0){ - (void) close(fd); - return; - } - /* drop everything; the corpse's possessions are usually cursed */ - otmp = invent; - while(otmp){ - otmp->ox = u.ux; - otmp->oy = u.uy; - otmp->age = 0; /* very long ago */ - otmp->owornmask = 0; - if(rn2(5)) otmp->cursed = 1; - if(!otmp->nobj){ - otmp->nobj = fobj; - fobj = invent; - invent = 0; /* superfluous */ - break; - } - otmp = otmp->nobj; - } - if(!(mtmp = makemon(PM_GHOST, u.ux, u.uy))) return; - mtmp->mx = u.ux; - mtmp->my = u.uy; - mtmp->msleep = 1; - (void) strcpy((char *) mtmp->mextra, plname); - mkgold(somegold() + d(dlevel,30), u.ux, u.uy); - for(mtmp = fmon; mtmp; mtmp = mtmp->nmon){ - mtmp->m_id = 0; - if(mtmp->mtame) { - mtmp->mtame = 0; - mtmp->mpeaceful = 0; - } - mtmp->mlstmv = 0; - if(mtmp->mdispl) unpmon(mtmp); - } - for(ttmp = ftrap; ttmp; ttmp = ttmp->ntrap) - ttmp->tseen = 0; - for(otmp = fobj; otmp; otmp = otmp->nobj) { - otmp->o_id = 0; - /* otmp->o_cnt_id = 0; - superfluous */ - otmp->onamelth = 0; - otmp->known = 0; - otmp->invlet = 0; - if(otmp->olet == AMULET_SYM && !otmp->spe) { - otmp->spe = -1; /* no longer the actual amulet */ - otmp->cursed = 1; /* flag as gotten from a ghost */ - } - } - if((fd = creat(bones, FMASK)) < 0) return; - savelev(fd,dlevel); - (void) close(fd); -} - -getbones(){ -int fd,x,y,ok; - if(rn2(3)) return(0); /* only once in three times do we find bones */ - bones[6] = '0' + dlevel/10; - bones[7] = '0' + dlevel%10; - if((fd = open(bones, 0)) < 0) return(0); - if((ok = uptodate(fd)) != 0){ - getlev(fd, 0, dlevel); - for(x = 0; x < COLNO; x++) for(y = 0; y < ROWNO; y++) - levl[x][y].seen = levl[x][y].new = 0; - } - (void) close(fd); -#ifdef WIZARD - if(!wizard) /* duvel!frans: don't remove bones while debugging */ -#endif /* WiZARD */ - if(unlink(bones) < 0){ - pline("Cannot unlink %s .", bones); - return(0); - } - return(ok); -} diff --git a/games/hack/hack.c b/games/hack/hack.c deleted file mode 100644 index 5a272044adae..000000000000 --- a/games/hack/hack.c +++ /dev/null @@ -1,801 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.c - version 1.0.3 */ - -#include -__FBSDID("$FreeBSD$"); - -#include "hack.h" -#include - -extern char news0(); -extern char *nomovemsg; -extern char *exclam(); -extern struct obj *addinv(); -extern boolean hmon(); - -/* called on movement: - 1. when throwing ball+chain far away - 2. when teleporting - 3. when walking out of a lit room - */ -unsee() { - int x,y; - struct rm *lev; - -/* - if(u.udispl){ - u.udispl = 0; - newsym(u.udisx, u.udisy); - } -*/ -#ifndef QUEST - if(seehx){ - seehx = 0; - } else -#endif /* QUEST */ - for(x = u.ux-1; x < u.ux+2; x++) - for(y = u.uy-1; y < u.uy+2; y++) { - if(!isok(x, y)) continue; - lev = &levl[x][y]; - if(!lev->lit && lev->scrsym == '.') { - lev->scrsym =' '; - lev->new = 1; - on_scr(x,y); - } - } -} - -/* called: - in hack.eat.c: seeoff(0) - blind after eating rotten food - in hack.mon.c: seeoff(0) - blinded by a yellow light - in hack.mon.c: seeoff(1) - swallowed - in hack.do.c: seeoff(0) - blind after drinking potion - in hack.do.c: seeoff(1) - go up or down the stairs - in hack.trap.c:seeoff(1) - fall through trapdoor - */ -seeoff(mode) /* 1 to redo @, 0 to leave them */ -{ /* 1 means misc movement, 0 means blindness */ - int x,y; - struct rm *lev; - - if(u.udispl && mode){ - u.udispl = 0; - levl[u.udisx][u.udisy].scrsym = news0(u.udisx,u.udisy); - } -#ifndef QUEST - if(seehx) { - seehx = 0; - } else -#endif /* QUEST */ - if(!mode) { - for(x = u.ux-1; x < u.ux+2; x++) - for(y = u.uy-1; y < u.uy+2; y++) { - if(!isok(x, y)) continue; - lev = &levl[x][y]; - if(!lev->lit && lev->scrsym == '.') - lev->seen = 0; - } - } -} - -domove() -{ - xchar oldx,oldy; - struct monst *mtmp; - struct rm *tmpr,*ust; - struct trap *trap; - struct obj *otmp; - - u_wipe_engr(rnd(5)); - - if(inv_weight() > 0){ - pline("You collapse under your load."); - nomul(0); - return; - } - if(u.uswallow) { - u.dx = u.dy = 0; - u.ux = u.ustuck->mx; - u.uy = u.ustuck->my; - } else { - if(Confusion) { - do { - confdir(); - } while(!isok(u.ux+u.dx, u.uy+u.dy) || - IS_ROCK(levl[u.ux+u.dx][u.uy+u.dy].typ)); - } - if(!isok(u.ux+u.dx, u.uy+u.dy)){ - nomul(0); - return; - } - } - - ust = &levl[u.ux][u.uy]; - oldx = u.ux; - oldy = u.uy; - if(!u.uswallow && (trap = t_at(u.ux+u.dx, u.uy+u.dy)) && trap->tseen) - nomul(0); - if(u.ustuck && !u.uswallow && (u.ux+u.dx != u.ustuck->mx || - u.uy+u.dy != u.ustuck->my)) { - if(dist(u.ustuck->mx, u.ustuck->my) > 2){ - /* perhaps it fled (or was teleported or ... ) */ - u.ustuck = 0; - } else { - if(Blind) pline("You cannot escape from it!"); - else pline("You cannot escape from %s!", - monnam(u.ustuck)); - nomul(0); - return; - } - } - if(u.uswallow || (mtmp = m_at(u.ux+u.dx,u.uy+u.dy))) { - /* attack monster */ - - nomul(0); - gethungry(); - if(multi < 0) return; /* we just fainted */ - - /* try to attack; note that it might evade */ - if(attack(u.uswallow ? u.ustuck : mtmp)) - return; - } - /* not attacking an animal, so we try to move */ - if(u.utrap) { - if(u.utraptype == TT_PIT) { - pline("You are still in a pit."); - u.utrap--; - } else { - pline("You are caught in a beartrap."); - if((u.dx && u.dy) || !rn2(5)) u.utrap--; - } - return; - } - tmpr = &levl[u.ux+u.dx][u.uy+u.dy]; - if(IS_ROCK(tmpr->typ) || - (u.dx && u.dy && (tmpr->typ == DOOR || ust->typ == DOOR))){ - flags.move = 0; - nomul(0); - return; - } - while(otmp = sobj_at(ENORMOUS_ROCK, u.ux+u.dx, u.uy+u.dy)) { - xchar rx = u.ux+2*u.dx, ry = u.uy+2*u.dy; - struct trap *ttmp; - nomul(0); - if(isok(rx,ry) && !IS_ROCK(levl[rx][ry].typ) && - (levl[rx][ry].typ != DOOR || !(u.dx && u.dy)) && - !sobj_at(ENORMOUS_ROCK, rx, ry)) { - if(m_at(rx,ry)) { - pline("You hear a monster behind the rock."); - pline("Perhaps that's why you cannot move it."); - goto cannot_push; - } - if(ttmp = t_at(rx,ry)) - switch(ttmp->ttyp) { - case PIT: - pline("You push the rock into a pit!"); - deltrap(ttmp); - delobj(otmp); - pline("It completely fills the pit!"); - continue; - case TELEP_TRAP: - pline("You push the rock and suddenly it disappears!"); - delobj(otmp); - continue; - } - if(levl[rx][ry].typ == POOL) { - levl[rx][ry].typ = ROOM; - mnewsym(rx,ry); - prl(rx,ry); - pline("You push the rock into the water."); - pline("Now you can cross the water!"); - delobj(otmp); - continue; - } - otmp->ox = rx; - otmp->oy = ry; - /* pobj(otmp); */ - if(cansee(rx,ry)) atl(rx,ry,otmp->olet); - if(Invisible) newsym(u.ux+u.dx, u.uy+u.dy); - - { static long lastmovetime; - /* note: this var contains garbage initially and - after a restore */ - if(moves > lastmovetime+2 || moves < lastmovetime) - pline("With great effort you move the enormous rock."); - lastmovetime = moves; - } - } else { - pline("You try to move the enormous rock, but in vain."); - cannot_push: - if((!invent || inv_weight()+90 <= 0) && - (!u.dx || !u.dy || (IS_ROCK(levl[u.ux][u.uy+u.dy].typ) - && IS_ROCK(levl[u.ux+u.dx][u.uy].typ)))){ - pline("However, you can squeeze yourself into a small opening."); - break; - } else - return; - } - } - if(u.dx && u.dy && IS_ROCK(levl[u.ux][u.uy+u.dy].typ) && - IS_ROCK(levl[u.ux+u.dx][u.uy].typ) && - invent && inv_weight()+40 > 0) { - pline("You are carrying too much to get through."); - nomul(0); - return; - } - if(Punished && - DIST(u.ux+u.dx, u.uy+u.dy, uchain->ox, uchain->oy) > 2){ - if(carried(uball)) { - movobj(uchain, u.ux, u.uy); - goto nodrag; - } - - if(DIST(u.ux+u.dx, u.uy+u.dy, uball->ox, uball->oy) < 3){ - /* leave ball, move chain under/over ball */ - movobj(uchain, uball->ox, uball->oy); - goto nodrag; - } - - if(inv_weight() + (int) uball->owt/2 > 0) { - pline("You cannot %sdrag the heavy iron ball.", - invent ? "carry all that and also " : ""); - nomul(0); - return; - } - - movobj(uball, uchain->ox, uchain->oy); - unpobj(uball); /* BAH %% */ - uchain->ox = u.ux; - uchain->oy = u.uy; - nomul(-2); - nomovemsg = ""; - nodrag: ; - } - u.ux += u.dx; - u.uy += u.dy; - if(flags.run) { - if(tmpr->typ == DOOR || - (xupstair == u.ux && yupstair == u.uy) || - (xdnstair == u.ux && ydnstair == u.uy)) - nomul(0); - } - - if(tmpr->typ == POOL && !Levitation) - drown(); /* not necessarily fatal */ - -/* - if(u.udispl) { - u.udispl = 0; - newsym(oldx,oldy); - } -*/ - if(!Blind) { -#ifdef QUEST - setsee(); -#else - if(ust->lit) { - if(tmpr->lit) { - if(tmpr->typ == DOOR) - prl1(u.ux+u.dx,u.uy+u.dy); - else if(ust->typ == DOOR) - nose1(oldx-u.dx,oldy-u.dy); - } else { - unsee(); - prl1(u.ux+u.dx,u.uy+u.dy); - } - } else { - if(tmpr->lit) setsee(); - else { - prl1(u.ux+u.dx,u.uy+u.dy); - if(tmpr->typ == DOOR) { - if(u.dy) { - prl(u.ux-1,u.uy); - prl(u.ux+1,u.uy); - } else { - prl(u.ux,u.uy-1); - prl(u.ux,u.uy+1); - } - } - } - nose1(oldx-u.dx,oldy-u.dy); - } -#endif /* QUEST */ - } else { - pru(); - } - if(!flags.nopick) pickup(1); - if(trap) dotrap(trap); /* fall into pit, arrow trap, etc. */ - (void) inshop(); - if(!Blind) read_engr_at(u.ux,u.uy); -} - -movobj(obj, ox, oy) -struct obj *obj; -int ox, oy; -{ - /* Some dirty programming to get display right */ - freeobj(obj); - unpobj(obj); - obj->nobj = fobj; - fobj = obj; - obj->ox = ox; - obj->oy = oy; -} - -dopickup(){ - if(!g_at(u.ux,u.uy) && !o_at(u.ux,u.uy)) { - pline("There is nothing here to pick up."); - return(0); - } - if(Levitation) { - pline("You cannot reach the floor."); - return(1); - } - pickup(0); - return(1); -} - -pickup(all) -{ - struct gold *gold; - struct obj *obj, *obj2; - int wt; - - if(Levitation) return; - while(gold = g_at(u.ux,u.uy)) { - pline("%ld gold piece%s.", gold->amount, plur(gold->amount)); - u.ugold += gold->amount; - flags.botl = 1; - freegold(gold); - if(flags.run) nomul(0); - if(Invisible) newsym(u.ux,u.uy); - } - - /* check for more than one object */ - if(!all) { - int ct = 0; - - for(obj = fobj; obj; obj = obj->nobj) - if(obj->ox == u.ux && obj->oy == u.uy) - if(!Punished || obj != uchain) - ct++; - if(ct < 2) - all++; - else - pline("There are several objects here."); - } - - for(obj = fobj; obj; obj = obj2) { - obj2 = obj->nobj; /* perhaps obj will be picked up */ - if(obj->ox == u.ux && obj->oy == u.uy) { - if(flags.run) nomul(0); - - /* do not pick up uchain */ - if(Punished && obj == uchain) - continue; - - if(!all) { - char c; - - pline("Pick up %s ? [ynaq]", doname(obj)); - while(!index("ynaq ", (c = readchar()))) - bell(); - if(c == 'q') return; - if(c == 'n') continue; - if(c == 'a') all = 1; - } - - if(obj->otyp == DEAD_COCKATRICE && !uarmg){ - pline("Touching the dead cockatrice is a fatal mistake."); - pline("You turn to stone."); - killer = "cockatrice cadaver"; - done("died"); - } - - if(obj->otyp == SCR_SCARE_MONSTER){ - if(!obj->spe) obj->spe = 1; - else { - /* Note: perhaps the 1st pickup failed: you cannot - carry anymore, and so we never dropped it - - let's assume that treading on it twice also - destroys the scroll */ - pline("The scroll turns to dust as you pick it up."); - delobj(obj); - continue; - } - } - - wt = inv_weight() + obj->owt; - if(wt > 0) { - if(obj->quan > 1) { - /* see how many we can lift */ - extern struct obj *splitobj(); - int savequan = obj->quan; - int iw = inv_weight(); - int qq; - for(qq = 1; qq < savequan; qq++){ - obj->quan = qq; - if(iw + weight(obj) > 0) - break; - } - obj->quan = savequan; - qq--; - /* we can carry qq of them */ - if(!qq) goto too_heavy; - pline("You can only carry %s of the %s lying here.", - (qq == 1) ? "one" : "some", - doname(obj)); - (void) splitobj(obj, qq); - /* note: obj2 is set already, so we'll never - * encounter the other half; if it should be - * otherwise then write - * obj2 = splitobj(obj,qq); - */ - goto lift_some; - } - too_heavy: - pline("There %s %s here, but %s.", - (obj->quan == 1) ? "is" : "are", - doname(obj), - !invent ? "it is too heavy for you to lift" - : "you cannot carry anymore"); - break; - } - lift_some: - if(inv_cnt() >= 52) { - pline("Your knapsack cannot accomodate anymore items."); - break; - } - if(wt > -5) pline("You have a little trouble lifting"); - freeobj(obj); - if(Invisible) newsym(u.ux,u.uy); - addtobill(obj); /* sets obj->unpaid if necessary */ - { int pickquan = obj->quan; - int mergquan; - if(!Blind) obj->dknown = 1; /* this is done by prinv(), - but addinv() needs it already for merging */ - obj = addinv(obj); /* might merge it with other objects */ - mergquan = obj->quan; - obj->quan = pickquan; /* to fool prinv() */ - prinv(obj); - obj->quan = mergquan; - } - } - } -} - -/* stop running if we see something interesting */ -/* turn around a corner if that is the only way we can proceed */ -/* do not turn left or right twice */ -lookaround(){ -int x,y,i,x0,y0,m0,i0 = 9; -int corrct = 0, noturn = 0; -struct monst *mtmp; -#ifdef lint - /* suppress "used before set" message */ - x0 = y0 = 0; -#endif /* lint */ - if(Blind || flags.run == 0) return; - if(flags.run == 1 && levl[u.ux][u.uy].typ == ROOM) return; -#ifdef QUEST - if(u.ux0 == u.ux+u.dx && u.uy0 == u.uy+u.dy) goto stop; -#endif /* QUEST */ - for(x = u.ux-1; x <= u.ux+1; x++) for(y = u.uy-1; y <= u.uy+1; y++){ - if(x == u.ux && y == u.uy) continue; - if(!levl[x][y].typ) continue; - if((mtmp = m_at(x,y)) && !mtmp->mimic && - (!mtmp->minvis || See_invisible)){ - if(!mtmp->mtame || (x == u.ux+u.dx && y == u.uy+u.dy)) - goto stop; - } else mtmp = 0; /* invisible M cannot influence us */ - if(x == u.ux-u.dx && y == u.uy-u.dy) continue; - switch(levl[x][y].scrsym){ - case '|': - case '-': - case '.': - case ' ': - break; - case '+': - if(x != u.ux && y != u.uy) break; - if(flags.run != 1) goto stop; - /* FALLTHROUGH */ - case CORR_SYM: - corr: - if(flags.run == 1 || flags.run == 3) { - i = DIST(x,y,u.ux+u.dx,u.uy+u.dy); - if(i > 2) break; - if(corrct == 1 && DIST(x,y,x0,y0) != 1) - noturn = 1; - if(i < i0) { - i0 = i; - x0 = x; - y0 = y; - m0 = mtmp ? 1 : 0; - } - } - corrct++; - break; - case '^': - if(flags.run == 1) goto corr; /* if you must */ - if(x == u.ux+u.dx && y == u.uy+u.dy) goto stop; - break; - default: /* e.g. objects or trap or stairs */ - if(flags.run == 1) goto corr; - if(mtmp) break; /* d */ - stop: - nomul(0); - return; - } - } -#ifdef QUEST - if(corrct > 0 && (flags.run == 4 || flags.run == 5)) goto stop; -#endif /* QUEST */ - if(corrct > 1 && flags.run == 2) goto stop; - if((flags.run == 1 || flags.run == 3) && !noturn && !m0 && i0 && - (corrct == 1 || (corrct == 2 && i0 == 1))) { - /* make sure that we do not turn too far */ - if(i0 == 2) { - if(u.dx == y0-u.uy && u.dy == u.ux-x0) - i = 2; /* straight turn right */ - else - i = -2; /* straight turn left */ - } else if(u.dx && u.dy) { - if((u.dx == u.dy && y0 == u.uy) || - (u.dx != u.dy && y0 != u.uy)) - i = -1; /* half turn left */ - else - i = 1; /* half turn right */ - } else { - if((x0-u.ux == y0-u.uy && !u.dy) || - (x0-u.ux != y0-u.uy && u.dy)) - i = 1; /* half turn right */ - else - i = -1; /* half turn left */ - } - i += u.last_str_turn; - if(i <= 2 && i >= -2) { - u.last_str_turn = i; - u.dx = x0-u.ux, u.dy = y0-u.uy; - } - } -} - -/* something like lookaround, but we are not running */ -/* react only to monsters that might hit us */ -monster_nearby() { -int x,y; -struct monst *mtmp; - if(!Blind) - for(x = u.ux-1; x <= u.ux+1; x++) for(y = u.uy-1; y <= u.uy+1; y++){ - if(x == u.ux && y == u.uy) continue; - if((mtmp = m_at(x,y)) && !mtmp->mimic && !mtmp->mtame && - !mtmp->mpeaceful && !index("Ea", mtmp->data->mlet) && - !mtmp->mfroz && !mtmp->msleep && /* aplvax!jcn */ - (!mtmp->minvis || See_invisible)) - return(1); - } - return(0); -} - -#ifdef QUEST -cansee(x,y) xchar x,y; { -int dx,dy,adx,ady,sdx,sdy,dmax,d; - if(Blind) return(0); - if(!isok(x,y)) return(0); - d = dist(x,y); - if(d < 3) return(1); - if(d > u.uhorizon*u.uhorizon) return(0); - if(!levl[x][y].lit) - return(0); - dx = x - u.ux; adx = abs(dx); sdx = sgn(dx); - dy = y - u.uy; ady = abs(dy); sdy = sgn(dy); - if(dx == 0 || dy == 0 || adx == ady){ - dmax = (dx == 0) ? ady : adx; - for(d = 1; d <= dmax; d++) - if(!rroom(sdx*d,sdy*d)) - return(0); - return(1); - } else if(ady > adx){ - for(d = 1; d <= ady; d++){ - if(!rroom(sdx*( (d*adx)/ady ), sdy*d) || - !rroom(sdx*( (d*adx-1)/ady+1 ), sdy*d)) - return(0); - } - return(1); - } else { - for(d = 1; d <= adx; d++){ - if(!rroom(sdx*d, sdy*( (d*ady)/adx )) || - !rroom(sdx*d, sdy*( (d*ady-1)/adx+1 ))) - return(0); - } - return(1); - } -} - -rroom(x,y) int x,y; { - return(IS_ROOM(levl[u.ux+x][u.uy+y].typ)); -} - -#else - -cansee(x,y) xchar x,y; { - if(Blind || u.uswallow) return(0); - if(dist(x,y) < 3) return(1); - if(levl[x][y].lit && seelx <= x && x <= seehx && seely <= y && - y <= seehy) return(1); - return(0); -} -#endif /* QUEST */ - -sgn(a) int a; { - return((a > 0) ? 1 : (a == 0) ? 0 : -1); -} - -#ifdef QUEST -setsee() -{ - x,y; - - if(Blind) { - pru(); - return; - } - for(y = u.uy-u.uhorizon; y <= u.uy+u.uhorizon; y++) - for(x = u.ux-u.uhorizon; x <= u.ux+u.uhorizon; x++) { - if(cansee(x,y)) - prl(x,y); - } -} - -#else - -setsee() -{ - int x,y; - - if(Blind) { - pru(); - return; - } - if(!levl[u.ux][u.uy].lit) { - seelx = u.ux-1; - seehx = u.ux+1; - seely = u.uy-1; - seehy = u.uy+1; - } else { - for(seelx = u.ux; levl[seelx-1][u.uy].lit; seelx--); - for(seehx = u.ux; levl[seehx+1][u.uy].lit; seehx++); - for(seely = u.uy; levl[u.ux][seely-1].lit; seely--); - for(seehy = u.uy; levl[u.ux][seehy+1].lit; seehy++); - } - for(y = seely; y <= seehy; y++) - for(x = seelx; x <= seehx; x++) { - prl(x,y); - } - if(!levl[u.ux][u.uy].lit) seehx = 0; /* seems necessary elsewhere */ - else { - if(seely == u.uy) for(x = u.ux-1; x <= u.ux+1; x++) prl(x,seely-1); - if(seehy == u.uy) for(x = u.ux-1; x <= u.ux+1; x++) prl(x,seehy+1); - if(seelx == u.ux) for(y = u.uy-1; y <= u.uy+1; y++) prl(seelx-1,y); - if(seehx == u.ux) for(y = u.uy-1; y <= u.uy+1; y++) prl(seehx+1,y); - } -} -#endif /* QUEST */ - -nomul(nval) -int nval; -{ - if(multi < 0) return; - multi = nval; - flags.mv = flags.run = 0; -} - -abon() -{ - if(u.ustr == 3) return(-3); - else if(u.ustr < 6) return(-2); - else if(u.ustr < 8) return(-1); - else if(u.ustr < 17) return(0); - else if(u.ustr < 69) return(1); /* up to 18/50 */ - else if(u.ustr < 118) return(2); - else return(3); -} - -dbon() -{ - if(u.ustr < 6) return(-1); - else if(u.ustr < 16) return(0); - else if(u.ustr < 18) return(1); - else if(u.ustr == 18) return(2); /* up to 18 */ - else if(u.ustr < 94) return(3); /* up to 18/75 */ - else if(u.ustr < 109) return(4); /* up to 18/90 */ - else if(u.ustr < 118) return(5); /* up to 18/99 */ - else return(6); -} - -losestr(num) /* may kill you; cause may be poison or monster like 'A' */ -int num; -{ - u.ustr -= num; - while(u.ustr < 3) { - u.ustr++; - u.uhp -= 6; - u.uhpmax -= 6; - } - flags.botl = 1; -} - -losehp(n,knam) -int n; -char *knam; -{ - u.uhp -= n; - if(u.uhp > u.uhpmax) - u.uhpmax = u.uhp; /* perhaps n was negative */ - flags.botl = 1; - if(u.uhp < 1) { - killer = knam; /* the thing that killed you */ - done("died"); - } -} - -losehp_m(n,mtmp) -int n; -struct monst *mtmp; -{ - u.uhp -= n; - flags.botl = 1; - if(u.uhp < 1) - done_in_by(mtmp); -} - -losexp() /* hit by V or W */ -{ - int num; - extern long newuexp(); - - if(u.ulevel > 1) - pline("Goodbye level %u.", u.ulevel--); - else - u.uhp = -1; - num = rnd(10); - u.uhp -= num; - u.uhpmax -= num; - u.uexp = newuexp(); - flags.botl = 1; -} - -inv_weight(){ -struct obj *otmp = invent; -int wt = (u.ugold + 500)/1000; -int carrcap; - if(Levitation) /* pugh@cornell */ - carrcap = MAX_CARR_CAP; - else { - carrcap = 5*(((u.ustr > 18) ? 20 : u.ustr) + u.ulevel); - if(carrcap > MAX_CARR_CAP) carrcap = MAX_CARR_CAP; - if(Wounded_legs & LEFT_SIDE) carrcap -= 10; - if(Wounded_legs & RIGHT_SIDE) carrcap -= 10; - } - while(otmp){ - wt += otmp->owt; - otmp = otmp->nobj; - } - return(wt - carrcap); -} - -inv_cnt(){ -struct obj *otmp = invent; -int ct = 0; - while(otmp){ - ct++; - otmp = otmp->nobj; - } - return(ct); -} - -long -newuexp() -{ - return(10*(1L << (u.ulevel-1))); -} diff --git a/games/hack/hack.cmd.c b/games/hack/hack.cmd.c deleted file mode 100644 index fe32ced3c2d7..000000000000 --- a/games/hack/hack.cmd.c +++ /dev/null @@ -1,303 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.cmd.c - version 1.0.3 */ -/* $FreeBSD$ */ - -#include "hack.h" -#include "def.func_tab.h" - -int doredraw(),doredotopl(),dodrop(),dodrink(),doread(),dosearch(),dopickup(), -doversion(),doweararm(),dowearring(),doremarm(),doremring(),dopay(),doapply(), -dosave(),dowield(),ddoinv(),dozap(),ddocall(),dowhatis(),doengrave(),dotele(), -dohelp(),doeat(),doddrop(),do_mname(),doidtrap(),doprwep(),doprarm(), -doprring(),doprgold(),dodiscovered(),dotypeinv(),dolook(),doset(), -doup(), dodown(), done1(), donull(), dothrow(), doextcmd(), dodip(), dopray(); -#ifdef SHELL -int dosh(); -#endif /* SHELL */ -#ifdef SUSPEND -int dosuspend(); -#endif /* SUSPEND */ - -struct func_tab cmdlist[]={ - '\020', doredotopl, - '\022', doredraw, - '\024', dotele, -#ifdef SUSPEND - '\032', dosuspend, -#endif /* SUSPEND */ - 'a', doapply, -/* 'A' : UNUSED */ -/* 'b', 'B' : go sw */ - 'c', ddocall, - 'C', do_mname, - 'd', dodrop, - 'D', doddrop, - 'e', doeat, - 'E', doengrave, -/* 'f', 'F' : multiple go (might become 'fight') */ -/* 'g', 'G' : UNUSED */ -/* 'h', 'H' : go west */ - 'I', dotypeinv, /* Robert Viduya */ - 'i', ddoinv, -/* 'j', 'J', 'k', 'K', 'l', 'L', 'm', 'M', 'n', 'N' : move commands */ -/* 'o', doopen, */ - 'O', doset, - 'p', dopay, - 'P', dowearring, - 'q', dodrink, - 'Q', done1, - 'r', doread, - 'R', doremring, - 's', dosearch, - 'S', dosave, - 't', dothrow, - 'T', doremarm, -/* 'u', 'U' : go ne */ - 'v', doversion, -/* 'V' : UNUSED */ - 'w', dowield, - 'W', doweararm, -/* 'x', 'X' : UNUSED */ -/* 'y', 'Y' : go nw */ - 'z', dozap, -/* 'Z' : UNUSED */ - '<', doup, - '>', dodown, - '/', dowhatis, - '?', dohelp, -#ifdef SHELL - '!', dosh, -#endif /* SHELL */ - '.', donull, - ' ', donull, - ',', dopickup, - ':', dolook, - '^', doidtrap, - '\\', dodiscovered, /* Robert Viduya */ - WEAPON_SYM, doprwep, - ARMOR_SYM, doprarm, - RING_SYM, doprring, - '$', doprgold, - '#', doextcmd, - 0,0,0 -}; - -struct ext_func_tab extcmdlist[] = { - "dip", dodip, - "pray", dopray, - (char *) 0, donull -}; - -extern char *parse(), lowc(), unctrl(), quitchars[]; - -rhack(cmd) -char *cmd; -{ - struct func_tab *tlist = cmdlist; - boolean firsttime = FALSE; - int res; - - if(!cmd) { - firsttime = TRUE; - flags.nopick = 0; - cmd = parse(); - } - if(!*cmd || (*cmd & 0377) == 0377 || - (flags.no_rest_on_space && *cmd == ' ')){ - bell(); - flags.move = 0; - return; /* probably we just had an interrupt */ - } - if(movecmd(*cmd)) { - walk: - if(multi) flags.mv = 1; - domove(); - return; - } - if(movecmd(lowc(*cmd))) { - flags.run = 1; - rush: - if(firsttime){ - if(!multi) multi = COLNO; - u.last_str_turn = 0; - } - flags.mv = 1; -#ifdef QUEST - if(flags.run >= 4) finddir(); - if(firsttime){ - u.ux0 = u.ux + u.dx; - u.uy0 = u.uy + u.dy; - } -#endif /* QUEST */ - domove(); - return; - } - if((*cmd == 'f' && movecmd(cmd[1])) || movecmd(unctrl(*cmd))) { - flags.run = 2; - goto rush; - } - if(*cmd == 'F' && movecmd(lowc(cmd[1]))) { - flags.run = 3; - goto rush; - } - if(*cmd == 'm' && movecmd(cmd[1])) { - flags.run = 0; - flags.nopick = 1; - goto walk; - } - if(*cmd == 'M' && movecmd(lowc(cmd[1]))) { - flags.run = 1; - flags.nopick = 1; - goto rush; - } -#ifdef QUEST - if(*cmd == cmd[1] && (*cmd == 'f' || *cmd == 'F')) { - flags.run = 4; - if(*cmd == 'F') flags.run += 2; - if(cmd[2] == '-') flags.run += 1; - goto rush; - } -#endif /* QUEST */ - while(tlist->f_char) { - if(*cmd == tlist->f_char){ - res = (*(tlist->f_funct))(); - if(!res) { - flags.move = 0; - multi = 0; - } - return; - } - tlist++; - } - { char expcmd[10]; - char *cp = expcmd; - while(*cmd && cp-expcmd < sizeof(expcmd)-2) { - if(*cmd >= 040 && *cmd < 0177) - *cp++ = *cmd++; - else { - *cp++ = '^'; - *cp++ = *cmd++ ^ 0100; - } - } - *cp++ = 0; - pline("Unknown command '%s'.", expcmd); - } - multi = flags.move = 0; -} - -doextcmd() /* here after # - now read a full-word command */ -{ - char buf[BUFSZ]; - struct ext_func_tab *efp = extcmdlist; - - pline("# "); - getlin(buf); - clrlin(); - if(buf[0] == '\033') - return(0); - while(efp->ef_txt) { - if(!strcmp(efp->ef_txt, buf)) - return((*(efp->ef_funct))()); - efp++; - } - pline("%s: unknown command.", buf); - return(0); -} - -char -lowc(sym) -char sym; -{ - return( (sym >= 'A' && sym <= 'Z') ? sym+'a'-'A' : sym ); -} - -char -unctrl(sym) -char sym; -{ - return( (sym >= ('A' & 037) && sym <= ('Z' & 037)) ? sym + 0140 : sym ); -} - -/* 'rogue'-like direction commands */ -char sdir[] = "hykulnjb><"; -schar xdir[10] = { -1,-1, 0, 1, 1, 1, 0,-1, 0, 0 }; -schar ydir[10] = { 0,-1,-1,-1, 0, 1, 1, 1, 0, 0 }; -schar zdir[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 1,-1 }; - -movecmd(sym) /* also sets u.dz, but returns false for <> */ -char sym; -{ - char *dp; - - u.dz = 0; - if(!(dp = index(sdir, sym))) return(0); - u.dx = xdir[dp-sdir]; - u.dy = ydir[dp-sdir]; - u.dz = zdir[dp-sdir]; - return(!u.dz); -} - -getdir(s) -boolean s; -{ - char dirsym; - - if(s) pline("In what direction?"); - dirsym = readchar(); - if(!movecmd(dirsym) && !u.dz) { - if(!index(quitchars, dirsym)) - pline("What a strange direction!"); - return(0); - } - if(Confusion && !u.dz) - confdir(); - return(1); -} - -confdir() -{ - int x = rn2(8); - u.dx = xdir[x]; - u.dy = ydir[x]; -} - -#ifdef QUEST -finddir(){ -int i, ui = u.di; - for(i = 0; i <= 8; i++){ - if(flags.run & 1) ui++; else ui += 7; - ui %= 8; - if(i == 8){ - pline("Not near a wall."); - flags.move = multi = 0; - return(0); - } - if(!isroom(u.ux+xdir[ui], u.uy+ydir[ui])) - break; - } - for(i = 0; i <= 8; i++){ - if(flags.run & 1) ui += 7; else ui++; - ui %= 8; - if(i == 8){ - pline("Not near a room."); - flags.move = multi = 0; - return(0); - } - if(isroom(u.ux+xdir[ui], u.uy+ydir[ui])) - break; - } - u.di = ui; - u.dx = xdir[ui]; - u.dy = ydir[ui]; -} - -isroom(x,y) x,y; { /* what about POOL? */ - return(isok(x,y) && (levl[x][y].typ == ROOM || - (levl[x][y].typ >= LDOOR && flags.run >= 6))); -} -#endif /* QUEST */ - -isok(x,y) int x,y; { - /* x corresponds to curx, so x==1 is the first column. Ach. %% */ - return(x >= 1 && x <= COLNO-1 && y >= 0 && y <= ROWNO-1); -} diff --git a/games/hack/hack.do.c b/games/hack/hack.do.c deleted file mode 100644 index a2327820c269..000000000000 --- a/games/hack/hack.do.c +++ /dev/null @@ -1,489 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.do.c - version 1.0.3 */ -/* $FreeBSD$ */ - -/* Contains code for 'd', 'D' (drop), '>', '<' (up, down) and 't' (throw) */ - -#include "hack.h" - -extern struct obj *splitobj(), *addinv(); -extern boolean hmon(); -extern boolean level_exists[]; -extern struct monst youmonst; -extern char *Doname(); -extern char *nomovemsg; - -static int drop(); - -dodrop() { - return(drop(getobj("0$#", "drop"))); -} - -static int -drop(obj) struct obj *obj; { - if(!obj) return(0); - if(obj->olet == '$') { /* pseudo object */ - long amount = OGOLD(obj); - - if(amount == 0) - pline("You didn't drop any gold pieces."); - else { - mkgold(amount, u.ux, u.uy); - pline("You dropped %ld gold piece%s.", - amount, plur(amount)); - if(Invisible) newsym(u.ux, u.uy); - } - free((char *) obj); - return(1); - } - if(obj->owornmask & (W_ARMOR | W_RING)){ - pline("You cannot drop something you are wearing."); - return(0); - } - if(obj == uwep) { - if(uwep->cursed) { - pline("Your weapon is welded to your hand!"); - return(0); - } - setuwep((struct obj *) 0); - } - pline("You dropped %s.", doname(obj)); - dropx(obj); - return(1); -} - -/* Called in several places - should not produce texts */ -dropx(obj) -struct obj *obj; -{ - freeinv(obj); - dropy(obj); -} - -dropy(obj) -struct obj *obj; -{ - if(obj->otyp == CRYSKNIFE) - obj->otyp = WORM_TOOTH; - obj->ox = u.ux; - obj->oy = u.uy; - obj->nobj = fobj; - fobj = obj; - if(Invisible) newsym(u.ux,u.uy); - subfrombill(obj); - stackobj(obj); -} - -/* drop several things */ -doddrop() { - return(ggetobj("drop", drop, 0)); -} - -dodown() -{ - if(u.ux != xdnstair || u.uy != ydnstair) { - pline("You can't go down here."); - return(0); - } - if(u.ustuck) { - pline("You are being held, and cannot go down."); - return(1); - } - if(Levitation) { - pline("You're floating high above the stairs."); - return(0); - } - - goto_level(dlevel+1, TRUE); - return(1); -} - -doup() -{ - if(u.ux != xupstair || u.uy != yupstair) { - pline("You can't go up here."); - return(0); - } - if(u.ustuck) { - pline("You are being held, and cannot go up."); - return(1); - } - if(!Levitation && inv_weight() + 5 > 0) { - pline("Your load is too heavy to climb the stairs."); - return(1); - } - - goto_level(dlevel-1, TRUE); - return(1); -} - -goto_level(newlevel, at_stairs) -int newlevel; -boolean at_stairs; -{ - int fd; - boolean up = (newlevel < dlevel); - - if(newlevel <= 0) done("escaped"); /* in fact < 0 is impossible */ - if(newlevel > MAXLEVEL) newlevel = MAXLEVEL; /* strange ... */ - if(newlevel == dlevel) return; /* this can happen */ - - glo(dlevel); - fd = creat(lock, FMASK); - if(fd < 0) { - /* - * This is not quite impossible: e.g., we may have - * exceeded our quota. If that is the case then we - * cannot leave this level, and cannot save either. - * Another possibility is that the directory was not - * writable. - */ - pline("A mysterious force prevents you from going %s.", - up ? "up" : "down"); - return; - } - - if(Punished) unplacebc(); - u.utrap = 0; /* needed in level_tele */ - u.ustuck = 0; /* idem */ - keepdogs(); - seeoff(1); - if(u.uswallow) /* idem */ - u.uswldtim = u.uswallow = 0; - flags.nscrinh = 1; - u.ux = FAR; /* hack */ - (void) inshop(); /* probably was a trapdoor */ - - savelev(fd,dlevel); - (void) close(fd); - - dlevel = newlevel; - if(maxdlevel < dlevel) - maxdlevel = dlevel; - glo(dlevel); - - if(!level_exists[dlevel]) - mklev(); - else { - extern int hackpid; - - if((fd = open(lock,0)) < 0) { - pline("Cannot open %s .", lock); - pline("Probably someone removed it."); - done("tricked"); - } - getlev(fd, hackpid, dlevel); - (void) close(fd); - } - - if(at_stairs) { - if(up) { - u.ux = xdnstair; - u.uy = ydnstair; - if(!u.ux) { /* entering a maze from below? */ - u.ux = xupstair; /* this will confuse the player! */ - u.uy = yupstair; - } - if(Punished && !Levitation){ - pline("With great effort you climb the stairs."); - placebc(1); - } - } else { - u.ux = xupstair; - u.uy = yupstair; - if(inv_weight() + 5 > 0 || Punished){ - pline("You fall down the stairs."); /* %% */ - losehp(rnd(3), "fall"); - if(Punished) { - if(uwep != uball && rn2(3)){ - pline("... and are hit by the iron ball."); - losehp(rnd(20), "iron ball"); - } - placebc(1); - } - selftouch("Falling, you"); - } - } - { struct monst *mtmp = m_at(u.ux, u.uy); - if(mtmp) - mnexto(mtmp); - } - } else { /* trapdoor or level_tele */ - do { - u.ux = rnd(COLNO-1); - u.uy = rn2(ROWNO); - } while(levl[u.ux][u.uy].typ != ROOM || - m_at(u.ux,u.uy)); - if(Punished){ - if(uwep != uball && !up /* %% */ && rn2(5)){ - pline("The iron ball falls on your head."); - losehp(rnd(25), "iron ball"); - } - placebc(1); - } - selftouch("Falling, you"); - } - (void) inshop(); - initrack(); - - losedogs(); - { struct monst *mtmp; - if(mtmp = m_at(u.ux, u.uy)) mnexto(mtmp); /* riv05!a3 */ - } - flags.nscrinh = 0; - setsee(); - seeobjs(); /* make old cadavers disappear - riv05!a3 */ - docrt(); - pickup(1); - read_engr_at(u.ux,u.uy); -} - -donull() { - return(1); /* Do nothing, but let other things happen */ -} - -dopray() { - nomovemsg = "You finished your prayer."; - nomul(-3); - return(1); -} - -struct monst *bhit(), *boomhit(); -dothrow() -{ - struct obj *obj; - struct monst *mon; - int tmp; - - obj = getobj("#)", "throw"); /* it is also possible to throw food */ - /* (or jewels, or iron balls ... ) */ - if(!obj || !getdir(1)) /* ask "in what direction?" */ - return(0); - if(obj->owornmask & (W_ARMOR | W_RING)){ - pline("You can't throw something you are wearing."); - return(0); - } - - u_wipe_engr(2); - - if(obj == uwep){ - if(obj->cursed){ - pline("Your weapon is welded to your hand."); - return(1); - } - if(obj->quan > 1) - setuwep(splitobj(obj, 1)); - else - setuwep((struct obj *) 0); - } - else if(obj->quan > 1) - (void) splitobj(obj, 1); - freeinv(obj); - if(u.uswallow) { - mon = u.ustuck; - bhitpos.x = mon->mx; - bhitpos.y = mon->my; - } else if(u.dz) { - if(u.dz < 0) { - pline("%s hits the ceiling, then falls back on top of your head.", - Doname(obj)); /* note: obj->quan == 1 */ - if(obj->olet == POTION_SYM) - potionhit(&youmonst, obj); - else { - if(uarmh) pline("Fortunately, you are wearing a helmet!"); - losehp(uarmh ? 1 : rnd((int)(obj->owt)), "falling object"); - dropy(obj); - } - } else { - pline("%s hits the floor.", Doname(obj)); - if(obj->otyp == EXPENSIVE_CAMERA) { - pline("It is shattered in a thousand pieces!"); - obfree(obj, Null(obj)); - } else if(obj->otyp == EGG) { - pline("\"Splash!\""); - obfree(obj, Null(obj)); - } else if(obj->olet == POTION_SYM) { - pline("The flask breaks, and you smell a peculiar odor ..."); - potionbreathe(obj); - obfree(obj, Null(obj)); - } else { - dropy(obj); - } - } - return(1); - } else if(obj->otyp == BOOMERANG) { - mon = boomhit(u.dx, u.dy); - if(mon == &youmonst) { /* the thing was caught */ - (void) addinv(obj); - return(1); - } - } else { - if(obj->otyp == PICK_AXE && shkcatch(obj)) - return(1); - - mon = bhit(u.dx, u.dy, (obj->otyp == ICE_BOX) ? 1 : - (!Punished || obj != uball) ? 8 : !u.ustuck ? 5 : 1, - obj->olet, - (int (*)()) 0, (int (*)()) 0, obj); - } - if(mon) { - /* awake monster if sleeping */ - wakeup(mon); - - if(obj->olet == WEAPON_SYM) { - tmp = -1+u.ulevel+mon->data->ac+abon(); - if(obj->otyp < ROCK) { - if(!uwep || - uwep->otyp != obj->otyp+(BOW-ARROW)) - tmp -= 4; - else { - tmp += uwep->spe; - } - } else - if(obj->otyp == BOOMERANG) tmp += 4; - tmp += obj->spe; - if(u.uswallow || tmp >= rnd(20)) { - if(hmon(mon,obj,1) == TRUE){ - /* mon still alive */ -#ifndef NOWORM - cutworm(mon,bhitpos.x,bhitpos.y,obj->otyp); -#endif /* NOWORM */ - } else mon = 0; - /* weapons thrown disappear sometimes */ - if(obj->otyp < BOOMERANG && rn2(3)) { - /* check bill; free */ - obfree(obj, (struct obj *) 0); - return(1); - } - } else miss(objects[obj->otyp].oc_name, mon); - } else if(obj->otyp == HEAVY_IRON_BALL) { - tmp = -1+u.ulevel+mon->data->ac+abon(); - if(!Punished || obj != uball) tmp += 2; - if(u.utrap) tmp -= 2; - if(u.uswallow || tmp >= rnd(20)) { - if(hmon(mon,obj,1) == FALSE) - mon = 0; /* he died */ - } else miss("iron ball", mon); - } else if(obj->olet == POTION_SYM && u.ulevel > rn2(15)) { - potionhit(mon, obj); - return(1); - } else { - if(cansee(bhitpos.x,bhitpos.y)) - pline("You miss %s.",monnam(mon)); - else pline("You miss it."); - if(obj->olet == FOOD_SYM && mon->data->mlet == 'd') - if(tamedog(mon,obj)) return(1); - if(obj->olet == GEM_SYM && mon->data->mlet == 'u' && - !mon->mtame){ - if(obj->dknown && objects[obj->otyp].oc_name_known){ - if(objects[obj->otyp].g_val > 0){ - u.uluck += 5; - goto valuable; - } else { - pline("%s is not interested in your junk.", - Monnam(mon)); - } - } else { /* value unknown to @ */ - u.uluck++; - valuable: - if(u.uluck > LUCKMAX) /* dan@ut-ngp */ - u.uluck = LUCKMAX; - pline("%s graciously accepts your gift.", - Monnam(mon)); - mpickobj(mon, obj); - rloc(mon); - return(1); - } - } - } - } - /* the code following might become part of dropy() */ - if(obj->otyp == CRYSKNIFE) - obj->otyp = WORM_TOOTH; - obj->ox = bhitpos.x; - obj->oy = bhitpos.y; - obj->nobj = fobj; - fobj = obj; - /* prevent him from throwing articles to the exit and escaping */ - /* subfrombill(obj); */ - stackobj(obj); - if(Punished && obj == uball && - (bhitpos.x != u.ux || bhitpos.y != u.uy)){ - freeobj(uchain); - unpobj(uchain); - if(u.utrap){ - if(u.utraptype == TT_PIT) - pline("The ball pulls you out of the pit!"); - else { - long side = - rn2(3) ? LEFT_SIDE : RIGHT_SIDE; - pline("The ball pulls you out of the bear trap."); - pline("Your %s leg is severely damaged.", - (side == LEFT_SIDE) ? "left" : "right"); - set_wounded_legs(side, 500+rn2(1000)); - losehp(2, "thrown ball"); - } - u.utrap = 0; - } - unsee(); - uchain->nobj = fobj; - fobj = uchain; - u.ux = uchain->ox = bhitpos.x - u.dx; - u.uy = uchain->oy = bhitpos.y - u.dy; - setsee(); - (void) inshop(); - } - if(cansee(bhitpos.x, bhitpos.y)) prl(bhitpos.x,bhitpos.y); - return(1); -} - -/* split obj so that it gets size num */ -/* remainder is put in the object structure delivered by this call */ -struct obj * -splitobj(obj, num) struct obj *obj; int num; { -struct obj *otmp; - otmp = newobj(0); - *otmp = *obj; /* copies whole structure */ - otmp->o_id = flags.ident++; - otmp->onamelth = 0; - obj->quan = num; - obj->owt = weight(obj); - otmp->quan -= num; - otmp->owt = weight(otmp); /* -= obj->owt ? */ - obj->nobj = otmp; - if(obj->unpaid) splitbill(obj,otmp); - return(otmp); -} - -more_experienced(exp,rexp) -int exp, rexp; -{ - extern char pl_character[]; - - u.uexp += exp; - u.urexp += 4*exp + rexp; - if(exp) flags.botl = 1; - if(u.urexp >= ((pl_character[0] == 'W') ? 1000 : 2000)) - flags.beginner = 0; -} - -set_wounded_legs(side, timex) -long side; -int timex; -{ - if(!Wounded_legs || (Wounded_legs & TIMEOUT)) - Wounded_legs |= side + timex; - else - Wounded_legs |= side; -} - -heal_legs() -{ - if(Wounded_legs) { - if((Wounded_legs & BOTH_SIDES) == BOTH_SIDES) - pline("Your legs feel somewhat better."); - else - pline("Your leg feels somewhat better."); - Wounded_legs = 0; - } -} diff --git a/games/hack/hack.do_name.c b/games/hack/hack.do_name.c deleted file mode 100644 index 24dce8a158e6..000000000000 --- a/games/hack/hack.do_name.c +++ /dev/null @@ -1,292 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.do_name.c - version 1.0.3 */ - -#include -__FBSDID("$FreeBSD$"); - -#include "hack.h" -#include -extern char plname[]; - -coord -getpos(force,goal) int force; char *goal; { -int cx,cy,i,c; -extern char sdir[]; /* defined in hack.c */ -extern schar xdir[], ydir[]; /* idem */ -extern char *visctrl(); /* see below */ -coord cc; - pline("(For instructions type a ?)"); - cx = u.ux; - cy = u.uy; - curs(cx,cy+2); - while((c = readchar()) != '.'){ - for(i=0; i<8; i++) if(sdir[i] == c){ - if(1 <= cx + xdir[i] && cx + xdir[i] <= COLNO) - cx += xdir[i]; - if(0 <= cy + ydir[i] && cy + ydir[i] <= ROWNO-1) - cy += ydir[i]; - goto nxtc; - } - if(c == '?'){ - pline("Use [hjkl] to move the cursor to %s.", goal); - pline("Type a . when you are at the right place."); - } else { - pline("Unknown direction: '%s' (%s).", - visctrl(c), - force ? "use hjkl or ." : "aborted"); - if(force) goto nxtc; - cc.x = -1; - cc.y = 0; - return(cc); - } - nxtc: ; - curs(cx,cy+2); - } - cc.x = cx; - cc.y = cy; - return(cc); -} - -do_mname(){ -char buf[BUFSZ]; -coord cc; -int cx,cy,lth,i; -struct monst *mtmp, *mtmp2; -extern char *lmonnam(); - cc = getpos(0, "the monster you want to name"); - cx = cc.x; - cy = cc.y; - if(cx < 0) return(0); - mtmp = m_at(cx,cy); - if(!mtmp){ - if(cx == u.ux && cy == u.uy) - pline("This ugly monster is called %s and cannot be renamed.", - plname); - else - pline("There is no monster there."); - return(1); - } - if(mtmp->mimic){ - pline("I see no monster there."); - return(1); - } - if(!cansee(cx,cy)) { - pline("I cannot see a monster there."); - return(1); - } - pline("What do you want to call %s? ", lmonnam(mtmp)); - getlin(buf); - clrlin(); - if(!*buf || *buf == '\033') - return(1); - lth = strlen(buf)+1; - if(lth > 63){ - buf[62] = 0; - lth = 63; - } - mtmp2 = newmonst(mtmp->mxlth + lth); - *mtmp2 = *mtmp; - for(i=0; imxlth; i++) - ((char *) mtmp2->mextra)[i] = ((char *) mtmp->mextra)[i]; - mtmp2->mnamelth = lth; - (void) strcpy(NAME(mtmp2), buf); - replmon(mtmp,mtmp2); - return(1); -} - -/* - * This routine changes the address of obj . Be careful not to call it - * when there might be pointers around in unknown places. For now: only - * when obj is in the inventory. - */ -do_oname(obj) struct obj *obj; { -struct obj *otmp, *otmp2; -int lth; -char buf[BUFSZ]; - pline("What do you want to name %s? ", doname(obj)); - getlin(buf); - clrlin(); - if(!*buf || *buf == '\033') - return; - lth = strlen(buf)+1; - if(lth > 63){ - buf[62] = 0; - lth = 63; - } - otmp2 = newobj(lth); - *otmp2 = *obj; - otmp2->onamelth = lth; - (void) strcpy(ONAME(otmp2), buf); - - setworn((struct obj *) 0, obj->owornmask); - setworn(otmp2, otmp2->owornmask); - - /* do freeinv(obj); etc. by hand in order to preserve - the position of this object in the inventory */ - if(obj == invent) invent = otmp2; - else for(otmp = invent; ; otmp = otmp->nobj){ - if(!otmp) - panic("Do_oname: cannot find obj."); - if(otmp->nobj == obj){ - otmp->nobj = otmp2; - break; - } - } - /*obfree(obj, otmp2);*/ /* now unnecessary: no pointers on bill */ - free((char *) obj); /* let us hope nobody else saved a pointer */ -} - -ddocall() -{ - struct obj *obj; - - pline("Do you want to name an individual object? [ny] "); - switch(readchar()) { - case '\033': - break; - case 'y': - obj = getobj("#", "name"); - if(obj) do_oname(obj); - break; - default: - obj = getobj("?!=/", "call"); - if(obj) docall(obj); - } - return(0); -} - -docall(obj) -struct obj *obj; -{ - char buf[BUFSZ]; - struct obj otemp; - char **str1; - extern char *xname(); - char *str; - - otemp = *obj; - otemp.quan = 1; - otemp.onamelth = 0; - str = xname(&otemp); - pline("Call %s %s: ", index(vowels,*str) ? "an" : "a", str); - getlin(buf); - clrlin(); - if(!*buf || *buf == '\033') - return; - str = newstring(strlen(buf)+1); - (void) strcpy(str,buf); - str1 = &(objects[obj->otyp].oc_uname); - if(*str1) free(*str1); - *str1 = str; -} - -char *ghostnames[] = { /* these names should have length < PL_NSIZ */ - "adri", "andries", "andreas", "bert", "david", "dirk", "emile", - "frans", "fred", "greg", "hether", "jay", "john", "jon", "kay", - "kenny", "maud", "michiel", "mike", "peter", "robert", "ron", - "tom", "wilmar" -}; - -char * -xmonnam(mtmp, vb) struct monst *mtmp; int vb; { -static char buf[BUFSZ]; /* %% */ -extern char *shkname(); - if(mtmp->mnamelth && !vb) { - (void) strcpy(buf, NAME(mtmp)); - return(buf); - } - switch(mtmp->data->mlet) { - case ' ': - { char *gn = (char *) mtmp->mextra; - if(!*gn) { /* might also look in scorefile */ - gn = ghostnames[rn2(SIZE(ghostnames))]; - if(!rn2(2)) (void) - strcpy((char *) mtmp->mextra, !rn2(5) ? plname : gn); - } - (void) sprintf(buf, "%s's ghost", gn); - } - break; - case '@': - if(mtmp->isshk) { - (void) strcpy(buf, shkname(mtmp)); - break; - } - /* FALLTHROUGH */ - default: - (void) sprintf(buf, "the %s%s", - mtmp->minvis ? "invisible " : "", - mtmp->data->mname); - } - if(vb && mtmp->mnamelth) { - (void) strcat(buf, " called "); - (void) strcat(buf, NAME(mtmp)); - } - return(buf); -} - -char * -lmonnam(mtmp) struct monst *mtmp; { - return(xmonnam(mtmp, 1)); -} - -char * -monnam(mtmp) struct monst *mtmp; { - return(xmonnam(mtmp, 0)); -} - -char * -Monnam(mtmp) struct monst *mtmp; { -char *bp = monnam(mtmp); - if('a' <= *bp && *bp <= 'z') *bp += ('A' - 'a'); - return(bp); -} - -char * -amonnam(mtmp,adj) -struct monst *mtmp; -char *adj; -{ - char *bp = monnam(mtmp); - static char buf[BUFSZ]; /* %% */ - - if(!strncmp(bp, "the ", 4)) bp += 4; - (void) sprintf(buf, "the %s %s", adj, bp); - return(buf); -} - -char * -Amonnam(mtmp, adj) -struct monst *mtmp; -char *adj; -{ - char *bp = amonnam(mtmp,adj); - - *bp = 'T'; - return(bp); -} - -char * -Xmonnam(mtmp) struct monst *mtmp; { -char *bp = Monnam(mtmp); - if(!strncmp(bp, "The ", 4)) { - bp += 2; - *bp = 'A'; - } - return(bp); -} - -char * -visctrl(c) -char c; -{ -static char ccc[3]; - if(c < 040) { - ccc[0] = '^'; - ccc[1] = c + 0100; - ccc[2] = 0; - } else { - ccc[0] = c; - ccc[1] = 0; - } - return(ccc); -} diff --git a/games/hack/hack.do_wear.c b/games/hack/hack.do_wear.c deleted file mode 100644 index 1aa77fdca2f7..000000000000 --- a/games/hack/hack.do_wear.c +++ /dev/null @@ -1,337 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.do_wear.c - version 1.0.3 */ -/* $FreeBSD$ */ - -#include "hack.h" -#include -extern char *nomovemsg; -extern char quitchars[]; -extern char *Doname(); - -off_msg(otmp) struct obj *otmp; { - pline("You were wearing %s.", doname(otmp)); -} - -doremarm() { - struct obj *otmp; - if(!uarm && !uarmh && !uarms && !uarmg) { - pline("Not wearing any armor."); - return(0); - } - otmp = (!uarmh && !uarms && !uarmg) ? uarm : - (!uarms && !uarm && !uarmg) ? uarmh : - (!uarmh && !uarm && !uarmg) ? uarms : - (!uarmh && !uarm && !uarms) ? uarmg : - getobj("[", "take off"); - if(!otmp) return(0); - if(!(otmp->owornmask & (W_ARMOR - W_ARM2))) { - pline("You can't take that off."); - return(0); - } - if( otmp == uarmg && uwep && uwep->cursed ) { /* myers@uwmacc */ - pline("You seem not able to take off the gloves while holding your weapon."); - return(0); - } - (void) armoroff(otmp); - return(1); -} - -doremring() { - if(!uleft && !uright){ - pline("Not wearing any ring."); - return(0); - } - if(!uleft) - return(dorr(uright)); - if(!uright) - return(dorr(uleft)); - if(uleft && uright) while(1) { - char answer; - - pline("What ring, Right or Left? [ rl?]"); - if(index(quitchars, (answer = readchar()))) - return(0); - switch(answer) { - case 'l': - case 'L': - return(dorr(uleft)); - case 'r': - case 'R': - return(dorr(uright)); - case '?': - (void) doprring(); - /* might look at morc here %% */ - } - } - /* NOTREACHED */ -#ifdef lint - return(0); -#endif /* lint */ -} - -dorr(otmp) struct obj *otmp; { - if(cursed(otmp)) return(0); - ringoff(otmp); - off_msg(otmp); - return(1); -} - -cursed(otmp) struct obj *otmp; { - if(otmp->cursed){ - pline("You can't. It appears to be cursed."); - return(1); - } - return(0); -} - -armoroff(otmp) struct obj *otmp; { -int delay = -objects[otmp->otyp].oc_delay; - if(cursed(otmp)) return(0); - setworn((struct obj *) 0, otmp->owornmask & W_ARMOR); - if(delay) { - nomul(delay); - switch(otmp->otyp) { - case HELMET: - nomovemsg = "You finished taking off your helmet."; - break; - case PAIR_OF_GLOVES: - nomovemsg = "You finished taking off your gloves"; - break; - default: - nomovemsg = "You finished taking off your suit."; - } - } else { - off_msg(otmp); - } - return(1); -} - -doweararm() { - struct obj *otmp; - int delay; - int err = 0; - long mask = 0; - - otmp = getobj("[", "wear"); - if(!otmp) return(0); - if(otmp->owornmask & W_ARMOR) { - pline("You are already wearing that!"); - return(0); - } - if(otmp->otyp == HELMET){ - if(uarmh) { - pline("You are already wearing a helmet."); - err++; - } else - mask = W_ARMH; - } else if(otmp->otyp == SHIELD){ - if(uarms) pline("You are already wearing a shield."), err++; - if(uwep && uwep->otyp == TWO_HANDED_SWORD) - pline("You cannot wear a shield and wield a two-handed sword."), err++; - if(!err) mask = W_ARMS; - } else if(otmp->otyp == PAIR_OF_GLOVES) { - if(uarmg) { - pline("You are already wearing gloves."); - err++; - } else - if(uwep && uwep->cursed) { - pline("You cannot wear gloves over your weapon."); - err++; - } else - mask = W_ARMG; - } else { - if(uarm) { - if(otmp->otyp != ELVEN_CLOAK || uarm2) { - pline("You are already wearing some armor."); - err++; - } - } - if(!err) mask = W_ARM; - } - if(otmp == uwep && uwep->cursed) { - if(!err++) - pline("%s is welded to your hand.", Doname(uwep)); - } - if(err) return(0); - setworn(otmp, mask); - if(otmp == uwep) - setuwep((struct obj *) 0); - delay = -objects[otmp->otyp].oc_delay; - if(delay){ - nomul(delay); - nomovemsg = "You finished your dressing manoeuvre."; - } - otmp->known = 1; - return(1); -} - -dowearring() { - struct obj *otmp; - long mask = 0; - long oldprop; - - if(uleft && uright){ - pline("There are no more ring-fingers to fill."); - return(0); - } - otmp = getobj("=", "wear"); - if(!otmp) return(0); - if(otmp->owornmask & W_RING) { - pline("You are already wearing that!"); - return(0); - } - if(otmp == uleft || otmp == uright) { - pline("You are already wearing that."); - return(0); - } - if(otmp == uwep && uwep->cursed) { - pline("%s is welded to your hand.", Doname(uwep)); - return(0); - } - if(uleft) mask = RIGHT_RING; - else if(uright) mask = LEFT_RING; - else do { - char answer; - - pline("What ring-finger, Right or Left? "); - if(index(quitchars, (answer = readchar()))) - return(0); - switch(answer){ - case 'l': - case 'L': - mask = LEFT_RING; - break; - case 'r': - case 'R': - mask = RIGHT_RING; - break; - } - } while(!mask); - setworn(otmp, mask); - if(otmp == uwep) - setuwep((struct obj *) 0); - oldprop = u.uprops[PROP(otmp->otyp)].p_flgs; - u.uprops[PROP(otmp->otyp)].p_flgs |= mask; - switch(otmp->otyp){ - case RIN_LEVITATION: - if(!oldprop) float_up(); - break; - case RIN_PROTECTION_FROM_SHAPE_CHANGERS: - rescham(); - break; - case RIN_GAIN_STRENGTH: - u.ustr += otmp->spe; - u.ustrmax += otmp->spe; - if(u.ustr > 118) u.ustr = 118; - if(u.ustrmax > 118) u.ustrmax = 118; - flags.botl = 1; - break; - case RIN_INCREASE_DAMAGE: - u.udaminc += otmp->spe; - break; - } - prinv(otmp); - return(1); -} - -ringoff(obj) -struct obj *obj; -{ -long mask; - mask = obj->owornmask & W_RING; - setworn((struct obj *) 0, obj->owornmask); - if(!(u.uprops[PROP(obj->otyp)].p_flgs & mask)) - impossible("Strange... I didnt know you had that ring."); - u.uprops[PROP(obj->otyp)].p_flgs &= ~mask; - switch(obj->otyp) { - case RIN_FIRE_RESISTANCE: - /* Bad luck if the player is in hell... --jgm */ - if (!Fire_resistance && dlevel >= 30) { - pline("The flames of Hell burn you to a crisp."); - killer = "stupidity in hell"; - done("burned"); - } - break; - case RIN_LEVITATION: - if(!Levitation) { /* no longer floating */ - float_down(); - } - break; - case RIN_GAIN_STRENGTH: - u.ustr -= obj->spe; - u.ustrmax -= obj->spe; - if(u.ustr > 118) u.ustr = 118; - if(u.ustrmax > 118) u.ustrmax = 118; - flags.botl = 1; - break; - case RIN_INCREASE_DAMAGE: - u.udaminc -= obj->spe; - break; - } -} - -find_ac(){ -int uac = 10; - if(uarm) uac -= ARM_BONUS(uarm); - if(uarm2) uac -= ARM_BONUS(uarm2); - if(uarmh) uac -= ARM_BONUS(uarmh); - if(uarms) uac -= ARM_BONUS(uarms); - if(uarmg) uac -= ARM_BONUS(uarmg); - if(uleft && uleft->otyp == RIN_PROTECTION) uac -= uleft->spe; - if(uright && uright->otyp == RIN_PROTECTION) uac -= uright->spe; - if(uac != u.uac){ - u.uac = uac; - flags.botl = 1; - } -} - -glibr(){ -struct obj *otmp; -int xfl = 0; - if(!uarmg) if(uleft || uright) { - /* Note: at present also cursed rings fall off */ - pline("Your %s off your fingers.", - (uleft && uright) ? "rings slip" : "ring slips"); - xfl++; - if((otmp = uleft) != Null(obj)){ - ringoff(uleft); - dropx(otmp); - } - if((otmp = uright) != Null(obj)){ - ringoff(uright); - dropx(otmp); - } - } - if((otmp = uwep) != Null(obj)){ - /* Note: at present also cursed weapons fall */ - setuwep((struct obj *) 0); - dropx(otmp); - pline("Your weapon %sslips from your hands.", - xfl ? "also " : ""); - } -} - -struct obj * -some_armor(){ -struct obj *otmph = uarm; - if(uarmh && (!otmph || !rn2(4))) otmph = uarmh; - if(uarmg && (!otmph || !rn2(4))) otmph = uarmg; - if(uarms && (!otmph || !rn2(4))) otmph = uarms; - return(otmph); -} - -corrode_armor(){ -struct obj *otmph = some_armor(); - if(otmph){ - if(otmph->rustfree || - otmph->otyp == ELVEN_CLOAK || - otmph->otyp == LEATHER_ARMOR || - otmph->otyp == STUDDED_LEATHER_ARMOR) { - pline("Your %s not affected!", - aobjnam(otmph, "are")); - return; - } - pline("Your %s!", aobjnam(otmph, "corrode")); - otmph->spe--; - } -} diff --git a/games/hack/hack.dog.c b/games/hack/hack.dog.c deleted file mode 100644 index 6272a18a27f7..000000000000 --- a/games/hack/hack.dog.c +++ /dev/null @@ -1,416 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.dog.c - version 1.0.3 */ - -#include -__FBSDID("$FreeBSD$"); - -#include "hack.h" -#include "hack.mfndpos.h" -extern struct monst *makemon(); -#include "def.edog.h" -#include "def.mkroom.h" - -struct permonst li_dog = - { "little dog", 'd',2,18,6,1,6,sizeof(struct edog) }; -struct permonst dog = - { "dog", 'd',4,16,5,1,6,sizeof(struct edog) }; -struct permonst la_dog = - { "large dog", 'd',6,15,4,2,4,sizeof(struct edog) }; - - -makedog(){ -struct monst *mtmp = makemon(&li_dog,u.ux,u.uy); - if(!mtmp) return; /* dogs were genocided */ - initedog(mtmp); -} - -initedog(mtmp) struct monst *mtmp; { - mtmp->mtame = mtmp->mpeaceful = 1; - EDOG(mtmp)->hungrytime = 1000 + moves; - EDOG(mtmp)->eattime = 0; - EDOG(mtmp)->droptime = 0; - EDOG(mtmp)->dropdist = 10000; - EDOG(mtmp)->apport = 10; - EDOG(mtmp)->whistletime = 0; -} - -/* attach the monsters that went down (or up) together with @ */ -struct monst *mydogs = 0; -struct monst *fallen_down = 0; /* monsters that fell through a trapdoor */ - /* they will appear on the next level @ goes to, even if he goes up! */ - -losedogs(){ -struct monst *mtmp; - while(mtmp = mydogs){ - mydogs = mtmp->nmon; - mtmp->nmon = fmon; - fmon = mtmp; - mnexto(mtmp); - } - while(mtmp = fallen_down){ - fallen_down = mtmp->nmon; - mtmp->nmon = fmon; - fmon = mtmp; - rloc(mtmp); - } -} - -keepdogs(){ -struct monst *mtmp; - for(mtmp = fmon; mtmp; mtmp = mtmp->nmon) - if(dist(mtmp->mx,mtmp->my) < 3 && follower(mtmp) - && !mtmp->msleep && !mtmp->mfroz) { - relmon(mtmp); - mtmp->nmon = mydogs; - mydogs = mtmp; - unpmon(mtmp); - keepdogs(); /* we destroyed the link, so use recursion */ - return; /* (admittedly somewhat primitive) */ - } -} - -fall_down(mtmp) struct monst *mtmp; { - relmon(mtmp); - mtmp->nmon = fallen_down; - fallen_down = mtmp; - unpmon(mtmp); - mtmp->mtame = 0; -} - -/* return quality of food; the lower the better */ -#define DOGFOOD 0 -#define CADAVER 1 -#define ACCFOOD 2 -#define MANFOOD 3 -#define APPORT 4 -#define POISON 5 -#define UNDEF 6 -dogfood(obj) struct obj *obj; { - switch(obj->olet) { - case FOOD_SYM: - return( - (obj->otyp == TRIPE_RATION) ? DOGFOOD : - (obj->otyp < CARROT) ? ACCFOOD : - (obj->otyp < CORPSE) ? MANFOOD : - (poisonous(obj) || obj->age + 50 <= moves || - obj->otyp == DEAD_COCKATRICE) - ? POISON : CADAVER - ); - default: - if(!obj->cursed) return(APPORT); - /* FALLTHROUGH */ - case BALL_SYM: - case CHAIN_SYM: - case ROCK_SYM: - return(UNDEF); - } -} - -/* return 0 (no move), 1 (move) or 2 (dead) */ -dog_move(mtmp, after) struct monst *mtmp; { -int nx,ny,omx,omy,appr,nearer,j; -int udist,chi,i,whappr; -struct monst *mtmp2; -struct permonst *mdat = mtmp->data; -struct edog *edog = EDOG(mtmp); -struct obj *obj; -struct trap *trap; -xchar cnt,chcnt,nix,niy; -schar dogroom,uroom; -xchar gx,gy,gtyp,otyp; /* current goal */ -coord poss[9]; -int info[9]; -#define GDIST(x,y) ((x-gx)*(x-gx) + (y-gy)*(y-gy)) -#define DDIST(x,y) ((x-omx)*(x-omx) + (y-omy)*(y-omy)) - - if(moves <= edog->eattime) return(0); /* dog is still eating */ - omx = mtmp->mx; - omy = mtmp->my; - whappr = (moves - EDOG(mtmp)->whistletime < 5); - if(moves > edog->hungrytime + 500 && !mtmp->mconf){ - mtmp->mconf = 1; - mtmp->mhpmax /= 3; - if(mtmp->mhp > mtmp->mhpmax) - mtmp->mhp = mtmp->mhpmax; - if(cansee(omx,omy)) - pline("%s is confused from hunger.", Monnam(mtmp)); - else pline("You feel worried about %s.", monnam(mtmp)); - } else - if(moves > edog->hungrytime + 750 || mtmp->mhp < 1){ - if(cansee(omx,omy)) - pline("%s dies from hunger.", Monnam(mtmp)); - else - pline("You have a sad feeling for a moment, then it passes."); - mondied(mtmp); - return(2); - } - dogroom = inroom(omx,omy); - uroom = inroom(u.ux,u.uy); - udist = dist(omx,omy); - - /* maybe we tamed him while being swallowed --jgm */ - if(!udist) return(0); - - /* if we are carrying sth then we drop it (perhaps near @) */ - /* Note: if apport == 1 then our behaviour is independent of udist */ - if(mtmp->minvent){ - if(!rn2(udist) || !rn2((int) edog->apport)) - if(rn2(10) < edog->apport){ - relobj(mtmp, (int) mtmp->minvis); - if(edog->apport > 1) edog->apport--; - edog->dropdist = udist; /* hpscdi!jon */ - edog->droptime = moves; - } - } else { - if(obj = o_at(omx,omy)) if(!index("0_", obj->olet)){ - if((otyp = dogfood(obj)) <= CADAVER){ - nix = omx; - niy = omy; - goto eatobj; - } - if(obj->owt < 10*mtmp->data->mlevel) - if(rn2(20) < edog->apport+3) - if(rn2(udist) || !rn2((int) edog->apport)){ - freeobj(obj); - unpobj(obj); - /* if(levl[omx][omy].scrsym == obj->olet) - newsym(omx,omy); */ - mpickobj(mtmp,obj); - } - } - } - - /* first we look for food */ - gtyp = UNDEF; /* no goal as yet */ -#ifdef lint - gx = gy = 0; /* suppress 'used before set' message */ -#endif /* LINT */ - for(obj = fobj; obj; obj = obj->nobj) { - otyp = dogfood(obj); - if(otyp > gtyp || otyp == UNDEF) continue; - if(inroom(obj->ox,obj->oy) != dogroom) continue; - if(otyp < MANFOOD && - (dogroom >= 0 || DDIST(obj->ox,obj->oy) < 10)) { - if(otyp < gtyp || (otyp == gtyp && - DDIST(obj->ox,obj->oy) < DDIST(gx,gy))){ - gx = obj->ox; - gy = obj->oy; - gtyp = otyp; - } - } else - if(gtyp == UNDEF && dogroom >= 0 && - uroom == dogroom && - !mtmp->minvent && edog->apport > rn2(8)){ - gx = obj->ox; - gy = obj->oy; - gtyp = APPORT; - } - } - if(gtyp == UNDEF || - (gtyp != DOGFOOD && gtyp != APPORT && moves < edog->hungrytime)){ - if(dogroom < 0 || dogroom == uroom){ - gx = u.ux; - gy = u.uy; -#ifndef QUEST - } else { - int tmp = rooms[dogroom].fdoor; - cnt = rooms[dogroom].doorct; - - gx = gy = FAR; /* random, far away */ - while(cnt--){ - if(dist(gx,gy) > - dist(doors[tmp].x, doors[tmp].y)){ - gx = doors[tmp].x; - gy = doors[tmp].y; - } - tmp++; - } - /* here gx == FAR e.g. when dog is in a vault */ - if(gx == FAR || (gx == omx && gy == omy)){ - gx = u.ux; - gy = u.uy; - } -#endif /* QUEST */ - } - appr = (udist >= 9) ? 1 : (mtmp->mflee) ? -1 : 0; - if(after && udist <= 4 && gx == u.ux && gy == u.uy) - return(0); - if(udist > 1){ - if(!IS_ROOM(levl[u.ux][u.uy].typ) || !rn2(4) || - whappr || - (mtmp->minvent && rn2((int) edog->apport))) - appr = 1; - } - /* if you have dog food he'll follow you more closely */ - if(appr == 0){ - obj = invent; - while(obj){ - if(obj->otyp == TRIPE_RATION){ - appr = 1; - break; - } - obj = obj->nobj; - } - } - } else appr = 1; /* gtyp != UNDEF */ - if(mtmp->mconf) appr = 0; - - if(gx == u.ux && gy == u.uy && (dogroom != uroom || dogroom < 0)){ - extern coord *gettrack(); - coord *cp; - cp = gettrack(omx,omy); - if(cp){ - gx = cp->x; - gy = cp->y; - } - } - - nix = omx; - niy = omy; - cnt = mfndpos(mtmp,poss,info,ALLOW_M | ALLOW_TRAPS); - chcnt = 0; - chi = -1; - for(i=0; idata->mlevel >= mdat->mlevel+2 || - mtmp2->data->mlet == 'c') - continue; - if(after) return(0); /* hit only once each move */ - - if(hitmm(mtmp, mtmp2) == 1 && rn2(4) && - mtmp2->mlstmv != moves && - hitmm(mtmp2,mtmp) == 2) return(2); - return(0); - } - - /* dog avoids traps */ - /* but perhaps we have to pass a trap in order to follow @ */ - if((info[i] & ALLOW_TRAPS) && (trap = t_at(nx,ny))){ - if(!trap->tseen && rn2(40)) continue; - if(rn2(10)) continue; - } - - /* dog eschewes cursed objects */ - /* but likes dog food */ - obj = fobj; - while(obj){ - if(obj->ox != nx || obj->oy != ny) - goto nextobj; - if(obj->cursed) goto nxti; - if(obj->olet == FOOD_SYM && - (otyp = dogfood(obj)) < MANFOOD && - (otyp < ACCFOOD || edog->hungrytime <= moves)){ - /* Note: our dog likes the food so much that he - might eat it even when it conceals a cursed object */ - nix = nx; - niy = ny; - chi = i; - eatobj: - edog->eattime = - moves + obj->quan * objects[obj->otyp].oc_delay; - if(edog->hungrytime < moves) - edog->hungrytime = moves; - edog->hungrytime += - 5*obj->quan * objects[obj->otyp].nutrition; - mtmp->mconf = 0; - if(cansee(nix,niy)) - pline("%s ate %s.", Monnam(mtmp), doname(obj)); - /* perhaps this was a reward */ - if(otyp != CADAVER) - edog->apport += 200/(edog->dropdist+moves-edog->droptime); - delobj(obj); - goto newdogpos; - } - nextobj: - obj = obj->nobj; - } - - for(j=0; jmtrack[j].x && ny == mtmp->mtrack[j].y) - if(rn2(4*(cnt-j))) goto nxti; - -/* Some stupid C compilers cannot compute the whole expression at once. */ - nearer = GDIST(nx,ny); - nearer -= GDIST(nix,niy); - nearer *= appr; - if((nearer == 0 && !rn2(++chcnt)) || nearer<0 || - (nearer > 0 && !whappr && - ((omx == nix && omy == niy && !rn2(3)) - || !rn2(12)) - )){ - nix = nx; - niy = ny; - if(nearer < 0) chcnt = 0; - chi = i; - } - nxti: ; - } -newdogpos: - if(nix != omx || niy != omy){ - if(info[chi] & ALLOW_U){ - (void) hitu(mtmp, d(mdat->damn, mdat->damd)+1); - return(0); - } - mtmp->mx = nix; - mtmp->my = niy; - for(j=MTSZ-1; j>0; j--) mtmp->mtrack[j] = mtmp->mtrack[j-1]; - mtmp->mtrack[0].x = omx; - mtmp->mtrack[0].y = omy; - } - if(mintrap(mtmp) == 2) /* he died */ - return(2); - pmon(mtmp); - return(1); -} - -/* return roomnumber or -1 */ -inroom(x,y) xchar x,y; { -#ifndef QUEST - struct mkroom *croom = &rooms[0]; - while(croom->hx >= 0){ - if(croom->hx >= x-1 && croom->lx <= x+1 && - croom->hy >= y-1 && croom->ly <= y+1) - return(croom - rooms); - croom++; - } -#endif /* QUEST */ - return(-1); /* not in room or on door */ -} - -tamedog(mtmp, obj) -struct monst *mtmp; -struct obj *obj; -{ - struct monst *mtmp2; - - if(flags.moonphase == FULL_MOON && night() && rn2(6)) - return(0); - - /* If we cannot tame him, at least he's no longer afraid. */ - mtmp->mflee = 0; - mtmp->mfleetim = 0; - if(mtmp->mtame || mtmp->mfroz || -#ifndef NOWORM - mtmp->wormno || -#endif /* NOWORM */ - mtmp->isshk || mtmp->isgd || index(" &@12", mtmp->data->mlet)) - return(0); /* no tame long worms? */ - if(obj) { - if(dogfood(obj) >= MANFOOD) return(0); - if(cansee(mtmp->mx,mtmp->my)){ - pline("%s devours the %s.", Monnam(mtmp), - objects[obj->otyp].oc_name); - } - obfree(obj, (struct obj *) 0); - } - mtmp2 = newmonst(sizeof(struct edog) + mtmp->mnamelth); - *mtmp2 = *mtmp; - mtmp2->mxlth = sizeof(struct edog); - if(mtmp->mnamelth) (void) strcpy(NAME(mtmp2), NAME(mtmp)); - initedog(mtmp2); - replmon(mtmp,mtmp2); - return(1); -} diff --git a/games/hack/hack.eat.c b/games/hack/hack.eat.c deleted file mode 100644 index 6f4116bc20b7..000000000000 --- a/games/hack/hack.eat.c +++ /dev/null @@ -1,462 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.eat.c - version 1.0.3 */ - -#include -__FBSDID("$FreeBSD$"); - -#include "hack.h" -char POISONOUS[] = "ADKSVabhks"; -extern char *nomovemsg; -extern int (*afternmv)(); -extern int (*occupation)(); -extern char *occtxt; -extern struct obj *splitobj(), *addinv(); - -/* hunger texts used on bottom line (each 8 chars long) */ -#define SATIATED 0 -#define NOT_HUNGRY 1 -#define HUNGRY 2 -#define WEAK 3 -#define FAINTING 4 -#define FAINTED 5 -#define STARVED 6 - -char *hu_stat[] = { - "Satiated", - " ", - "Hungry ", - "Weak ", - "Fainting", - "Fainted ", - "Starved " -}; - -init_uhunger(){ - u.uhunger = 900; - u.uhs = NOT_HUNGRY; -} - -#define TTSZ SIZE(tintxts) -struct { char *txt; int nut; } tintxts[] = { - "It contains first quality peaches - what a surprise!", 40, - "It contains salmon - not bad!", 60, - "It contains apple juice - perhaps not what you hoped for.", 20, - "It contains some nondescript substance, tasting awfully.", 500, - "It contains rotten meat. You vomit.", -50, - "It turns out to be empty.", 0 -}; - -static struct { - struct obj *tin; - int usedtime, reqtime; -} tin; - -opentin(){ - int r; - - if(!carried(tin.tin)) /* perhaps it was stolen? */ - return(0); /* %% probably we should use tinoid */ - if(tin.usedtime++ >= 50) { - pline("You give up your attempt to open the tin."); - return(0); - } - if(tin.usedtime < tin.reqtime) - return(1); /* still busy */ - - pline("You succeed in opening the tin."); - useup(tin.tin); - r = rn2(2*TTSZ); - if(r < TTSZ){ - pline(tintxts[r].txt); - lesshungry(tintxts[r].nut); - if(r == 1) /* SALMON */ { - Glib = rnd(15); - pline("Eating salmon made your fingers very slippery."); - } - } else { - pline("It contains spinach - this makes you feel like Popeye!"); - lesshungry(600); - if(u.ustr < 118) - u.ustr += rnd( ((u.ustr < 17) ? 19 : 118) - u.ustr); - if(u.ustr > u.ustrmax) u.ustrmax = u.ustr; - flags.botl = 1; - } - return(0); -} - -Meatdone(){ - u.usym = '@'; - prme(); -} - -doeat(){ - struct obj *otmp; - struct objclass *ftmp; - int tmp; - - /* Is there some food (probably a heavy corpse) here on the ground? */ - if(!Levitation) - for(otmp = fobj; otmp; otmp = otmp->nobj) { - if(otmp->ox == u.ux && otmp->oy == u.uy && - otmp->olet == FOOD_SYM) { - pline("There %s %s here; eat %s? [ny] ", - (otmp->quan == 1) ? "is" : "are", - doname(otmp), - (otmp->quan == 1) ? "it" : "one"); - if(readchar() == 'y') { - if(otmp->quan != 1) - (void) splitobj(otmp, 1); - freeobj(otmp); - otmp = addinv(otmp); - addtobill(otmp); - goto gotit; - } - } - } - otmp = getobj("%", "eat"); - if(!otmp) return(0); -gotit: - if(otmp->otyp == TIN){ - if(uwep) { - switch(uwep->otyp) { - case CAN_OPENER: - tmp = 1; - break; - case DAGGER: - case CRYSKNIFE: - tmp = 3; - break; - case PICK_AXE: - case AXE: - tmp = 6; - break; - default: - goto no_opener; - } - pline("Using your %s you try to open the tin.", - aobjnam(uwep, (char *) 0)); - } else { - no_opener: - pline("It is not so easy to open this tin."); - if(Glib) { - pline("The tin slips out of your hands."); - if(otmp->quan > 1) { - struct obj *obj; - extern struct obj *splitobj(); - - obj = splitobj(otmp, 1); - if(otmp == uwep) setuwep(obj); - } - dropx(otmp); - return(1); - } - tmp = 10 + rn2(1 + 500/((int)(u.ulevel + u.ustr))); - } - tin.reqtime = tmp; - tin.usedtime = 0; - tin.tin = otmp; - occupation = opentin; - occtxt = "opening the tin"; - return(1); - } - ftmp = &objects[otmp->otyp]; - multi = -ftmp->oc_delay; - if(otmp->otyp >= CORPSE && eatcorpse(otmp)) goto eatx; - if(!rn2(7) && otmp->otyp != FORTUNE_COOKIE) { - pline("Blecch! Rotten food!"); - if(!rn2(4)) { - pline("You feel rather light headed."); - Confusion += d(2,4); - } else if(!rn2(4)&& !Blind) { - pline("Everything suddenly goes dark."); - Blind = d(2,10); - seeoff(0); - } else if(!rn2(3)) { - if(Blind) - pline("The world spins and you slap against the floor."); - else - pline("The world spins and goes dark."); - nomul(-rnd(10)); - nomovemsg = "You are conscious again."; - } - lesshungry(ftmp->nutrition / 4); - } else { - if(u.uhunger >= 1500) { - pline("You choke over your food."); - pline("You die..."); - killer = ftmp->oc_name; - done("choked"); - } - switch(otmp->otyp){ - case FOOD_RATION: - if(u.uhunger <= 200) - pline("That food really hit the spot!"); - else if(u.uhunger <= 700) - pline("That satiated your stomach!"); - else { - pline("You're having a hard time getting all that food down."); - multi -= 2; - } - lesshungry(ftmp->nutrition); - if(multi < 0) nomovemsg = "You finished your meal."; - break; - case TRIPE_RATION: - pline("Yak - dog food!"); - more_experienced(1,0); - flags.botl = 1; - if(rn2(2)){ - pline("You vomit."); - morehungry(20); - if(Sick) { - Sick = 0; /* David Neves */ - pline("What a relief!"); - } - } else lesshungry(ftmp->nutrition); - break; - default: - if(otmp->otyp >= CORPSE) - pline("That %s tasted terrible!",ftmp->oc_name); - else - pline("That %s was delicious!",ftmp->oc_name); - lesshungry(ftmp->nutrition); - if(otmp->otyp == DEAD_LIZARD && (Confusion > 2)) - Confusion = 2; - else -#ifdef QUEST - if(otmp->otyp == CARROT && !Blind){ - u.uhorizon++; - setsee(); - pline("Your vision improves."); - } else -#endif /* QUEST */ - if(otmp->otyp == FORTUNE_COOKIE) { - if(Blind) { - pline("This cookie has a scrap of paper inside!"); - pline("What a pity, that you cannot read it!"); - } else - outrumor(); - } else - if(otmp->otyp == LUMP_OF_ROYAL_JELLY) { - /* This stuff seems to be VERY healthy! */ - if(u.ustrmax < 118) u.ustrmax++; - if(u.ustr < u.ustrmax) u.ustr++; - u.uhp += rnd(20); - if(u.uhp > u.uhpmax) { - if(!rn2(17)) u.uhpmax++; - u.uhp = u.uhpmax; - } - heal_legs(); - } - break; - } - } -eatx: - if(multi<0 && !nomovemsg){ - static char msgbuf[BUFSZ]; - (void) sprintf(msgbuf, "You finished eating the %s.", - ftmp->oc_name); - nomovemsg = msgbuf; - } - useup(otmp); - return(1); -} - -/* called in hack.main.c */ -gethungry(){ - --u.uhunger; - if(moves % 2) { - if(Regeneration) u.uhunger--; - if(Hunger) u.uhunger--; - /* a3: if(Hunger & LEFT_RING) u.uhunger--; - if(Hunger & RIGHT_RING) u.uhunger--; - etc. */ - } - if(moves % 20 == 0) { /* jimt@asgb */ - if(uleft) u.uhunger--; - if(uright) u.uhunger--; - } - newuhs(TRUE); -} - -/* called after vomiting and after performing feats of magic */ -morehungry(num) int num; { - u.uhunger -= num; - newuhs(TRUE); -} - -/* called after eating something (and after drinking fruit juice) */ -lesshungry(num) int num; { - u.uhunger += num; - newuhs(FALSE); -} - -unfaint(){ - u.uhs = FAINTING; - flags.botl = 1; -} - -newuhs(incr) boolean incr; { - int newhs, h = u.uhunger; - - newhs = (h > 1000) ? SATIATED : - (h > 150) ? NOT_HUNGRY : - (h > 50) ? HUNGRY : - (h > 0) ? WEAK : FAINTING; - - if(newhs == FAINTING) { - if(u.uhs == FAINTED) - newhs = FAINTED; - if(u.uhs <= WEAK || rn2(20-u.uhunger/10) >= 19) { - if(u.uhs != FAINTED && multi >= 0 /* %% */) { - pline("You faint from lack of food."); - nomul(-10+(u.uhunger/10)); - nomovemsg = "You regain consciousness."; - afternmv = unfaint; - newhs = FAINTED; - } - } else - if(u.uhunger < -(int)(200 + 25*u.ulevel)) { - u.uhs = STARVED; - flags.botl = 1; - bot(); - pline("You die from starvation."); - done("starved"); - } - } - - if(newhs != u.uhs) { - if(newhs >= WEAK && u.uhs < WEAK) - losestr(1); /* this may kill you -- see below */ - else - if(newhs < WEAK && u.uhs >= WEAK && u.ustr < u.ustrmax) - losestr(-1); - switch(newhs){ - case HUNGRY: - pline((!incr) ? "You only feel hungry now." : - (u.uhunger < 145) ? "You feel hungry." : - "You are beginning to feel hungry."); - break; - case WEAK: - pline((!incr) ? "You feel weak now." : - (u.uhunger < 45) ? "You feel weak." : - "You are beginning to feel weak."); - break; - } - u.uhs = newhs; - flags.botl = 1; - if(u.uhp < 1) { - pline("You die from hunger and exhaustion."); - killer = "exhaustion"; - done("starved"); - } - } -} - -#define CORPSE_I_TO_C(otyp) (char) ((otyp >= DEAD_ACID_BLOB)\ - ? 'a' + (otyp - DEAD_ACID_BLOB)\ - : '@' + (otyp - DEAD_HUMAN)) -poisonous(otmp) -struct obj *otmp; -{ - return(index(POISONOUS, CORPSE_I_TO_C(otmp->otyp)) != 0); -} - -/* returns 1 if some text was printed */ -eatcorpse(otmp) struct obj *otmp; { -char let = CORPSE_I_TO_C(otmp->otyp); -int tp = 0; - if(let != 'a' && moves > otmp->age + 50 + rn2(100)) { - tp++; - pline("Ulch -- that meat was tainted!"); - pline("You get very sick."); - Sick = 10 + rn2(10); - u.usick_cause = objects[otmp->otyp].oc_name; - } else if(index(POISONOUS, let) && rn2(5)){ - tp++; - pline("Ecch -- that must have been poisonous!"); - if(!Poison_resistance){ - losestr(rnd(4)); - losehp(rnd(15), "poisonous corpse"); - } else - pline("You don't seem affected by the poison."); - } else if(index("ELNOPQRUuxz", let) && rn2(5)){ - tp++; - pline("You feel sick."); - losehp(rnd(8), "cadaver"); - } - switch(let) { - case 'L': - case 'N': - case 't': - Teleportation |= INTRINSIC; - break; - case 'W': - pluslvl(); - break; - case 'n': - u.uhp = u.uhpmax; - flags.botl = 1; - /* FALLTHROUGH */ - case '@': - pline("You cannibal! You will be sorry for this!"); - /* not tp++; */ - /* FALLTHROUGH */ - case 'd': - Aggravate_monster |= INTRINSIC; - break; - case 'I': - if(!Invis) { - Invis = 50+rn2(100); - if(!See_invisible) - newsym(u.ux, u.uy); - } else { - Invis |= INTRINSIC; - See_invisible |= INTRINSIC; - } - /* FALLTHROUGH */ - case 'y': -#ifdef QUEST - u.uhorizon++; -#endif /* QUEST */ - /* FALLTHROUGH */ - case 'B': - Confusion = 50; - break; - case 'D': - Fire_resistance |= INTRINSIC; - break; - case 'E': - Telepat |= INTRINSIC; - break; - case 'F': - case 'Y': - Cold_resistance |= INTRINSIC; - break; - case 'k': - case 's': - Poison_resistance |= INTRINSIC; - break; - case 'c': - pline("You turn to stone."); - killer = "dead cockatrice"; - done("died"); - /* NOTREACHED */ - case 'a': - if(Stoned) { - pline("What a pity - you just destroyed a future piece of art!"); - tp++; - Stoned = 0; - } - break; - case 'M': - pline("You cannot resist the temptation to mimic a treasure chest."); - tp++; - nomul(-30); - afternmv = Meatdone; - nomovemsg = "You now again prefer mimicking a human."; - u.usym = '$'; - prme(); - break; - } - return(tp); -} diff --git a/games/hack/hack.end.c b/games/hack/hack.end.c deleted file mode 100644 index e839ae114d52..000000000000 --- a/games/hack/hack.end.c +++ /dev/null @@ -1,643 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.end.c - version 1.0.3 */ -/* $FreeBSD$ */ - -#include "hack.h" -#include -#include -#define Sprintf (void) sprintf -extern char plname[], pl_character[]; -extern char *itoa(), *ordin(), *eos(); - -xchar maxdlevel = 1; - -void -done1() -{ - (void) signal(SIGINT,SIG_IGN); - pline("Really quit?"); - if(readchar() != 'y') { - (void) signal(SIGINT,done1); - clrlin(); - (void) fflush(stdout); - if(multi > 0) nomul(0); - return; - } - done("quit"); - /* NOTREACHED */ -} - -int done_stopprint; -int done_hup; - -void -done_intr(){ - done_stopprint++; - (void) signal(SIGINT, SIG_IGN); - (void) signal(SIGQUIT, SIG_IGN); -} - -void -done_hangup(){ - done_hup++; - (void) signal(SIGHUP, SIG_IGN); - done_intr(); -} - -done_in_by(mtmp) struct monst *mtmp; { -static char buf[BUFSZ]; - pline("You die ..."); - if(mtmp->data->mlet == ' '){ - Sprintf(buf, "the ghost of %s", (char *) mtmp->mextra); - killer = buf; - } else if(mtmp->mnamelth) { - Sprintf(buf, "%s called %s", - mtmp->data->mname, NAME(mtmp)); - killer = buf; - } else if(mtmp->minvis) { - Sprintf(buf, "invisible %s", mtmp->data->mname); - killer = buf; - } else killer = mtmp->data->mname; - done("died"); -} - -/* called with arg "died", "drowned", "escaped", "quit", "choked", "panicked", - "burned", "starved" or "tricked" */ -/* Be careful not to call panic from here! */ -done(st1) -char *st1; -{ - -#ifdef WIZARD - if(wizard && *st1 == 'd'){ - u.uswldtim = 0; - if(u.uhpmax < 0) u.uhpmax = 100; /* arbitrary */ - u.uhp = u.uhpmax; - pline("For some reason you are still alive."); - flags.move = 0; - if(multi > 0) multi = 0; else multi = -1; - flags.botl = 1; - return; - } -#endif /* WIZARD */ - (void) signal(SIGINT, done_intr); - (void) signal(SIGQUIT, done_intr); - (void) signal(SIGHUP, done_hangup); - if(*st1 == 'q' && u.uhp < 1){ - st1 = "died"; - killer = "quit while already on Charon's boat"; - } - if(*st1 == 's') killer = "starvation"; else - if(*st1 == 'd' && st1[1] == 'r') killer = "drowning"; else - if(*st1 == 'p') killer = "panic"; else - if(*st1 == 't') killer = "trickery"; else - if(!index("bcd", *st1)) killer = st1; - paybill(); - clearlocks(); - if(flags.toplin == 1) more(); - if(index("bcds", *st1)){ -#ifdef WIZARD - if(!wizard) -#endif /* WIZARD */ - savebones(); - if(!flags.notombstone) - outrip(); - } - if(*st1 == 'c') killer = st1; /* after outrip() */ - settty((char *) 0); /* does a clear_screen() */ - if(!done_stopprint) - printf("Goodbye %s %s...\n\n", pl_character, plname); - { long int tmp; - tmp = u.ugold - u.ugold0; - if(tmp < 0) - tmp = 0; - if(*st1 == 'd' || *st1 == 'b') - tmp -= tmp/10; - u.urexp += tmp; - u.urexp += 50 * maxdlevel; - if(maxdlevel > 20) - u.urexp += 1000*((maxdlevel > 30) ? 10 : maxdlevel - 20); - } - if(*st1 == 'e') { - extern struct monst *mydogs; - struct monst *mtmp; - struct obj *otmp; - int i; - unsigned worthlessct = 0; - boolean has_amulet = FALSE; - - killer = st1; - keepdogs(); - mtmp = mydogs; - if(mtmp) { - if(!done_stopprint) printf("You"); - while(mtmp) { - if(!done_stopprint) - printf(" and %s", monnam(mtmp)); - if(mtmp->mtame) - u.urexp += mtmp->mhp; - mtmp = mtmp->nmon; - } - if(!done_stopprint) - printf("\nescaped from the dungeon with %ld points,\n", - u.urexp); - } else - if(!done_stopprint) - printf("You escaped from the dungeon with %ld points,\n", - u.urexp); - for(otmp = invent; otmp; otmp = otmp->nobj) { - if(otmp->olet == GEM_SYM){ - objects[otmp->otyp].oc_name_known = 1; - i = otmp->quan*objects[otmp->otyp].g_val; - if(i == 0) { - worthlessct += otmp->quan; - continue; - } - u.urexp += i; - if(!done_stopprint) - printf("\t%s (worth %d Zorkmids),\n", - doname(otmp), i); - } else if(otmp->olet == AMULET_SYM) { - otmp->known = 1; - i = (otmp->spe < 0) ? 2 : 5000; - u.urexp += i; - if(!done_stopprint) - printf("\t%s (worth %d Zorkmids),\n", - doname(otmp), i); - if(otmp->spe >= 0) { - has_amulet = TRUE; - killer = "escaped (with amulet)"; - } - } - } - if(worthlessct) if(!done_stopprint) - printf("\t%u worthless piece%s of coloured glass,\n", - worthlessct, plur(worthlessct)); - if(has_amulet) u.urexp *= 2; - } else - if(!done_stopprint) - printf("You %s on dungeon level %d with %ld points,\n", - st1, dlevel, u.urexp); - if(!done_stopprint) - printf("and %ld piece%s of gold, after %ld move%s.\n", - u.ugold, plur(u.ugold), moves, plur(moves)); - if(!done_stopprint) - printf("You were level %u with a maximum of %d hit points when you %s.\n", - u.ulevel, u.uhpmax, st1); - if(*st1 == 'e' && !done_stopprint){ - getret(); /* all those pieces of coloured glass ... */ - cls(); - } -#ifdef WIZARD - if(!wizard) -#endif /* WIZARD */ - topten(); - if(done_stopprint) printf("\n\n"); - exit(0); -} - -#define newttentry() (struct toptenentry *) alloc(sizeof(struct toptenentry)) -#define NAMSZ 8 -#define DTHSZ 40 -#define PERSMAX 1 -#define POINTSMIN 1 /* must be > 0 */ -#define ENTRYMAX 100 /* must be >= 10 */ -#define PERS_IS_UID /* delete for PERSMAX per name; now per uid */ -struct toptenentry { - struct toptenentry *tt_next; - long int points; - int level,maxlvl,hp,maxhp; - int uid; - char plchar; - char sex; - char name[NAMSZ+1]; - char death[DTHSZ+1]; - char date[7]; /* yymmdd */ -} *tt_head; - -topten(){ - int uid = getuid(); - int rank, rank0 = -1, rank1 = 0; - int occ_cnt = PERSMAX; - struct toptenentry *t0, *t1, *tprev; - char *recfile = RECORD; - char *reclock = "record_lock"; - int sleepct = 300; - FILE *rfile; - int flg = 0; - extern char *getdate(); -#define HUP if(!done_hup) - while(link(recfile, reclock) == -1) { - HUP perror(reclock); - if(!sleepct--) { - HUP puts("I give up. Sorry."); - HUP puts("Perhaps there is an old record_lock around?"); - return; - } - HUP printf("Waiting for access to record file. (%d)\n", - sleepct); - HUP (void) fflush(stdout); - sleep(1); - } - if(!(rfile = fopen(recfile,"r"))){ - HUP puts("Cannot open record file!"); - goto unlock; - } - HUP (void) putchar('\n'); - - /* create a new 'topten' entry */ - t0 = newttentry(); - t0->level = dlevel; - t0->maxlvl = maxdlevel; - t0->hp = u.uhp; - t0->maxhp = u.uhpmax; - t0->points = u.urexp; - t0->plchar = pl_character[0]; - t0->sex = (flags.female ? 'F' : 'M'); - t0->uid = uid; - (void) strncpy(t0->name, plname, NAMSZ); - (t0->name)[NAMSZ] = 0; - (void) strncpy(t0->death, killer, DTHSZ); - (t0->death)[DTHSZ] = 0; - (void) strcpy(t0->date, getdate()); - - /* assure minimum number of points */ - if(t0->points < POINTSMIN) - t0->points = 0; - - t1 = tt_head = newttentry(); - tprev = 0; - /* rank0: -1 undefined, 0 not_on_list, n n_th on list */ - for(rank = 1; ; ) { - if(fscanf(rfile, "%6s %d %d %d %d %d %ld %c%c %[^,],%[^\n]", - t1->date, &t1->uid, - &t1->level, &t1->maxlvl, - &t1->hp, &t1->maxhp, &t1->points, - &t1->plchar, &t1->sex, t1->name, t1->death) != 11 - || t1->points < POINTSMIN) - t1->points = 0; - if(rank0 < 0 && t1->points < t0->points) { - rank0 = rank++; - if(tprev == 0) - tt_head = t0; - else - tprev->tt_next = t0; - t0->tt_next = t1; - occ_cnt--; - flg++; /* ask for a rewrite */ - } else - tprev = t1; - if(t1->points == 0) break; - if( -#ifdef PERS_IS_UID - t1->uid == t0->uid && -#else - strncmp(t1->name, t0->name, NAMSZ) == 0 && -#endif /* PERS_IS_UID */ - t1->plchar == t0->plchar && --occ_cnt <= 0){ - if(rank0 < 0){ - rank0 = 0; - rank1 = rank; - HUP printf("You didn't beat your previous score of %ld points.\n\n", - t1->points); - } - if(occ_cnt < 0){ - flg++; - continue; - } - } - if(rank <= ENTRYMAX){ - t1 = t1->tt_next = newttentry(); - rank++; - } - if(rank > ENTRYMAX){ - t1->points = 0; - break; - } - } - if(flg) { /* rewrite record file */ - (void) fclose(rfile); - if(!(rfile = fopen(recfile,"w"))){ - HUP puts("Cannot write record file\n"); - goto unlock; - } - - if(!done_stopprint) if(rank0 > 0){ - if(rank0 <= 10) - puts("You made the top ten list!\n"); - else - printf("You reached the %d%s place on the top %d list.\n\n", - rank0, ordin(rank0), ENTRYMAX); - } - } - if(rank0 == 0) rank0 = rank1; - if(rank0 <= 0) rank0 = rank; - if(!done_stopprint) outheader(); - t1 = tt_head; - for(rank = 1; t1->points != 0; rank++, t1 = t1->tt_next) { - if(flg) fprintf(rfile,"%6s %d %d %d %d %d %ld %c%c %s,%s\n", - t1->date, t1->uid, - t1->level, t1->maxlvl, - t1->hp, t1->maxhp, t1->points, - t1->plchar, t1->sex, t1->name, t1->death); - if(done_stopprint) continue; - if(rank > flags.end_top && - (rank < rank0-flags.end_around || rank > rank0+flags.end_around) - && (!flags.end_own || -#ifdef PERS_IS_UID - t1->uid != t0->uid )) -#else - strncmp(t1->name, t0->name, NAMSZ))) -#endif /* PERS_IS_UID */ - continue; - if(rank == rank0-flags.end_around && - rank0 > flags.end_top+flags.end_around+1 && - !flags.end_own) - (void) putchar('\n'); - if(rank != rank0) - (void) outentry(rank, t1, 0); - else if(!rank1) - (void) outentry(rank, t1, 1); - else { - int t0lth = outentry(0, t0, -1); - int t1lth = outentry(rank, t1, t0lth); - if(t1lth > t0lth) t0lth = t1lth; - (void) outentry(0, t0, t0lth); - } - } - if(rank0 >= rank) if(!done_stopprint) - (void) outentry(0, t0, 1); - (void) fclose(rfile); -unlock: - (void) unlink(reclock); -} - -outheader() { -char linebuf[BUFSZ]; -char *bp; - (void) strcpy(linebuf, "Number Points Name"); - bp = eos(linebuf); - while(bp < linebuf + COLNO - 9) *bp++ = ' '; - (void) strcpy(bp, "Hp [max]"); - puts(linebuf); -} - -/* so>0: standout line; so=0: ordinary line; so<0: no output, return lth */ -int -outentry(rank,t1,so) struct toptenentry *t1; { -boolean quit = FALSE, killed = FALSE, starv = FALSE; -char linebuf[BUFSZ]; - linebuf[0] = 0; - if(rank) Sprintf(eos(linebuf), "%3d", rank); - else Sprintf(eos(linebuf), " "); - Sprintf(eos(linebuf), " %6ld %8s", t1->points, t1->name); - if(t1->plchar == 'X') Sprintf(eos(linebuf), " "); - else Sprintf(eos(linebuf), "-%c ", t1->plchar); - if(!strncmp("escaped", t1->death, 7)) { - if(!strcmp(" (with amulet)", t1->death+7)) - Sprintf(eos(linebuf), "escaped the dungeon with amulet"); - else - Sprintf(eos(linebuf), "escaped the dungeon [max level %d]", - t1->maxlvl); - } else { - if(!strncmp(t1->death,"quit",4)) { - quit = TRUE; - if(t1->maxhp < 3*t1->hp && t1->maxlvl < 4) - Sprintf(eos(linebuf), "cravenly gave up"); - else - Sprintf(eos(linebuf), "quit"); - } - else if(!strcmp(t1->death,"choked")) - Sprintf(eos(linebuf), "choked on %s food", - (t1->sex == 'F') ? "her" : "his"); - else if(!strncmp(t1->death,"starv",5)) - Sprintf(eos(linebuf), "starved to death"), starv = TRUE; - else Sprintf(eos(linebuf), "was killed"), killed = TRUE; - Sprintf(eos(linebuf), " on%s level %d", - (killed || starv) ? "" : " dungeon", t1->level); - if(t1->maxlvl != t1->level) - Sprintf(eos(linebuf), " [max %d]", t1->maxlvl); - if(quit && t1->death[4]) Sprintf(eos(linebuf), t1->death + 4); - } - if(killed) Sprintf(eos(linebuf), " by %s%s", - (!strncmp(t1->death, "trick", 5) || !strncmp(t1->death, "the ", 4)) - ? "" : - index(vowels,*t1->death) ? "an " : "a ", - t1->death); - Sprintf(eos(linebuf), "."); - if(t1->maxhp) { - char *bp = eos(linebuf); - char hpbuf[10]; - int hppos; - Sprintf(hpbuf, (t1->hp > 0) ? itoa(t1->hp) : "-"); - hppos = COLNO - 7 - strlen(hpbuf); - if(bp <= linebuf + hppos) { - while(bp < linebuf + hppos) *bp++ = ' '; - (void) strcpy(bp, hpbuf); - Sprintf(eos(bp), " [%d]", t1->maxhp); - } - } - if(so == 0) puts(linebuf); - else if(so > 0) { - char *bp = eos(linebuf); - if(so >= COLNO) so = COLNO-1; - while(bp < linebuf + so) *bp++ = ' '; - *bp = 0; - standoutbeg(); - fputs(linebuf,stdout); - standoutend(); - (void) putchar('\n'); - } - return(strlen(linebuf)); -} - -char * -itoa(a) int a; { -static char buf[12]; - Sprintf(buf,"%d",a); - return(buf); -} - -char * -ordin(n) int n; { -int d = n%10; - return((d==0 || d>3 || n/10==1) ? "th" : (d==1) ? "st" : - (d==2) ? "nd" : "rd"); -} - -clearlocks(){ -int x; - (void) signal(SIGHUP,SIG_IGN); - for(x = maxdlevel; x >= 0; x--) { - glo(x); - (void) unlink(lock); /* not all levels need be present */ - } -} - -#ifdef NOSAVEONHANGUP -hangup() -{ - (void) signal(SIGINT, SIG_IGN); - clearlocks(); - exit(1); -} -#endif /* NOSAVEONHANGUP */ - -char * -eos(s) -char *s; -{ - while(*s) s++; - return(s); -} - -/* it is the callers responsibility to check that there is room for c */ -charcat(s,c) char *s, c; { - while(*s) s++; - *s++ = c; - *s = 0; -} - -/* - * Called with args from main if argc >= 0. In this case, list scores as - * requested. Otherwise, find scores for the current player (and list them - * if argc == -1). - */ -prscore(argc,argv) int argc; char **argv; { - extern char *hname; - char **players; - int playerct; - int rank; - struct toptenentry *t1, *t2; - char *recfile = RECORD; - FILE *rfile; - int flg = 0; - int i; -#ifdef nonsense - long total_score = 0L; - char totchars[10]; - int totcharct = 0; -#endif /* nonsense */ - int outflg = (argc >= -1); -#ifdef PERS_IS_UID - int uid = -1; -#else - char *player0; -#endif /* PERS_IS_UID */ - - if(!(rfile = fopen(recfile,"r"))){ - puts("Cannot open record file!"); - return; - } - - if(argc > 1 && !strncmp(argv[1], "-s", 2)){ - if(!argv[1][2]){ - argc--; - argv++; - } else if(!argv[1][3] && index("CFKSTWX", argv[1][2])) { - argv[1]++; - argv[1][0] = '-'; - } else argv[1] += 2; - } - if(argc <= 1){ -#ifdef PERS_IS_UID - uid = getuid(); - playerct = 0; -#else - player0 = plname; - if(!*player0) - player0 = "hackplayer"; - playerct = 1; - players = &player0; -#endif /* PERS_IS_UID */ - } else { - playerct = --argc; - players = ++argv; - } - if(outflg) putchar('\n'); - - t1 = tt_head = newttentry(); - for(rank = 1; ; rank++) { - if(fscanf(rfile, "%6s %d %d %d %d %d %ld %c%c %[^,],%[^\n]", - t1->date, &t1->uid, - &t1->level, &t1->maxlvl, - &t1->hp, &t1->maxhp, &t1->points, - &t1->plchar, &t1->sex, t1->name, t1->death) != 11) - t1->points = 0; - if(t1->points == 0) break; -#ifdef PERS_IS_UID - if(!playerct && t1->uid == uid) - flg++; - else -#endif /* PERS_IS_UID */ - for(i = 0; i < playerct; i++){ - if(strcmp(players[i], "all") == 0 || - strncmp(t1->name, players[i], NAMSZ) == 0 || - (players[i][0] == '-' && - players[i][1] == t1->plchar && - players[i][2] == 0) || - (digit(players[i][0]) && rank <= atoi(players[i]))) - flg++; - } - t1 = t1->tt_next = newttentry(); - } - (void) fclose(rfile); - if(!flg) { - if(outflg) { - printf("Cannot find any entries for "); - if(playerct < 1) printf("you.\n"); - else { - if(playerct > 1) printf("any of "); - for(i=0; ipoints != 0; rank++, t1 = t2) { - t2 = t1->tt_next; -#ifdef PERS_IS_UID - if(!playerct && t1->uid == uid) - goto outwithit; - else -#endif /* PERS_IS_UID */ - for(i = 0; i < playerct; i++){ - if(strcmp(players[i], "all") == 0 || - strncmp(t1->name, players[i], NAMSZ) == 0 || - (players[i][0] == '-' && - players[i][1] == t1->plchar && - players[i][2] == 0) || - (digit(players[i][0]) && rank <= atoi(players[i]))){ - outwithit: - if(outflg) - (void) outentry(rank, t1, 0); -#ifdef nonsense - total_score += t1->points; - if(totcharct < sizeof(totchars)-1) - totchars[totcharct++] = t1->plchar; -#endif /* nonsense */ - break; - } - } - free((char *) t1); - } -#ifdef nonsense - totchars[totcharct] = 0; - - /* We would like to determine whether he is experienced. However, - the information collected here only tells about the scores/roles - that got into the topten (top 100?). We should maintain a - .hacklog or something in his home directory. */ - flags.beginner = (total_score < 6000); - for(i=0; i<6; i++) - if(!index(totchars, "CFKSTWX"[i])) { - flags.beginner = 1; - if(!pl_character[0]) pl_character[0] = "CFKSTWX"[i]; - break; - } -#endif /* nonsense */ -} diff --git a/games/hack/hack.engrave.c b/games/hack/hack.engrave.c deleted file mode 100644 index bc9ed849dae9..000000000000 --- a/games/hack/hack.engrave.c +++ /dev/null @@ -1,307 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.engrave.c - version 1.0.3 */ -/* $FreeBSD$ */ - -#include "hack.h" - -extern char *nomovemsg; -extern char nul[]; -extern struct obj zeroobj; -struct engr { - struct engr *nxt_engr; - char *engr_txt; - xchar engr_x, engr_y; - unsigned engr_lth; /* for save & restore; not length of text */ - long engr_time; /* moment engraving was (will be) finished */ - xchar engr_type; -#define DUST 1 -#define ENGRAVE 2 -#define BURN 3 -} *head_engr; - -struct engr * -engr_at(x,y) xchar x,y; { -struct engr *ep = head_engr; - while(ep) { - if(x == ep->engr_x && y == ep->engr_y) - return(ep); - ep = ep->nxt_engr; - } - return((struct engr *) 0); -} - -sengr_at(s,x,y) char *s; xchar x,y; { -struct engr *ep = engr_at(x,y); -char *t; -int n; - if(ep && ep->engr_time <= moves) { - t = ep->engr_txt; -/* - if(!strcmp(s,t)) return(1); -*/ - n = strlen(s); - while(*t) { - if(!strncmp(s,t,n)) return(1); - t++; - } - } - return(0); -} - -u_wipe_engr(cnt) -int cnt; -{ - if(!u.uswallow && !Levitation) - wipe_engr_at(u.ux, u.uy, cnt); -} - -wipe_engr_at(x,y,cnt) xchar x,y,cnt; { -struct engr *ep = engr_at(x,y); -int lth,pos; -char ch; - if(ep){ - if((ep->engr_type != DUST) || Levitation) { - cnt = rn2(1 + 50/(cnt+1)) ? 0 : 1; - } - lth = strlen(ep->engr_txt); - if(lth && cnt > 0 ) { - while(cnt--) { - pos = rn2(lth); - if((ch = ep->engr_txt[pos]) == ' ') - continue; - ep->engr_txt[pos] = (ch != '?') ? '?' : ' '; - } - } - while(lth && ep->engr_txt[lth-1] == ' ') - ep->engr_txt[--lth] = 0; - while(ep->engr_txt[0] == ' ') - ep->engr_txt++; - if(!ep->engr_txt[0]) del_engr(ep); - } -} - -read_engr_at(x,y) int x,y; { -struct engr *ep = engr_at(x,y); - if(ep && ep->engr_txt[0]) { - switch(ep->engr_type) { - case DUST: - pline("Something is written here in the dust."); - break; - case ENGRAVE: - pline("Something is engraved here on the floor."); - break; - case BURN: - pline("Some text has been burned here in the floor."); - break; - default: - impossible("Something is written in a very strange way."); - } - pline("You read: \"%s\".", ep->engr_txt); - } -} - -make_engr_at(x,y,s) -int x,y; -char *s; -{ - struct engr *ep; - - if(ep = engr_at(x,y)) - del_engr(ep); - ep = (struct engr *) - alloc((unsigned)(sizeof(struct engr) + strlen(s) + 1)); - ep->nxt_engr = head_engr; - head_engr = ep; - ep->engr_x = x; - ep->engr_y = y; - ep->engr_txt = (char *)(ep + 1); - (void) strcpy(ep->engr_txt, s); - ep->engr_time = 0; - ep->engr_type = DUST; - ep->engr_lth = strlen(s) + 1; -} - -doengrave(){ -int len; -char *sp; -struct engr *ep, *oep = engr_at(u.ux,u.uy); -char buf[BUFSZ]; -xchar type; -int spct; /* number of leading spaces */ -struct obj *otmp; - multi = 0; - - if(u.uswallow) { - pline("You're joking. Hahaha!"); /* riv05!a3 */ - return(0); - } - - /* one may write with finger, weapon or wand */ - otmp = getobj("#-)/", "write with"); - if(!otmp) return(0); - - if(otmp == &zeroobj) - otmp = 0; - if(otmp && otmp->otyp == WAN_FIRE && otmp->spe) { - type = BURN; - otmp->spe--; - } else { - /* first wield otmp */ - if(otmp != uwep) { - if(uwep && uwep->cursed) { - /* Andreas Bormann */ - pline("Since your weapon is welded to your hand,"); - pline("you use the %s.", aobjnam(uwep, (char *) 0)); - otmp = uwep; - } else { - if(!otmp) - pline("You are now empty-handed."); - else if(otmp->cursed) - pline("The %s %s to your hand!", - aobjnam(otmp, "weld"), - (otmp->quan == 1) ? "itself" : "themselves"); - else - pline("You now wield %s.", doname(otmp)); - setuwep(otmp); - } - } - - if(!otmp) - type = DUST; - else - if(otmp->otyp == DAGGER || otmp->otyp == TWO_HANDED_SWORD || - otmp->otyp == CRYSKNIFE || - otmp->otyp == LONG_SWORD || otmp->otyp == AXE) { - type = ENGRAVE; - if((int)otmp->spe <= -3) { - type = DUST; - pline("Your %s too dull for engraving.", - aobjnam(otmp, "are")); - if(oep && oep->engr_type != DUST) return(1); - } - } else type = DUST; - } - if(Levitation && type != BURN){ /* riv05!a3 */ - pline("You can't reach the floor!"); - return(1); - } - if(oep && oep->engr_type == DUST){ - pline("You wipe out the message that was written here."); - del_engr(oep); - oep = 0; - } - if(type == DUST && oep){ - pline("You cannot wipe out the message that is %s in the rock.", - (oep->engr_type == BURN) ? "burned" : "engraved"); - return(1); - } - - pline("What do you want to %s on the floor here? ", - (type == ENGRAVE) ? "engrave" : (type == BURN) ? "burn" : "write"); - getlin(buf); - clrlin(); - spct = 0; - sp = buf; - while(*sp == ' ') spct++, sp++; - len = strlen(sp); - if(!len || *buf == '\033') { - if(type == BURN) otmp->spe++; - return(0); - } - - switch(type) { - case DUST: - case BURN: - if(len > 15) { - multi = -(len/10); - nomovemsg = "You finished writing."; - } - break; - case ENGRAVE: /* here otmp != 0 */ - { int len2 = (otmp->spe + 3) * 2 + 1; - - pline("Your %s dull.", aobjnam(otmp, "get")); - if(len2 < len) { - len = len2; - sp[len] = 0; - otmp->spe = -3; - nomovemsg = "You cannot engrave more."; - } else { - otmp->spe -= len/2; - nomovemsg = "You finished engraving."; - } - multi = -len; - } - break; - } - if(oep) len += strlen(oep->engr_txt) + spct; - ep = (struct engr *) alloc((unsigned)(sizeof(struct engr) + len + 1)); - ep->nxt_engr = head_engr; - head_engr = ep; - ep->engr_x = u.ux; - ep->engr_y = u.uy; - sp = (char *)(ep + 1); /* (char *)ep + sizeof(struct engr) */ - ep->engr_txt = sp; - if(oep) { - (void) strcpy(sp, oep->engr_txt); - (void) strcat(sp, buf); - del_engr(oep); - } else - (void) strcpy(sp, buf); - ep->engr_lth = len+1; - ep->engr_type = type; - ep->engr_time = moves-multi; - - /* kludge to protect pline against excessively long texts */ - if(len > BUFSZ-20) sp[BUFSZ-20] = 0; - - return(1); -} - -save_engravings(fd) int fd; { -struct engr *ep = head_engr; - while(ep) { - if(!ep->engr_lth || !ep->engr_txt[0]){ - ep = ep->nxt_engr; - continue; - } - bwrite(fd, (char *) & (ep->engr_lth), sizeof(ep->engr_lth)); - bwrite(fd, (char *) ep, sizeof(struct engr) + ep->engr_lth); - ep = ep->nxt_engr; - } - bwrite(fd, (char *) nul, sizeof(unsigned)); - head_engr = 0; -} - -rest_engravings(fd) int fd; { -struct engr *ep; -unsigned lth; - head_engr = 0; - while(1) { - mread(fd, (char *) <h, sizeof(unsigned)); - if(lth == 0) return; - ep = (struct engr *) alloc(sizeof(struct engr) + lth); - mread(fd, (char *) ep, sizeof(struct engr) + lth); - ep->nxt_engr = head_engr; - ep->engr_txt = (char *) (ep + 1); /* Andreas Bormann */ - head_engr = ep; - } -} - -del_engr(ep) struct engr *ep; { -struct engr *ept; - if(ep == head_engr) - head_engr = ep->nxt_engr; - else { - for(ept = head_engr; ept; ept = ept->nxt_engr) { - if(ept->nxt_engr == ep) { - ept->nxt_engr = ep->nxt_engr; - goto fnd; - } - } - impossible("Error in del_engr?"); - return; - fnd: ; - } - free((char *) ep); -} diff --git a/games/hack/hack.fight.c b/games/hack/hack.fight.c deleted file mode 100644 index 532cb9ee0101..000000000000 --- a/games/hack/hack.fight.c +++ /dev/null @@ -1,359 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.fight.c - version 1.0.3 */ -/* $FreeBSD$ */ - -#include "hack.h" -extern struct permonst li_dog, dog, la_dog; -extern char *exclam(), *xname(); -extern struct obj *mkobj_at(); - -static boolean far_noise; -static long noisetime; - -/* hitmm returns 0 (miss), 1 (hit), or 2 (kill) */ -hitmm(magr,mdef) struct monst *magr,*mdef; { -struct permonst *pa = magr->data, *pd = mdef->data; -int hit; -schar tmp; -boolean vis; - if(index("Eauy", pa->mlet)) return(0); - if(magr->mfroz) return(0); /* riv05!a3 */ - tmp = pd->ac + pa->mlevel; - if(mdef->mconf || mdef->mfroz || mdef->msleep){ - tmp += 4; - if(mdef->msleep) mdef->msleep = 0; - } - hit = (tmp > rnd(20)); - if(hit) mdef->msleep = 0; - vis = (cansee(magr->mx,magr->my) && cansee(mdef->mx,mdef->my)); - if(vis){ - char buf[BUFSZ]; - if(mdef->mimic) seemimic(mdef); - if(magr->mimic) seemimic(magr); - (void) sprintf(buf,"%s %s", Monnam(magr), - hit ? "hits" : "misses"); - pline("%s %s.", buf, monnam(mdef)); - } else { - boolean far = (dist(magr->mx, magr->my) > 15); - if(far != far_noise || moves-noisetime > 10) { - far_noise = far; - noisetime = moves; - pline("You hear some noises%s.", - far ? " in the distance" : ""); - } - } - if(hit){ - if(magr->data->mlet == 'c' && !magr->cham) { - magr->mhpmax += 3; - if(vis) pline("%s is turned to stone!", Monnam(mdef)); - else if(mdef->mtame) - pline("You have a peculiarly sad feeling for a moment, then it passes."); - monstone(mdef); - hit = 2; - } else - if((mdef->mhp -= d(pa->damn,pa->damd)) < 1) { - magr->mhpmax += 1 + rn2(pd->mlevel+1); - if(magr->mtame && magr->mhpmax > 8*pa->mlevel){ - if(pa == &li_dog) magr->data = pa = &dog; - else if(pa == &dog) magr->data = pa = &la_dog; - } - if(vis) pline("%s is killed!", Monnam(mdef)); - else if(mdef->mtame) - pline("You have a sad feeling for a moment, then it passes."); - mondied(mdef); - hit = 2; - } - } - return(hit); -} - -/* drop (perhaps) a cadaver and remove monster */ -mondied(mdef) struct monst *mdef; { -struct permonst *pd = mdef->data; - if(letter(pd->mlet) && rn2(3)){ - (void) mkobj_at(pd->mlet,mdef->mx,mdef->my); - if(cansee(mdef->mx,mdef->my)){ - unpmon(mdef); - atl(mdef->mx,mdef->my,fobj->olet); - } - stackobj(fobj); - } - mondead(mdef); -} - -/* drop a rock and remove monster */ -monstone(mdef) struct monst *mdef; { - extern char mlarge[]; - if(index(mlarge, mdef->data->mlet)) - mksobj_at(ENORMOUS_ROCK, mdef->mx, mdef->my); - else - mksobj_at(ROCK, mdef->mx, mdef->my); - if(cansee(mdef->mx, mdef->my)){ - unpmon(mdef); - atl(mdef->mx,mdef->my,fobj->olet); - } - mondead(mdef); -} - - -fightm(mtmp) struct monst *mtmp; { -struct monst *mon; - for(mon = fmon; mon; mon = mon->nmon) if(mon != mtmp) { - if(DIST(mon->mx,mon->my,mtmp->mx,mtmp->my) < 3) - if(rn2(4)) - return(hitmm(mtmp,mon)); - } - return(-1); -} - -/* u is hit by sth, but not a monster */ -thitu(tlev,dam,name) -int tlev,dam; -char *name; -{ -char buf[BUFSZ]; - setan(name,buf); - if(u.uac + tlev <= rnd(20)) { - if(Blind) pline("It misses."); - else pline("You are almost hit by %s!", buf); - return(0); - } else { - if(Blind) pline("You are hit!"); - else pline("You are hit by %s!", buf); - losehp(dam,name); - return(1); - } -} - -char mlarge[] = "bCDdegIlmnoPSsTUwY',&"; - -boolean -hmon(mon,obj,thrown) /* return TRUE if mon still alive */ -struct monst *mon; -struct obj *obj; -int thrown; -{ - int tmp; - boolean hittxt = FALSE; - - if(!obj){ - tmp = rnd(2); /* attack with bare hands */ - if(mon->data->mlet == 'c' && !uarmg){ - pline("You hit the cockatrice with your bare hands."); - pline("You turn to stone ..."); - done_in_by(mon); - } - } else if(obj->olet == WEAPON_SYM || obj->otyp == PICK_AXE) { - if(obj == uwep && (obj->otyp > SPEAR || obj->otyp < BOOMERANG)) - tmp = rnd(2); - else { - if(index(mlarge, mon->data->mlet)) { - tmp = rnd(objects[obj->otyp].wldam); - if(obj->otyp == TWO_HANDED_SWORD) tmp += d(2,6); - else if(obj->otyp == FLAIL) tmp += rnd(4); - } else { - tmp = rnd(objects[obj->otyp].wsdam); - } - tmp += obj->spe; - if(!thrown && obj == uwep && obj->otyp == BOOMERANG - && !rn2(3)){ - pline("As you hit %s, the boomerang breaks into splinters.", - monnam(mon)); - freeinv(obj); - setworn((struct obj *) 0, obj->owornmask); - obfree(obj, (struct obj *) 0); - tmp++; - } - } - if(mon->data->mlet == 'O' && obj->otyp == TWO_HANDED_SWORD && - !strcmp(ONAME(obj), "Orcrist")) - tmp += rnd(10); - } else switch(obj->otyp) { - case HEAVY_IRON_BALL: - tmp = rnd(25); break; - case EXPENSIVE_CAMERA: - pline("You succeed in destroying your camera. Congratulations!"); - freeinv(obj); - if(obj->owornmask) - setworn((struct obj *) 0, obj->owornmask); - obfree(obj, (struct obj *) 0); - return(TRUE); - case DEAD_COCKATRICE: - pline("You hit %s with the cockatrice corpse.", - monnam(mon)); - if(mon->data->mlet == 'c') { - tmp = 1; - hittxt = TRUE; - break; - } - pline("%s is turned to stone!", Monnam(mon)); - killed(mon); - return(FALSE); - case CLOVE_OF_GARLIC: /* no effect against demons */ - if(index(UNDEAD, mon->data->mlet)) - mon->mflee = 1; - tmp = 1; - break; - default: - /* non-weapons can damage because of their weight */ - /* (but not too much) */ - tmp = obj->owt/10; - if(tmp < 1) tmp = 1; - else tmp = rnd(tmp); - if(tmp > 6) tmp = 6; - } - - /****** NOTE: perhaps obj is undefined!! (if !thrown && BOOMERANG) */ - - tmp += u.udaminc + dbon(); - if(u.uswallow) { - if((tmp -= u.uswldtim) <= 0) { - pline("Your arms are no longer able to hit."); - return(TRUE); - } - } - if(tmp < 1) tmp = 1; - mon->mhp -= tmp; - if(mon->mhp < 1) { - killed(mon); - return(FALSE); - } - if(mon->mtame && (!mon->mflee || mon->mfleetim)) { - mon->mflee = 1; /* Rick Richardson */ - mon->mfleetim += 10*rnd(tmp); - } - - if(!hittxt) { - if(thrown) - /* this assumes that we cannot throw plural things */ - hit( xname(obj) /* or: objects[obj->otyp].oc_name */, - mon, exclam(tmp) ); - else if(Blind) - pline("You hit it."); - else - pline("You hit %s%s", monnam(mon), exclam(tmp)); - } - - if(u.umconf && !thrown) { - if(!Blind) { - pline("Your hands stop glowing blue."); - if(!mon->mfroz && !mon->msleep) - pline("%s appears confused.",Monnam(mon)); - } - mon->mconf = 1; - u.umconf = 0; - } - return(TRUE); /* mon still alive */ -} - -/* try to attack; return FALSE if monster evaded */ -/* u.dx and u.dy must be set */ -attack(mtmp) -struct monst *mtmp; -{ - schar tmp; - boolean malive = TRUE; - struct permonst *mdat; - mdat = mtmp->data; - - u_wipe_engr(3); /* andrew@orca: prevent unlimited pick-axe attacks */ - - if(mdat->mlet == 'L' && !mtmp->mfroz && !mtmp->msleep && - !mtmp->mconf && mtmp->mcansee && !rn2(7) && - (m_move(mtmp, 0) == 2 /* he died */ || /* he moved: */ - mtmp->mx != u.ux+u.dx || mtmp->my != u.uy+u.dy)) - return(FALSE); - - if(mtmp->mimic){ - if(!u.ustuck && !mtmp->mflee) u.ustuck = mtmp; - switch(levl[u.ux+u.dx][u.uy+u.dy].scrsym){ - case '+': - pline("The door actually was a Mimic."); - break; - case '$': - pline("The chest was a Mimic!"); - break; - default: - pline("Wait! That's a Mimic!"); - } - wakeup(mtmp); /* clears mtmp->mimic */ - return(TRUE); - } - - wakeup(mtmp); - - if(mtmp->mhide && mtmp->mundetected){ - struct obj *obj; - - mtmp->mundetected = 0; - if((obj = o_at(mtmp->mx,mtmp->my)) && !Blind) - pline("Wait! There's a %s hiding under %s!", - mdat->mname, doname(obj)); - return(TRUE); - } - - tmp = u.uluck + u.ulevel + mdat->ac + abon(); - if(uwep) { - if(uwep->olet == WEAPON_SYM || uwep->otyp == PICK_AXE) - tmp += uwep->spe; - if(uwep->otyp == TWO_HANDED_SWORD) tmp -= 1; - else if(uwep->otyp == DAGGER) tmp += 2; - else if(uwep->otyp == CRYSKNIFE) tmp += 3; - else if(uwep->otyp == SPEAR && - index("XDne", mdat->mlet)) tmp += 2; - } - if(mtmp->msleep) { - mtmp->msleep = 0; - tmp += 2; - } - if(mtmp->mfroz) { - tmp += 4; - if(!rn2(10)) mtmp->mfroz = 0; - } - if(mtmp->mflee) tmp += 2; - if(u.utrap) tmp -= 3; - - /* with a lot of luggage, your agility diminishes */ - tmp -= (inv_weight() + 40)/20; - - if(tmp <= rnd(20) && !u.uswallow){ - if(Blind) pline("You miss it."); - else pline("You miss %s.",monnam(mtmp)); - } else { - /* we hit the monster; be careful: it might die! */ - - if((malive = hmon(mtmp,uwep,0)) == TRUE) { - /* monster still alive */ - if(!rn2(25) && mtmp->mhp < mtmp->mhpmax/2) { - mtmp->mflee = 1; - if(!rn2(3)) mtmp->mfleetim = rnd(100); - if(u.ustuck == mtmp && !u.uswallow) - u.ustuck = 0; - } -#ifndef NOWORM - if(mtmp->wormno) - cutworm(mtmp, u.ux+u.dx, u.uy+u.dy, - uwep ? uwep->otyp : 0); -#endif /* NOWORM */ - } - if(mdat->mlet == 'a') { - if(rn2(2)) { - pline("You are splashed by the blob's acid!"); - losehp_m(rnd(6), mtmp); - if(!rn2(30)) corrode_armor(); - } - if(!rn2(6)) corrode_weapon(); - } - } - if(malive && mdat->mlet == 'E' && canseemon(mtmp) - && !mtmp->mcan && rn2(3)) { - if(mtmp->mcansee) { - pline("You are frozen by the floating eye's gaze!"); - nomul((u.ulevel > 6 || rn2(4)) ? rn1(20,-21) : -200); - } else { - pline("The blinded floating eye cannot defend itself."); - if(!rn2(500)) if((int)u.uluck > LUCKMIN) u.uluck--; - } - } - return(TRUE); -} diff --git a/games/hack/hack.fix b/games/hack/hack.fix deleted file mode 100644 index 01e6460247d7..000000000000 --- a/games/hack/hack.fix +++ /dev/null @@ -1,113 +0,0 @@ -/***** unido:net.games.hack / ab / 7:23 pm Sep 13, 1985*/ - -Recently hack (1.0.3) crashed with core dumps during some good games. -The crashes occured in the onbill-routine. After investigating the core -dump I found that the shopkeeper's bill was still to be paid. Normaly -if you leave a shop the bill will be cleared and onbill() would not -check it. But under certain conditions you can leave a shop without -clearing the bill. The conditions are: - - 1. You have to rob a shop in order to make the shopkeeper - follow you. - - 2. After leaving the shop being followed by the shopkeeper - you must return to the shop... - - 3. ...and then leave the unguarded shop again. - - The shopkeeper mustn't be present! - -If you climb the stairs to the previous level, chances are that your -bill now contains much more items than allowed. If so the next call to -onbill() will dump the core. - -Following is a context diff to fix the bug. Actually just the last hunk -does the fix [it deletes two lines which have been inserted in 1.0.3], -but I think the other fix was intended by the now deleted lines. - - Andreas - --- -Andreas Bormann ab@unido.UUCP -University of Dortmund N 51 29' 05" E 07 24' 42" -West Germany - ------- the diff follows: - -*** hack.shk.c.orig Sun Aug 4 12:07:51 1985 ---- hack.shk.c Fri Sep 13 14:29:52 1985 -*************** -*** 133,139 - /* Did we just leave a shop? */ - if(u.uinshop && - (u.uinshop != roomno + 1 || shlevel != dlevel || !shopkeeper)) { -- u.uinshop = 0; - if(shopkeeper) { - if(ESHK(shopkeeper)->billct) { - pline("Somehow you escaped the shop without paying!"); - ---- 133,138 ----- - /* Did we just leave a shop? */ - if(u.uinshop && - (u.uinshop != roomno + 1 || shlevel != dlevel || !shopkeeper)) { - if(shopkeeper) { - if(ESHK(shopkeeper)->billct) { - if(inroom(shopkeeper->mx, shopkeeper->my) -*************** -*** 136,142 - u.uinshop = 0; - if(shopkeeper) { - if(ESHK(shopkeeper)->billct) { -! pline("Somehow you escaped the shop without paying!"); - addupbill(); - pline("You stole for a total worth of %ld zorkmids.", - total); - ---- 135,143 ----- - (u.uinshop != roomno + 1 || shlevel != dlevel || !shopkeeper)) { - if(shopkeeper) { - if(ESHK(shopkeeper)->billct) { -! if(inroom(shopkeeper->mx, shopkeeper->my) -! == u.uinshop - 1) /* ab@unido */ -! pline("Somehow you escaped the shop without paying!"); - addupbill(); - pline("You stole for a total worth of %ld zorkmids.", - total); -*************** -*** 149,154 - shopkeeper = 0; - shlevel = 0; - } - } - - /* Did we just enter a zoo of some kind? */ - ---- 150,156 ----- - shopkeeper = 0; - shlevel = 0; - } -+ u.uinshop = 0; - } - - /* Did we just enter a zoo of some kind? */ -*************** -*** 183,190 - findshk(roomno); - if(!shopkeeper) { - rooms[roomno].rtype = 0; -- u.uinshop = 0; -- } else if(inroom(shopkeeper->mx, shopkeeper->my) != roomno) { - u.uinshop = 0; - } else if(!u.uinshop){ - if(!ESHK(shopkeeper)->visitct || - ---- 185,190 ----- - findshk(roomno); - if(!shopkeeper) { - rooms[roomno].rtype = 0; - u.uinshop = 0; - } else if(!u.uinshop){ - if(!ESHK(shopkeeper)->visitct || -/* ---------- */ - - - diff --git a/games/hack/hack.h b/games/hack/hack.h deleted file mode 100644 index a9cc347e6d2b..000000000000 --- a/games/hack/hack.h +++ /dev/null @@ -1,161 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.h - version 1.0.3 */ -/* $FreeBSD$ */ - -#include "config.h" -#include - -#ifndef BSD -#define index strchr -#define rindex strrchr -#endif /* BSD */ - -#define Null(type) ((struct type *) 0) - -#include "def.objclass.h" - -typedef struct { - xchar x,y; -} coord; - -#include "def.monst.h" /* uses coord */ -#include "def.gold.h" -#include "def.trap.h" -#include "def.obj.h" -#include "def.flag.h" - -#define plur(x) (((x) == 1) ? "" : "s") - -#define BUFSZ 256 /* for getlin buffers */ -#define PL_NSIZ 32 /* name of player, ghost, shopkeeper */ - -#include "def.rm.h" -#include "def.permonst.h" - -extern long *alloc(); - -extern xchar xdnstair, ydnstair, xupstair, yupstair; /* stairs up and down. */ - -extern xchar dlevel; -#define newstring(x) (char *) alloc((unsigned)(x)) -#include "hack.onames.h" - -#define ON 1 -#define OFF 0 - -extern struct obj *invent, *uwep, *uarm, *uarm2, *uarmh, *uarms, *uarmg, - *uleft, *uright, *fcobj; -extern struct obj *uchain; /* defined iff PUNISHED */ -extern struct obj *uball; /* defined if PUNISHED */ -struct obj *o_at(), *getobj(), *sobj_at(); - -struct prop { -#define TIMEOUT 007777 /* mask */ -#define LEFT_RING W_RINGL /* 010000L */ -#define RIGHT_RING W_RINGR /* 020000L */ -#define INTRINSIC 040000L -#define LEFT_SIDE LEFT_RING -#define RIGHT_SIDE RIGHT_RING -#define BOTH_SIDES (LEFT_SIDE | RIGHT_SIDE) - long p_flgs; - int (*p_tofn)(); /* called after timeout */ -}; - -struct you { - xchar ux, uy; - schar dx, dy, dz; /* direction of move (or zap or ... ) */ -#ifdef QUEST - schar di; /* direction of FF */ - xchar ux0, uy0; /* initial position FF */ -#endif /* QUEST */ - xchar udisx, udisy; /* last display pos */ - char usym; /* usually '@' */ - schar uluck; -#define LUCKMAX 10 /* on moonlit nights 11 */ -#define LUCKMIN (-10) - int last_str_turn:3; /* 0: none, 1: half turn, 2: full turn */ - /* +: turn right, -: turn left */ - unsigned udispl:1; /* @ on display */ - unsigned ulevel:4; /* 1 - 14 */ -#ifdef QUEST - unsigned uhorizon:7; -#endif /* QUEST */ - unsigned utrap:3; /* trap timeout */ - unsigned utraptype:1; /* defined if utrap nonzero */ -#define TT_BEARTRAP 0 -#define TT_PIT 1 - unsigned uinshop:6; /* used only in shk.c - (roomno+1) of shop */ - - -/* perhaps these #define's should also be generated by makedefs */ -#define TELEPAT LAST_RING /* not a ring */ -#define Telepat u.uprops[TELEPAT].p_flgs -#define FAST (LAST_RING+1) /* not a ring */ -#define Fast u.uprops[FAST].p_flgs -#define CONFUSION (LAST_RING+2) /* not a ring */ -#define Confusion u.uprops[CONFUSION].p_flgs -#define INVIS (LAST_RING+3) /* not a ring */ -#define Invis u.uprops[INVIS].p_flgs -#define Invisible (Invis && !See_invisible) -#define GLIB (LAST_RING+4) /* not a ring */ -#define Glib u.uprops[GLIB].p_flgs -#define PUNISHED (LAST_RING+5) /* not a ring */ -#define Punished u.uprops[PUNISHED].p_flgs -#define SICK (LAST_RING+6) /* not a ring */ -#define Sick u.uprops[SICK].p_flgs -#define BLIND (LAST_RING+7) /* not a ring */ -#define Blind u.uprops[BLIND].p_flgs -#define WOUNDED_LEGS (LAST_RING+8) /* not a ring */ -#define Wounded_legs u.uprops[WOUNDED_LEGS].p_flgs -#define STONED (LAST_RING+9) /* not a ring */ -#define Stoned u.uprops[STONED].p_flgs -#define PROP(x) (x-RIN_ADORNMENT) /* convert ring to index in uprops */ - unsigned umconf:1; - char *usick_cause; - struct prop uprops[LAST_RING+10]; - - unsigned uswallow:1; /* set if swallowed by a monster */ - unsigned uswldtim:4; /* time you have been swallowed */ - unsigned uhs:3; /* hunger state - see hack.eat.c */ - schar ustr,ustrmax; - schar udaminc; - schar uac; - int uhp,uhpmax; - long int ugold,ugold0,uexp,urexp; - int uhunger; /* refd only in eat.c and shk.c */ - int uinvault; - struct monst *ustuck; - int nr_killed[CMNUM+2]; /* used for experience bookkeeping */ -}; - -extern struct you u; - -extern char *traps[]; -extern char *monnam(), *Monnam(), *amonnam(), *Amonnam(), - *doname(), *aobjnam(); -extern char readchar(); -extern char vowels[]; - -extern xchar curx,cury; /* cursor location on screen */ - -extern coord bhitpos; /* place where thrown weapon falls to the ground */ - -extern xchar seehx,seelx,seehy,seely; /* where to see*/ -extern char *save_cm,*killer; - -extern xchar dlevel, maxdlevel; /* dungeon level */ - -extern long moves; - -extern int multi; - - -extern char lock[]; - - -#define DIST(x1,y1,x2,y2) (((x1)-(x2))*((x1)-(x2)) + ((y1)-(y2))*((y1)-(y2))) - -#define PL_CSIZ 20 /* sizeof pl_character */ -#define MAX_CARR_CAP 120 /* so that boulders can be heavier */ -#define MAXLEVEL 40 -#define FAR (COLNO+2) /* position outside screen */ diff --git a/games/hack/hack.invent.c b/games/hack/hack.invent.c deleted file mode 100644 index f261034f07e4..000000000000 --- a/games/hack/hack.invent.c +++ /dev/null @@ -1,864 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.invent.c - version 1.0.3 */ -/* $FreeBSD$ */ - -#include "hack.h" -#include -extern struct obj *splitobj(); -extern struct obj zeroobj; -extern char morc; -extern char quitchars[]; -static char *xprname(); - -#ifndef NOWORM -#include "def.wseg.h" -extern struct wseg *wsegs[32]; -#endif /* NOWORM */ - -#define NOINVSYM '#' - -static int lastinvnr = 51; /* 0 ... 51 */ -static -assigninvlet(otmp) -struct obj *otmp; -{ - boolean inuse[52]; - int i; - struct obj *obj; - - for(i = 0; i < 52; i++) inuse[i] = FALSE; - for(obj = invent; obj; obj = obj->nobj) if(obj != otmp) { - i = obj->invlet; - if('a' <= i && i <= 'z') inuse[i - 'a'] = TRUE; else - if('A' <= i && i <= 'Z') inuse[i - 'A' + 26] = TRUE; - if(i == otmp->invlet) otmp->invlet = 0; - } - if((i = otmp->invlet) && - (('a' <= i && i <= 'z') || ('A' <= i && i <= 'Z'))) - return; - for(i = lastinvnr+1; i != lastinvnr; i++) { - if(i == 52) { i = -1; continue; } - if(!inuse[i]) break; - } - otmp->invlet = (inuse[i] ? NOINVSYM : - (i < 26) ? ('a'+i) : ('A'+i-26)); - lastinvnr = i; -} - -struct obj * -addinv(obj) -struct obj *obj; -{ - struct obj *otmp; - - /* merge or attach to end of chain */ - if(!invent) { - invent = obj; - otmp = 0; - } else - for(otmp = invent; /* otmp */; otmp = otmp->nobj) { - if(merged(otmp, obj, 0)) - return(otmp); - if(!otmp->nobj) { - otmp->nobj = obj; - break; - } - } - obj->nobj = 0; - - if(flags.invlet_constant) { - assigninvlet(obj); - /* - * The ordering of the chain is nowhere significant - * so in case you prefer some other order than the - * historical one, change the code below. - */ - if(otmp) { /* find proper place in chain */ - otmp->nobj = 0; - if((invent->invlet ^ 040) > (obj->invlet ^ 040)) { - obj->nobj = invent; - invent = obj; - } else - for(otmp = invent; ; otmp = otmp->nobj) { - if(!otmp->nobj || - (otmp->nobj->invlet ^ 040) > (obj->invlet ^ 040)){ - obj->nobj = otmp->nobj; - otmp->nobj = obj; - break; - } - } - } - } - - return(obj); -} - -useup(obj) -struct obj *obj; -{ - if(obj->quan > 1){ - obj->quan--; - obj->owt = weight(obj); - } else { - setnotworn(obj); - freeinv(obj); - obfree(obj, (struct obj *) 0); - } -} - -freeinv(obj) -struct obj *obj; -{ - struct obj *otmp; - - if(obj == invent) - invent = invent->nobj; - else { - for(otmp = invent; otmp->nobj != obj; otmp = otmp->nobj) - if(!otmp->nobj) panic("freeinv"); - otmp->nobj = obj->nobj; - } -} - -/* destroy object in fobj chain (if unpaid, it remains on the bill) */ -delobj(obj) struct obj *obj; { - freeobj(obj); - unpobj(obj); - obfree(obj, (struct obj *) 0); -} - -/* unlink obj from chain starting with fobj */ -freeobj(obj) struct obj *obj; { - struct obj *otmp; - - if(obj == fobj) fobj = fobj->nobj; - else { - for(otmp = fobj; otmp->nobj != obj; otmp = otmp->nobj) - if(!otmp) panic("error in freeobj"); - otmp->nobj = obj->nobj; - } -} - -/* Note: freegold throws away its argument! */ -freegold(gold) struct gold *gold; { - struct gold *gtmp; - - if(gold == fgold) fgold = gold->ngold; - else { - for(gtmp = fgold; gtmp->ngold != gold; gtmp = gtmp->ngold) - if(!gtmp) panic("error in freegold"); - gtmp->ngold = gold->ngold; - } - free((char *) gold); -} - -deltrap(trap) -struct trap *trap; -{ - struct trap *ttmp; - - if(trap == ftrap) - ftrap = ftrap->ntrap; - else { - for(ttmp = ftrap; ttmp->ntrap != trap; ttmp = ttmp->ntrap) ; - ttmp->ntrap = trap->ntrap; - } - free((char *) trap); -} - -struct wseg *m_atseg; - -struct monst * -m_at(x,y) -int x,y; -{ - struct monst *mtmp; -#ifndef NOWORM - struct wseg *wtmp; -#endif /* NOWORM */ - - m_atseg = 0; - for(mtmp = fmon; mtmp; mtmp = mtmp->nmon){ - if(mtmp->mx == x && mtmp->my == y) - return(mtmp); -#ifndef NOWORM - if(mtmp->wormno){ - for(wtmp = wsegs[mtmp->wormno]; wtmp; wtmp = wtmp->nseg) - if(wtmp->wx == x && wtmp->wy == y){ - m_atseg = wtmp; - return(mtmp); - } - } -#endif /* NOWORM */ - } - return(0); -} - -struct obj * -o_at(x,y) -int x,y; -{ - struct obj *otmp; - - for(otmp = fobj; otmp; otmp = otmp->nobj) - if(otmp->ox == x && otmp->oy == y) return(otmp); - return(0); -} - -struct obj * -sobj_at(n,x,y) -int n,x,y; -{ - struct obj *otmp; - - for(otmp = fobj; otmp; otmp = otmp->nobj) - if(otmp->ox == x && otmp->oy == y && otmp->otyp == n) - return(otmp); - return(0); -} - -carried(obj) struct obj *obj; { -struct obj *otmp; - for(otmp = invent; otmp; otmp = otmp->nobj) - if(otmp == obj) return(1); - return(0); -} - -carrying(type) -int type; -{ - struct obj *otmp; - - for(otmp = invent; otmp; otmp = otmp->nobj) - if(otmp->otyp == type) - return(TRUE); - return(FALSE); -} - -struct obj * -o_on(id, objchn) unsigned int id; struct obj *objchn; { - while(objchn) { - if(objchn->o_id == id) return(objchn); - objchn = objchn->nobj; - } - return((struct obj *) 0); -} - -struct trap * -t_at(x,y) -int x,y; -{ - struct trap *trap = ftrap; - while(trap) { - if(trap->tx == x && trap->ty == y) return(trap); - trap = trap->ntrap; - } - return(0); -} - -struct gold * -g_at(x,y) -int x,y; -{ - struct gold *gold = fgold; - while(gold) { - if(gold->gx == x && gold->gy == y) return(gold); - gold = gold->ngold; - } - return(0); -} - -/* make dummy object structure containing gold - for temporary use only */ -struct obj * -mkgoldobj(q) -long q; -{ - struct obj *otmp; - - otmp = newobj(0); - /* should set o_id etc. but otmp will be freed soon */ - otmp->olet = '$'; - u.ugold -= q; - OGOLD(otmp) = q; - flags.botl = 1; - return(otmp); -} - -/* - * getobj returns: - * struct obj *xxx: object to do something with. - * (struct obj *) 0 error return: no object. - * &zeroobj explicitly no object (as in w-). - */ -struct obj * -getobj(let,word) -char *let,*word; -{ - struct obj *otmp; - char ilet,ilet1,ilet2; - char buf[BUFSZ]; - char lets[BUFSZ]; - int foo = 0, foo2; - char *bp = buf; - xchar allowcnt = 0; /* 0, 1 or 2 */ - boolean allowgold = FALSE; - boolean allowall = FALSE; - boolean allownone = FALSE; - xchar foox = 0; - long cnt; - - if(*let == '0') let++, allowcnt = 1; - if(*let == '$') let++, allowgold = TRUE; - if(*let == '#') let++, allowall = TRUE; - if(*let == '-') let++, allownone = TRUE; - if(allownone) *bp++ = '-'; - if(allowgold) *bp++ = '$'; - if(bp > buf && bp[-1] == '-') *bp++ = ' '; - - ilet = 'a'; - for(otmp = invent; otmp; otmp = otmp->nobj){ - if(!*let || index(let, otmp->olet)) { - bp[foo++] = flags.invlet_constant ? otmp->invlet : ilet; - - /* ugly check: remove inappropriate things */ - if((!strcmp(word, "take off") && - !(otmp->owornmask & (W_ARMOR - W_ARM2))) - || (!strcmp(word, "wear") && - (otmp->owornmask & (W_ARMOR | W_RING))) - || (!strcmp(word, "wield") && - (otmp->owornmask & W_WEP))) { - foo--; - foox++; - } - } - if(ilet == 'z') ilet = 'A'; else ilet++; - } - bp[foo] = 0; - if(foo == 0 && bp > buf && bp[-1] == ' ') *--bp = 0; - (void) strcpy(lets, bp); /* necessary since we destroy buf */ - if(foo > 5) { /* compactify string */ - foo = foo2 = 1; - ilet2 = bp[0]; - ilet1 = bp[1]; - while(ilet = bp[++foo2] = bp[++foo]){ - if(ilet == ilet1+1){ - if(ilet1 == ilet2+1) - bp[foo2 - 1] = ilet1 = '-'; - else if(ilet2 == '-') { - bp[--foo2] = ++ilet1; - continue; - } - } - ilet2 = ilet1; - ilet1 = ilet; - } - } - if(!foo && !allowall && !allowgold && !allownone) { - pline("You don't have anything %sto %s.", - foox ? "else " : "", word); - return(0); - } - for(;;) { - if(!buf[0]) - pline("What do you want to %s [*]? ", word); - else - pline("What do you want to %s [%s or ?*]? ", - word, buf); - - cnt = 0; - ilet = readchar(); - while(digit(ilet) && allowcnt) { - if (cnt < 100000000) - cnt = 10*cnt + (ilet - '0'); - else - cnt = 999999999; - allowcnt = 2; /* signal presence of cnt */ - ilet = readchar(); - } - if(digit(ilet)) { - pline("No count allowed with this command."); - continue; - } - if(index(quitchars,ilet)) - return((struct obj *)0); - if(ilet == '-') { - return(allownone ? &zeroobj : (struct obj *) 0); - } - if(ilet == '$') { - if(!allowgold){ - pline("You cannot %s gold.", word); - continue; - } - if(!(allowcnt == 2 && cnt < u.ugold)) - cnt = u.ugold; - return(mkgoldobj(cnt)); - } - if(ilet == '?') { - doinv(lets); - if(!(ilet = morc)) continue; - /* he typed a letter (not a space) to more() */ - } else if(ilet == '*') { - doinv((char *) 0); - if(!(ilet = morc)) continue; - /* ... */ - } - if(flags.invlet_constant) { - for(otmp = invent; otmp; otmp = otmp->nobj) - if(otmp->invlet == ilet) break; - } else { - if(ilet >= 'A' && ilet <= 'Z') ilet += 'z'-'A'+1; - ilet -= 'a'; - for(otmp = invent; otmp && ilet; - ilet--, otmp = otmp->nobj) ; - } - if(!otmp) { - pline("You don't have that object."); - continue; - } - if(cnt < 0 || otmp->quan < cnt) { - pline("You don't have that many! [You have %u]" - , otmp->quan); - continue; - } - break; - } - if(!allowall && let && !index(let,otmp->olet)) { - pline("That is a silly thing to %s.",word); - return(0); - } - if(allowcnt == 2) { /* cnt given */ - if(cnt == 0) return(0); - if(cnt != otmp->quan) { - struct obj *obj; - obj = splitobj(otmp, (int) cnt); - if(otmp == uwep) setuwep(obj); - } - } - return(otmp); -} - -ckunpaid(otmp) struct obj *otmp; { - return( otmp->unpaid ); -} - -/* interactive version of getobj - used for Drop and Identify */ -/* return the number of times fn was called successfully */ -ggetobj(word, fn, max) -char *word; -int (*fn)(), max; -{ -char buf[BUFSZ]; -char *ip; -char sym; -int oletct = 0, iletct = 0; -boolean allflag = FALSE; -char olets[20], ilets[20]; -int (*ckfn)() = (int (*)()) 0; -xchar allowgold = (u.ugold && !strcmp(word, "drop")) ? 1 : 0; /* BAH */ - if(!invent && !allowgold){ - pline("You have nothing to %s.", word); - return(0); - } else { - struct obj *otmp = invent; - int uflg = 0; - - if(allowgold) ilets[iletct++] = '$'; - ilets[iletct] = 0; - while(otmp) { - if(!index(ilets, otmp->olet)){ - ilets[iletct++] = otmp->olet; - ilets[iletct] = 0; - } - if(otmp->unpaid) uflg = 1; - otmp = otmp->nobj; - } - ilets[iletct++] = ' '; - if(uflg) ilets[iletct++] = 'u'; - if(invent) ilets[iletct++] = 'a'; - ilets[iletct] = 0; - } - pline("What kinds of thing do you want to %s? [%s] ", - word, ilets); - getlin(buf); - if(buf[0] == '\033') { - clrlin(); - return(0); - } - ip = buf; - olets[0] = 0; - while(sym = *ip++){ - if(sym == ' ') continue; - if(sym == '$') { - if(allowgold == 1) - (*fn)(mkgoldobj(u.ugold)); - else if(!u.ugold) - pline("You have no gold."); - allowgold = 2; - } else - if(sym == 'a' || sym == 'A') allflag = TRUE; else - if(sym == 'u' || sym == 'U') ckfn = ckunpaid; else - if(index("!%?[()=*/\"0", sym)){ - if(!index(olets, sym)){ - olets[oletct++] = sym; - olets[oletct] = 0; - } - } - else pline("You don't have any %c's.", sym); - } - if(allowgold == 2 && !oletct) - return(1); /* he dropped gold (or at least tried to) */ - else - return(askchain(invent, olets, allflag, fn, ckfn, max)); -} - -/* - * Walk through the chain starting at objchn and ask for all objects - * with olet in olets (if nonNULL) and satisfying ckfn (if nonNULL) - * whether the action in question (i.e., fn) has to be performed. - * If allflag then no questions are asked. Max gives the max nr of - * objects to be treated. Return the number of objects treated. - */ -askchain(objchn, olets, allflag, fn, ckfn, max) -struct obj *objchn; -char *olets; -int allflag; -int (*fn)(), (*ckfn)(); -int max; -{ -struct obj *otmp, *otmp2; -char sym, ilet; -int cnt = 0; - ilet = 'a'-1; - for(otmp = objchn; otmp; otmp = otmp2){ - if(ilet == 'z') ilet = 'A'; else ilet++; - otmp2 = otmp->nobj; - if(olets && *olets && !index(olets, otmp->olet)) continue; - if(ckfn && !(*ckfn)(otmp)) continue; - if(!allflag) { - pline(xprname(otmp, ilet)); - addtopl(" [nyaq]? "); - sym = readchar(); - } - else sym = 'y'; - - switch(sym){ - case 'a': - allflag = 1; - case 'y': - cnt += (*fn)(otmp); - if(--max == 0) goto ret; - case 'n': - default: - break; - case 'q': - goto ret; - } - } - pline(cnt ? "That was all." : "No applicable objects."); -ret: - return(cnt); -} - -obj_to_let(obj) /* should of course only be called for things in invent */ -struct obj *obj; -{ - struct obj *otmp; - char ilet; - - if(flags.invlet_constant) - return(obj->invlet); - ilet = 'a'; - for(otmp = invent; otmp && otmp != obj; otmp = otmp->nobj) - if(++ilet > 'z') ilet = 'A'; - return(otmp ? ilet : NOINVSYM); -} - -prinv(obj) -struct obj *obj; -{ - pline(xprname(obj, obj_to_let(obj))); -} - -static char * -xprname(obj,let) -struct obj *obj; -char let; -{ - static char li[BUFSZ]; - - (void) sprintf(li, "%c - %s.", - flags.invlet_constant ? obj->invlet : let, - doname(obj)); - return(li); -} - -ddoinv() -{ - doinv((char *) 0); - return(0); -} - -/* called with 0 or "": all objects in inventory */ -/* otherwise: all objects with (serial) letter in lets */ -doinv(lets) -char *lets; -{ - struct obj *otmp; - char ilet; - int ct = 0; - char any[BUFSZ]; - - morc = 0; /* just to be sure */ - - if(!invent){ - pline("Not carrying anything."); - return; - } - - cornline(0, (char *) 0); - ilet = 'a'; - for(otmp = invent; otmp; otmp = otmp->nobj) { - if(flags.invlet_constant) ilet = otmp->invlet; - if(!lets || !*lets || index(lets, ilet)) { - cornline(1, xprname(otmp, ilet)); - any[ct++] = ilet; - } - if(!flags.invlet_constant) if(++ilet > 'z') ilet = 'A'; - } - any[ct] = 0; - cornline(2, any); -} - -dotypeinv () /* free after Robert Viduya */ -/* Changed to one type only, so he doesnt have to type cr */ -{ - char c, ilet; - char stuff[BUFSZ]; - int stct; - struct obj *otmp; - boolean billx = inshop() && doinvbill(0); - boolean unpd = FALSE; - - if (!invent && !u.ugold && !billx) { - pline ("You aren't carrying anything."); - return(0); - } - - stct = 0; - if(u.ugold) stuff[stct++] = '$'; - stuff[stct] = 0; - for(otmp = invent; otmp; otmp = otmp->nobj) { - if (!index (stuff, otmp->olet)) { - stuff[stct++] = otmp->olet; - stuff[stct] = 0; - } - if(otmp->unpaid) - unpd = TRUE; - } - if(unpd) stuff[stct++] = 'u'; - if(billx) stuff[stct++] = 'x'; - stuff[stct] = 0; - - if(stct > 1) { - pline ("What type of object [%s] do you want an inventory of? ", - stuff); - c = readchar(); - if(index(quitchars,c)) return(0); - } else - c = stuff[0]; - - if(c == '$') - return(doprgold()); - - if(c == 'x' || c == 'X') { - if(billx) - (void) doinvbill(1); - else - pline("No used-up objects on the shopping bill."); - return(0); - } - - if((c == 'u' || c == 'U') && !unpd) { - pline("You are not carrying any unpaid objects."); - return(0); - } - - stct = 0; - ilet = 'a'; - for (otmp = invent; otmp; otmp = otmp -> nobj) { - if(flags.invlet_constant) ilet = otmp->invlet; - if (c == otmp -> olet || (c == 'u' && otmp -> unpaid)) - stuff[stct++] = ilet; - if(!flags.invlet_constant) if(++ilet > 'z') ilet = 'A'; - } - stuff[stct] = '\0'; - if(stct == 0) - pline("You have no such objects."); - else - doinv (stuff); - - return(0); -} - -/* look at what is here */ -dolook() { - struct obj *otmp, *otmp0; - struct gold *gold; - char *verb = Blind ? "feel" : "see"; - int ct = 0; - - if(!u.uswallow) { - if(Blind) { - pline("You try to feel what is lying here on the floor."); - if(Levitation) { /* ab@unido */ - pline("You cannot reach the floor!"); - return(1); - } - } - otmp0 = o_at(u.ux, u.uy); - gold = g_at(u.ux, u.uy); - } - - if(u.uswallow || (!otmp0 && !gold)) { - pline("You %s no objects here.", verb); - return(!!Blind); - } - - cornline(0, "Things that are here:"); - for(otmp = otmp0; otmp; otmp = otmp->nobj) { - if(otmp->ox == u.ux && otmp->oy == u.uy) { - ct++; - cornline(1, doname(otmp)); - if(Blind && otmp->otyp == DEAD_COCKATRICE && !uarmg) { - pline("Touching the dead cockatrice is a fatal mistake ..."); - pline("You die ..."); - killer = "dead cockatrice"; - done("died"); - } - } - } - - if(gold) { - char gbuf[30]; - - (void) sprintf(gbuf, "%ld gold piece%s", - gold->amount, plur(gold->amount)); - if(!ct++) - pline("You %s here %s.", verb, gbuf); - else - cornline(1, gbuf); - } - - if(ct == 1 && !gold) { - pline("You %s here %s.", verb, doname(otmp0)); - cornline(3, (char *) 0); - } - if(ct > 1) - cornline(2, (char *) 0); - return(!!Blind); -} - -stackobj(obj) struct obj *obj; { -struct obj *otmp = fobj; - for(otmp = fobj; otmp; otmp = otmp->nobj) if(otmp != obj) - if(otmp->ox == obj->ox && otmp->oy == obj->oy && - merged(obj,otmp,1)) - return; -} - -/* merge obj with otmp and delete obj if types agree */ -merged(otmp,obj,lose) struct obj *otmp, *obj; { - if(obj->otyp == otmp->otyp && - obj->unpaid == otmp->unpaid && - obj->spe == otmp->spe && - obj->dknown == otmp->dknown && - obj->cursed == otmp->cursed && - (index("%*?!", obj->olet) || - (obj->known == otmp->known && - (obj->olet == WEAPON_SYM && obj->otyp < BOOMERANG)))) { - otmp->quan += obj->quan; - otmp->owt += obj->owt; - if(lose) freeobj(obj); - obfree(obj,otmp); /* free(obj), bill->otmp */ - return(1); - } else return(0); -} - -/* - * Gold is no longer displayed; in fact, when you have a lot of money, - * it may take a while before you have counted it all. - * [Bug: d$ and pickup still tell you how much it was.] - */ -extern int (*occupation)(); -extern char *occtxt; -static long goldcounted; - -countgold(){ - if((goldcounted += 100*(u.ulevel + 1)) >= u.ugold) { - long eps = 0; - if(!rn2(2)) eps = rnd((int) (u.ugold/100 + 1)); - pline("You probably have about %ld gold pieces.", - u.ugold + eps); - return(0); /* done */ - } - return(1); /* continue */ -} - -doprgold(){ - if(!u.ugold) - pline("You do not carry any gold."); - else if(u.ugold <= 500) - pline("You are carrying %ld gold pieces.", u.ugold); - else { - pline("You sit down in order to count your gold pieces."); - goldcounted = 500; - occupation = countgold; - occtxt = "counting your gold"; - } - return(1); -} - -/* --- end of gold counting section --- */ - -doprwep(){ - if(!uwep) pline("You are empty handed."); - else prinv(uwep); - return(0); -} - -doprarm(){ - if(!uarm && !uarmg && !uarms && !uarmh) - pline("You are not wearing any armor."); - else { - char lets[6]; - int ct = 0; - - if(uarm) lets[ct++] = obj_to_let(uarm); - if(uarm2) lets[ct++] = obj_to_let(uarm2); - if(uarmh) lets[ct++] = obj_to_let(uarmh); - if(uarms) lets[ct++] = obj_to_let(uarms); - if(uarmg) lets[ct++] = obj_to_let(uarmg); - lets[ct] = 0; - doinv(lets); - } - return(0); -} - -doprring(){ - if(!uleft && !uright) - pline("You are not wearing any rings."); - else { - char lets[3]; - int ct = 0; - - if(uleft) lets[ct++] = obj_to_let(uleft); - if(uright) lets[ct++] = obj_to_let(uright); - lets[ct] = 0; - doinv(lets); - } - return(0); -} - -digit(c) char c; { - return(c >= '0' && c <= '9'); -} diff --git a/games/hack/hack.ioctl.c b/games/hack/hack.ioctl.c deleted file mode 100644 index 9989e6233a9e..000000000000 --- a/games/hack/hack.ioctl.c +++ /dev/null @@ -1,57 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.ioctl.c - version 1.0.2 */ - -#include -__FBSDID("$FreeBSD$"); - -/* This cannot be part of hack.tty.c (as it was earlier) since on some - systems (e.g. MUNIX) the include files and - define the same constants, and the C preprocessor complains. */ - -#include -#include "config.h" -#ifdef BSD -#include -struct ltchars ltchars, ltchars0; -#else -#include /* also includes part of */ -struct termio termio; -#endif /* BSD */ - -getioctls() { -#ifdef BSD - (void) ioctl(fileno(stdin), (int) TIOCGLTC, (char *) <chars); - (void) ioctl(fileno(stdin), (int) TIOCSLTC, (char *) <chars0); -#else - (void) ioctl(fileno(stdin), (int) TCGETA, &termio); -#endif /* BSD */ -} - -setioctls() { -#ifdef BSD - (void) ioctl(fileno(stdin), (int) TIOCSLTC, (char *) <chars); -#else - (void) ioctl(fileno(stdin), (int) TCSETA, &termio); -#endif /* BSD */ -} - -#ifdef SUSPEND /* implies BSD */ -#include -dosuspend() { -#ifdef SIGTSTP - if(signal(SIGTSTP, SIG_IGN) == SIG_DFL) { - settty((char *) 0); - (void) signal(SIGTSTP, SIG_DFL); - (void) kill(0, SIGTSTP); - gettty(); - setftty(); - docrt(); - } else { - pline("I don't think your shell has job control."); - } -#else /* SIGTSTP */ - pline("Sorry, it seems we have no SIGTSTP here. Try ! or S."); -#endif /* SIGTSTP */ - return(0); -} -#endif /* SUSPEND */ diff --git a/games/hack/hack.lev.c b/games/hack/hack.lev.c deleted file mode 100644 index 8cc709e1b6ca..000000000000 --- a/games/hack/hack.lev.c +++ /dev/null @@ -1,286 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.lev.c - version 1.0.3 */ -/* $FreeBSD$ */ - -#include "hack.h" -#include "def.mkroom.h" -#include -extern struct monst *restmonchn(); -extern struct obj *restobjchn(); -extern struct obj *billobjs; -extern char *itoa(); -extern char SAVEF[]; -extern int hackpid; -extern xchar dlevel; -extern char nul[]; - -#ifndef NOWORM -#include "def.wseg.h" -extern struct wseg *wsegs[32], *wheads[32]; -extern long wgrowtime[32]; -#endif /* NOWORM */ - -boolean level_exists[MAXLEVEL+1]; - -savelev(fd,lev) -int fd; -xchar lev; -{ -#ifndef NOWORM - struct wseg *wtmp, *wtmp2; - int tmp; -#endif /* NOWORM */ - - if(fd < 0) panic("Save on bad file!"); /* impossible */ - if(lev >= 0 && lev <= MAXLEVEL) - level_exists[lev] = TRUE; - - bwrite(fd,(char *) &hackpid,sizeof(hackpid)); - bwrite(fd,(char *) &lev,sizeof(lev)); - bwrite(fd,(char *) levl,sizeof(levl)); - bwrite(fd,(char *) &moves,sizeof(long)); - bwrite(fd,(char *) &xupstair,sizeof(xupstair)); - bwrite(fd,(char *) &yupstair,sizeof(yupstair)); - bwrite(fd,(char *) &xdnstair,sizeof(xdnstair)); - bwrite(fd,(char *) &ydnstair,sizeof(ydnstair)); - savemonchn(fd, fmon); - savegoldchn(fd, fgold); - savetrapchn(fd, ftrap); - saveobjchn(fd, fobj); - saveobjchn(fd, billobjs); - billobjs = 0; - save_engravings(fd); -#ifndef QUEST - bwrite(fd,(char *) rooms,sizeof(rooms)); - bwrite(fd,(char *) doors,sizeof(doors)); -#endif /* QUEST */ - fgold = 0; - ftrap = 0; - fmon = 0; - fobj = 0; -#ifndef NOWORM - bwrite(fd,(char *) wsegs,sizeof(wsegs)); - for(tmp=1; tmp<32; tmp++){ - for(wtmp = wsegs[tmp]; wtmp; wtmp = wtmp2){ - wtmp2 = wtmp->nseg; - bwrite(fd,(char *) wtmp,sizeof(struct wseg)); - } - wsegs[tmp] = 0; - } - bwrite(fd,(char *) wgrowtime,sizeof(wgrowtime)); -#endif /* NOWORM */ -} - -bwrite(fd,loc,num) -int fd; -char *loc; -unsigned num; -{ -/* lint wants the 3rd arg of write to be an int; lint -p an unsigned */ - if(write(fd, loc, (int) num) != num) - panic("cannot write %u bytes to file #%d", num, fd); -} - -saveobjchn(fd,otmp) -int fd; -struct obj *otmp; -{ - struct obj *otmp2; - unsigned xl; - int minusone = -1; - - while(otmp) { - otmp2 = otmp->nobj; - xl = otmp->onamelth; - bwrite(fd, (char *) &xl, sizeof(int)); - bwrite(fd, (char *) otmp, xl + sizeof(struct obj)); - free((char *) otmp); - otmp = otmp2; - } - bwrite(fd, (char *) &minusone, sizeof(int)); -} - -savemonchn(fd,mtmp) -int fd; -struct monst *mtmp; -{ - struct monst *mtmp2; - unsigned xl; - int minusone = -1; - struct permonst *monbegin = &mons[0]; - - bwrite(fd, (char *) &monbegin, sizeof(monbegin)); - - while(mtmp) { - mtmp2 = mtmp->nmon; - xl = mtmp->mxlth + mtmp->mnamelth; - bwrite(fd, (char *) &xl, sizeof(int)); - bwrite(fd, (char *) mtmp, xl + sizeof(struct monst)); - if(mtmp->minvent) saveobjchn(fd,mtmp->minvent); - free((char *) mtmp); - mtmp = mtmp2; - } - bwrite(fd, (char *) &minusone, sizeof(int)); -} - -savegoldchn(fd,gold) -int fd; -struct gold *gold; -{ - struct gold *gold2; - while(gold) { - gold2 = gold->ngold; - bwrite(fd, (char *) gold, sizeof(struct gold)); - free((char *) gold); - gold = gold2; - } - bwrite(fd, nul, sizeof(struct gold)); -} - -savetrapchn(fd,trap) -int fd; -struct trap *trap; -{ - struct trap *trap2; - while(trap) { - trap2 = trap->ntrap; - bwrite(fd, (char *) trap, sizeof(struct trap)); - free((char *) trap); - trap = trap2; - } - bwrite(fd, nul, sizeof(struct trap)); -} - -getlev(fd,pid,lev) -int fd,pid; -xchar lev; -{ - struct gold *gold; - struct trap *trap; -#ifndef NOWORM - struct wseg *wtmp; -#endif /* NOWORM */ - int tmp; - long omoves; - int hpid; - xchar dlvl; - - /* First some sanity checks */ - mread(fd, (char *) &hpid, sizeof(hpid)); - mread(fd, (char *) &dlvl, sizeof(dlvl)); - if((pid && pid != hpid) || (lev && dlvl != lev)) { - pline("Strange, this map is not as I remember it."); - pline("Somebody is trying some trickery here ..."); - pline("This game is void ..."); - done("tricked"); - } - - fgold = 0; - ftrap = 0; - mread(fd, (char *) levl, sizeof(levl)); - mread(fd, (char *)&omoves, sizeof(omoves)); - mread(fd, (char *)&xupstair, sizeof(xupstair)); - mread(fd, (char *)&yupstair, sizeof(yupstair)); - mread(fd, (char *)&xdnstair, sizeof(xdnstair)); - mread(fd, (char *)&ydnstair, sizeof(ydnstair)); - - fmon = restmonchn(fd); - - /* regenerate animals while on another level */ - { long tmoves = (moves > omoves) ? moves-omoves : 0; - struct monst *mtmp, *mtmp2; - extern char genocided[]; - - for(mtmp = fmon; mtmp; mtmp = mtmp2) { - long newhp; /* tmoves may be very large */ - - mtmp2 = mtmp->nmon; - if(index(genocided, mtmp->data->mlet)) { - mondead(mtmp); - continue; - } - - if(mtmp->mtame && tmoves > 250) { - mtmp->mtame = 0; - mtmp->mpeaceful = 0; - } - - newhp = mtmp->mhp + - (index(MREGEN, mtmp->data->mlet) ? tmoves : tmoves/20); - if(newhp > mtmp->mhpmax) - mtmp->mhp = mtmp->mhpmax; - else - mtmp->mhp = newhp; - } - } - - setgd(); - gold = newgold(); - mread(fd, (char *)gold, sizeof(struct gold)); - while(gold->gx) { - gold->ngold = fgold; - fgold = gold; - gold = newgold(); - mread(fd, (char *)gold, sizeof(struct gold)); - } - free((char *) gold); - trap = newtrap(); - mread(fd, (char *)trap, sizeof(struct trap)); - while(trap->tx) { - trap->ntrap = ftrap; - ftrap = trap; - trap = newtrap(); - mread(fd, (char *)trap, sizeof(struct trap)); - } - free((char *) trap); - fobj = restobjchn(fd); - billobjs = restobjchn(fd); - rest_engravings(fd); -#ifndef QUEST - mread(fd, (char *)rooms, sizeof(rooms)); - mread(fd, (char *)doors, sizeof(doors)); -#endif /* QUEST */ -#ifndef NOWORM - mread(fd, (char *)wsegs, sizeof(wsegs)); - for(tmp = 1; tmp < 32; tmp++) if(wsegs[tmp]){ - wheads[tmp] = wsegs[tmp] = wtmp = newseg(); - while(1) { - mread(fd, (char *)wtmp, sizeof(struct wseg)); - if(!wtmp->nseg) break; - wheads[tmp]->nseg = wtmp = newseg(); - wheads[tmp] = wtmp; - } - } - mread(fd, (char *)wgrowtime, sizeof(wgrowtime)); -#endif /* NOWORM */ -} - -mread(fd, buf, len) -int fd; -char *buf; -unsigned len; -{ - int rlen; - extern boolean restoring; - - rlen = read(fd, buf, (int) len); - if(rlen != len){ - pline("Read %d instead of %u bytes.\n", rlen, len); - if(restoring) { - (void) unlink(SAVEF); - error("Error restoring old game."); - } - panic("Error reading level file."); - } -} - -mklev() -{ - extern boolean in_mklev; - - if(getbones()) return; - - in_mklev = TRUE; - makelevel(); - in_mklev = FALSE; -} diff --git a/games/hack/hack.main.c b/games/hack/hack.main.c deleted file mode 100644 index b29320a5aa02..000000000000 --- a/games/hack/hack.main.c +++ /dev/null @@ -1,502 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.main.c - version 1.0.3 */ -/* $FreeBSD$ */ - -#include -#include -#include -#include -#include "hack.h" - -#ifdef QUEST -#define gamename "quest" -#else -#define gamename "hack" -#endif - -extern char plname[PL_NSIZ], pl_character[PL_CSIZ]; -extern struct permonst mons[CMNUM+2]; -extern char genocided[60], fut_geno[]; - -int (*afternmv)(); -int (*occupation)(); -char *occtxt; /* defined when occupation != NULL */ - -void done1(); -void hangup(); - -int hackpid; /* current pid */ -int locknum; /* max num of players */ -#ifdef DEF_PAGER -char *catmore; /* default pager */ -#endif -char SAVEF[PL_NSIZ + 11] = "save/"; /* save/99999player */ -char *hname; /* name of the game (argv[0] of call) */ -char obuf[BUFSIZ]; /* BUFSIZ is defined in stdio.h */ - -extern char *nomovemsg; -extern long wailmsg; - -#ifdef CHDIR -static void chdirx(); -#endif - -main(argc,argv) -int argc; -char *argv[]; -{ - int fd; -#ifdef CHDIR - char *dir; -#endif - - hname = argv[0]; - hackpid = getpid(); - -#ifdef CHDIR /* otherwise no chdir() */ - /* - * See if we must change directory to the playground. - * (Perhaps hack runs suid and playground is inaccessible - * for the player.) - * The environment variable HACKDIR is overridden by a - * -d command line option (must be the first option given) - */ - - dir = getenv("HACKDIR"); - if(argc > 1 && !strncmp(argv[1], "-d", 2)) { - argc--; - argv++; - dir = argv[0]+2; - if(*dir == '=' || *dir == ':') dir++; - if(!*dir && argc > 1) { - argc--; - argv++; - dir = argv[0]; - } - if(!*dir) - error("Flag -d must be followed by a directory name."); - } -#endif - - /* - * Who am i? Algorithm: 1. Use name as specified in HACKOPTIONS - * 2. Use $USER or $LOGNAME (if 1. fails) - * 3. Use getlogin() (if 2. fails) - * The resulting name is overridden by command line options. - * If everything fails, or if the resulting name is some generic - * account like "games", "play", "player", "hack" then eventually - * we'll ask him. - * Note that we trust him here; it is possible to play under - * somebody else's name. - */ - { char *s; - - initoptions(); - if(!*plname && (s = getenv("USER"))) - (void) strncpy(plname, s, sizeof(plname)-1); - if(!*plname && (s = getenv("LOGNAME"))) - (void) strncpy(plname, s, sizeof(plname)-1); - if(!*plname && (s = getlogin())) - (void) strncpy(plname, s, sizeof(plname)-1); - } - - /* - * Now we know the directory containing 'record' and - * may do a prscore(). - */ - if(argc > 1 && !strncmp(argv[1], "-s", 2)) { -#ifdef CHDIR - chdirx(dir,0); -#endif - prscore(argc, argv); - exit(0); - } - - /* - * It seems he really wants to play. - * Remember tty modes, to be restored on exit. - */ - gettty(); - setbuf(stdout,obuf); - umask(007); - setrandom(); - startup(); - cls(); - u.uhp = 1; /* prevent RIP on early quits */ - u.ux = FAR; /* prevent nscr() */ - (void) signal(SIGHUP, hangup); - - /* - * Find the creation date of this game, - * so as to avoid restoring outdated savefiles. - */ - gethdate(hname); - - /* - * We cannot do chdir earlier, otherwise gethdate will fail. - */ -#ifdef CHDIR - chdirx(dir,1); -#endif - - /* - * Process options. - */ - while(argc > 1 && argv[1][0] == '-'){ - argv++; - argc--; - switch(argv[0][1]){ -#ifdef WIZARD - case 'D': -/* if(!strcmp(getlogin(), WIZARD)) */ - wizard = TRUE; -/* else - printf("Sorry.\n"); */ - break; -#endif -#ifdef NEWS - case 'n': - flags.nonews = TRUE; - break; -#endif - case 'u': - if(argv[0][2]) - (void) strncpy(plname, argv[0]+2, sizeof(plname)-1); - else if(argc > 1) { - argc--; - argv++; - (void) strncpy(plname, argv[0], sizeof(plname)-1); - } else - printf("Player name expected after -u\n"); - break; - default: - /* allow -T for Tourist, etc. */ - (void) strncpy(pl_character, argv[0]+1, - sizeof(pl_character)-1); - - /* printf("Unknown option: %s\n", *argv); */ - } - } - - if(argc > 1) - locknum = atoi(argv[1]); -#ifdef MAX_NR_OF_PLAYERS - if(!locknum || locknum > MAX_NR_OF_PLAYERS) - locknum = MAX_NR_OF_PLAYERS; -#endif -#ifdef DEF_PAGER - if(!(catmore = getenv("HACKPAGER")) && !(catmore = getenv("PAGER"))) - catmore = DEF_PAGER; -#endif -#ifdef MAIL - getmailstatus(); -#endif -#ifdef WIZARD - if(wizard) (void) strcpy(plname, "wizard"); else -#endif - if(!*plname || !strncmp(plname, "player", 4) - || !strncmp(plname, "games", 4)) - askname(); - plnamesuffix(); /* strip suffix from name; calls askname() */ - /* again if suffix was whole name */ - /* accepts any suffix */ -#ifdef WIZARD - if(!wizard) { -#endif - /* - * check for multiple games under the same name - * (if !locknum) or check max nr of players (otherwise) - */ - (void) signal(SIGQUIT,SIG_IGN); - (void) signal(SIGINT,SIG_IGN); - if(!locknum) - (void) strcpy(lock,plname); - getlock(); /* sets lock if locknum != 0 */ -#ifdef WIZARD - } else { - char *sfoo; - (void) strcpy(lock,plname); - if(sfoo = getenv("MAGIC")) - while(*sfoo) { - switch(*sfoo++) { - case 'n': (void) srandom(*sfoo++); - break; - } - } - if(sfoo = getenv("GENOCIDED")){ - if(*sfoo == '!'){ - struct permonst *pm = mons; - char *gp = genocided; - - while(pm < mons+CMNUM+2){ - if(!index(sfoo, pm->mlet)) - *gp++ = pm->mlet; - pm++; - } - *gp = 0; - } else - (void) strncpy(genocided, sfoo, sizeof(genocided)-1); - (void) strcpy(fut_geno, genocided); - } - } -#endif - setftty(); - (void) sprintf(SAVEF, "save/%d%s", getuid(), plname); - regularize(SAVEF+5); /* avoid . or / in name */ - if((fd = open(SAVEF,0)) >= 0 && - (uptodate(fd) || unlink(SAVEF) == 666)) { - (void) signal(SIGINT,done1); - pline("Restoring old save file..."); - (void) fflush(stdout); - if(!dorecover(fd)) - goto not_recovered; - pline("Hello %s, welcome to %s!", plname, gamename); - flags.move = 0; - } else { -not_recovered: - fobj = fcobj = invent = 0; - fmon = fallen_down = 0; - ftrap = 0; - fgold = 0; - flags.ident = 1; - init_objects(); - u_init(); - - (void) signal(SIGINT,done1); - mklev(); - u.ux = xupstair; - u.uy = yupstair; - (void) inshop(); - setsee(); - flags.botlx = 1; - makedog(); - { struct monst *mtmp; - if(mtmp = m_at(u.ux, u.uy)) mnexto(mtmp); /* riv05!a3 */ - } - seemons(); -#ifdef NEWS - if(flags.nonews || !readnews()) - /* after reading news we did docrt() already */ -#endif - docrt(); - - /* give welcome message before pickup messages */ - pline("Hello %s, welcome to %s!", plname, gamename); - - pickup(1); - read_engr_at(u.ux,u.uy); - flags.move = 1; - } - - flags.moonphase = phase_of_the_moon(); - if(flags.moonphase == FULL_MOON) { - pline("You are lucky! Full moon tonight."); - u.uluck++; - } else if(flags.moonphase == NEW_MOON) { - pline("Be careful! New moon tonight."); - } - - initrack(); - - for(;;) { - if(flags.move) { /* actual time passed */ - - settrack(); - - if(moves%2 == 0 || - (!(Fast & ~INTRINSIC) && (!Fast || rn2(3)))) { - extern struct monst *makemon(); - movemon(); - if(!rn2(70)) - (void) makemon((struct permonst *)0, 0, 0); - } - if(Glib) glibr(); - timeout(); - ++moves; - if(flags.time) flags.botl = 1; - if(u.uhp < 1) { - pline("You die..."); - done("died"); - } - if(u.uhp*10 < u.uhpmax && moves-wailmsg > 50){ - wailmsg = moves; - if(u.uhp == 1) - pline("You hear the wailing of the Banshee..."); - else - pline("You hear the howling of the CwnAnnwn..."); - } - if(u.uhp < u.uhpmax) { - if(u.ulevel > 9) { - if(Regeneration || !(moves%3)) { - flags.botl = 1; - u.uhp += rnd((int) u.ulevel-9); - if(u.uhp > u.uhpmax) - u.uhp = u.uhpmax; - } - } else if(Regeneration || - (!(moves%(22-u.ulevel*2)))) { - flags.botl = 1; - u.uhp++; - } - } - if(Teleportation && !rn2(85)) tele(); - if(Searching && multi >= 0) (void) dosearch(); - gethungry(); - invault(); - amulet(); - } - if(multi < 0) { - if(!++multi){ - pline(nomovemsg ? nomovemsg : - "You can move again."); - nomovemsg = 0; - if(afternmv) (*afternmv)(); - afternmv = 0; - } - } - - find_ac(); -#ifndef QUEST - if(!flags.mv || Blind) -#endif - { - seeobjs(); - seemons(); - nscr(); - } - if(flags.botl || flags.botlx) bot(); - - flags.move = 1; - - if(multi >= 0 && occupation) { - if(monster_nearby()) - stop_occupation(); - else if ((*occupation)() == 0) - occupation = 0; - continue; - } - - if(multi > 0) { -#ifdef QUEST - if(flags.run >= 4) finddir(); -#endif - lookaround(); - if(!multi) { /* lookaround may clear multi */ - flags.move = 0; - continue; - } - if(flags.mv) { - if(multi < COLNO && !--multi) - flags.mv = flags.run = 0; - domove(); - } else { - --multi; - rhack(save_cm); - } - } else if(multi == 0) { -#ifdef MAIL - ckmailstatus(); -#endif - rhack((char *) 0); - } - if(multi && multi%7 == 0) - (void) fflush(stdout); - } -} - -glo(foo) -int foo; -{ - /* construct the string xlock.n */ - char *tf; - - tf = lock; - while(*tf && *tf != '.') tf++; - (void) sprintf(tf, ".%d", foo); -} - -/* - * plname is filled either by an option (-u Player or -uPlayer) or - * explicitly (-w implies wizard) or by askname. - * It may still contain a suffix denoting pl_character. - */ -askname(){ -int c,ct; - printf("\nWho are you? "); - (void) fflush(stdout); - ct = 0; - while((c = getchar()) != '\n'){ - if(c == EOF) error("End of input\n"); - /* some people get confused when their erase char is not ^H */ - if(c == '\010') { - if(ct) ct--; - continue; - } - if(c != '-') - if(c < 'A' || (c > 'Z' && c < 'a') || c > 'z') c = '_'; - if(ct < sizeof(plname)-1) plname[ct++] = c; - } - plname[ct] = 0; - if(ct == 0) askname(); -} - -/*VARARGS1*/ -impossible(s,x1,x2) -char *s; -{ - pline(s,x1,x2); - pline("Program in disorder - perhaps you'd better Quit."); -} - -#ifdef CHDIR -static void -chdirx(dir, wr) -char *dir; -boolean wr; -{ - -#ifdef SECURE - if(dir /* User specified directory? */ -#ifdef HACKDIR - && strcmp(dir, HACKDIR) /* and not the default? */ -#endif - ) { - /* revoke */ - setgid(getgid()); - } -#endif - -#ifdef HACKDIR - if(dir == NULL) - dir = HACKDIR; -#endif - - if(dir && chdir(dir) < 0) { - perror(dir); - error("Cannot chdir to %s.", dir); - } - - /* warn the player if he cannot write the record file */ - /* perhaps we should also test whether . is writable */ - /* unfortunately the access systemcall is worthless */ - if(wr) { - int fd; - - if(dir == NULL) - dir = "."; - if((fd = open(RECORD, 2)) < 0) { - printf("Warning: cannot write %s/%s", dir, RECORD); - getret(); - } else - (void) close(fd); - } -} -#endif - -stop_occupation() -{ - if(occupation) { - pline("You stop %s.", occtxt); - occupation = 0; - } -} diff --git a/games/hack/hack.makemon.c b/games/hack/hack.makemon.c deleted file mode 100644 index 54cf307b57b1..000000000000 --- a/games/hack/hack.makemon.c +++ /dev/null @@ -1,199 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.makemon.c - version 1.0.2 */ -/* $FreeBSD$ */ - -#include "hack.h" -extern char fut_geno[]; -extern char *index(); -extern struct obj *mkobj_at(); -struct monst zeromonst; - -/* - * called with [x,y] = coordinates; - * [0,0] means anyplace - * [u.ux,u.uy] means: call mnexto (if !in_mklev) - * - * In case we make an Orc or killer bee, we make an entire horde (swarm); - * note that in this case we return only one of them (the one at [x,y]). - */ -struct monst * -makemon(ptr,x,y) -struct permonst *ptr; -{ - struct monst *mtmp; - int tmp, ct; - boolean anything = (!ptr); - extern boolean in_mklev; - - if(x != 0 || y != 0) if(m_at(x,y)) return((struct monst *) 0); - if(ptr){ - if(index(fut_geno, ptr->mlet)) return((struct monst *) 0); - } else { - ct = CMNUM - strlen(fut_geno); - if(index(fut_geno, 'm')) ct++; /* make only 1 minotaur */ - if(index(fut_geno, '@')) ct++; - if(ct <= 0) return(0); /* no more monsters! */ - tmp = rn2(ct*dlevel/24 + 7); - if(tmp < dlevel - 4) tmp = rn2(ct*dlevel/24 + 12); - if(tmp >= ct) tmp = rn1(ct - ct/2, ct/2); - for(ct = 0; ct < CMNUM; ct++){ - ptr = &mons[ct]; - if(index(fut_geno, ptr->mlet)) - continue; - if(!tmp--) goto gotmon; - } - panic("makemon?"); - } -gotmon: - mtmp = newmonst(ptr->pxlth); - *mtmp = zeromonst; /* clear all entries in structure */ - for(ct = 0; ct < ptr->pxlth; ct++) - ((char *) &(mtmp->mextra[0]))[ct] = 0; - mtmp->nmon = fmon; - fmon = mtmp; - mtmp->m_id = flags.ident++; - mtmp->data = ptr; - mtmp->mxlth = ptr->pxlth; - if(ptr->mlet == 'D') mtmp->mhpmax = mtmp->mhp = 80; - else if(!ptr->mlevel) mtmp->mhpmax = mtmp->mhp = rnd(4); - else mtmp->mhpmax = mtmp->mhp = d(ptr->mlevel, 8); - mtmp->mx = x; - mtmp->my = y; - mtmp->mcansee = 1; - if(ptr->mlet == 'M'){ - mtmp->mimic = 1; - mtmp->mappearance = ']'; - } - if(!in_mklev) { - if(x == u.ux && y == u.uy && ptr->mlet != ' ') - mnexto(mtmp); - if(x == 0 && y == 0) - rloc(mtmp); - } - if(ptr->mlet == 's' || ptr->mlet == 'S') { - mtmp->mhide = mtmp->mundetected = 1; - if(in_mklev) - if(mtmp->mx && mtmp->my) - (void) mkobj_at(0, mtmp->mx, mtmp->my); - } - if(ptr->mlet == ':') { - mtmp->cham = 1; - (void) newcham(mtmp, &mons[dlevel+14+rn2(CMNUM-14-dlevel)]); - } - if(ptr->mlet == 'I' || ptr->mlet == ';') - mtmp->minvis = 1; - if(ptr->mlet == 'L' || ptr->mlet == 'N' - || (in_mklev && index("&w;", ptr->mlet) && rn2(5)) - ) mtmp->msleep = 1; - -#ifndef NOWORM - if(ptr->mlet == 'w' && getwn(mtmp)) - initworm(mtmp); -#endif /* NOWORM */ - - if(anything) if(ptr->mlet == 'O' || ptr->mlet == 'k') { - coord enexto(); - coord mm; - int cnt = rnd(10); - mm.x = x; - mm.y = y; - while(cnt--) { - mm = enexto(mm.x, mm.y); - (void) makemon(ptr, mm.x, mm.y); - } - } - - return(mtmp); -} - -coord -enexto(xx,yy) -xchar xx,yy; -{ - xchar x,y; - coord foo[15], *tfoo; - int range; - - tfoo = foo; - range = 1; - do { /* full kludge action. */ - for(x = xx-range; x <= xx+range; x++) - if(goodpos(x, yy-range)) { - tfoo->x = x; - tfoo++->y = yy-range; - if(tfoo == &foo[15]) goto foofull; - } - for(x = xx-range; x <= xx+range; x++) - if(goodpos(x,yy+range)) { - tfoo->x = x; - tfoo++->y = yy+range; - if(tfoo == &foo[15]) goto foofull; - } - for(y = yy+1-range; y < yy+range; y++) - if(goodpos(xx-range,y)) { - tfoo->x = xx-range; - tfoo++->y = y; - if(tfoo == &foo[15]) goto foofull; - } - for(y = yy+1-range; y < yy+range; y++) - if(goodpos(xx+range,y)) { - tfoo->x = xx+range; - tfoo++->y = y; - if(tfoo == &foo[15]) goto foofull; - } - range++; - } while(tfoo == foo); -foofull: - return( foo[rn2(tfoo-foo)] ); -} - -goodpos(x,y) /* used only in mnexto and rloc */ -{ - return( - ! (x < 1 || x > COLNO-2 || y < 1 || y > ROWNO-2 || - m_at(x,y) || !ACCESSIBLE(levl[x][y].typ) - || (x == u.ux && y == u.uy) - || sobj_at(ENORMOUS_ROCK, x, y) - )); -} - -rloc(mtmp) -struct monst *mtmp; -{ - int tx,ty; - char ch = mtmp->data->mlet; - -#ifndef NOWORM - if(ch == 'w' && mtmp->mx) return; /* do not relocate worms */ -#endif /* NOWORM */ - do { - tx = rn1(COLNO-3,2); - ty = rn2(ROWNO); - } while(!goodpos(tx,ty)); - mtmp->mx = tx; - mtmp->my = ty; - if(u.ustuck == mtmp){ - if(u.uswallow) { - u.ux = tx; - u.uy = ty; - docrt(); - } else u.ustuck = 0; - } - pmon(mtmp); -} - -struct monst * -mkmon_at(let,x,y) -char let; -int x,y; -{ - int ct; - struct permonst *ptr; - - for(ct = 0; ct < CMNUM; ct++) { - ptr = &mons[ct]; - if(ptr->mlet == let) - return(makemon(ptr,x,y)); - } - return(0); -} diff --git a/games/hack/hack.mfndpos.h b/games/hack/hack.mfndpos.h deleted file mode 100644 index f4da529fc7fc..000000000000 --- a/games/hack/hack.mfndpos.h +++ /dev/null @@ -1,12 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.mfndpos.h - version 1.0.2 */ - -#define ALLOW_TRAPS 0777 -#define ALLOW_U 01000 -#define ALLOW_M 02000 -#define ALLOW_TM 04000 -#define ALLOW_ALL (ALLOW_U | ALLOW_M | ALLOW_TM | ALLOW_TRAPS) -#define ALLOW_SSM 010000 -#define ALLOW_ROCK 020000 -#define NOTONL 040000 -#define NOGARLIC 0100000 diff --git a/games/hack/hack.mhitu.c b/games/hack/hack.mhitu.c deleted file mode 100644 index e8c3d75c3367..000000000000 --- a/games/hack/hack.mhitu.c +++ /dev/null @@ -1,364 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.mhitu.c - version 1.0.3 */ -/* $FreeBSD$ */ - -#include "hack.h" -extern struct monst *makemon(); - -/* - * mhitu: monster hits you - * returns 1 if monster dies (e.g. 'y', 'F'), 0 otherwise - */ -mhitu(mtmp) -struct monst *mtmp; -{ - struct permonst *mdat = mtmp->data; - int tmp, ctmp; - - nomul(0); - - /* If swallowed, can only be affected by hissers and by u.ustuck */ - if(u.uswallow) { - if(mtmp != u.ustuck) { - if(mdat->mlet == 'c' && !rn2(13)) { - pline("Outside, you hear %s's hissing!", - monnam(mtmp)); - pline("%s gets turned to stone!", - Monnam(u.ustuck)); - pline("And the same fate befalls you."); - done_in_by(mtmp); - /* "notreached": not return(1); */ - } - return(0); - } - switch(mdat->mlet) { /* now mtmp == u.ustuck */ - case ',': - youswld(mtmp, (u.uac > 0) ? u.uac+4 : 4, - 5, "The trapper"); - break; - case '\'': - youswld(mtmp,rnd(6),7,"The lurker above"); - break; - case 'P': - youswld(mtmp,d(2,4),12,"The purple worm"); - break; - default: - /* This is not impossible! */ - pline("The mysterious monster totally digests you."); - u.uhp = 0; - } - if(u.uhp < 1) done_in_by(mtmp); - return(0); - } - - if(mdat->mlet == 'c' && Stoned) - return(0); - - /* make eels visible the moment they hit/miss us */ - if(mdat->mlet == ';' && mtmp->minvis && cansee(mtmp->mx,mtmp->my)){ - mtmp->minvis = 0; - pmon(mtmp); - } - if(!index("1&DuxynNF",mdat->mlet)) - tmp = hitu(mtmp,d(mdat->damn,mdat->damd)); - else - tmp = 0; - if(index(UNDEAD, mdat->mlet) && midnight()) - tmp += hitu(mtmp,d(mdat->damn,mdat->damd)); - - ctmp = tmp && !mtmp->mcan && - (!uarm || objects[uarm->otyp].a_can < rnd(3) || !rn2(50)); - switch(mdat->mlet) { - case '1': - if(wiz_hit(mtmp)) return(1); /* he disappeared */ - break; - case '&': - if(!mtmp->cham && !mtmp->mcan && !rn2(13)) { - (void) makemon(PM_DEMON,u.ux,u.uy); - } else { - (void) hitu(mtmp,d(2,6)); - (void) hitu(mtmp,d(2,6)); - (void) hitu(mtmp,rnd(3)); - (void) hitu(mtmp,rnd(3)); - (void) hitu(mtmp,rn1(4,2)); - } - break; - case ',': - if(tmp) justswld(mtmp,"The trapper"); - break; - case '\'': - if(tmp) justswld(mtmp, "The lurker above"); - break; - case ';': - if(ctmp) { - if(!u.ustuck && !rn2(10)) { - pline("%s swings itself around you!", - Monnam(mtmp)); - u.ustuck = mtmp; - } else if(u.ustuck == mtmp && - levl[mtmp->mx][mtmp->my].typ == POOL) { - pline("%s drowns you ...", Monnam(mtmp)); - done("drowned"); - } - } - break; - case 'A': - if(ctmp && rn2(2)) { - if(Poison_resistance) - pline("The sting doesn't seem to affect you."); - else { - pline("You feel weaker!"); - losestr(1); - } - } - break; - case 'C': - (void) hitu(mtmp,rnd(6)); - break; - case 'c': - if(!rn2(5)) { - pline("You hear %s's hissing!", monnam(mtmp)); - if(ctmp || !rn2(20) || (flags.moonphase == NEW_MOON - && !carrying(DEAD_LIZARD))) { - Stoned = 5; - /* pline("You get turned to stone!"); */ - /* done_in_by(mtmp); */ - } - } - break; - case 'D': - if(rn2(6) || mtmp->mcan) { - (void) hitu(mtmp,d(3,10)); - (void) hitu(mtmp,rnd(8)); - (void) hitu(mtmp,rnd(8)); - break; - } - kludge("%s breathes fire!","The dragon"); - buzz(-1,mtmp->mx,mtmp->my,u.ux-mtmp->mx,u.uy-mtmp->my); - break; - case 'd': - (void) hitu(mtmp,d(2, (flags.moonphase == FULL_MOON) ? 3 : 4)); - break; - case 'e': - (void) hitu(mtmp,d(3,6)); - break; - case 'F': - if(mtmp->mcan) break; - kludge("%s explodes!","The freezing sphere"); - if(Cold_resistance) pline("You don't seem affected by it."); - else { - xchar dn; - if(17-(u.ulevel/2) > rnd(20)) { - pline("You get blasted!"); - dn = 6; - } else { - pline("You duck the blast..."); - dn = 3; - } - losehp_m(d(dn,6), mtmp); - } - mondead(mtmp); - return(1); - case 'g': - if(ctmp && multi >= 0 && !rn2(3)) { - kludge("You are frozen by %ss juices","the cube'"); - nomul(-rnd(10)); - } - break; - case 'h': - if(ctmp && multi >= 0 && !rn2(5)) { - nomul(-rnd(10)); - kludge("You are put to sleep by %ss bite!", - "the homunculus'"); - } - break; - case 'j': - tmp = hitu(mtmp,rnd(3)); - tmp &= hitu(mtmp,rnd(3)); - if(tmp){ - (void) hitu(mtmp,rnd(4)); - (void) hitu(mtmp,rnd(4)); - } - break; - case 'k': - if((hitu(mtmp,rnd(4)) || !rn2(3)) && ctmp){ - poisoned("bee's sting",mdat->mname); - } - break; - case 'L': - if(tmp) stealgold(mtmp); - break; - case 'N': - if(mtmp->mcan && !Blind) { - pline("%s tries to seduce you, but you seem not interested.", - Amonnam(mtmp, "plain")); - if(rn2(3)) rloc(mtmp); - } else if(steal(mtmp)) { - rloc(mtmp); - mtmp->mflee = 1; - } - break; - case 'n': - if(!uwep && !uarm && !uarmh && !uarms && !uarmg) { - pline("%s hits! (I hope you don't mind)", - Monnam(mtmp)); - u.uhp += rnd(7); - if(!rn2(7)) u.uhpmax++; - if(u.uhp > u.uhpmax) u.uhp = u.uhpmax; - flags.botl = 1; - if(!rn2(50)) rloc(mtmp); - } else { - (void) hitu(mtmp,d(2,6)); - (void) hitu(mtmp,d(2,6)); - } - break; - case 'o': - tmp = hitu(mtmp,rnd(6)); - if(hitu(mtmp,rnd(6)) && tmp && /* hits with both paws */ - !u.ustuck && rn2(2)) { - u.ustuck = mtmp; - kludge("%s has grabbed you!","The owlbear"); - u.uhp -= d(2,8); - } else if(u.ustuck == mtmp) { - u.uhp -= d(2,8); - pline("You are being crushed."); - } - break; - case 'P': - if(ctmp && !rn2(4)) - justswld(mtmp,"The purple worm"); - else - (void) hitu(mtmp,d(2,4)); - break; - case 'Q': - (void) hitu(mtmp,rnd(2)); - (void) hitu(mtmp,rnd(2)); - break; - case 'R': - if(tmp && uarmh && !uarmh->rustfree && - (int) uarmh->spe >= -1) { - pline("Your helmet rusts!"); - uarmh->spe--; - } else - if(ctmp && uarm && !uarm->rustfree && /* Mike Newton */ - uarm->otyp < STUDDED_LEATHER_ARMOR && - (int) uarm->spe >= -1) { - pline("Your armor rusts!"); - uarm->spe--; - } - break; - case 'S': - if(ctmp && !rn2(8)) { - poisoned("snake's bite",mdat->mname); - } - break; - case 's': - if(tmp && !rn2(8)) { - poisoned("scorpion's sting",mdat->mname); - } - (void) hitu(mtmp,rnd(8)); - (void) hitu(mtmp,rnd(8)); - break; - case 'T': - (void) hitu(mtmp,rnd(6)); - (void) hitu(mtmp,rnd(6)); - break; - case 't': - if(!rn2(5)) rloc(mtmp); - break; - case 'u': - mtmp->mflee = 1; - break; - case 'U': - (void) hitu(mtmp,d(3,4)); - (void) hitu(mtmp,d(3,4)); - break; - case 'v': - if(ctmp && !u.ustuck) u.ustuck = mtmp; - break; - case 'V': - if(tmp) u.uhp -= 4; - if(ctmp) losexp(); - break; - case 'W': - if(ctmp) losexp(); - break; -#ifndef NOWORM - case 'w': - if(tmp) wormhit(mtmp); -#endif /* NOWORM */ - break; - case 'X': - (void) hitu(mtmp,rnd(5)); - (void) hitu(mtmp,rnd(5)); - (void) hitu(mtmp,rnd(5)); - break; - case 'x': - { long side = rn2(2) ? RIGHT_SIDE : LEFT_SIDE; - pline("%s pricks in your %s leg!", - Monnam(mtmp), (side == RIGHT_SIDE) ? "right" : "left"); - set_wounded_legs(side, rnd(50)); - losehp_m(2, mtmp); - break; - } - case 'y': - if(mtmp->mcan) break; - mondead(mtmp); - if(!Blind) { - pline("You are blinded by a blast of light!"); - Blind = d(4,12); - seeoff(0); - } - return(1); - case 'Y': - (void) hitu(mtmp,rnd(6)); - break; - } - if(u.uhp < 1) done_in_by(mtmp); - return(0); -} - -hitu(mtmp,dam) -struct monst *mtmp; -int dam; -{ - int tmp, res; - - nomul(0); - if(u.uswallow) return(0); - - if(mtmp->mhide && mtmp->mundetected) { - mtmp->mundetected = 0; - if(!Blind) { - struct obj *obj; - extern char * Xmonnam(); - if(obj = o_at(mtmp->mx,mtmp->my)) - pline("%s was hidden under %s!", - Xmonnam(mtmp), doname(obj)); - } - } - - tmp = u.uac; - /* give people with Ac = -10 at least some vulnerability */ - if(tmp < 0) { - dam += tmp; /* decrease damage */ - if(dam <= 0) dam = 1; - tmp = -rn2(-tmp); - } - tmp += mtmp->data->mlevel; - if(multi < 0) tmp += 4; - if((Invis && mtmp->data->mlet != 'I') || !mtmp->mcansee) tmp -= 2; - if(mtmp->mtrapped) tmp -= 2; - if(tmp <= rnd(20)) { - if(Blind) pline("It misses."); - else pline("%s misses.",Monnam(mtmp)); - res = 0; - } else { - if(Blind) pline("It hits!"); - else pline("%s hits!",Monnam(mtmp)); - losehp_m(dam, mtmp); - res = 1; - } - stop_occupation(); - return(res); -} diff --git a/games/hack/hack.mklev.c b/games/hack/hack.mklev.c deleted file mode 100644 index f6b99336059d..000000000000 --- a/games/hack/hack.mklev.c +++ /dev/null @@ -1,744 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.mklev.c - version 1.0.3 */ -/* $FreeBSD$ */ - -#include -#include - -#include "hack.h" - -extern struct monst *makemon(); -extern struct obj *mkobj_at(); -extern struct trap *maketrap(); - -#define somex() ((random()%(croom->hx-croom->lx+1))+croom->lx) -#define somey() ((random()%(croom->hy-croom->ly+1))+croom->ly) - -#include "def.mkroom.h" -#define XLIM 4 /* define minimum required space around a room */ -#define YLIM 3 -boolean secret; /* TRUE while making a vault: increase [XY]LIM */ -struct mkroom rooms[MAXNROFROOMS+1]; -int smeq[MAXNROFROOMS+1]; -coord doors[DOORMAX]; -int doorindex; -struct rm zerorm; -int comp(); -schar nxcor; -boolean goldseen; -int nroom; -xchar xdnstair,xupstair,ydnstair,yupstair; - -/* Definitions used by makerooms() and addrs() */ -#define MAXRS 50 /* max lth of temp rectangle table - arbitrary */ -struct rectangle { - xchar rlx,rly,rhx,rhy; -} rs[MAXRS+1]; -int rscnt,rsmax; /* 0..rscnt-1: currently under consideration */ - /* rscnt..rsmax: discarded */ - -makelevel() -{ - struct mkroom *croom, *troom; - unsigned tryct; - int x,y; - - nroom = 0; - doorindex = 0; - rooms[0].hx = -1; /* in case we are in a maze */ - - for(x=0; x= rn1(3, 26)) { /* there might be several mazes */ - makemaz(); - return; - } - - /* construct the rooms */ - nroom = 0; - secret = FALSE; - (void) makerooms(); - - /* construct stairs (up and down in different rooms if possible) */ - croom = &rooms[rn2(nroom)]; - xdnstair = somex(); - ydnstair = somey(); - levl[xdnstair][ydnstair].scrsym ='>'; - levl[xdnstair][ydnstair].typ = STAIRS; - if(nroom > 1) { - troom = croom; - croom = &rooms[rn2(nroom-1)]; - if(croom >= troom) croom++; - } - xupstair = somex(); /* %% < and > might be in the same place */ - yupstair = somey(); - levl[xupstair][yupstair].scrsym ='<'; - levl[xupstair][yupstair].typ = STAIRS; - - /* for each room: put things inside */ - for(croom = rooms; croom->hx > 0; croom++) { - - /* put a sleeping monster inside */ - /* Note: monster may be on the stairs. This cannot be - avoided: maybe the player fell through a trapdoor - while a monster was on the stairs. Conclusion: - we have to check for monsters on the stairs anyway. */ - if(!rn2(3)) (void) - makemon((struct permonst *) 0, somex(), somey()); - - /* put traps and mimics inside */ - goldseen = FALSE; - while(!rn2(8-(dlevel/6))) mktrap(0,0,croom); - if(!goldseen && !rn2(3)) mkgold(0L,somex(),somey()); - if(!rn2(3)) { - (void) mkobj_at(0, somex(), somey()); - tryct = 0; - while(!rn2(5)) { - if(++tryct > 100){ - printf("tryct overflow4\n"); - break; - } - (void) mkobj_at(0, somex(), somey()); - } - } - } - - qsort((char *) rooms, nroom, sizeof(struct mkroom), comp); - makecorridors(); - make_niches(); - - /* make a secret treasure vault, not connected to the rest */ - if(nroom <= (2*MAXNROFROOMS/3)) if(rn2(3)) { - troom = &rooms[nroom]; - secret = TRUE; - if(makerooms()) { - troom->rtype = VAULT; /* treasure vault */ - for(x = troom->lx; x <= troom->hx; x++) - for(y = troom->ly; y <= troom->hy; y++) - mkgold((long)(rnd(dlevel*100) + 50), x, y); - if(!rn2(3)) - makevtele(); - } - } - -#ifndef QUEST -#ifdef WIZARD - if(wizard && getenv("SHOPTYPE")) mkshop(); else -#endif /* WIZARD */ - if(dlevel > 1 && dlevel < 20 && rn2(dlevel) < 3) mkshop(); - else - if(dlevel > 6 && !rn2(7)) mkzoo(ZOO); - else - if(dlevel > 9 && !rn2(5)) mkzoo(BEEHIVE); - else - if(dlevel > 11 && !rn2(6)) mkzoo(MORGUE); - else - if(dlevel > 18 && !rn2(6)) mkswamp(); -#endif /* QUEST */ -} - -makerooms() { -struct rectangle *rsp; -int lx, ly, hx, hy, lowx, lowy, hix, hiy, dx, dy; -int tryct = 0, xlim, ylim; - - /* init */ - xlim = XLIM + secret; - ylim = YLIM + secret; - if(nroom == 0) { - rsp = rs; - rsp->rlx = rsp->rly = 0; - rsp->rhx = COLNO-1; - rsp->rhy = ROWNO-1; - rsmax = 1; - } - rscnt = rsmax; - - /* make rooms until satisfied */ - while(rscnt > 0 && nroom < MAXNROFROOMS-1) { - if(!secret && nroom > (MAXNROFROOMS/3) && - !rn2((MAXNROFROOMS-nroom)*(MAXNROFROOMS-nroom))) - return(0); - - /* pick a rectangle */ - rsp = &rs[rn2(rscnt)]; - hx = rsp->rhx; - hy = rsp->rhy; - lx = rsp->rlx; - ly = rsp->rly; - - /* find size of room */ - if(secret) - dx = dy = 1; - else { - dx = 2 + rn2((hx-lx-8 > 20) ? 12 : 8); - dy = 2 + rn2(4); - if(dx*dy > 50) - dy = 50/dx; - } - - /* look whether our room will fit */ - if(hx-lx < dx + dx/2 + 2*xlim || hy-ly < dy + dy/3 + 2*ylim) { - /* no, too small */ - /* maybe we throw this area out */ - if(secret || !rn2(MAXNROFROOMS+1-nroom-tryct)) { - rscnt--; - rs[rsmax] = *rsp; - *rsp = rs[rscnt]; - rs[rscnt] = rs[rsmax]; - tryct = 0; - } else - tryct++; - continue; - } - - lowx = lx + xlim + rn2(hx - lx - dx - 2*xlim + 1); - lowy = ly + ylim + rn2(hy - ly - dy - 2*ylim + 1); - hix = lowx + dx; - hiy = lowy + dy; - - if(maker(lowx, dx, lowy, dy)) { - if(secret) - return(1); - addrs(lowx-1, lowy-1, hix+1, hiy+1); - tryct = 0; - } else - if(tryct++ > 100) - break; - } - return(0); /* failed to make vault - very strange */ -} - -addrs(lowx,lowy,hix,hiy) -int lowx,lowy,hix,hiy; -{ - struct rectangle *rsp; - int lx,ly,hx,hy,xlim,ylim; - boolean discarded; - - xlim = XLIM + secret; - ylim = YLIM + secret; - - /* walk down since rscnt and rsmax change */ - for(rsp = &rs[rsmax-1]; rsp >= rs; rsp--) { - - if((lx = rsp->rlx) > hix || (ly = rsp->rly) > hiy || - (hx = rsp->rhx) < lowx || (hy = rsp->rhy) < lowy) - continue; - if((discarded = (rsp >= &rs[rscnt]))) { - *rsp = rs[--rsmax]; - } else { - rsmax--; - rscnt--; - *rsp = rs[rscnt]; - if(rscnt != rsmax) - rs[rscnt] = rs[rsmax]; - } - if(lowy - ly > 2*ylim + 4) - addrsx(lx,ly,hx,lowy-2,discarded); - if(lowx - lx > 2*xlim + 4) - addrsx(lx,ly,lowx-2,hy,discarded); - if(hy - hiy > 2*ylim + 4) - addrsx(lx,hiy+2,hx,hy,discarded); - if(hx - hix > 2*xlim + 4) - addrsx(hix+2,ly,hx,hy,discarded); - } -} - -addrsx(lx,ly,hx,hy,discarded) -int lx,ly,hx,hy; -boolean discarded; /* piece of a discarded area */ -{ - struct rectangle *rsp; - - /* check inclusions */ - for(rsp = rs; rsp < &rs[rsmax]; rsp++) { - if(lx >= rsp->rlx && hx <= rsp->rhx && - ly >= rsp->rly && hy <= rsp->rhy) - return; - } - - /* make a new entry */ - if(rsmax >= MAXRS) { -#ifdef WIZARD - if(wizard) pline("MAXRS may be too small."); -#endif /* WIZARD */ - return; - } - rsmax++; - if(!discarded) { - *rsp = rs[rscnt]; - rsp = &rs[rscnt]; - rscnt++; - } - rsp->rlx = lx; - rsp->rly = ly; - rsp->rhx = hx; - rsp->rhy = hy; -} - -comp(x,y) -struct mkroom *x,*y; -{ - if(x->lx < y->lx) return(-1); - return(x->lx > y->lx); -} - -coord -finddpos(xl,yl,xh,yh) { - coord ff; - int x,y; - - x = (xl == xh) ? xl : (xl + rn2(xh-xl+1)); - y = (yl == yh) ? yl : (yl + rn2(yh-yl+1)); - if(okdoor(x, y)) - goto gotit; - - for(x = xl; x <= xh; x++) for(y = yl; y <= yh; y++) - if(okdoor(x, y)) - goto gotit; - - for(x = xl; x <= xh; x++) for(y = yl; y <= yh; y++) - if(levl[x][y].typ == DOOR || levl[x][y].typ == SDOOR) - goto gotit; - /* cannot find something reasonable -- strange */ - x = xl; - y = yh; -gotit: - ff.x = x; - ff.y = y; - return(ff); -} - -/* see whether it is allowable to create a door at [x,y] */ -okdoor(x,y) -int x,y; -{ - if(levl[x-1][y].typ == DOOR || levl[x+1][y].typ == DOOR || - levl[x][y+1].typ == DOOR || levl[x][y-1].typ == DOOR || - levl[x-1][y].typ == SDOOR || levl[x+1][y].typ == SDOOR || - levl[x][y-1].typ == SDOOR || levl[x][y+1].typ == SDOOR || - (levl[x][y].typ != HWALL && levl[x][y].typ != VWALL) || - doorindex >= DOORMAX) - return(0); - return(1); -} - -dodoor(x,y,aroom) -int x,y; -struct mkroom *aroom; -{ - if(doorindex >= DOORMAX) { - impossible("DOORMAX exceeded?"); - return; - } - if(!okdoor(x,y) && nxcor) - return; - dosdoor(x,y,aroom,rn2(8) ? DOOR : SDOOR); -} - -dosdoor(x,y,aroom,type) -int x,y; -struct mkroom *aroom; -int type; -{ - struct mkroom *broom; - int tmp; - - if(!IS_WALL(levl[x][y].typ)) /* avoid SDOORs with '+' as scrsym */ - type = DOOR; - levl[x][y].typ = type; - if(type == DOOR) - levl[x][y].scrsym = '+'; - aroom->doorct++; - broom = aroom+1; - if(broom->hx < 0) tmp = doorindex; else - for(tmp = doorindex; tmp > broom->fdoor; tmp--) - doors[tmp] = doors[tmp-1]; - doorindex++; - doors[tmp].x = x; - doors[tmp].y = y; - for( ; broom->hx >= 0; broom++) broom->fdoor++; -} - -/* Only called from makerooms() */ -maker(lowx,ddx,lowy,ddy) -schar lowx,ddx,lowy,ddy; -{ - struct mkroom *croom; - int x, y, hix = lowx+ddx, hiy = lowy+ddy; - int xlim = XLIM + secret, ylim = YLIM + secret; - - if(nroom >= MAXNROFROOMS) return(0); - if(lowx < XLIM) lowx = XLIM; - if(lowy < YLIM) lowy = YLIM; - if(hix > COLNO-XLIM-1) hix = COLNO-XLIM-1; - if(hiy > ROWNO-YLIM-1) hiy = ROWNO-YLIM-1; -chk: - if(hix <= lowx || hiy <= lowy) return(0); - - /* check area around room (and make room smaller if necessary) */ - for(x = lowx - xlim; x <= hix + xlim; x++) { - for(y = lowy - ylim; y <= hiy + ylim; y++) { - if(levl[x][y].typ) { -#ifdef WIZARD - if(wizard && !secret) - pline("Strange area [%d,%d] in maker().",x,y); -#endif /* WIZARD */ - if(!rn2(3)) return(0); - if(x < lowx) - lowx = x+xlim+1; - else - hix = x-xlim-1; - if(y < lowy) - lowy = y+ylim+1; - else - hiy = y-ylim-1; - goto chk; - } - } - } - - croom = &rooms[nroom]; - - /* on low levels the room is lit (usually) */ - /* secret vaults are always lit */ - if((rnd(dlevel) < 10 && rn2(77)) || (ddx == 1 && ddy == 1)) { - for(x = lowx-1; x <= hix+1; x++) - for(y = lowy-1; y <= hiy+1; y++) - levl[x][y].lit = 1; - croom->rlit = 1; - } else - croom->rlit = 0; - croom->lx = lowx; - croom->hx = hix; - croom->ly = lowy; - croom->hy = hiy; - croom->rtype = croom->doorct = croom->fdoor = 0; - - for(x = lowx-1; x <= hix+1; x++) - for(y = lowy-1; y <= hiy+1; y += (hiy-lowy+2)) { - levl[x][y].scrsym = '-'; - levl[x][y].typ = HWALL; - } - for(x = lowx-1; x <= hix+1; x += (hix-lowx+2)) - for(y = lowy; y <= hiy; y++) { - levl[x][y].scrsym = '|'; - levl[x][y].typ = VWALL; - } - for(x = lowx; x <= hix; x++) - for(y = lowy; y <= hiy; y++) { - levl[x][y].scrsym = '.'; - levl[x][y].typ = ROOM; - } - - smeq[nroom] = nroom; - croom++; - croom->hx = -1; - nroom++; - return(1); -} - -makecorridors() { - int a,b; - - nxcor = 0; - for(a = 0; a < nroom-1; a++) - join(a, a+1); - for(a = 0; a < nroom-2; a++) - if(smeq[a] != smeq[a+2]) - join(a, a+2); - for(a = 0; a < nroom; a++) - for(b = 0; b < nroom; b++) - if(smeq[a] != smeq[b]) - join(a, b); - if(nroom > 2) - for(nxcor = rn2(nroom) + 4; nxcor; nxcor--) { - a = rn2(nroom); - b = rn2(nroom-2); - if(b >= a) b += 2; - join(a, b); - } -} - -join(a,b) -int a,b; -{ - coord cc,tt; - int tx, ty, xx, yy; - struct rm *crm; - struct mkroom *croom, *troom; - int dx, dy, dix, diy, cct; - - croom = &rooms[a]; - troom = &rooms[b]; - - /* find positions cc and tt for doors in croom and troom - and direction for a corridor between them */ - - if(troom->hx < 0 || croom->hx < 0 || doorindex >= DOORMAX) return; - if(troom->lx > croom->hx) { - dx = 1; - dy = 0; - xx = croom->hx+1; - tx = troom->lx-1; - cc = finddpos(xx,croom->ly,xx,croom->hy); - tt = finddpos(tx,troom->ly,tx,troom->hy); - } else if(troom->hy < croom->ly) { - dy = -1; - dx = 0; - yy = croom->ly-1; - cc = finddpos(croom->lx,yy,croom->hx,yy); - ty = troom->hy+1; - tt = finddpos(troom->lx,ty,troom->hx,ty); - } else if(troom->hx < croom->lx) { - dx = -1; - dy = 0; - xx = croom->lx-1; - tx = troom->hx+1; - cc = finddpos(xx,croom->ly,xx,croom->hy); - tt = finddpos(tx,troom->ly,tx,troom->hy); - } else { - dy = 1; - dx = 0; - yy = croom->hy+1; - ty = troom->ly-1; - cc = finddpos(croom->lx,yy,croom->hx,yy); - tt = finddpos(troom->lx,ty,troom->hx,ty); - } - xx = cc.x; - yy = cc.y; - tx = tt.x - dx; - ty = tt.y - dy; - if(nxcor && levl[xx+dx][yy+dy].typ) - return; - dodoor(xx,yy,croom); - - cct = 0; - while(xx != tx || yy != ty) { - xx += dx; - yy += dy; - - /* loop: dig corridor at [xx,yy] and find new [xx,yy] */ - if(cct++ > 500 || (nxcor && !rn2(35))) - return; - - if(xx == COLNO-1 || xx == 0 || yy == 0 || yy == ROWNO-1) - return; /* impossible */ - - crm = &levl[xx][yy]; - if(!(crm->typ)) { - if(rn2(100)) { - crm->typ = CORR; - crm->scrsym = CORR_SYM; - if(nxcor && !rn2(50)) - (void) mkobj_at(ROCK_SYM, xx, yy); - } else { - crm->typ = SCORR; - crm->scrsym = ' '; - } - } else - if(crm->typ != CORR && crm->typ != SCORR) { - /* strange ... */ - return; - } - - /* find next corridor position */ - dix = abs(xx-tx); - diy = abs(yy-ty); - - /* do we have to change direction ? */ - if(dy && dix > diy) { - int ddx = (xx > tx) ? -1 : 1; - - crm = &levl[xx+ddx][yy]; - if(!crm->typ || crm->typ == CORR || crm->typ == SCORR) { - dx = ddx; - dy = 0; - continue; - } - } else if(dx && diy > dix) { - int ddy = (yy > ty) ? -1 : 1; - - crm = &levl[xx][yy+ddy]; - if(!crm->typ || crm->typ == CORR || crm->typ == SCORR) { - dy = ddy; - dx = 0; - continue; - } - } - - /* continue straight on? */ - crm = &levl[xx+dx][yy+dy]; - if(!crm->typ || crm->typ == CORR || crm->typ == SCORR) - continue; - - /* no, what must we do now?? */ - if(dx) { - dx = 0; - dy = (ty < yy) ? -1 : 1; - crm = &levl[xx+dx][yy+dy]; - if(!crm->typ || crm->typ == CORR || crm->typ == SCORR) - continue; - dy = -dy; - continue; - } else { - dy = 0; - dx = (tx < xx) ? -1 : 1; - crm = &levl[xx+dx][yy+dy]; - if(!crm->typ || crm->typ == CORR || crm->typ == SCORR) - continue; - dx = -dx; - continue; - } - } - - /* we succeeded in digging the corridor */ - dodoor(tt.x, tt.y, troom); - - if(smeq[a] < smeq[b]) - smeq[b] = smeq[a]; - else - smeq[a] = smeq[b]; -} - -make_niches() -{ - int ct = rnd(nroom/2 + 1); - while(ct--) makeniche(FALSE); -} - -makevtele() -{ - makeniche(TRUE); -} - -makeniche(with_trap) -boolean with_trap; -{ - struct mkroom *aroom; - struct rm *rm; - int vct = 8; - coord dd; - int dy,xx,yy; - struct trap *ttmp; - - if(doorindex < DOORMAX) - while(vct--) { - aroom = &rooms[rn2(nroom-1)]; - if(aroom->rtype != 0) continue; /* not an ordinary room */ - if(aroom->doorct == 1 && rn2(5)) continue; - if(rn2(2)) { - dy = 1; - dd = finddpos(aroom->lx,aroom->hy+1,aroom->hx,aroom->hy+1); - } else { - dy = -1; - dd = finddpos(aroom->lx,aroom->ly-1,aroom->hx,aroom->ly-1); - } - xx = dd.x; - yy = dd.y; - if((rm = &levl[xx][yy+dy])->typ) continue; - if(with_trap || !rn2(4)) { - rm->typ = SCORR; - rm->scrsym = ' '; - if(with_trap) { - ttmp = maketrap(xx, yy+dy, TELEP_TRAP); - ttmp->once = 1; - make_engr_at(xx, yy-dy, "ad ae?ar um"); - } - dosdoor(xx, yy, aroom, SDOOR); - } else { - rm->typ = CORR; - rm->scrsym = CORR_SYM; - if(rn2(7)) - dosdoor(xx, yy, aroom, rn2(5) ? SDOOR : DOOR); - else { - mksobj_at(SCR_TELEPORTATION, xx, yy+dy); - if(!rn2(3)) (void) mkobj_at(0, xx, yy+dy); - } - } - return; - } -} - -/* make a trap somewhere (in croom if mazeflag = 0) */ -mktrap(num,mazeflag,croom) -int num,mazeflag; -struct mkroom *croom; -{ - struct trap *ttmp; - int kind,nopierc,nomimic,fakedoor,fakegold,tryct = 0; - xchar mx,my; - extern char fut_geno[]; - - if(!num || num >= TRAPNUM) { - nopierc = (dlevel < 4) ? 1 : 0; - nomimic = (dlevel < 9 || goldseen ) ? 1 : 0; - if(index(fut_geno, 'M')) nomimic = 1; - kind = rn2(TRAPNUM - nopierc - nomimic); - /* note: PIERC = 7, MIMIC = 8, TRAPNUM = 9 */ - } else kind = num; - - if(kind == MIMIC) { - struct monst *mtmp; - - fakedoor = (!rn2(3) && !mazeflag); - fakegold = (!fakedoor && !rn2(2)); - if(fakegold) goldseen = TRUE; - do { - if(++tryct > 200) return; - if(fakedoor) { - /* note: fakedoor maybe on actual door */ - if(rn2(2)){ - if(rn2(2)) - mx = croom->hx+1; - else mx = croom->lx-1; - my = somey(); - } else { - if(rn2(2)) - my = croom->hy+1; - else my = croom->ly-1; - mx = somex(); - } - } else if(mazeflag) { - extern coord mazexy(); - coord mm; - mm = mazexy(); - mx = mm.x; - my = mm.y; - } else { - mx = somex(); - my = somey(); - } - } while(m_at(mx,my) || levl[mx][my].typ == STAIRS); - if(mtmp = makemon(PM_MIMIC,mx,my)) { - mtmp->mimic = 1; - mtmp->mappearance = - fakegold ? '$' : fakedoor ? '+' : - (mazeflag && rn2(2)) ? AMULET_SYM : - "=/)%?![<>" [ rn2(9) ]; - } - return; - } - - do { - if(++tryct > 200) - return; - if(mazeflag){ - extern coord mazexy(); - coord mm; - mm = mazexy(); - mx = mm.x; - my = mm.y; - } else { - mx = somex(); - my = somey(); - } - } while(t_at(mx, my) || levl[mx][my].typ == STAIRS); - ttmp = maketrap(mx, my, kind); - if(mazeflag && !rn2(10) && ttmp->ttyp < PIERC) - ttmp->tseen = 1; -} diff --git a/games/hack/hack.mkmaze.c b/games/hack/hack.mkmaze.c deleted file mode 100644 index 769cd5db5955..000000000000 --- a/games/hack/hack.mkmaze.c +++ /dev/null @@ -1,137 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.mkmaze.c - version 1.0.2 */ -/* $FreeBSD$ */ - -#include "hack.h" -#include "def.mkroom.h" /* not really used */ -extern struct monst *makemon(); -extern struct permonst pm_wizard; -extern struct obj *mkobj_at(); -extern coord mazexy(); -struct permonst hell_hound = - { "hell hound", 'd', 12, 14, 2, 3, 6, 0 }; - -makemaz() -{ - int x,y; - int zx,zy; - coord mm; - boolean al = (dlevel >= 30 && !flags.made_amulet); - - for(x = 2; x < COLNO-1; x++) - for(y = 2; y < ROWNO-1; y++) - levl[x][y].typ = (x%2 && y%2) ? 0 : HWALL; - if(al) { - struct monst *mtmp; - - zx = 2*(COLNO/4) - 1; - zy = 2*(ROWNO/4) - 1; - for(x = zx-2; x < zx+4; x++) for(y = zy-2; y <= zy+2; y++) { - levl[x][y].typ = - (y == zy-2 || y == zy+2 || x == zx-2 || x == zx+3) ? POOL : - (y == zy-1 || y == zy+1 || x == zx-1 || x == zx+2) ? HWALL: - ROOM; - } - (void) mkobj_at(AMULET_SYM, zx, zy); - flags.made_amulet = 1; - walkfrom(zx+4, zy); - if(mtmp = makemon(&hell_hound, zx, zy)) - mtmp->msleep = 1; - if(mtmp = makemon(PM_WIZARD, zx+1, zy)) { - mtmp->msleep = 1; - flags.no_of_wizards = 1; - } - } else { - mm = mazexy(); - zx = mm.x; - zy = mm.y; - walkfrom(zx,zy); - (void) mksobj_at(WAN_WISHING, zx, zy); - (void) mkobj_at(ROCK_SYM, zx, zy); /* put a rock on top of it */ - } - - for(x = 2; x < COLNO-1; x++) - for(y = 2; y < ROWNO-1; y++) { - switch(levl[x][y].typ) { - case HWALL: - levl[x][y].scrsym = '-'; - break; - case ROOM: - levl[x][y].scrsym = '.'; - break; - } - } - for(x = rn1(8,11); x; x--) { - mm = mazexy(); - (void) mkobj_at(rn2(2) ? GEM_SYM : 0, mm.x, mm.y); - } - for(x = rn1(10,2); x; x--) { - mm = mazexy(); - (void) mkobj_at(ROCK_SYM, mm.x, mm.y); - } - mm = mazexy(); - (void) makemon(PM_MINOTAUR, mm.x, mm.y); - for(x = rn1(5,7); x; x--) { - mm = mazexy(); - (void) makemon((struct permonst *) 0, mm.x, mm.y); - } - for(x = rn1(6,7); x; x--) { - mm = mazexy(); - mkgold(0L,mm.x,mm.y); - } - for(x = rn1(6,7); x; x--) - mktrap(0,1,(struct mkroom *) 0); - mm = mazexy(); - levl[(xupstair = mm.x)][(yupstair = mm.y)].scrsym = '<'; - levl[xupstair][yupstair].typ = STAIRS; - xdnstair = ydnstair = 0; -} - -walkfrom(x,y) int x,y; { -int q,a,dir; -int dirs[4]; - levl[x][y].typ = ROOM; - while(1) { - q = 0; - for(a = 0; a < 4; a++) - if(okay(x,y,a)) dirs[q++]= a; - if(!q) return; - dir = dirs[rn2(q)]; - move(&x,&y,dir); - levl[x][y].typ = ROOM; - move(&x,&y,dir); - walkfrom(x,y); - } -} - -move(x,y,dir) -int *x, *y; -int dir; -{ - switch(dir){ - case 0: --(*y); break; - case 1: (*x)++; break; - case 2: (*y)++; break; - case 3: --(*x); break; - } -} - -okay(x,y,dir) -int x,y; -int dir; -{ - move(&x,&y,dir); - move(&x,&y,dir); - if(x<3 || y<3 || x>COLNO-3 || y>ROWNO-3 || levl[x][y].typ != 0) - return(0); - else - return(1); -} - -coord -mazexy(){ - coord mm; - mm.x = 3 + 2*rn2(COLNO/2 - 2); - mm.y = 3 + 2*rn2(ROWNO/2 - 2); - return mm; -} diff --git a/games/hack/hack.mkobj.c b/games/hack/hack.mkobj.c deleted file mode 100644 index 7ef15409e792..000000000000 --- a/games/hack/hack.mkobj.c +++ /dev/null @@ -1,151 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.mkobj.c - version 1.0.3 */ - -#include -__FBSDID("$FreeBSD$"); - -#include "hack.h" - -char mkobjstr[] = "))[[!!!!????%%%%/=**))[[!!!!????%%%%/=**(%"; -struct obj *mkobj(), *mksobj(); - -struct obj * -mkobj_at(let,x,y) -int let,x,y; -{ - struct obj *otmp = mkobj(let); - otmp->ox = x; - otmp->oy = y; - otmp->nobj = fobj; - fobj = otmp; - return(otmp); -} - -mksobj_at(otyp,x,y) -int otyp,x,y; -{ - struct obj *otmp = mksobj(otyp); - otmp->ox = x; - otmp->oy = y; - otmp->nobj = fobj; - fobj = otmp; -} - -struct obj * -mkobj(let) { - if(!let) - let = mkobjstr[rn2(sizeof(mkobjstr) - 1)]; - return( - mksobj( - letter(let) ? - CORPSE + ((let > 'Z') ? (let-'a'+'Z'-'@'+1) : (let-'@')) - : probtype(let) - ) - ); -} - - -struct obj zeroobj; - -struct obj * -mksobj(otyp) -int otyp; -{ - struct obj *otmp; - char let = objects[otyp].oc_olet; - - otmp = newobj(0); - *otmp = zeroobj; - otmp->age = moves; - otmp->o_id = flags.ident++; - otmp->quan = 1; - otmp->olet = let; - otmp->otyp = otyp; - otmp->dknown = index("/=!?*", let) ? 0 : 1; - switch(let) { - case WEAPON_SYM: - otmp->quan = (otmp->otyp <= ROCK) ? rn1(6,6) : 1; - if(!rn2(11)) otmp->spe = rnd(3); - else if(!rn2(10)) { - otmp->cursed = 1; - otmp->spe = -rnd(3); - } - break; - case FOOD_SYM: - if(otmp->otyp >= CORPSE) break; -#ifdef NOT_YET_IMPLEMENTED - /* if tins are to be identified, need to adapt doname() etc */ - if(otmp->otyp == TIN) - otmp->spe = rnd(...); -#endif /* NOT_YET_IMPLEMENTED */ - /* FALLTHROUGH */ - case GEM_SYM: - otmp->quan = rn2(6) ? 1 : 2; - case TOOL_SYM: - case CHAIN_SYM: - case BALL_SYM: - case ROCK_SYM: - case POTION_SYM: - case SCROLL_SYM: - case AMULET_SYM: - break; - case ARMOR_SYM: - if(!rn2(8)) otmp->cursed = 1; - if(!rn2(10)) otmp->spe = rnd(3); - else if(!rn2(9)) { - otmp->spe = -rnd(3); - otmp->cursed = 1; - } - break; - case WAND_SYM: - if(otmp->otyp == WAN_WISHING) otmp->spe = 3; else - otmp->spe = rn1(5, - (objects[otmp->otyp].bits & NODIR) ? 11 : 4); - break; - case RING_SYM: - if(objects[otmp->otyp].bits & SPEC) { - if(!rn2(3)) { - otmp->cursed = 1; - otmp->spe = -rnd(2); - } else otmp->spe = rnd(2); - } else if(otmp->otyp == RIN_TELEPORTATION || - otmp->otyp == RIN_AGGRAVATE_MONSTER || - otmp->otyp == RIN_HUNGER || !rn2(9)) - otmp->cursed = 1; - break; - default: - panic("impossible mkobj"); - } - otmp->owt = weight(otmp); - return(otmp); -} - -letter(c) { - return(('@' <= c && c <= 'Z') || ('a' <= c && c <= 'z')); -} - -weight(obj) -struct obj *obj; -{ -int wt = objects[obj->otyp].oc_weight; - return(wt ? wt*obj->quan : (obj->quan + 1)/2); -} - -mkgold(num,x,y) -long num; -{ - struct gold *gold; - long amount = (num ? num : 1 + (rnd(dlevel+2) * rnd(30))); - - if(gold = g_at(x,y)) - gold->amount += amount; - else { - gold = newgold(); - gold->ngold = fgold; - gold->gx = x; - gold->gy = y; - gold->amount = amount; - fgold = gold; - /* do sth with display? */ - } -} diff --git a/games/hack/hack.mkshop.c b/games/hack/hack.mkshop.c deleted file mode 100644 index c503b7d50c80..000000000000 --- a/games/hack/hack.mkshop.c +++ /dev/null @@ -1,275 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.mkshop.c - version 1.0.3 */ -/* $FreeBSD$ */ - -#ifndef QUEST -#include "hack.h" -#include "def.mkroom.h" -#include "def.eshk.h" -#include -#define ESHK ((struct eshk *)(&(shk->mextra[0]))) -extern struct monst *makemon(); -extern struct obj *mkobj_at(); -extern int nroom; -extern char shtypes[]; /* = "=/)%?!["; 8 types: 7 specialized, 1 mixed */ -schar shprobs[] = { 3,3,5,5,10,10,14,50 }; /* their probabilities */ - -mkshop(){ -struct mkroom *sroom; -int sh,sx,sy,i = -1; -char let; -int roomno; -struct monst *shk; -#ifdef WIZARD - /* first determine shoptype */ - if(wizard){ - char *ep = getenv("SHOPTYPE"); - if(ep){ - if(*ep == 'z' || *ep == 'Z'){ - mkzoo(ZOO); - return; - } - if(*ep == 'm' || *ep == 'M'){ - mkzoo(MORGUE); - return; - } - if(*ep == 'b' || *ep == 'B'){ - mkzoo(BEEHIVE); - return; - } - if(*ep == 's' || *ep == 'S'){ - mkswamp(); - return; - } - for(i=0; shtypes[i]; i++) - if(*ep == shtypes[i]) break; - goto gottype; - } - } -gottype: -#endif /* WIZARD */ - for(sroom = &rooms[0], roomno = 0; ; sroom++, roomno++){ - if(sroom->hx < 0) return; - if(sroom - rooms >= nroom) { - pline("rooms not closed by -1?"); - return; - } - if(sroom->rtype) continue; - if(!sroom->rlit || has_dnstairs(sroom) || has_upstairs(sroom)) - continue; - if( -#ifdef WIZARD - (wizard && getenv("SHOPTYPE") && sroom->doorct != 0) || -#endif /* WIZARD */ - sroom->doorct <= 2 && sroom->doorct > 0) break; - } - - if(i < 0) { /* shoptype not yet determined */ - int j; - - for(j = rn2(100), i = 0; (j -= shprobs[i])>= 0; i++) - if(!shtypes[i]) break; /* superfluous */ - if(isbig(sroom) && i + SHOPBASE == WANDSHOP) - i = GENERAL-SHOPBASE; - } - sroom->rtype = i + SHOPBASE; - let = shtypes[i]; - sh = sroom->fdoor; - sx = doors[sh].x; - sy = doors[sh].y; - if(sx == sroom->lx-1) sx++; else - if(sx == sroom->hx+1) sx--; else - if(sy == sroom->ly-1) sy++; else - if(sy == sroom->hy+1) sy--; else { -#ifdef WIZARD - /* This is said to happen sometimes, but I've never seen it. */ - if(wizard) { - int j = sroom->doorct; - extern int doorindex; - - pline("Where is shopdoor?"); - pline("Room at (%d,%d),(%d,%d).", sroom->lx, sroom->ly, - sroom->hx, sroom->hy); - pline("doormax=%d doorct=%d fdoor=%d", - doorindex, sroom->doorct, sh); - while(j--) { - pline("door [%d,%d]", doors[sh].x, doors[sh].y); - sh++; - } - more(); - } -#endif /* WIZARD */ - return; - } - if(!(shk = makemon(PM_SHK,sx,sy))) return; - shk->isshk = shk->mpeaceful = 1; - shk->msleep = 0; - shk->mtrapseen = ~0; /* we know all the traps already */ - ESHK->shoproom = roomno; - ESHK->shoplevel = dlevel; - ESHK->shd = doors[sh]; - ESHK->shk.x = sx; - ESHK->shk.y = sy; - ESHK->robbed = 0; - ESHK->visitct = 0; - ESHK->following = 0; - shk->mgold = 1000 + 30*rnd(100); /* initial capital */ - ESHK->billct = 0; - findname(ESHK->shknam, let); - for(sx = sroom->lx; sx <= sroom->hx; sx++) - for(sy = sroom->ly; sy <= sroom->hy; sy++){ - struct monst *mtmp; - if((sx == sroom->lx && doors[sh].x == sx-1) || - (sx == sroom->hx && doors[sh].x == sx+1) || - (sy == sroom->ly && doors[sh].y == sy-1) || - (sy == sroom->hy && doors[sh].y == sy+1)) continue; - if(rn2(100) < dlevel && !m_at(sx,sy) && - (mtmp = makemon(PM_MIMIC, sx, sy))){ - mtmp->mimic = 1; - mtmp->mappearance = - (let && rn2(10) < dlevel) ? let : ']'; - continue; - } - (void) mkobj_at(let, sx, sy); - } -} - -mkzoo(type) -int type; -{ - struct mkroom *sroom; - struct monst *mon; - int sh,sx,sy,i; - int goldlim = 500 * dlevel; - int moct = 0; - struct permonst *morguemon(); - - i = nroom; - for(sroom = &rooms[rn2(nroom)]; ; sroom++) { - if(sroom == &rooms[nroom]) - sroom = &rooms[0]; - if(!i-- || sroom->hx < 0) - return; - if(sroom->rtype) - continue; - if(type == MORGUE && sroom->rlit) - continue; - if(has_upstairs(sroom) || (has_dnstairs(sroom) && rn2(3))) - continue; - if(sroom->doorct == 1 || !rn2(5)) - break; - } - sroom->rtype = type; - sh = sroom->fdoor; - for(sx = sroom->lx; sx <= sroom->hx; sx++) - for(sy = sroom->ly; sy <= sroom->hy; sy++){ - if((sx == sroom->lx && doors[sh].x == sx-1) || - (sx == sroom->hx && doors[sh].x == sx+1) || - (sy == sroom->ly && doors[sh].y == sy-1) || - (sy == sroom->hy && doors[sh].y == sy+1)) continue; - mon = makemon( - (type == MORGUE) ? morguemon() : - (type == BEEHIVE) ? PM_KILLER_BEE : (struct permonst *) 0, - sx, sy); - if(mon) mon->msleep = 1; - switch(type) { - case ZOO: - i = sq(dist2(sx,sy,doors[sh].x,doors[sh].y)); - if(i >= goldlim) i = 5*dlevel; - goldlim -= i; - mkgold((long)(10 + rn2(i)), sx, sy); - break; - case MORGUE: - /* Usually there is one dead body in the morgue */ - if(!moct && rn2(3)) { - mksobj_at(CORPSE, sx, sy); - moct++; - } - break; - case BEEHIVE: - if(!rn2(3)) mksobj_at(LUMP_OF_ROYAL_JELLY, sx, sy); - break; - } - } -} - -struct permonst * -morguemon() -{ - extern struct permonst pm_ghost; - int i = rn2(100), hd = rn2(dlevel); - - if(hd > 10 && i < 10) return(PM_DEMON); - if(hd > 8 && i > 85) return(PM_VAMPIRE); - return((i < 40) ? PM_GHOST : (i < 60) ? PM_WRAITH : PM_ZOMBIE); -} - -mkswamp() /* Michiel Huisjes & Fred de Wilde */ -{ - struct mkroom *sroom; - int sx,sy,i,eelct = 0; - extern struct permonst pm_eel; - - for(i=0; i<5; i++) { /* 5 tries */ - sroom = &rooms[rn2(nroom)]; - if(sroom->hx < 0 || sroom->rtype || - has_upstairs(sroom) || has_dnstairs(sroom)) - continue; - - /* satisfied; make a swamp */ - sroom->rtype = SWAMP; - for(sx = sroom->lx; sx <= sroom->hx; sx++) - for(sy = sroom->ly; sy <= sroom->hy; sy++) - if((sx+sy)%2 && !o_at(sx,sy) && !t_at(sx,sy) - && !m_at(sx,sy) && !nexttodoor(sx,sy)){ - levl[sx][sy].typ = POOL; - levl[sx][sy].scrsym = POOL_SYM; - if(!eelct || !rn2(4)) { - (void) makemon(PM_EEL, sx, sy); - eelct++; - } - } - } -} - -nexttodoor(sx,sy) -int sx,sy; -{ - int dx,dy; - struct rm *lev; - for(dx = -1; dx <= 1; dx++) for(dy = -1; dy <= 1; dy++) - if((lev = &levl[sx+dx][sy+dy])->typ == DOOR || - lev->typ == SDOOR || lev->typ == LDOOR) - return(1); - return(0); -} - -has_dnstairs(sroom) -struct mkroom *sroom; -{ - return(sroom->lx <= xdnstair && xdnstair <= sroom->hx && - sroom->ly <= ydnstair && ydnstair <= sroom->hy); -} - -has_upstairs(sroom) -struct mkroom *sroom; -{ - return(sroom->lx <= xupstair && xupstair <= sroom->hx && - sroom->ly <= yupstair && yupstair <= sroom->hy); -} - -isbig(sroom) -struct mkroom *sroom; -{ - int area = (sroom->hx - sroom->lx) * (sroom->hy - sroom->ly); - return( area > 20 ); -} - -dist2(x0,y0,x1,y1){ - return((x0-x1)*(x0-x1) + (y0-y1)*(y0-y1)); -} - -sq(a) int a; { - return(a*a); -} -#endif /* QUEST */ diff --git a/games/hack/hack.mon.c b/games/hack/hack.mon.c deleted file mode 100644 index 8cf641b52420..000000000000 --- a/games/hack/hack.mon.c +++ /dev/null @@ -1,854 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.mon.c - version 1.0.3 */ -/* $FreeBSD$ */ - -#include "hack.h" -#include "hack.mfndpos.h" - -#ifndef NULL -#define NULL (char *) 0 -#endif - -extern struct monst *makemon(); -extern struct obj *mkobj_at(); - -int warnlevel; /* used by movemon and dochugw */ -long lastwarntime; -int lastwarnlev; -char *warnings[] = { - "white", "pink", "red", "ruby", "purple", "black" -}; - -movemon() -{ - struct monst *mtmp; - int fr; - - warnlevel = 0; - - while(1) { - /* find a monster that we haven't treated yet */ - /* note that mtmp or mtmp->nmon might get killed - while mtmp moves, so we cannot just walk down the - chain (even new monsters might get created!) */ - for(mtmp = fmon; mtmp; mtmp = mtmp->nmon) - if(mtmp->mlstmv < moves) goto next_mon; - /* treated all monsters */ - break; - - next_mon: - mtmp->mlstmv = moves; - - /* most monsters drown in pools */ - { boolean inpool, iseel; - - inpool = (levl[mtmp->mx][mtmp->my].typ == POOL); - iseel = (mtmp->data->mlet == ';'); - if(inpool && !iseel) { - if(cansee(mtmp->mx,mtmp->my)) - pline("%s drowns.", Monnam(mtmp)); - mondead(mtmp); - continue; - } - /* but eels have a difficult time outside */ - if(iseel && !inpool) { - if(mtmp->mhp > 1) mtmp->mhp--; - mtmp->mflee = 1; - mtmp->mfleetim += 2; - } - } - if(mtmp->mblinded && !--mtmp->mblinded) - mtmp->mcansee = 1; - if(mtmp->mfleetim && !--mtmp->mfleetim) - mtmp->mflee = 0; - if(mtmp->mimic) continue; - if(mtmp->mspeed != MSLOW || !(moves%2)){ - /* continue if the monster died fighting */ - fr = -1; - if(Conflict && cansee(mtmp->mx,mtmp->my) - && (fr = fightm(mtmp)) == 2) - continue; - if(fr<0 && dochugw(mtmp)) - continue; - } - if(mtmp->mspeed == MFAST && dochugw(mtmp)) - continue; - } - - warnlevel -= u.ulevel; - if(warnlevel >= SIZE(warnings)) - warnlevel = SIZE(warnings)-1; - if(warnlevel >= 0) - if(warnlevel > lastwarnlev || moves > lastwarntime + 5){ - char *rr; - switch(Warning & (LEFT_RING | RIGHT_RING)){ - case LEFT_RING: - rr = "Your left ring glows"; - break; - case RIGHT_RING: - rr = "Your right ring glows"; - break; - case LEFT_RING | RIGHT_RING: - rr = "Both your rings glow"; - break; - default: - rr = "Your fingertips glow"; - break; - } - pline("%s %s!", rr, warnings[warnlevel]); - lastwarntime = moves; - lastwarnlev = warnlevel; - } - - dmonsfree(); /* remove all dead monsters */ -} - -justswld(mtmp,name) -struct monst *mtmp; -char *name; -{ - - mtmp->mx = u.ux; - mtmp->my = u.uy; - u.ustuck = mtmp; - pmon(mtmp); - kludge("%s swallows you!",name); - more(); - seeoff(1); - u.uswallow = 1; - u.uswldtim = 0; - swallowed(); -} - -youswld(mtmp,dam,die,name) -struct monst *mtmp; -int dam,die; -char *name; -{ - if(mtmp != u.ustuck) return; - kludge("%s digests you!",name); - u.uhp -= dam; - if(u.uswldtim++ >= die){ /* a3 */ - pline("It totally digests you!"); - u.uhp = -1; - } - if(u.uhp < 1) done_in_by(mtmp); - /* flags.botlx = 1; */ /* should we show status line ? */ -} - -dochugw(mtmp) struct monst *mtmp; { -int x = mtmp->mx; -int y = mtmp->my; -int d = dochug(mtmp); -int dd; - if(!d) /* monster still alive */ - if(Warning) - if(!mtmp->mpeaceful) - if(mtmp->data->mlevel > warnlevel) - if((dd = dist(mtmp->mx,mtmp->my)) < dist(x,y)) - if(dd < 100) - if(!canseemon(mtmp)) - warnlevel = mtmp->data->mlevel; - return(d); -} - -/* returns 1 if monster died moving, 0 otherwise */ -dochug(mtmp) -struct monst *mtmp; -{ - struct permonst *mdat; - int tmp, nearby, scared; - - if(mtmp->cham && !rn2(6)) - (void) newcham(mtmp, &mons[dlevel+14+rn2(CMNUM-14-dlevel)]); - mdat = mtmp->data; - if(mdat->mlevel < 0) - panic("bad monster %c (%d)",mdat->mlet,mdat->mlevel); - - /* regenerate monsters */ - if((!(moves%20) || index(MREGEN, mdat->mlet)) && - mtmp->mhp < mtmp->mhpmax) - mtmp->mhp++; - - if(mtmp->mfroz) return(0); /* frozen monsters don't do anything */ - - if(mtmp->msleep) { - /* wake up, or get out of here. */ - /* ettins are hard to surprise */ - /* Nymphs and Leprechauns do not easily wake up */ - if(cansee(mtmp->mx,mtmp->my) && - (!Stealth || (mdat->mlet == 'e' && rn2(10))) && - (!index("NL",mdat->mlet) || !rn2(50)) && - (Aggravate_monster || index("d1", mdat->mlet) - || (!rn2(7) && !mtmp->mimic))) - mtmp->msleep = 0; - else return(0); - } - - /* not frozen or sleeping: wipe out texts written in the dust */ - wipe_engr_at(mtmp->mx, mtmp->my, 1); - - /* confused monsters get unconfused with small probability */ - if(mtmp->mconf && !rn2(50)) mtmp->mconf = 0; - - /* some monsters teleport */ - if(mtmp->mflee && index("tNL", mdat->mlet) && !rn2(40)){ - rloc(mtmp); - return(0); - } - if(mdat->mmove < rnd(6)) return(0); - - /* fleeing monsters might regain courage */ - if(mtmp->mflee && !mtmp->mfleetim - && mtmp->mhp == mtmp->mhpmax && !rn2(25)) - mtmp->mflee = 0; - - nearby = (dist(mtmp->mx, mtmp->my) < 3); - scared = (nearby && (sengr_at("Elbereth", u.ux, u.uy) || - sobj_at(SCR_SCARE_MONSTER, u.ux, u.uy))); - if(scared && !mtmp->mflee) { - mtmp->mflee = 1; - mtmp->mfleetim = (rn2(7) ? rnd(10) : rnd(100)); - } - - if(!nearby || - mtmp->mflee || - mtmp->mconf || - (mtmp->minvis && !rn2(3)) || - (index("BIuy", mdat->mlet) && !rn2(4)) || - (mdat->mlet == 'L' && !u.ugold && (mtmp->mgold || rn2(2))) || - (!mtmp->mcansee && !rn2(4)) || - mtmp->mpeaceful - ) { - tmp = m_move(mtmp,0); /* 2: monster died moving */ - if(tmp == 2 || (tmp && mdat->mmove <= 12)) - return(tmp == 2); - } - - if(!index("Ea", mdat->mlet) && nearby && - !mtmp->mpeaceful && u.uhp > 0 && !scared) { - if(mhitu(mtmp)) - return(1); /* monster died (e.g. 'y' or 'F') */ - } - /* extra movement for fast monsters */ - if(mdat->mmove-12 > rnd(12)) tmp = m_move(mtmp,1); - return(tmp == 2); -} - -m_move(mtmp,after) -struct monst *mtmp; -{ - struct monst *mtmp2; - int nx,ny,omx,omy,appr,nearer,cnt,i,j; - xchar gx,gy,nix,niy,chcnt; - schar chi; - boolean likegold, likegems, likeobjs; - char msym = mtmp->data->mlet; - schar mmoved = 0; /* not strictly nec.: chi >= 0 will do */ - coord poss[9]; - int info[9]; - - if(mtmp->mfroz || mtmp->msleep) - return(0); - if(mtmp->mtrapped) { - i = mintrap(mtmp); - if(i == 2) return(2); /* he died */ - if(i == 1) return(0); /* still in trap, so didnt move */ - } - if(mtmp->mhide && o_at(mtmp->mx,mtmp->my) && rn2(10)) - return(0); /* do not leave hiding place */ - -#ifndef NOWORM - if(mtmp->wormno) - goto not_special; -#endif /* NOWORM */ - - /* my dog gets a special treatment */ - if(mtmp->mtame) { - return( dog_move(mtmp, after) ); - } - - /* likewise for shopkeeper */ - if(mtmp->isshk) { - mmoved = shk_move(mtmp); - if(mmoved >= 0) - goto postmov; - mmoved = 0; /* follow player outside shop */ - } - - /* and for the guard */ - if(mtmp->isgd) { - mmoved = gd_move(); - goto postmov; - } - -/* teleport if that lies in our nature ('t') or when badly wounded ('1') */ - if((msym == 't' && !rn2(5)) - || (msym == '1' && (mtmp->mhp < 7 || (!xdnstair && !rn2(5)) - || levl[u.ux][u.uy].typ == STAIRS))) { - if(mtmp->mhp < 7 || (msym == 't' && rn2(2))) - rloc(mtmp); - else - mnexto(mtmp); - mmoved = 1; - goto postmov; - } - - /* spit fire ('D') or use a wand ('1') when appropriate */ - if(index("D1", msym)) - inrange(mtmp); - - if(msym == 'U' && !mtmp->mcan && canseemon(mtmp) && - mtmp->mcansee && rn2(5)) { - if(!Confusion) - pline("%s's gaze has confused you!", Monnam(mtmp)); - else - pline("You are getting more and more confused."); - if(rn2(3)) mtmp->mcan = 1; - Confusion += d(3,4); /* timeout */ - } -not_special: - if(!mtmp->mflee && u.uswallow && u.ustuck != mtmp) return(1); - appr = 1; - if(mtmp->mflee) appr = -1; - if(mtmp->mconf || Invis || !mtmp->mcansee || - (index("BIy", msym) && !rn2(3))) - appr = 0; - omx = mtmp->mx; - omy = mtmp->my; - gx = u.ux; - gy = u.uy; - if(msym == 'L' && appr == 1 && mtmp->mgold > u.ugold) - appr = -1; - - /* random criterion for 'smell' or track finding ability - should use mtmp->msmell or sth - */ - if(msym == '@' || - ('a' <= msym && msym <= 'z')) { - extern coord *gettrack(); - coord *cp; - schar mroom; - mroom = inroom(omx,omy); - if(mroom < 0 || mroom != inroom(u.ux,u.uy)){ - cp = gettrack(omx,omy); - if(cp){ - gx = cp->x; - gy = cp->y; - } - } - } - - /* look for gold or jewels nearby */ - likegold = (index("LOD", msym) != NULL); - likegems = (index("ODu", msym) != NULL); - likeobjs = mtmp->mhide; -#define SRCHRADIUS 25 - { xchar mind = SRCHRADIUS; /* not too far away */ - int dd; - if(likegold){ - struct gold *gold; - for(gold = fgold; gold; gold = gold->ngold) - if((dd = DIST(omx,omy,gold->gx,gold->gy)) < mind){ - mind = dd; - gx = gold->gx; - gy = gold->gy; - } - } - if(likegems || likeobjs){ - struct obj *otmp; - for(otmp = fobj; otmp; otmp = otmp->nobj) - if(likeobjs || otmp->olet == GEM_SYM) - if(msym != 'u' || - objects[otmp->otyp].g_val != 0) - if((dd = DIST(omx,omy,otmp->ox,otmp->oy)) < mind){ - mind = dd; - gx = otmp->ox; - gy = otmp->oy; - } - } - if(mind < SRCHRADIUS && appr == -1) { - if(dist(omx,omy) < 10) { - gx = u.ux; - gy = u.uy; - } else - appr = 1; - } - } - nix = omx; - niy = omy; - cnt = mfndpos(mtmp,poss,info, - msym == 'u' ? NOTONL : - (msym == '@' || msym == '1') ? (ALLOW_SSM | ALLOW_TRAPS) : - index(UNDEAD, msym) ? NOGARLIC : ALLOW_TRAPS); - /* ALLOW_ROCK for some monsters ? */ - chcnt = 0; - chi = -1; - for(i=0; imtrack[j].x && ny == mtmp->mtrack[j].y) - if(rn2(4*(cnt-j))) goto nxti; -#ifdef STUPID - /* some stupid compilers think that this is too complicated */ - { int d1 = DIST(nx,ny,gx,gy); - int d2 = DIST(nix,niy,gx,gy); - nearer = (d1 < d2); - } -#else - nearer = (DIST(nx,ny,gx,gy) < DIST(nix,niy,gx,gy)); -#endif /* STUPID */ - if((appr == 1 && nearer) || (appr == -1 && !nearer) || - !mmoved || - (!appr && !rn2(++chcnt))){ - nix = nx; - niy = ny; - chi = i; - mmoved = 1; - } - nxti: ; - } - if(mmoved){ - if(info[chi] & ALLOW_M){ - mtmp2 = m_at(nix,niy); - if(hitmm(mtmp,mtmp2) == 1 && rn2(4) && - hitmm(mtmp2,mtmp) == 2) return(2); - return(0); - } - if(info[chi] & ALLOW_U){ - (void) hitu(mtmp, d(mtmp->data->damn, mtmp->data->damd)+1); - return(0); - } - mtmp->mx = nix; - mtmp->my = niy; - for(j=MTSZ-1; j>0; j--) mtmp->mtrack[j] = mtmp->mtrack[j-1]; - mtmp->mtrack[0].x = omx; - mtmp->mtrack[0].y = omy; -#ifndef NOWORM - if(mtmp->wormno) worm_move(mtmp); -#endif /* NOWORM */ - } else { - if(msym == 'u' && rn2(2)){ - rloc(mtmp); - return(0); - } -#ifndef NOWORM - if(mtmp->wormno) worm_nomove(mtmp); -#endif /* NOWORM */ - } -postmov: - if(mmoved == 1) { - if(mintrap(mtmp) == 2) /* he died */ - return(2); - if(likegold) mpickgold(mtmp); - if(likegems) mpickgems(mtmp); - if(mtmp->mhide) mtmp->mundetected = 1; - } - pmon(mtmp); - return(mmoved); -} - -mpickgold(mtmp) struct monst *mtmp; { -struct gold *gold; - while(gold = g_at(mtmp->mx, mtmp->my)){ - mtmp->mgold += gold->amount; - freegold(gold); - if(levl[mtmp->mx][mtmp->my].scrsym == '$') - newsym(mtmp->mx, mtmp->my); - } -} - -mpickgems(mtmp) struct monst *mtmp; { -struct obj *otmp; - for(otmp = fobj; otmp; otmp = otmp->nobj) - if(otmp->olet == GEM_SYM) - if(otmp->ox == mtmp->mx && otmp->oy == mtmp->my) - if(mtmp->data->mlet != 'u' || objects[otmp->otyp].g_val != 0){ - freeobj(otmp); - mpickobj(mtmp, otmp); - if(levl[mtmp->mx][mtmp->my].scrsym == GEM_SYM) - newsym(mtmp->mx, mtmp->my); /* %% */ - return; /* pick only one object */ - } -} - -/* return number of acceptable neighbour positions */ -mfndpos(mon,poss,info,flag) -struct monst *mon; -coord poss[9]; -int info[9], flag; -{ - int x,y,nx,ny,cnt = 0,ntyp; - struct monst *mtmp; - int nowtyp; - boolean pool; - - x = mon->mx; - y = mon->my; - nowtyp = levl[x][y].typ; - - pool = (mon->data->mlet == ';'); -nexttry: /* eels prefer the water, but if there is no water nearby, - they will crawl over land */ - if(mon->mconf) { - flag |= ALLOW_ALL; - flag &= ~NOTONL; - } - for(nx = x-1; nx <= x+1; nx++) for(ny = y-1; ny <= y+1; ny++) - if(nx != x || ny != y) if(isok(nx,ny)) - if(!IS_ROCK(ntyp = levl[nx][ny].typ)) - if(!(nx != x && ny != y && (nowtyp == DOOR || ntyp == DOOR))) - if((ntyp == POOL) == pool) { - info[cnt] = 0; - if(nx == u.ux && ny == u.uy){ - if(!(flag & ALLOW_U)) continue; - info[cnt] = ALLOW_U; - } else if(mtmp = m_at(nx,ny)){ - if(!(flag & ALLOW_M)) continue; - info[cnt] = ALLOW_M; - if(mtmp->mtame){ - if(!(flag & ALLOW_TM)) continue; - info[cnt] |= ALLOW_TM; - } - } - if(sobj_at(CLOVE_OF_GARLIC, nx, ny)) { - if(flag & NOGARLIC) continue; - info[cnt] |= NOGARLIC; - } - if(sobj_at(SCR_SCARE_MONSTER, nx, ny) || - (!mon->mpeaceful && sengr_at("Elbereth", nx, ny))) { - if(!(flag & ALLOW_SSM)) continue; - info[cnt] |= ALLOW_SSM; - } - if(sobj_at(ENORMOUS_ROCK, nx, ny)) { - if(!(flag & ALLOW_ROCK)) continue; - info[cnt] |= ALLOW_ROCK; - } - if(!Invis && online(nx,ny)){ - if(flag & NOTONL) continue; - info[cnt] |= NOTONL; - } - /* we cannot avoid traps of an unknown kind */ - { struct trap *ttmp = t_at(nx, ny); - int tt; - if(ttmp) { - tt = 1 << ttmp->ttyp; - if(mon->mtrapseen & tt){ - if(!(flag & tt)) continue; - info[cnt] |= tt; - } - } - } - poss[cnt].x = nx; - poss[cnt].y = ny; - cnt++; - } - if(!cnt && pool && nowtyp != POOL) { - pool = FALSE; - goto nexttry; - } - return(cnt); -} - -dist(x,y) int x,y; { - return((x-u.ux)*(x-u.ux) + (y-u.uy)*(y-u.uy)); -} - -poisoned(string, pname) -char *string, *pname; -{ - int i; - - if(Blind) pline("It was poisoned."); - else pline("The %s was poisoned!",string); - if(Poison_resistance) { - pline("The poison doesn't seem to affect you."); - return; - } - i = rn2(10); - if(i == 0) { - u.uhp = -1; - pline("I am afraid the poison was deadly ..."); - } else if(i <= 5) { - losestr(rn1(3,3)); - } else { - losehp(rn1(10,6), pname); - } - if(u.uhp < 1) { - killer = pname; - done("died"); - } -} - -mondead(mtmp) -struct monst *mtmp; -{ - relobj(mtmp,1); - unpmon(mtmp); - relmon(mtmp); - unstuck(mtmp); - if(mtmp->isshk) shkdead(mtmp); - if(mtmp->isgd) gddead(); -#ifndef NOWORM - if(mtmp->wormno) wormdead(mtmp); -#endif /* NOWORM */ - monfree(mtmp); -} - -/* called when monster is moved to larger structure */ -replmon(mtmp,mtmp2) -struct monst *mtmp, *mtmp2; -{ - relmon(mtmp); - monfree(mtmp); - mtmp2->nmon = fmon; - fmon = mtmp2; - if(u.ustuck == mtmp) u.ustuck = mtmp2; - if(mtmp2->isshk) replshk(mtmp,mtmp2); - if(mtmp2->isgd) replgd(mtmp,mtmp2); -} - -relmon(mon) -struct monst *mon; -{ - struct monst *mtmp; - - if(mon == fmon) fmon = fmon->nmon; - else { - for(mtmp = fmon; mtmp->nmon != mon; mtmp = mtmp->nmon) ; - mtmp->nmon = mon->nmon; - } -} - -/* we do not free monsters immediately, in order to have their name - available shortly after their demise */ -struct monst *fdmon; /* chain of dead monsters, need not to be saved */ - -monfree(mtmp) struct monst *mtmp; { - mtmp->nmon = fdmon; - fdmon = mtmp; -} - -dmonsfree(){ -struct monst *mtmp; - while(mtmp = fdmon){ - fdmon = mtmp->nmon; - free((char *) mtmp); - } -} - -unstuck(mtmp) -struct monst *mtmp; -{ - if(u.ustuck == mtmp) { - if(u.uswallow){ - u.ux = mtmp->mx; - u.uy = mtmp->my; - u.uswallow = 0; - setsee(); - docrt(); - } - u.ustuck = 0; - } -} - -killed(mtmp) -struct monst *mtmp; -{ -#ifdef lint -#define NEW_SCORING -#endif /* lint */ - int tmp,tmp2,nk,x,y; - struct permonst *mdat; - extern long newuexp(); - - if(mtmp->cham) mtmp->data = PM_CHAMELEON; - mdat = mtmp->data; - if(Blind) pline("You destroy it!"); - else { - pline("You destroy %s!", - mtmp->mtame ? amonnam(mtmp, "poor") : monnam(mtmp)); - } - if(u.umconf) { - if(!Blind) pline("Your hands stop glowing blue."); - u.umconf = 0; - } - - /* count killed monsters */ -#define MAXMONNO 100 - nk = 1; /* in case we cannot find it in mons */ - tmp = mdat - mons; /* index in mons array (if not 'd', '@', ...) */ - if(tmp >= 0 && tmp < CMNUM+2) { - extern char fut_geno[]; - u.nr_killed[tmp]++; - if((nk = u.nr_killed[tmp]) > MAXMONNO && - !index(fut_geno, mdat->mlet)) - charcat(fut_geno, mdat->mlet); - } - - /* punish bad behaviour */ - if(mdat->mlet == '@') Telepat = 0, u.uluck -= 2; - if(mtmp->mpeaceful || mtmp->mtame) u.uluck--; - if(mdat->mlet == 'u') u.uluck -= 5; - if((int)u.uluck < LUCKMIN) u.uluck = LUCKMIN; - - /* give experience points */ - tmp = 1 + mdat->mlevel * mdat->mlevel; - if(mdat->ac < 3) tmp += 2*(7 - mdat->ac); - if(index("AcsSDXaeRTVWU&In:P", mdat->mlet)) - tmp += 2*mdat->mlevel; - if(index("DeV&P",mdat->mlet)) tmp += (7*mdat->mlevel); - if(mdat->mlevel > 6) tmp += 50; - if(mdat->mlet == ';') tmp += 1000; - -#ifdef NEW_SCORING - /* ------- recent addition: make nr of points decrease - when this is not the first of this kind */ - { int ul = u.ulevel; - int ml = mdat->mlevel; - - if(ul < 14) /* points are given based on present and future level */ - for(tmp2 = 0; !tmp2 || ul + tmp2 <= ml; tmp2++) - if(u.uexp + 1 + (tmp + ((tmp2 <= 0) ? 0 : 4<<(tmp2-1)))/nk - >= 10*pow((unsigned)(ul-1))) - if(++ul == 14) break; - - tmp2 = ml - ul -1; - tmp = (tmp + ((tmp2 < 0) ? 0 : 4<= newuexp()){ - pline("Welcome to experience level %u.", ++u.ulevel); - tmp = rnd(10); - if(tmp < 3) tmp = rnd(10); - u.uhpmax += tmp; - u.uhp += tmp; - flags.botl = 1; - } - - /* dispose of monster and make cadaver */ - x = mtmp->mx; y = mtmp->my; - mondead(mtmp); - tmp = mdat->mlet; - if(tmp == 'm') { /* he killed a minotaur, give him a wand of digging */ - /* note: the dead minotaur will be on top of it! */ - mksobj_at(WAN_DIGGING, x, y); - /* if(cansee(x,y)) atl(x,y,fobj->olet); */ - stackobj(fobj); - } else -#ifndef NOWORM - if(tmp == 'w') { - mksobj_at(WORM_TOOTH, x, y); - stackobj(fobj); - } else -#endif /* NOWORM */ - if(!letter(tmp) || (!index("mw", tmp) && !rn2(3))) tmp = 0; - - if(ACCESSIBLE(levl[x][y].typ)) /* might be mimic in wall or dead eel*/ - if(x != u.ux || y != u.uy) /* might be here after swallowed */ - if(index("NTVm&",mdat->mlet) || rn2(5)) { - struct obj *obj2 = mkobj_at(tmp,x,y); - if(cansee(x,y)) - atl(x,y,obj2->olet); - stackobj(obj2); - } -} - -kludge(str,arg) -char *str,*arg; -{ - if(Blind) { - if(*str == '%') pline(str,"It"); - else pline(str,"it"); - } else pline(str,arg); -} - -rescham() /* force all chameleons to become normal */ -{ - struct monst *mtmp; - - for(mtmp = fmon; mtmp; mtmp = mtmp->nmon) - if(mtmp->cham) { - mtmp->cham = 0; - (void) newcham(mtmp, PM_CHAMELEON); - } -} - -newcham(mtmp,mdat) /* make a chameleon look like a new monster */ - /* returns 1 if the monster actually changed */ -struct monst *mtmp; -struct permonst *mdat; -{ - int mhp, hpn, hpd; - - if(mdat == mtmp->data) return(0); /* still the same monster */ -#ifndef NOWORM - if(mtmp->wormno) wormdead(mtmp); /* throw tail away */ -#endif /* NOWORM */ - if (u.ustuck == mtmp) { - if (u.uswallow) { - u.uswallow = 0; - u.uswldtim = 0; - mnexto (mtmp); - docrt (); - prme (); - } - u.ustuck = 0; - } - hpn = mtmp->mhp; - hpd = (mtmp->data->mlevel)*8; - if(!hpd) hpd = 4; - mtmp->data = mdat; - mhp = (mdat->mlevel)*8; - /* new hp: same fraction of max as before */ - mtmp->mhp = 2 + (hpn*mhp)/hpd; - hpn = mtmp->mhpmax; - mtmp->mhpmax = 2 + (hpn*mhp)/hpd; - mtmp->minvis = (mdat->mlet == 'I') ? 1 : 0; -#ifndef NOWORM - if(mdat->mlet == 'w' && getwn(mtmp)) initworm(mtmp); - /* perhaps we should clear mtmp->mtame here? */ -#endif /* NOWORM */ - unpmon(mtmp); /* necessary for 'I' and to force pmon */ - pmon(mtmp); - return(1); -} - -mnexto(mtmp) /* Make monster mtmp next to you (if possible) */ -struct monst *mtmp; -{ - extern coord enexto(); - coord mm; - mm = enexto(u.ux, u.uy); - mtmp->mx = mm.x; - mtmp->my = mm.y; - pmon(mtmp); -} - -ishuman(mtmp) struct monst *mtmp; { - return(mtmp->data->mlet == '@'); -} - -setmangry(mtmp) struct monst *mtmp; { - if(!mtmp->mpeaceful) return; - if(mtmp->mtame) return; - mtmp->mpeaceful = 0; - if(ishuman(mtmp)) pline("%s gets angry!", Monnam(mtmp)); -} - -/* not one hundred procent correct: now a snake may hide under an - invisible object */ -canseemon(mtmp) -struct monst *mtmp; -{ - return((!mtmp->minvis || See_invisible) - && (!mtmp->mhide || !o_at(mtmp->mx,mtmp->my)) - && cansee(mtmp->mx, mtmp->my)); -} diff --git a/games/hack/hack.monst.c b/games/hack/hack.monst.c deleted file mode 100644 index 78c2a2e0101c..000000000000 --- a/games/hack/hack.monst.c +++ /dev/null @@ -1,80 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.monst.c - version 1.0.2 */ -/* $FreeBSD$ */ - -#include "hack.h" -#include "def.eshk.h" -extern char plname[PL_NSIZ]; - -struct permonst mons[CMNUM+2] = { - { "bat", 'B',1,22,8,1,4,0 }, - { "gnome", 'G',1,6,5,1,6,0 }, - { "hobgoblin", 'H',1,9,5,1,8,0 }, - { "jackal", 'J',0,12,7,1,2,0 }, - { "kobold", 'K',1,6,7,1,4,0 }, - { "leprechaun", 'L',5,15,8,1,2,0 }, - { "giant rat", 'r',0,12,7,1,3,0 }, - { "acid blob", 'a',2,3,8,0,0,0 }, - { "floating eye", 'E',2,1,9,0,0,0 }, - { "homunculus", 'h',2,6,6,1,3,0 }, - { "imp", 'i',2,6,2,1,4,0 }, - { "orc", 'O',2,9,6,1,8,0 }, - { "yellow light", 'y',3,15,0,0,0,0 }, - { "zombie", 'Z',2,6,8,1,8,0 }, - { "giant ant", 'A',3,18,3,1,6,0 }, - { "fog cloud", 'f',3,1,0,1,6,0 }, - { "nymph", 'N',6,12,9,1,2,0 }, - { "piercer", 'p',3,1,3,2,6,0 }, - { "quasit", 'Q',3,15,3,1,4,0 }, - { "quivering blob", 'q',3,1,8,1,8,0 }, - { "violet fungi", 'v',3,1,7,1,4,0 }, - { "giant beetle", 'b',4,6,4,3,4,0 }, - { "centaur", 'C',4,18,4,1,6,0 }, - { "cockatrice", 'c',4,6,6,1,3,0 }, - { "gelatinous cube", 'g',4,6,8,2,4,0 }, - { "jaguar", 'j',4,15,6,1,8,0 }, - { "killer bee", 'k',4,14,4,2,4,0 }, - { "snake", 'S',4,15,3,1,6,0 }, - { "freezing sphere", 'F',2,13,4,0,0,0 }, - { "owlbear", 'o',5,12,5,2,6,0 }, - { "rust monster", 'R',10,18,3,0,0,0 }, - { "scorpion", 's',5,15,3,1,4,0 }, - { "tengu", 't',5,13,5,1,7,0 }, - { "wraith", 'W',5,12,5,1,6,0 }, -#ifdef NOWORM - { "wumpus", 'w',8,3,2,3,6,0 }, -#else - { "long worm", 'w',8,3,5,1,4,0 }, -#endif /* NOWORM */ - { "large dog", 'd',6,15,4,2,4,0 }, - { "leocrotta", 'l',6,18,4,3,6,0 }, - { "mimic", 'M',7,3,7,3,4,0 }, - { "troll", 'T',7,12,4,2,7,0 }, - { "unicorn", 'u',8,24,5,1,10,0 }, - { "yeti", 'Y',5,15,6,1,6,0 }, - { "stalker", 'I',8,12,3,4,4,0 }, - { "umber hulk", 'U',9,6,2,2,10,0 }, - { "vampire", 'V',8,12,1,1,6,0 }, - { "xorn", 'X',8,9,-2,4,6,0 }, - { "xan", 'x',7,18,-2,2,4,0 }, - { "zruty", 'z',9,8,3,3,6,0 }, - { "chameleon", ':',6,5,6,4,2,0 }, - { "dragon", 'D',10,9,-1,3,8,0 }, - { "ettin", 'e',10,12,3,2,8,0 }, - { "lurker above", '\'',10,3,3,0,0,0 }, - { "nurse", 'n',11,6,0,1,3,0 }, - { "trapper", ',',12,3,3,0,0,0 }, - { "purple worm", 'P',15,9,6,2,8,0 }, - { "demon", '&',10,12,-4,1,4,0 }, - { "minotaur", 'm',15,15,6,4,10,0 }, - { "shopkeeper", '@', 12, 18, 0, 4, 8, sizeof(struct eshk) } -}; - -struct permonst pm_ghost = { "ghost", ' ', 10, 3, -5, 1, 1, sizeof(plname) }; -struct permonst pm_wizard = { - "wizard of Yendor", '1', 15, 12, -2, 1, 12, 0 -}; -#ifdef MAIL -struct permonst pm_mail_daemon = { "mail daemon", '2', 100, 1, 10, 0, 0, 0 }; -#endif /* MAIL */ -struct permonst pm_eel = { "giant eel", ';', 15, 6, -3, 3, 6, 0 }; diff --git a/games/hack/hack.o_init.c b/games/hack/hack.o_init.c deleted file mode 100644 index 0bb94189fa31..000000000000 --- a/games/hack/hack.o_init.c +++ /dev/null @@ -1,162 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.o_init.c - version 1.0.3 */ -/* $FreeBSD$ */ - -#include -#include "config.h" /* for typedefs */ -#include "def.objects.h" -#include "hack.onames.h" /* for LAST_GEM */ -extern char *index(); - -int -letindex(let) char let; { -int i = 0; -char ch; - while((ch = obj_symbols[i++]) != 0) - if(ch == let) return(i); - return(0); -} - -init_objects(){ -int i, j, first, last, sum, end; -char let, *tmp; - /* init base; if probs given check that they add up to 100, - otherwise compute probs; shuffle descriptions */ - end = SIZE(objects); - first = 0; - while( first < end ) { - let = objects[first].oc_olet; - last = first+1; - while(last < end && objects[last].oc_olet == let - && objects[last].oc_name != NULL) - last++; - i = letindex(let); - if((!i && let != ILLOBJ_SYM) || bases[i] != 0) - error("initialization error"); - bases[i] = first; - - if(let == GEM_SYM) - setgemprobs(); - check: - sum = 0; - for(j = first; j < last; j++) sum += objects[j].oc_prob; - if(sum == 0) { - for(j = first; j < last; j++) - objects[j].oc_prob = (100+j-first)/(last-first); - goto check; - } - if(sum != 100) - error("init-prob error for %c", let); - - if(objects[first].oc_descr != NULL && let != TOOL_SYM){ - /* shuffle, also some additional descriptions */ - while(last < end && objects[last].oc_olet == let) - last++; - j = last; - while(--j > first) { - i = first + rn2(j+1-first); - tmp = objects[j].oc_descr; - objects[j].oc_descr = objects[i].oc_descr; - objects[i].oc_descr = tmp; - } - } - first = last; - } -} - -probtype(let) char let; { -int i = bases[letindex(let)]; -int prob = rn2(100); - while((prob -= objects[i].oc_prob) >= 0) i++; - if(objects[i].oc_olet != let || !objects[i].oc_name) - panic("probtype(%c) error, i=%d", let, i); - return(i); -} - -setgemprobs() -{ - int j,first; - extern xchar dlevel; - - first = bases[letindex(GEM_SYM)]; - - for(j = 0; j < 9-dlevel/3; j++) - objects[first+j].oc_prob = 0; - first += j; - if(first >= LAST_GEM || first >= SIZE(objects) || - objects[first].oc_olet != GEM_SYM || - objects[first].oc_name == NULL) - printf("Not enough gems? - first=%d j=%d LAST_GEM=%d\n", - first, j, LAST_GEM); - for(j = first; j < LAST_GEM; j++) - objects[j].oc_prob = (20+j-first)/(LAST_GEM-first); -} - -oinit() /* level dependent initialization */ -{ - setgemprobs(); -} - -extern long *alloc(); - -savenames(fd) int fd; { -int i; -unsigned len; - bwrite(fd, (char *) bases, sizeof bases); - bwrite(fd, (char *) objects, sizeof objects); - /* as long as we use only one version of Hack/Quest we - need not save oc_name and oc_descr, but we must save - oc_uname for all objects */ - for(i=0; i < SIZE(objects); i++) { - if(objects[i].oc_uname) { - len = strlen(objects[i].oc_uname)+1; - bwrite(fd, (char *) &len, sizeof len); - bwrite(fd, objects[i].oc_uname, len); - } - } -} - -restnames(fd) int fd; { -int i; -unsigned len; - mread(fd, (char *) bases, sizeof bases); - mread(fd, (char *) objects, sizeof objects); - for(i=0; i < SIZE(objects); i++) if(objects[i].oc_uname) { - mread(fd, (char *) &len, sizeof len); - objects[i].oc_uname = (char *) alloc(len); - mread(fd, objects[i].oc_uname, len); - } -} - -dodiscovered() /* free after Robert Viduya */ -{ - extern char *typename(); - int i, end; - int ct = 0; - - cornline(0, "Discoveries"); - - end = SIZE(objects); - for (i = 0; i < end; i++) { - if (interesting_to_discover (i)) { - ct++; - cornline(1, typename(i)); - } - } - if (ct == 0) { - pline ("You haven't discovered anything yet..."); - cornline(3, (char *) 0); - } else - cornline(2, (char *) 0); - - return(0); -} - -interesting_to_discover(i) -int i; -{ - return( - objects[i].oc_uname != NULL || - (objects[i].oc_name_known && objects[i].oc_descr != NULL) - ); -} diff --git a/games/hack/hack.objnam.c b/games/hack/hack.objnam.c deleted file mode 100644 index add63a24417f..000000000000 --- a/games/hack/hack.objnam.c +++ /dev/null @@ -1,550 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.objnam.c - version 1.0.2 */ - -#include -__FBSDID("$FreeBSD$"); - -#include "hack.h" -#define Sprintf (void) sprintf -#define Strcat (void) strcat -#define Strcpy (void) strcpy -#define PREFIX 15 -extern char *eos(); -extern int bases[]; - -char * -strprepend(s,pref) char *s, *pref; { -int i = strlen(pref); - if(i > PREFIX) { - pline("WARNING: prefix too short."); - return(s); - } - s -= i; - (void) strncpy(s, pref, i); /* do not copy trailing 0 */ - return(s); -} - -char * -sitoa(a) int a; { -static char buf[13]; - Sprintf(buf, (a < 0) ? "%d" : "+%d", a); - return(buf); -} - -char * -typename(otyp) -int otyp; -{ -static char buf[BUFSZ]; -struct objclass *ocl = &objects[otyp]; -char *an = ocl->oc_name; -char *dn = ocl->oc_descr; -char *un = ocl->oc_uname; -int nn = ocl->oc_name_known; - switch(ocl->oc_olet) { - case POTION_SYM: - Strcpy(buf, "potion"); - break; - case SCROLL_SYM: - Strcpy(buf, "scroll"); - break; - case WAND_SYM: - Strcpy(buf, "wand"); - break; - case RING_SYM: - Strcpy(buf, "ring"); - break; - default: - if(nn) { - Strcpy(buf, an); - if(otyp >= TURQUOISE && otyp <= JADE) - Strcat(buf, " stone"); - if(un) - Sprintf(eos(buf), " called %s", un); - if(dn) - Sprintf(eos(buf), " (%s)", dn); - } else { - Strcpy(buf, dn ? dn : an); - if(ocl->oc_olet == GEM_SYM) - Strcat(buf, " gem"); - if(un) - Sprintf(eos(buf), " called %s", un); - } - return(buf); - } - /* here for ring/scroll/potion/wand */ - if(nn) - Sprintf(eos(buf), " of %s", an); - if(un) - Sprintf(eos(buf), " called %s", un); - if(dn) - Sprintf(eos(buf), " (%s)", dn); - return(buf); -} - -char * -xname(obj) -struct obj *obj; -{ -static char bufr[BUFSZ]; -char *buf = &(bufr[PREFIX]); /* leave room for "17 -3 " */ -int nn = objects[obj->otyp].oc_name_known; -char *an = objects[obj->otyp].oc_name; -char *dn = objects[obj->otyp].oc_descr; -char *un = objects[obj->otyp].oc_uname; -int pl = (obj->quan != 1); - if(!obj->dknown && !Blind) obj->dknown = 1; /* %% doesnt belong here */ - switch(obj->olet) { - case AMULET_SYM: - Strcpy(buf, (obj->spe < 0 && obj->known) - ? "cheap plastic imitation of the " : ""); - Strcat(buf,"Amulet of Yendor"); - break; - case TOOL_SYM: - if(!nn) { - Strcpy(buf, dn); - break; - } - Strcpy(buf,an); - break; - case FOOD_SYM: - if(obj->otyp == DEAD_HOMUNCULUS && pl) { - pl = 0; - Strcpy(buf, "dead homunculi"); - break; - } - /* fungis ? */ - /* FALLTHROUGH */ - case WEAPON_SYM: - if(obj->otyp == WORM_TOOTH && pl) { - pl = 0; - Strcpy(buf, "worm teeth"); - break; - } - if(obj->otyp == CRYSKNIFE && pl) { - pl = 0; - Strcpy(buf, "crysknives"); - break; - } - /* FALLTHROUGH */ - case ARMOR_SYM: - case CHAIN_SYM: - case ROCK_SYM: - Strcpy(buf,an); - break; - case BALL_SYM: - Sprintf(buf, "%sheavy iron ball", - (obj->owt > objects[obj->otyp].oc_weight) ? "very " : ""); - break; - case POTION_SYM: - if(nn || un || !obj->dknown) { - Strcpy(buf, "potion"); - if(pl) { - pl = 0; - Strcat(buf, "s"); - } - if(!obj->dknown) break; - if(un) { - Strcat(buf, " called "); - Strcat(buf, un); - } else { - Strcat(buf, " of "); - Strcat(buf, an); - } - } else { - Strcpy(buf, dn); - Strcat(buf, " potion"); - } - break; - case SCROLL_SYM: - Strcpy(buf, "scroll"); - if(pl) { - pl = 0; - Strcat(buf, "s"); - } - if(!obj->dknown) break; - if(nn) { - Strcat(buf, " of "); - Strcat(buf, an); - } else if(un) { - Strcat(buf, " called "); - Strcat(buf, un); - } else { - Strcat(buf, " labeled "); - Strcat(buf, dn); - } - break; - case WAND_SYM: - if(!obj->dknown) - Sprintf(buf, "wand"); - else if(nn) - Sprintf(buf, "wand of %s", an); - else if(un) - Sprintf(buf, "wand called %s", un); - else - Sprintf(buf, "%s wand", dn); - break; - case RING_SYM: - if(!obj->dknown) - Sprintf(buf, "ring"); - else if(nn) - Sprintf(buf, "ring of %s", an); - else if(un) - Sprintf(buf, "ring called %s", un); - else - Sprintf(buf, "%s ring", dn); - break; - case GEM_SYM: - if(!obj->dknown) { - Strcpy(buf, "gem"); - break; - } - if(!nn) { - Sprintf(buf, "%s gem", dn); - break; - } - Strcpy(buf, an); - if(obj->otyp >= TURQUOISE && obj->otyp <= JADE) - Strcat(buf, " stone"); - break; - default: - Sprintf(buf,"glorkum %c (0%o) %u %d", - obj->olet,obj->olet,obj->otyp,obj->spe); - } - if(pl) { - char *p; - - for(p = buf; *p; p++) { - if(!strncmp(" of ", p, 4)) { - /* pieces of, cloves of, lumps of */ - int c1, c2 = 's'; - - do { - c1 = c2; c2 = *p; *p++ = c1; - } while(c1); - goto nopl; - } - } - p = eos(buf)-1; - if(*p == 's' || *p == 'z' || *p == 'x' || - (*p == 'h' && p[-1] == 's')) - Strcat(buf, "es"); /* boxes */ - else if(*p == 'y' && !index(vowels, p[-1])) - Strcpy(p, "ies"); /* rubies, zruties */ - else - Strcat(buf, "s"); - } -nopl: - if(obj->onamelth) { - Strcat(buf, " named "); - Strcat(buf, ONAME(obj)); - } - return(buf); -} - -char * -doname(obj) -struct obj *obj; -{ -char prefix[PREFIX]; -char *bp = xname(obj); - if(obj->quan != 1) - Sprintf(prefix, "%u ", obj->quan); - else - Strcpy(prefix, "a "); - switch(obj->olet) { - case AMULET_SYM: - if(strncmp(bp, "cheap ", 6)) - Strcpy(prefix, "the "); - break; - case ARMOR_SYM: - if(obj->owornmask & W_ARMOR) - Strcat(bp, " (being worn)"); - /* FALLTHROUGH */ - case WEAPON_SYM: - if(obj->known) { - Strcat(prefix, sitoa(obj->spe)); - Strcat(prefix, " "); - } - break; - case WAND_SYM: - if(obj->known) - Sprintf(eos(bp), " (%d)", obj->spe); - break; - case RING_SYM: - if(obj->owornmask & W_RINGR) Strcat(bp, " (on right hand)"); - if(obj->owornmask & W_RINGL) Strcat(bp, " (on left hand)"); - if(obj->known && (objects[obj->otyp].bits & SPEC)) { - Strcat(prefix, sitoa(obj->spe)); - Strcat(prefix, " "); - } - break; - } - if(obj->owornmask & W_WEP) - Strcat(bp, " (weapon in hand)"); - if(obj->unpaid) - Strcat(bp, " (unpaid)"); - if(!strcmp(prefix, "a ") && index(vowels, *bp)) - Strcpy(prefix, "an "); - bp = strprepend(bp, prefix); - return(bp); -} - -/* used only in hack.fight.c (thitu) */ -setan(str,buf) -char *str,*buf; -{ - if(index(vowels,*str)) - Sprintf(buf, "an %s", str); - else - Sprintf(buf, "a %s", str); -} - -char * -aobjnam(otmp,verb) struct obj *otmp; char *verb; { -char *bp = xname(otmp); -char prefix[PREFIX]; - if(otmp->quan != 1) { - Sprintf(prefix, "%u ", otmp->quan); - bp = strprepend(bp, prefix); - } - - if(verb) { - /* verb is given in plural (i.e., without trailing s) */ - Strcat(bp, " "); - if(otmp->quan != 1) - Strcat(bp, verb); - else if(!strcmp(verb, "are")) - Strcat(bp, "is"); - else { - Strcat(bp, verb); - Strcat(bp, "s"); - } - } - return(bp); -} - -char * -Doname(obj) -struct obj *obj; -{ - char *s = doname(obj); - - if('a' <= *s && *s <= 'z') *s -= ('a' - 'A'); - return(s); -} - -char *wrp[] = { "wand", "ring", "potion", "scroll", "gem" }; -char wrpsym[] = { WAND_SYM, RING_SYM, POTION_SYM, SCROLL_SYM, GEM_SYM }; - -struct obj * -readobjnam(bp) char *bp; { -char *p; -int i; -int cnt, spe, spesgn, typ, heavy; -char let; -char *un, *dn, *an; -/* int the = 0; char *oname = 0; */ - cnt = spe = spesgn = typ = heavy = 0; - let = 0; - an = dn = un = 0; - for(p = bp; *p; p++) - if('A' <= *p && *p <= 'Z') *p += 'a'-'A'; - if(!strncmp(bp, "the ", 4)){ -/* the = 1; */ - bp += 4; - } else if(!strncmp(bp, "an ", 3)){ - cnt = 1; - bp += 3; - } else if(!strncmp(bp, "a ", 2)){ - cnt = 1; - bp += 2; - } - if(!cnt && digit(*bp)){ - cnt = atoi(bp); - while(digit(*bp)) bp++; - while(*bp == ' ') bp++; - } - if(!cnt) cnt = 1; /* %% what with "gems" etc. ? */ - - if(*bp == '+' || *bp == '-'){ - spesgn = (*bp++ == '+') ? 1 : -1; - spe = atoi(bp); - while(digit(*bp)) bp++; - while(*bp == ' ') bp++; - } else { - p = rindex(bp, '('); - if(p) { - if(p > bp && p[-1] == ' ') p[-1] = 0; - else *p = 0; - p++; - spe = atoi(p); - while(digit(*p)) p++; - if(strcmp(p, ")")) spe = 0; - else spesgn = 1; - } - } - /* now we have the actual name, as delivered by xname, say - green potions called whisky - scrolls labeled "QWERTY" - egg - dead zruties - fortune cookies - very heavy iron ball named hoei - wand of wishing - elven cloak - */ - for(p = bp; *p; p++) if(!strncmp(p, " named ", 7)) { - *p = 0; -/* oname = p+7; */ - } - for(p = bp; *p; p++) if(!strncmp(p, " called ", 8)) { - *p = 0; - un = p+8; - } - for(p = bp; *p; p++) if(!strncmp(p, " labeled ", 9)) { - *p = 0; - dn = p+9; - } - - /* first change to singular if necessary */ - if(cnt != 1) { - /* find "cloves of garlic", "worthless pieces of blue glass" */ - for(p = bp; *p; p++) if(!strncmp(p, "s of ", 5)){ - while(*p = p[1]) p++; - goto sing; - } - /* remove -s or -es (boxes) or -ies (rubies, zruties) */ - p = eos(bp); - if(p[-1] == 's') { - if(p[-2] == 'e') { - if(p[-3] == 'i') { - if(!strcmp(p-7, "cookies")) - goto mins; - Strcpy(p-3, "y"); - goto sing; - } - - /* note: cloves / knives from clove / knife */ - if(!strcmp(p-6, "knives")) { - Strcpy(p-3, "fe"); - goto sing; - } - - /* note: nurses, axes but boxes */ - if(!strcmp(p-5, "boxes")) { - p[-2] = 0; - goto sing; - } - } - mins: - p[-1] = 0; - } else { - if(!strcmp(p-9, "homunculi")) { - Strcpy(p-1, "us"); /* !! makes string longer */ - goto sing; - } - if(!strcmp(p-5, "teeth")) { - Strcpy(p-5, "tooth"); - goto sing; - } - /* here we cannot find the plural suffix */ - } - } -sing: - if(!strcmp(bp, "amulet of yendor")) { - typ = AMULET_OF_YENDOR; - goto typfnd; - } - p = eos(bp); - if(!strcmp(p-5, " mail")){ /* Note: ring mail is not a ring ! */ - let = ARMOR_SYM; - an = bp; - goto srch; - } - for(i = 0; i < sizeof(wrpsym); i++) { - int j = strlen(wrp[i]); - if(!strncmp(bp, wrp[i], j)){ - let = wrpsym[i]; - bp += j; - if(!strncmp(bp, " of ", 4)) an = bp+4; - /* else if(*bp) ?? */ - goto srch; - } - if(!strcmp(p-j, wrp[i])){ - let = wrpsym[i]; - p -= j; - *p = 0; - if(p[-1] == ' ') p[-1] = 0; - dn = bp; - goto srch; - } - } - if(!strcmp(p-6, " stone")){ - p[-6] = 0; - let = GEM_SYM; - an = bp; - goto srch; - } - if(!strcmp(bp, "very heavy iron ball")){ - heavy = 1; - typ = HEAVY_IRON_BALL; - goto typfnd; - } - an = bp; -srch: - if(!an && !dn && !un) - goto any; - i = 1; - if(let) i = bases[letindex(let)]; - while(i <= NROFOBJECTS && (!let || objects[i].oc_olet == let)){ - char *zn = objects[i].oc_name; - - if(!zn) goto nxti; - if(an && strcmp(an, zn)) - goto nxti; - if(dn && (!(zn = objects[i].oc_descr) || strcmp(dn, zn))) - goto nxti; - if(un && (!(zn = objects[i].oc_uname) || strcmp(un, zn))) - goto nxti; - typ = i; - goto typfnd; - nxti: - i++; - } -any: - if(!let) let = wrpsym[rn2(sizeof(wrpsym))]; - typ = probtype(let); -typfnd: - { struct obj *otmp; - extern struct obj *mksobj(); - let = objects[typ].oc_olet; - otmp = mksobj(typ); - if(heavy) - otmp->owt += 15; - if(cnt > 0 && index("%?!*)", let) && - (cnt < 4 || (let == WEAPON_SYM && typ <= ROCK && cnt < 20))) - otmp->quan = cnt; - - if(spe > 3 && spe > otmp->spe) - spe = 0; - else if(let == WAND_SYM) - spe = otmp->spe; - if(spe == 3 && u.uluck < 0) - spesgn = -1; - if(let != WAND_SYM && spesgn == -1) - spe = -spe; - if(let == BALL_SYM) - spe = 0; - else if(let == AMULET_SYM) - spe = -1; - else if(typ == WAN_WISHING && rn2(10)) - spe = (rn2(10) ? -1 : 0); - otmp->spe = spe; - - if(spesgn == -1) - otmp->cursed = 1; - - return(otmp); - } -} diff --git a/games/hack/hack.options.c b/games/hack/hack.options.c deleted file mode 100644 index 7bd1baa197d4..000000000000 --- a/games/hack/hack.options.c +++ /dev/null @@ -1,204 +0,0 @@ -/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ -/* hack.options.c - version 1.0.3 */ -/* $FreeBSD$ */ - -#include -#include "config.h" -#include "hack.h" -extern char *eos(); - -initoptions() -{ - char *opts; - - flags.time = flags.nonews = flags.notombstone = flags.end_own = - flags.standout = flags.nonull = FALSE; - flags.no_rest_on_space = TRUE; - flags.invlet_constant = TRUE; - flags.end_top = 5; - flags.end_around = 4; - flags.female = FALSE; /* players are usually male */ - - if(opts = getenv("HACKOPTIONS")) - parseoptions(opts,TRUE); -} - -parseoptions(opts, from_env) -char *opts; -boolean from_env; -{ - char *op,*op2; - unsigned num; - boolean negated; - - if(op = index(opts, ',')) { - *op++ = 0; - parseoptions(op, from_env); - } - if(op = index(opts, ' ')) { - op2 = op; - while(*op++) - if(*op != ' ') *op2++ = *op; - } - if(!*opts) return; - negated = FALSE; - while((*opts == '!') || !strncmp(opts, "no", 2)) { - if(*opts == '!') opts++; else opts += 2; - negated = !negated; - } - - if(!strncmp(opts,"standout",8)) { - flags.standout = !negated; - return; - } - - if(!strncmp(opts,"null",3)) { - flags.nonull = negated; - return; - } - - if(!strncmp(opts,"tombstone",4)) { - flags.notombstone = negated; - return; - } - - if(!strncmp(opts,"news",4)) { - flags.nonews = negated; - return; - } - - if(!strncmp(opts,"time",4)) { - flags.time = !negated; - flags.botl = 1; - return; - } - - if(!strncmp(opts,"restonspace",4)) { - flags.no_rest_on_space = negated; - return; - } - - if(!strncmp(opts,"fixinv",4)) { - if(from_env) - flags.invlet_constant = !negated; - else - pline("The fixinvlet option must be in HACKOPTIONS."); - return; - } - - if(!strncmp(opts,"male",4)) { - flags.female = negated; - return; - } - if(!strncmp(opts,"female",6)) { - flags.female = !negated; - return; - } - - /* name:string */ - if(!strncmp(opts,"name",4)) { - extern char plname[PL_NSIZ]; - if(!from_env) { - pline("The playername can be set only from HACKOPTIONS."); - return; - } - op = index(opts,':'); - if(!op) goto bad; - (void) strncpy(plname, op+1, sizeof(plname)-1); - return; - } - - /* endgame:5t[op] 5a[round] o[wn] */ - if(!strncmp(opts,"endgame",3)) { - op = index(opts,':'); - if(!op) goto bad; - op++; - while(*op) { - num = 1; - if(digit(*op)) { - num = atoi(op); - while(digit(*op)) op++; - } else - if(*op == '!') { - negated = !negated; - op++; - } - switch(*op) { - case 't': - flags.end_top = num; - break; - case 'a': - flags.end_around = num; - break; - case 'o': - flags.end_own = !negated; - break; - default: - goto bad; - } - while(letter(*++op)) ; - if(*op == '/') op++; - } - return; - } -bad: - if(!from_env) { - if(!strncmp(opts, "help", 4)) { - pline("%s%s%s", -"To set options use `HACKOPTIONS=\"\"' in your environment, or ", -"give the command 'o' followed by the line `' while playing. ", -"Here is a list of