* Copyright (c) 1980 Regents of the University of California.
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by the University of California, Berkeley. The name of the
* University may not be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
static char sccsid
[] = "@(#)move_robs.c 5.3 (Berkeley) %G%";
signal(SIGALRM
, move_robots
);
for (rp
= Robots
; rp
< &Robots
[MAXROBOTS
]; rp
++) {
mvaddch(rp
->y
, rp
->x
, ' ');
rp
->y
+= sign(My_pos
.y
- rp
->y
);
rp
->x
+= sign(My_pos
.x
- rp
->x
);
else if (rp
->y
>= Y_FIELDSIZE
)
else if (rp
->x
>= X_FIELDSIZE
)
for (rp
= Robots
; rp
< &Robots
[MAXROBOTS
]; rp
++)
else if (rp
->y
== My_pos
.y
&& rp
->x
== My_pos
.x
)
else if (Field
[rp
->y
][rp
->x
] > 1) {
mvaddch(rp
->y
, rp
->x
, HEAP
);
mvaddch(rp
->y
, rp
->x
, ROBOT
);
if (Dead
|| Num_robots
<= 0)
* Add a score to the overall point total
* Return the sign of the number