* The Regents of the University of California. All rights reserved.
* This code is derived from software contributed to Berkeley by
* %sccs.include.redist.c%
static char sccsid
[] = "@(#)bdisp.c 8.1 (Berkeley) %G%";
#define SCRNH 24 /* assume 24 lines for the moment */
#define SCRNW 80 /* assume 80 chars for the moment */
* Initialize screen display.
* Restore screen display.
* Initialize board display.
for (i
= 1; i
< BSZ1
; i
++) {
/* left and right edges */
for (j
= BSZ1
; --j
> 0; ) {
move(20 - j
, 2 * BSZ1
+ 1);
for (i
= 1; i
< BSZ1
; i
++) {
* Update who is playing whom.
i
= 6 - strlen(plyr
[BLACK
]) / 2;
printw("BLACK/%s", plyr
[BLACK
]);
i
= 30 - strlen(plyr
[WHITE
]) / 2;
printw("WHITE/%s", plyr
[WHITE
]);
* Update the board display after a move.
register struct spotstr
*sp
;
for (j
= BSZ1
; --j
> 0; ) {
for (i
= 1; i
< BSZ1
; i
++) {
move(BSZ1
- j
, 2 * i
+ 1);
sp
= &board
[i
+ j
* BSZ1
];
if (debug
> 1 && sp
->s_occ
== EMPTY
) {
if (sp
->s_flg
& IFLAGALL
)
else if (sp
->s_flg
& CFLAGALL
)
* Dump board display to a file.
register struct spotstr
*sp
;
fprintf(fp
, " A B C D E F G H J K L M N O P Q R S T\n");
for (j
= BSZ1
; --j
> 0; ) {
for (i
= 1; i
< BSZ1
; i
++) {
sp
= &board
[i
+ j
* BSZ1
];
if (debug
> 1 && sp
->s_occ
== EMPTY
) {
if (sp
->s_flg
& IFLAGALL
)
else if (sp
->s_flg
& CFLAGALL
)
fprintf(fp
, " A B C D E F G H J K L M N O P Q R S T\n");
* Display a transcript entry
if (++lastline
>= SCRNH
- 1) {
if (strlen(str
) >= SCRNW
- 46)
str
[SCRNW
- 46 - 1] = '\0';
end
= buf
+ size
- 1; /* save room for the '\0' */
while (cp
< end
&& (c
= getchar()) != EOF
&& c
!= '\n' && c
!= '\r') {