Trailing-Edge
-
PDP-10 Archives
-
decuslib20-03
-
decus/20-0078/demos/cat.sim
There are 4 other files named cat.sim in the archive. Click here to see a list.
00050 OPTIONS(/l);
00100 BEGIN
00150 EXTERNAL CHARACTER PROCEDURE getch, fetchar;
00200 EXTERNAL INTEGER PROCEDURE trmop, gettab, checkreal, checkint;
00250 EXTERNAL PROCEDURE echo, abort, outchr, depchar, forceout, outstring;
00300 EXTERNAL BOOLEAN PROCEDURE meny, tmpout;
00350 EXTERNAL TEXT PROCEDURE storbokstav, scanto, tmpin;
00400 EXTERNAL CLASS termty;
00450 EXTERNAL CLASS vista;
00500
00550 vista CLASS boardvista(boardwidth, boardheight);
00600 INTEGER boardwidth, boardheight;
00650 BEGIN
00700 INTEGER boardwidthm1, boardheightm1;
00750 PROCEDURE make_board;
00800 COMMENT
00850 ======================================================
00900 =======;
00950 COMMENT: Will make the whole screen blank. If
01000 boardheight
01050 and boardwidth are greater than zero,
01100 a board of this size
01150 is written on the screen;
01200 BEGIN
01250 INTEGER h, v;
01300 sysout.outimage;
01350 blank_the_screen;
01400 IF boardwidth > 0 AND boardheight > 0 THEN
01450 BEGIN
01500 COMMENT type screen border;
01550 home_the_cursor;
01600 FOR h:= -1 STEP 1 UNTIL boardwidth DO
01650 outchar('-');
01700 FOR v:= 1 STEP 1 UNTIL boardheight DO
01750 BEGIN
01800 set_char_on_screen('!',0,v);
01850 set_char_on_screen('!',boardwidth+1,v);
01900 END;
01950 move_the_cursor_to(0,boardheight+1);
02000 FOR h:= -1 STEP 1 UNTIL boardwidth DO
02050 outchar('-');
02100 END;
02150 home_the_cursor; breakoutimage;
02200 END;
02250 boardwidthm1:= boardwidth-1;
02300 boardheightm1:= boardheight-1;
02350 END;
02400
02450 INSPECT NEW boardvista(78, 16, sysin, sysout, FALSE, 0,
02500 NOTEXT, NOTEXT, 20, 8) DO
02550 BEGIN
02600 simulation BEGIN
02650 INTEGER numberofdeadrats, numberofsavedrats, exith,
02700 u;
02750 INTEGER numberofratholes;
02800 INTEGER playtime, number_of_fillers,
02850 sysin_strip_length;
02900 INTEGER avoidingdistance;
02950 REAL real_time_step, terminal_speed,
03000 rat_intelligence, ratfactor;
03050 TEXT blanks6;
03100 BOOLEAN direction_ordered;
03150 CHARACTER starter, direction;
03200 REF(rat) therat;
03250 REF(cat) thecat;
03300
03350 PROCEDURE setratfactor;
03400 BEGIN
03450 IF ratfactor < 0.5 THEN ratfactor:= 0.5 ELSE
03500 IF ratfactor >= 0.96 THEN ratfactor:= 0.96;
03550 ratfactor:= 0.005*(rat_intelligence+40);
03600 IF numberofratholes >= 0 THEN
03650 BEGIN
03700 move_the_cursor_to(45,4);
03750 outtext("Rat intelligence: ");
03800 outfix(rat_intelligence,0,4);
03850 home_the_cursor;
03900 END;
03950 END;
04000
04050
04100 PROCEDURE
04150 put_question_in_lower_left_corner(question);
04200 VALUE question; TEXT question;
04250 BEGIN
04300 move_the_cursor_to(0,boardheight+4);
04350 outtext(question);
04400 outimage; outtext(blanks6); outimage;
04450 outtext(blanks6);
04500 move_the_cursor_to(0,boardheight+5);
04550 END;
04600
04650 process CLASS animal;
04700 BEGIN INTEGER v, h, vnew, hnew;
04750 END;
04800