smk@axiom.UUCP (Steven M. Kramer) (08/01/85)
I saw two problems with Othello. The first is a dereferencing of *argv which is null after the last arg. The second is that the compiler we have could not handle the expressions. Rather than change the compiler (which is what we really should do), I made the simple fix to score.c below. Otherwise, a really nice game. user.y ------ 10a11,12 > #define bug1 /* Steve Kramer -- fixed dereferencing null problem */ > 378a381,383 > #ifdef bug1 > while ((*++argv != NULL) && (**argv == '-')) { > #else bug1 379a385 > #endif bug1 score.c ------- 73a74,108 > #ifdef AXIOM > /* The other expression was too compex for the > MIT compiler to handle. > Steve Kramer Axiom 7/31/85 > */ > { > register int score1; > register int score2; > register int score3; > register int score4; > > score1 = > cornerscores[board[1][1] + 1] > [board[1][2] + 1] > [board[2][1] + 1] > [board[2][2] + 1]; > score2 = > cornerscores[board[1][8] + 1] > [board[1][7] + 1] > [board[2][8] + 1] > [board[2][7] + 1]; > score3 = > cornerscores[board[8][1] + 1] > [board[8][2] + 1] > [board[7][1] + 1] > [board[7][2] + 1]; > score4 = > cornerscores[board[8][8] + 1] > [board[8][7] + 1] > [board[7][8] + 1] > [board[7][7] + 1]; > > score += score1 + score2 + score3 + score4; > } > #else AXIOM 90a126 > #endif AXIOM Subject: bug in othello (reversi) Newsgroups: net.sources.bugs net.sources.games I saw two problems with Othello. The first is a dereferencing of *argv which is null after the last arg. The second is that the compiler we have could not handle the expressions. Rather than change the compiler (which is what we really should do), I made the simple fix to score.c below. Otherwise, a really nice game. user.y ------ 10a11,12 > #define bug1 /* Steve Kramer -- fixed dereferencing null problem */ > 378a381,383 > #ifdef bug1 > while ((*++argv != NULL) && (**argv == '-')) { > #else bug1 379a385 > #endif bug1 score.c ------- 73a74,108 > #ifdef AXIOM > /* The other expression was too compex for the > MIT compiler to handle. > Steve Kramer Axiom 7/31/85 > */ > { > register int score1; > register int score2; > register int score3; > register int score4; > > score1 = > cornerscores[board[1][1] + 1] > [board[1][2] + 1] > [board[2][1] + 1] > [board[2][2] + 1]; > score2 = > cornerscores[board[1][8] + 1] > [board[1][7] + 1] > [board[2][8] + 1] > [board[2][7] + 1]; > score3 = > cornerscores[board[8][1] + 1] > [board[8][2] + 1] > [board[7][1] + 1] > [board[7][2] + 1]; > score4 = > cornerscores[board[8][8] + 1] > [board[8][7] + 1] > [board[7][8] + 1] > [board[7][7] + 1]; > > score += score1 + score2 + score3 + score4; > } > #else AXIOM 90a126 > #endif AXIOM -- --steve kramer {allegra,genrad,ihnp4,utzoo,philabs,uw-beaver}!linus!axiom!smk (UUCP) linus!axiom!smk@mitre-bedford (MIL)