| Rules Applied | JavaKeywordRule | app0.txt | PPspaceRule | PPifndefRule | PPRule | PPdefineRule.DefineReplacementRule | snippets0b.txt | TypedefRule.DefineReplacementRule | FunctionPointerReferenceRule | OneDeclarationPerLineRule | ArrayDeclaration0Rule | AddBracesRule | LabelRemoverRule | voidstarsnippet.txt | ConflictingVariableDeclarationRule | StaticVariablesRule | StaticFunctionsRule | ArrayDeclarationRule | StringRule | DeclarationAssignmentRule | PointerRule | BooleanVariableRule | ForceToBooleanRule | snippets2.txt | snippets2a.txt | snippets3.txt | PrintfRule | stdin.txt | UninitializedVariableRule | InsertClassRule | (Final Version) | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| JavaKeywordRule app0.txt PPspaceRule PPifndefRule PPRule PPdefineRule.DefineReplacementRule snippets0b.txt TypedefRule.DefineReplacementRule FunctionPointerReferenceRule OneDeclarationPerLineRule ArrayDeclaration0Rule AddBracesRule LabelRemoverRule voidstarsnippet.txt ConflictingVariableDeclarationRule StaticVariablesRule StaticFunctionsRule ArrayDeclarationRule StringRule DeclarationAssignmentRule PointerRule BooleanVariableRule ForceToBooleanRule snippets2.txt snippets2a.txt snippets3.txt PrintfRule stdin.txt UninitializedVariableRule InsertClassRule final | #ifndef lint
static char sccsid[] = "@(#)print.c 5.4 (Berkeley) 6/1/90";
#endif
# include "monop.ext"
static char buf[80],
* header = "Name Own Price Mg # Rent";
void printboard(void) {
regint i;
printf("%s\t%s\n", header, header);
for (i = 0;i < N_SQRS / 2;i++) {
printsq(i, FALSE);
putchar('\t');
printsq(i + N_SQRS / 2, TRUE);
}
}
void where(void) {
regint i;
char * bsp;
printf("%s Player\n", header);
for (i = 0;i < num_play;i++) {
printsq(play[i].loc, FALSE);
printf(" %s (%d)", play[i].name, i + 1);
if (cur_p == & play[i]) printf(" *");
putchar('\n');
}
}
void printsq(int sqn, register char eoln) {
regint rnt;
reg PROP * pp;
reg SQUARE * sqp;
int i;
sqp = & board[sqn];
printf("%-10.10s", sqp->name);
switch (sqp->type) {
case SAFE:
case CC:
case CHANCE:
case INC_TAX:
case GOTO_J:
case LUX_TAX:
case IN_JAIL:
spec:if (!eoln) printf(" ");
break;
case PRPTY:
pp = sqp->desc;
if (sqp->owner < 0) {
printf(" - %-8.8s %3d", pp->mon_desc->name, sqp->cost);
if (!eoln) printf(" ");
break;
}
printf(" %d %-8.8s %3d", sqp->owner + 1, pp->mon_desc->name, sqp->cost);
printmorg(sqp);
if (pp->monop) {
if (pp->houses < 5) if (pp->houses > 0) printf("%d %4d", pp->houses, pp->rent[pp->houses]);
else printf("0 %4d", pp->rent[0] * 2);
else printf("H %4d", pp->rent[5]);
}
else printf(" %4d", pp->rent[0]);
break;
case UTIL:
if (sqp->owner < 0) {
printf(" - 150");
if (!eoln) printf(" ");
break;
}
printf(" %d 150", sqp->owner + 1);
printmorg(sqp);
printf("%d", play[sqp->owner].num_util);
if (!eoln) printf(" ");
break;
case RR:
if (sqp->owner < 0) {
printf(" - Railroad 200");
if (!eoln) printf(" ");
break;
}
printf(" %d Railroad 200", sqp->owner + 1);
printmorg(sqp);
rnt = 25;
rnt <<= play[sqp->owner].num_rr - 1;
printf("%d %4d", play[sqp->owner].num_rr, 25 << (play[sqp->owner].num_rr - 1));
break;
}
if (eoln) putchar('\n');
}
void printmorg(register SQUARE * sqp) {
if (sqp->desc->morg) printf(" * ");
else printf(" ");
}
void printhold(register int pl) {
reg OWN * op;
reg PLAY * pp;
char * bsp;
pp = & play[pl];
printf("%s's (%d) holdings (Total worth: $%d):\n", name_list[pl], pl + 1, pp->money + prop_worth(pp));
printf("\t$%d", pp->money);
if (pp->num_gojf) {
printf(", %d get-out-of-jail-free card", pp->num_gojf);
if (pp->num_gojf > 1) putchar('s');
}
putchar('\n');
if (pp->own_list) {
printf("\t%s\n", header);
for (op = pp->own_list;op;op = op->next) {
putchar('\t');
printsq(sqnum(op->sqr) , TRUE);
}
}
}
| #ifndef lint
static char sccsid[] = "@(#)print.c 5.4 (Berkeley) 6/1/90";
#endif
# include "monop.ext"
static char buf[80],
* header = "Name Own Price Mg # Rent";
void printBoard(void) {
regint i;
printf("%s\t%s\n", header, header);
for (i = 0;i < NUMBER_OF_SQUARES / 2;i++) {
printSquare(i, FALSE);
putchar('\t');
printSquare(i + NUMBER_OF_SQUARES / 2, TRUE);
}
}
void printPlayerLocations(void) {
regint i;
char * bsp;
printf("%s Player\n", header);
for (i = 0;i < numberOfPlayers;i++) {
printSquare(players[i].location, FALSE);
printf(" %s (%d)", players[i].name, i + 1);
if (currentPlayer == & players[i]) printf(" *");
putchar('\n');
}
}
void printSquare(int squareIndex, register char printEndOfLine) {
regint rentAmount;
reg PROP * property;
reg SQUARE * square;
int i;
square = & board[squareIndex];
printf("%-10.10s", square->name);
switch (square->type) {
case TYPE_SAFE:
case TYPE_COMMUNITY_CHEST:
case TYPE_CHANCE:
case TYPE_INCOME_TAX:
case TYPE_GOTO_JAIL:
case TYPE_LUXURY_TAX:
case TYPE_IN_JAIL:
isSpecialCard:if (!printEndOfLine) printf(" ");
break;
case TYPE_PROPERTY:
property = square->description;
if (square->owner < 0) {
printf(" - %-8.8s %3d", property->monopolyDescription->name, square->cost);
if (!printEndOfLine) printf(" ");
break;
}
printf(" %d %-8.8s %3d", square->owner + 1, property->monopolyDescription->name, square->cost);
printMortgaged(square);
if (property->isMonopoly) {
if (property->houseCount < 5) if (property->houseCount > 0) printf("%d %4d", property->houseCount, property->rent[property->houseCount]);
else printf("0 %4d", property->rent[0] * 2);
else printf("H %4d", property->rent[5]);
}
else printf(" %4d", property->rent[0]);
break;
case TYPE_UTIL:
if (square->owner < 0) {
printf(" - 150");
if (!printEndOfLine) printf(" ");
break;
}
printf(" %d 150", square->owner + 1);
printMortgaged(square);
printf("%d", players[square->owner].utilitiesCount);
if (!printEndOfLine) printf(" ");
break;
case TYPE_RAILROAD:
if (square->owner < 0) {
printf(" - Railroad 200");
if (!printEndOfLine) printf(" ");
break;
}
printf(" %d Railroad 200", square->owner + 1);
printMortgaged(square);
rentAmount = 25;
rentAmount <<= players[square->owner].railroadCardCount - 1;
printf("%d %4d", players[square->owner].railroadCardCount, 25 << (players[square->owner].railroadCardCount - 1));
break;
}
if (printEndOfLine) putchar('\n');
}
void printMortgaged(register SQUARE * square) {
if (square->description->isMortgaged) printf(" * ");
else printf(" ");
}
void printHoldings(register int playerIndex) {
reg OWN * propertyList;
reg PLAY * property;
char * bsp;
property = & players[playerIndex];
printf("%s's (%d) holdings (Total worth: $%d):\n", playerNames[playerIndex], playerIndex + 1, property->money + getPropertyWorth(property));
printf("\t$%d", property->money);
if (property->getOutOfJailFreeCardCount) {
printf(", %d get-out-of-jail-free card", property->getOutOfJailFreeCardCount);
if (property->getOutOfJailFreeCardCount > 1) putchar('s');
}
putchar('\n');
if (property->ownedPropertyList) {
printf("\t%s\n", header);
for (propertyList = property->ownedPropertyList;propertyList;propertyList = propertyList->next) {
putchar('\t');
printSquare(getSquareIndex(propertyList->square1) , TRUE);
}
}
}
| #ifndef lint
static char sccsid[] = "@(#)print.c 5.4 (Berkeley) 6/1/90";
#endif
#include "monop.ext"
static char buf[80],
* header = "Name Own Price Mg # Rent";
void printBoard(void) {
regint i;
printf("%s\t%s\n", header, header);
for (i = 0;i < NUMBER_OF_SQUARES / 2;i++) {
printSquare(i, FALSE);
putchar('\t');
printSquare(i + NUMBER_OF_SQUARES / 2, TRUE);
}
}
void printPlayerLocations(void) {
regint i;
char * bsp;
printf("%s Player\n", header);
for (i = 0;i < numberOfPlayers;i++) {
printSquare(players[i].location, FALSE);
printf(" %s (%d)", players[i].name, i + 1);
if (currentPlayer == & players[i]) printf(" *");
putchar('\n');
}
}
void printSquare(int squareIndex, register char printEndOfLine) {
regint rentAmount;
reg PROP * property;
reg SQUARE * square;
int i;
square = & board[squareIndex];
printf("%-10.10s", square->name);
switch (square->type) {
case TYPE_SAFE:
case TYPE_COMMUNITY_CHEST:
case TYPE_CHANCE:
case TYPE_INCOME_TAX:
case TYPE_GOTO_JAIL:
case TYPE_LUXURY_TAX:
case TYPE_IN_JAIL:
isSpecialCard:if (!printEndOfLine) printf(" ");
break;
case TYPE_PROPERTY:
property = square->description;
if (square->owner < 0) {
printf(" - %-8.8s %3d", property->monopolyDescription->name, square->cost);
if (!printEndOfLine) printf(" ");
break;
}
printf(" %d %-8.8s %3d", square->owner + 1, property->monopolyDescription->name, square->cost);
printMortgaged(square);
if (property->isMonopoly) {
if (property->houseCount < 5) if (property->houseCount > 0) printf("%d %4d", property->houseCount, property->rent[property->houseCount]);
else printf("0 %4d", property->rent[0] * 2);
else printf("H %4d", property->rent[5]);
}
else printf(" %4d", property->rent[0]);
break;
case TYPE_UTIL:
if (square->owner < 0) {
printf(" - 150");
if (!printEndOfLine) printf(" ");
break;
}
printf(" %d 150", square->owner + 1);
printMortgaged(square);
printf("%d", players[square->owner].utilitiesCount);
if (!printEndOfLine) printf(" ");
break;
case TYPE_RAILROAD:
if (square->owner < 0) {
printf(" - Railroad 200");
if (!printEndOfLine) printf(" ");
break;
}
printf(" %d Railroad 200", square->owner + 1);
printMortgaged(square);
rentAmount = 25;
rentAmount <<= players[square->owner].railroadCardCount - 1;
printf("%d %4d", players[square->owner].railroadCardCount, 25 << (players[square->owner].railroadCardCount - 1));
break;
}
if (printEndOfLine) putchar('\n');
}
void printMortgaged(register SQUARE * square) {
if (square->description->isMortgaged) printf(" * ");
else printf(" ");
}
void printHoldings(register int playerIndex) {
reg OWN * propertyList;
reg PLAY * property;
char * bsp;
property = & players[playerIndex];
printf("%s's (%d) holdings (Total worth: $%d):\n", playerNames[playerIndex], playerIndex + 1, property->money + getPropertyWorth(property));
printf("\t$%d", property->money);
if (property->getOutOfJailFreeCardCount) {
printf(", %d get-out-of-jail-free card", property->getOutOfJailFreeCardCount);
if (property->getOutOfJailFreeCardCount > 1) putchar('s');
}
putchar('\n');
if (property->ownedPropertyList) {
printf("\t%s\n", header);
for (propertyList = property->ownedPropertyList;propertyList;propertyList = propertyList->next) {
putchar('\t');
printSquare(getSquareIndex(propertyList->square1) , TRUE);
}
}
}
| #if !defined(lint)
static char sccsid[] = "@(#)print.c 5.4 (Berkeley) 6/1/90";
#endif
#include "monop.ext"
static char buf[80],
* header = "Name Own Price Mg # Rent";
void printBoard(void) {
regint i;
printf("%s\t%s\n", header, header);
for (i = 0;i < NUMBER_OF_SQUARES / 2;i++) {
printSquare(i, FALSE);
putchar('\t');
printSquare(i + NUMBER_OF_SQUARES / 2, TRUE);
}
}
void printPlayerLocations(void) {
regint i;
char * bsp;
printf("%s Player\n", header);
for (i = 0;i < numberOfPlayers;i++) {
printSquare(players[i].location, FALSE);
printf(" %s (%d)", players[i].name, i + 1);
if (currentPlayer == & players[i]) printf(" *");
putchar('\n');
}
}
void printSquare(int squareIndex, register char printEndOfLine) {
regint rentAmount;
reg PROP * property;
reg SQUARE * square;
int i;
square = & board[squareIndex];
printf("%-10.10s", square->name);
switch (square->type) {
case TYPE_SAFE:
case TYPE_COMMUNITY_CHEST:
case TYPE_CHANCE:
case TYPE_INCOME_TAX:
case TYPE_GOTO_JAIL:
case TYPE_LUXURY_TAX:
case TYPE_IN_JAIL:
isSpecialCard:if (!printEndOfLine) printf(" ");
break;
case TYPE_PROPERTY:
property = square->description;
if (square->owner < 0) {
printf(" - %-8.8s %3d", property->monopolyDescription->name, square->cost);
if (!printEndOfLine) printf(" ");
break;
}
printf(" %d %-8.8s %3d", square->owner + 1, property->monopolyDescription->name, square->cost);
printMortgaged(square);
if (property->isMonopoly) {
if (property->houseCount < 5) if (property->houseCount > 0) printf("%d %4d", property->houseCount, property->rent[property->houseCount]);
else printf("0 %4d", property->rent[0] * 2);
else printf("H %4d", property->rent[5]);
}
else printf(" %4d", property->rent[0]);
break;
case TYPE_UTIL:
if (square->owner < 0) {
printf(" - 150");
if (!printEndOfLine) printf(" ");
break;
}
printf(" %d 150", square->owner + 1);
printMortgaged(square);
printf("%d", players[square->owner].utilitiesCount);
if (!printEndOfLine) printf(" ");
break;
case TYPE_RAILROAD:
if (square->owner < 0) {
printf(" - Railroad 200");
if (!printEndOfLine) printf(" ");
break;
}
printf(" %d Railroad 200", square->owner + 1);
printMortgaged(square);
rentAmount = 25;
rentAmount <<= players[square->owner].railroadCardCount - 1;
printf("%d %4d", players[square->owner].railroadCardCount, 25 << (players[square->owner].railroadCardCount - 1));
break;
}
if (printEndOfLine) putchar('\n');
}
void printMortgaged(register SQUARE * square) {
if (square->description->isMortgaged) printf(" * ");
else printf(" ");
}
void printHoldings(register int playerIndex) {
reg OWN * propertyList;
reg PLAY * property;
char * bsp;
property = & players[playerIndex];
printf("%s's (%d) holdings (Total worth: $%d):\n", playerNames[playerIndex], playerIndex + 1, property->money + getPropertyWorth(property));
printf("\t$%d", property->money);
if (property->getOutOfJailFreeCardCount) {
printf(", %d get-out-of-jail-free card", property->getOutOfJailFreeCardCount);
if (property->getOutOfJailFreeCardCount > 1) putchar('s');
}
putchar('\n');
if (property->ownedPropertyList) {
printf("\t%s\n", header);
for (propertyList = property->ownedPropertyList;propertyList;propertyList = propertyList->next) {
putchar('\t');
printSquare(getSquareIndex(propertyList->square1) , TRUE);
}
}
}
| static char sccsid[] = "@(#)print.c 5.4 (Berkeley) 6/1/90";
static char buf[80],
* header = "Name Own Price Mg # Rent";
void printBoard(void) {
regint i;
printf("%s\t%s\n", header, header);
for (i = 0;i < NUMBER_OF_SQUARES / 2;i++) {
printSquare(i, FALSE);
putchar('\t');
printSquare(i + NUMBER_OF_SQUARES / 2, TRUE);
}
}
void printPlayerLocations(void) {
regint i;
char * bsp;
printf("%s Player\n", header);
for (i = 0;i < numberOfPlayers;i++) {
printSquare(players[i].location, FALSE);
printf(" %s (%d)", players[i].name, i + 1);
if (currentPlayer == & players[i]) printf(" *");
putchar('\n');
}
}
void printSquare(int squareIndex, register char printEndOfLine) {
regint rentAmount;
reg PROP * property;
reg SQUARE * square;
int i;
square = & board[squareIndex];
printf("%-10.10s", square->name);
switch (square->type) {
case TYPE_SAFE:
case TYPE_COMMUNITY_CHEST:
case TYPE_CHANCE:
case TYPE_INCOME_TAX:
case TYPE_GOTO_JAIL:
case TYPE_LUXURY_TAX:
case TYPE_IN_JAIL:
isSpecialCard:if (!printEndOfLine) printf(" ");
break;
case TYPE_PROPERTY:
property = square->description;
if (square->owner < 0) {
printf(" - %-8.8s %3d", property->monopolyDescription->name, square->cost);
if (!printEndOfLine) printf(" ");
break;
}
printf(" %d %-8.8s %3d", square->owner + 1, property->monopolyDescription->name, square->cost);
printMortgaged(square);
if (property->isMonopoly) {
if (property->houseCount < 5) if (property->houseCount > 0) printf("%d %4d", property->houseCount, property->rent[property->houseCount]);
else printf("0 %4d", property->rent[0] * 2);
else printf("H %4d", property->rent[5]);
}
else printf(" %4d", property->rent[0]);
break;
case TYPE_UTIL:
if (square->owner < 0) {
printf(" - 150");
if (!printEndOfLine) printf(" ");
break;
}
printf(" %d 150", square->owner + 1);
printMortgaged(square);
printf("%d", players[square->owner].utilitiesCount);
if (!printEndOfLine) printf(" ");
break;
case TYPE_RAILROAD:
if (square->owner < 0) {
printf(" - Railroad 200");
if (!printEndOfLine) printf(" ");
break;
}
printf(" %d Railroad 200", square->owner + 1);
printMortgaged(square);
rentAmount = 25;
rentAmount <<= players[square->owner].railroadCardCount - 1;
printf("%d %4d", players[square->owner].railroadCardCount, 25 << (players[square->owner].railroadCardCount - 1));
break;
}
if (printEndOfLine) putchar('\n');
}
void printMortgaged(register SQUARE * square) {
if (square->description->isMortgaged) printf(" * ");
else printf(" ");
}
void printHoldings(register int playerIndex) {
reg OWN * propertyList;
reg PLAY * property;
char * bsp;
property = & players[playerIndex];
printf("%s's (%d) holdings (Total worth: $%d):\n", playerNames[playerIndex], playerIndex + 1, property->money + getPropertyWorth(property));
printf("\t$%d", property->money);
if (property->getOutOfJailFreeCardCount) {
printf(", %d get-out-of-jail-free card", property->getOutOfJailFreeCardCount);
if (property->getOutOfJailFreeCardCount > 1) putchar('s');
}
putchar('\n');
if (property->ownedPropertyList) {
printf("\t%s\n", header);
for (propertyList = property->ownedPropertyList;propertyList;propertyList = propertyList->next) {
putchar('\t');
printSquare(getSquareIndex(propertyList->square1) , TRUE);
}
}
}
| static char sccsid[] = "@(#)print.c 5.4 (Berkeley) 6/1/90";
static char buf[80],
* header = "Name Own Price Mg # Rent";
void printBoard(void) {
register int i;
printf("%s\t%s\n", header, header);
for (i = 0;i < NUMBER_OF_SQUARES / 2;i++) {
printSquare(i, false);
putchar('\t');
printSquare(i + NUMBER_OF_SQUARES / 2, true);
}
}
void printPlayerLocations(void) {
register int i;
char * bsp;
printf("%s Player\n", header);
for (i = 0;i < numberOfPlayers;i++) {
printSquare(players[i].location, false);
printf(" %s (%d)", players[i].name, i + 1);
if (currentPlayer == & players[i]) printf(" *");
putchar('\n');
}
}
void printSquare(int squareIndex, register char printEndOfLine) {
register int rentAmount;
register PROP * property;
register SQUARE * square;
int i;
square = & board[squareIndex];
printf("%-10.10s", square->name);
switch (square->type) {
case TYPE_SAFE:
case TYPE_COMMUNITY_CHEST:
case TYPE_CHANCE:
case TYPE_INCOME_TAX:
case TYPE_GOTO_JAIL:
case TYPE_LUXURY_TAX:
case TYPE_IN_JAIL:
isSpecialCard:if (!printEndOfLine) printf(" ");
break;
case TYPE_PROPERTY:
property = square->description;
if (square->owner < 0) {
printf(" - %-8.8s %3d", property->monopolyDescription->name, square->cost);
if (!printEndOfLine) printf(" ");
break;
}
printf(" %d %-8.8s %3d", square->owner + 1, property->monopolyDescription->name, square->cost);
printMortgaged(square);
if (property->isMonopoly) {
if (property->houseCount < 5) if (property->houseCount > 0) printf("%d %4d", property->houseCount, property->rent[property->houseCount]);
else printf("0 %4d", property->rent[0] * 2);
else printf("H %4d", property->rent[5]);
}
else printf(" %4d", property->rent[0]);
break;
case TYPE_UTIL:
if (square->owner < 0) {
printf(" - 150");
if (!printEndOfLine) printf(" ");
break;
}
printf(" %d 150", square->owner + 1);
printMortgaged(square);
printf("%d", players[square->owner].utilitiesCount);
if (!printEndOfLine) printf(" ");
break;
case TYPE_RAILROAD:
if (square->owner < 0) {
printf(" - Railroad 200");
if (!printEndOfLine) printf(" ");
break;
}
printf(" %d Railroad 200", square->owner + 1);
printMortgaged(square);
rentAmount = 25;
rentAmount <<= players[square->owner].railroadCardCount - 1;
printf("%d %4d", players[square->owner].railroadCardCount, 25 << (players[square->owner].railroadCardCount - 1));
break;
}
if (printEndOfLine) putchar('\n');
}
void printMortgaged(register SQUARE * square) {
if (square->description->isMortgaged) printf(" * ");
else printf(" ");
}
void printHoldings(register int playerIndex) {
register OWN * propertyList;
register PLAY * property;
char * bsp;
property = & players[playerIndex];
printf("%s's (%d) holdings (Total worth: $%d):\n", playerNames[playerIndex], playerIndex + 1, property->money + getPropertyWorth(property));
printf("\t$%d", property->money);
if (property->getOutOfJailFreeCardCount) {
printf(", %d get-out-of-jail-free card", property->getOutOfJailFreeCardCount);
if (property->getOutOfJailFreeCardCount > 1) putchar('s');
}
putchar('\n');
if (property->ownedPropertyList) {
printf("\t%s\n", header);
for (propertyList = property->ownedPropertyList;propertyList;propertyList = propertyList->next) {
putchar('\t');
printSquare(getSquareIndex(propertyList->square1) , true);
}
}
}
| static char sccsid[] = "@(#)print.c 5.4 (Berkeley) 6/1/90";
static char buf[80],
* header = "Name Own Price Mg # Rent";
void printBoard(void) {
int i;
printf("%s\t%s\n", header, header);
for (i = 0;i < NUMBER_OF_SQUARES / 2;i++) {
printSquare(i, false);
putchar('\t');
printSquare(i + NUMBER_OF_SQUARES / 2, true);
}
}
void printPlayerLocations(void) {
int i;
char * bsp;
printf("%s Player\n", header);
for (i = 0;i < numberOfPlayers;i++) {
printSquare(players[i].location, false);
printf(" %s (%d)", players[i].name, i + 1);
if (currentPlayer == & players[i]) printf(" *");
putchar('\n');
}
}
void printSquare(int squareIndex, char printEndOfLine) {
int rentAmount;
PROP * property;
SQUARE * square;
int i;
square = & board[squareIndex];
printf("%-10.10s", square->name);
switch (square->type) {
case TYPE_SAFE:
case TYPE_COMMUNITY_CHEST:
case TYPE_CHANCE:
case TYPE_INCOME_TAX:
case TYPE_GOTO_JAIL:
case TYPE_LUXURY_TAX:
case TYPE_IN_JAIL:
isSpecialCard:if (!printEndOfLine) printf(" ");
break;
case TYPE_PROPERTY:
property = square->description;
if (square->owner < 0) {
printf(" - %-8.8s %3d", property->monopolyDescription->name, square->cost);
if (!printEndOfLine) printf(" ");
break;
}
printf(" %d %-8.8s %3d", square->owner + 1, property->monopolyDescription->name, square->cost);
printMortgaged(square);
if (property->isMonopoly) {
if (property->houseCount < 5) if (property->houseCount > 0) printf("%d %4d", property->houseCount, property->rent[property->houseCount]);
else printf("0 %4d", property->rent[0] * 2);
else printf("H %4d", property->rent[5]);
}
else printf(" %4d", property->rent[0]);
break;
case TYPE_UTIL:
if (square->owner < 0) {
printf(" - 150");
if (!printEndOfLine) printf(" ");
break;
}
printf(" %d 150", square->owner + 1);
printMortgaged(square);
printf("%d", players[square->owner].utilitiesCount);
if (!printEndOfLine) printf(" ");
break;
case TYPE_RAILROAD:
if (square->owner < 0) {
printf(" - Railroad 200");
if (!printEndOfLine) printf(" ");
break;
}
printf(" %d Railroad 200", square->owner + 1);
printMortgaged(square);
rentAmount = 25;
rentAmount <<= players[square->owner].railroadCardCount - 1;
printf("%d %4d", players[square->owner].railroadCardCount, 25 << (players[square->owner].railroadCardCount - 1));
break;
}
if (printEndOfLine) putchar('\n');
}
void printMortgaged(SQUARE * square) {
if (square->description->isMortgaged) printf(" * ");
else printf(" ");
}
void printHoldings(int playerIndex) {
OWN * propertyList;
PLAY * property;
char * bsp;
property = & players[playerIndex];
printf("%s's (%d) holdings (Total worth: $%d):\n", playerNames[playerIndex], playerIndex + 1, property->money + getPropertyWorth(property));
printf("\t$%d", property->money);
if (property->getOutOfJailFreeCardCount) {
printf(", %d get-out-of-jail-free card", property->getOutOfJailFreeCardCount);
if (property->getOutOfJailFreeCardCount > 1) putchar('s');
}
putchar('\n');
if (property->ownedPropertyList) {
printf("\t%s\n", header);
for (propertyList = property->ownedPropertyList;propertyList;propertyList = propertyList->next) {
putchar('\t');
printSquare(getSquareIndex(propertyList->square1) , true);
}
}
}
| static char sccsid[] = "@(#)print.c 5.4 (Berkeley) 6/1/90";
static char buf[80],
* header = "Name Own Price Mg # Rent";
void printBoard(void) {
int i;
printf("%s\t%s\n", header, header);
for (i = 0;i < NUMBER_OF_SQUARES / 2;i++) {
printSquare(i, false);
putchar('\t');
printSquare(i + NUMBER_OF_SQUARES / 2, true);
}
}
void printPlayerLocations(void) {
int i;
char * bsp;
printf("%s Player\n", header);
for (i = 0;i < numberOfPlayers;i++) {
printSquare(players[i].location, false);
printf(" %s (%d)", players[i].name, i + 1);
if (currentPlayer == & players[i]) printf(" *");
putchar('\n');
}
}
void printSquare(int squareIndex, char printEndOfLine) {
int rentAmount;
Property * property;
Square * square;
int i;
square = & board[squareIndex];
printf("%-10.10s", square->name);
switch (square->type) {
case TYPE_SAFE:
case TYPE_COMMUNITY_CHEST:
case TYPE_CHANCE:
case TYPE_INCOME_TAX:
case TYPE_GOTO_JAIL:
case TYPE_LUXURY_TAX:
case TYPE_IN_JAIL:
isSpecialCard:if (!printEndOfLine) printf(" ");
break;
case TYPE_PROPERTY:
property = square->description;
if (square->owner < 0) {
printf(" - %-8.8s %3d", property->monopolyDescription->name, square->cost);
if (!printEndOfLine) printf(" ");
break;
}
printf(" %d %-8.8s %3d", square->owner + 1, property->monopolyDescription->name, square->cost);
printMortgaged(square);
if (property->isMonopoly) {
if (property->houseCount < 5) if (property->houseCount > 0) printf("%d %4d", property->houseCount, property->rent[property->houseCount]);
else printf("0 %4d", property->rent[0] * 2);
else printf("H %4d", property->rent[5]);
}
else printf(" %4d", property->rent[0]);
break;
case TYPE_UTIL:
if (square->owner < 0) {
printf(" - 150");
if (!printEndOfLine) printf(" ");
break;
}
printf(" %d 150", square->owner + 1);
printMortgaged(square);
printf("%d", players[square->owner].utilitiesCount);
if (!printEndOfLine) printf(" ");
break;
case TYPE_RAILROAD:
if (square->owner < 0) {
printf(" - Railroad 200");
if (!printEndOfLine) printf(" ");
break;
}
printf(" %d Railroad 200", square->owner + 1);
printMortgaged(square);
rentAmount = 25;
rentAmount <<= players[square->owner].railroadCardCount - 1;
printf("%d %4d", players[square->owner].railroadCardCount, 25 << (players[square->owner].railroadCardCount - 1));
break;
}
if (printEndOfLine) putchar('\n');
}
void printMortgaged(Square * square) {
if (square->description->isMortgaged) printf(" * ");
else printf(" ");
}
void printHoldings(int playerIndex) {
OwnedPropertyList * propertyList;
Player * property;
char * bsp;
property = & players[playerIndex];
printf("%s's (%d) holdings (Total worth: $%d):\n", playerNames[playerIndex], playerIndex + 1, property->money + getPropertyWorth(property));
printf("\t$%d", property->money);
if (property->getOutOfJailFreeCardCount) {
printf(", %d get-out-of-jail-free card", property->getOutOfJailFreeCardCount);
if (property->getOutOfJailFreeCardCount > 1) putchar('s');
}
putchar('\n');
if (property->ownedPropertyList) {
printf("\t%s\n", header);
for (propertyList = property->ownedPropertyList;propertyList;propertyList = propertyList->next) {
putchar('\t');
printSquare(getSquareIndex(propertyList->square1) , true);
}
}
}
| static char sccsid[] = "@(#)print.c 5.4 (Berkeley) 6/1/90";
static char buf[80],
* header = "Name Own Price Mg # Rent";
public static void printBoard(void) {
int i;
printf("%s\t%s\n", header, header);
for (i = 0;i < NUMBER_OF_SQUARES / 2;i++) {
printSquare(i, false);
putchar('\t');
printSquare(i + NUMBER_OF_SQUARES / 2, true);
}
}
public static void printPlayerLocations(void) {
int i;
char * bsp;
printf("%s Player\n", header);
for (i = 0;i < numberOfPlayers;i++) {
printSquare(players[i].location, false);
printf(" %s (%d)", players[i].name, i + 1);
if (currentPlayer == & players[i]) printf(" *");
putchar('\n');
}
}
void printSquare(int squareIndex, char printEndOfLine) {
int rentAmount;
Property * property;
Square * square;
int i;
square = & board[squareIndex];
printf("%-10.10s", square->name);
switch (square->type) {
case TYPE_SAFE:
case TYPE_COMMUNITY_CHEST:
case TYPE_CHANCE:
case TYPE_INCOME_TAX:
case TYPE_GOTO_JAIL:
case TYPE_LUXURY_TAX:
case TYPE_IN_JAIL:
isSpecialCard:if (!printEndOfLine) printf(" ");
break;
case TYPE_PROPERTY:
property = square->description;
if (square->owner < 0) {
printf(" - %-8.8s %3d", property->monopolyDescription->name, square->cost);
if (!printEndOfLine) printf(" ");
break;
}
printf(" %d %-8.8s %3d", square->owner + 1, property->monopolyDescription->name, square->cost);
printMortgaged(square);
if (property->isMonopoly) {
if (property->houseCount < 5) if (property->houseCount > 0) printf("%d %4d", property->houseCount, property->rent[property->houseCount]);
else printf("0 %4d", property->rent[0] * 2);
else printf("H %4d", property->rent[5]);
}
else printf(" %4d", property->rent[0]);
break;
case TYPE_UTIL:
if (square->owner < 0) {
printf(" - 150");
if (!printEndOfLine) printf(" ");
break;
}
printf(" %d 150", square->owner + 1);
printMortgaged(square);
printf("%d", players[square->owner].utilitiesCount);
if (!printEndOfLine) printf(" ");
break;
case TYPE_RAILROAD:
if (square->owner < 0) {
printf(" - Railroad 200");
if (!printEndOfLine) printf(" ");
break;
}
printf(" %d Railroad 200", square->owner + 1);
printMortgaged(square);
rentAmount = 25;
rentAmount <<= players[square->owner].railroadCardCount - 1;
printf("%d %4d", players[square->owner].railroadCardCount, 25 << (players[square->owner].railroadCardCount - 1));
break;
}
if (printEndOfLine) putchar('\n');
}
void printMortgaged(Square * square) {
if (square->description->isMortgaged) printf(" * ");
else printf(" ");
}
void printHoldings(int playerIndex) {
OwnedPropertyList * propertyList;
Player * property;
char * bsp;
property = & players[playerIndex];
printf("%s's (%d) holdings (Total worth: $%d):\n", playerNames[playerIndex], playerIndex + 1, property->money + getPropertyWorth(property));
printf("\t$%d", property->money);
if (property->getOutOfJailFreeCardCount) {
printf(", %d get-out-of-jail-free card", property->getOutOfJailFreeCardCount);
if (property->getOutOfJailFreeCardCount > 1) putchar('s');
}
putchar('\n');
if (property->ownedPropertyList) {
printf("\t%s\n", header);
for (propertyList = property->ownedPropertyList;propertyList;propertyList = propertyList->next) {
putchar('\t');
printSquare(getSquareIndex(propertyList->square1) , true);
}
}
}
| static char sccsid[] = "@(#)print.c 5.4 (Berkeley) 6/1/90";
static char buf[80];
static char * header = "Name Own Price Mg # Rent";
public static void printBoard(void) {
int i;
printf("%s\t%s\n", header, header);
for (i = 0;i < NUMBER_OF_SQUARES / 2;i++) {
printSquare(i, false);
putchar('\t');
printSquare(i + NUMBER_OF_SQUARES / 2, true);
}
}
public static void printPlayerLocations(void) {
int i;
char * bsp;
printf("%s Player\n", header);
for (i = 0;i < numberOfPlayers;i++) {
printSquare(players[i].location, false);
printf(" %s (%d)", players[i].name, i + 1);
if (currentPlayer == & players[i]) printf(" *");
putchar('\n');
}
}
void printSquare(int squareIndex, char printEndOfLine) {
int rentAmount;
Property * property;
Square * square;
int i;
square = & board[squareIndex];
printf("%-10.10s", square->name);
switch (square->type) {
case TYPE_SAFE:
case TYPE_COMMUNITY_CHEST:
case TYPE_CHANCE:
case TYPE_INCOME_TAX:
case TYPE_GOTO_JAIL:
case TYPE_LUXURY_TAX:
case TYPE_IN_JAIL:
isSpecialCard:if (!printEndOfLine) printf(" ");
break;
case TYPE_PROPERTY:
property = square->description;
if (square->owner < 0) {
printf(" - %-8.8s %3d", property->monopolyDescription->name, square->cost);
if (!printEndOfLine) printf(" ");
break;
}
printf(" %d %-8.8s %3d", square->owner + 1, property->monopolyDescription->name, square->cost);
printMortgaged(square);
if (property->isMonopoly) {
if (property->houseCount < 5) if (property->houseCount > 0) printf("%d %4d", property->houseCount, property->rent[property->houseCount]);
else printf("0 %4d", property->rent[0] * 2);
else printf("H %4d", property->rent[5]);
}
else printf(" %4d", property->rent[0]);
break;
case TYPE_UTIL:
if (square->owner < 0) {
printf(" - 150");
if (!printEndOfLine) printf(" ");
break;
}
printf(" %d 150", square->owner + 1);
printMortgaged(square);
printf("%d", players[square->owner].utilitiesCount);
if (!printEndOfLine) printf(" ");
break;
case TYPE_RAILROAD:
if (square->owner < 0) {
printf(" - Railroad 200");
if (!printEndOfLine) printf(" ");
break;
}
printf(" %d Railroad 200", square->owner + 1);
printMortgaged(square);
rentAmount = 25;
rentAmount <<= players[square->owner].railroadCardCount - 1;
printf("%d %4d", players[square->owner].railroadCardCount, 25 << (players[square->owner].railroadCardCount - 1));
break;
}
if (printEndOfLine) putchar('\n');
}
void printMortgaged(Square * square) {
if (square->description->isMortgaged) printf(" * ");
else printf(" ");
}
void printHoldings(int playerIndex) {
OwnedPropertyList * propertyList;
Player * property;
char * bsp;
property = & players[playerIndex];
printf("%s's (%d) holdings (Total worth: $%d):\n", playerNames[playerIndex], playerIndex + 1, property->money + getPropertyWorth(property));
printf("\t$%d", property->money);
if (property->getOutOfJailFreeCardCount) {
printf(", %d get-out-of-jail-free card", property->getOutOfJailFreeCardCount);
if (property->getOutOfJailFreeCardCount > 1) putchar('s');
}
putchar('\n');
if (property->ownedPropertyList) {
printf("\t%s\n", header);
for (propertyList = property->ownedPropertyList;propertyList;propertyList = propertyList->next) {
putchar('\t');
printSquare(getSquareIndex(propertyList->square1) , true);
}
}
}
| static char[] sccsid = "@(#)print.c 5.4 (Berkeley) 6/1/90";
static char[80] buf;
static char * header = "Name Own Price Mg # Rent";
public static void printBoard(void) {
int i;
printf("%s\t%s\n", header, header);
for (i = 0;i < NUMBER_OF_SQUARES / 2;i++) {
printSquare(i, false);
putchar('\t');
printSquare(i + NUMBER_OF_SQUARES / 2, true);
}
}
public static void printPlayerLocations(void) {
int i;
char * bsp;
printf("%s Player\n", header);
for (i = 0;i < numberOfPlayers;i++) {
printSquare(players[i].location, false);
printf(" %s (%d)", players[i].name, i + 1);
if (currentPlayer == & players[i]) printf(" *");
putchar('\n');
}
}
void printSquare(int squareIndex, char printEndOfLine) {
int rentAmount;
Property * property;
Square * square;
int i;
square = & board[squareIndex];
printf("%-10.10s", square->name);
switch (square->type) {
case TYPE_SAFE:
case TYPE_COMMUNITY_CHEST:
case TYPE_CHANCE:
case TYPE_INCOME_TAX:
case TYPE_GOTO_JAIL:
case TYPE_LUXURY_TAX:
case TYPE_IN_JAIL:
isSpecialCard:if (!printEndOfLine) printf(" ");
break;
case TYPE_PROPERTY:
property = square->description;
if (square->owner < 0) {
printf(" - %-8.8s %3d", property->monopolyDescription->name, square->cost);
if (!printEndOfLine) printf(" ");
break;
}
printf(" %d %-8.8s %3d", square->owner + 1, property->monopolyDescription->name, square->cost);
printMortgaged(square);
if (property->isMonopoly) {
if (property->houseCount < 5) if (property->houseCount > 0) printf("%d %4d", property->houseCount, property->rent[property->houseCount]);
else printf("0 %4d", property->rent[0] * 2);
else printf("H %4d", property->rent[5]);
}
else printf(" %4d", property->rent[0]);
break;
case TYPE_UTIL:
if (square->owner < 0) {
printf(" - 150");
if (!printEndOfLine) printf(" ");
break;
}
printf(" %d 150", square->owner + 1);
printMortgaged(square);
printf("%d", players[square->owner].utilitiesCount);
if (!printEndOfLine) printf(" ");
break;
case TYPE_RAILROAD:
if (square->owner < 0) {
printf(" - Railroad 200");
if (!printEndOfLine) printf(" ");
break;
}
printf(" %d Railroad 200", square->owner + 1);
printMortgaged(square);
rentAmount = 25;
rentAmount <<= players[square->owner].railroadCardCount - 1;
printf("%d %4d", players[square->owner].railroadCardCount, 25 << (players[square->owner].railroadCardCount - 1));
break;
}
if (printEndOfLine) putchar('\n');
}
void printMortgaged(Square * square) {
if (square->description->isMortgaged) printf(" * ");
else printf(" ");
}
void printHoldings(int playerIndex) {
OwnedPropertyList * propertyList;
Player * property;
char * bsp;
property = & players[playerIndex];
printf("%s's (%d) holdings (Total worth: $%d):\n", playerNames[playerIndex], playerIndex + 1, property->money + getPropertyWorth(property));
printf("\t$%d", property->money);
if (property->getOutOfJailFreeCardCount) {
printf(", %d get-out-of-jail-free card", property->getOutOfJailFreeCardCount);
if (property->getOutOfJailFreeCardCount > 1) putchar('s');
}
putchar('\n');
if (property->ownedPropertyList) {
printf("\t%s\n", header);
for (propertyList = property->ownedPropertyList;propertyList;propertyList = propertyList->next) {
putchar('\t');
printSquare(getSquareIndex(propertyList->square1) , true);
}
}
}
| static char[] sccsid = "@(#)print.c 5.4 (Berkeley) 6/1/90";
static char[80] buf;
static char * header = "Name Own Price Mg # Rent";
public static void printBoard(void) {
int i;
printf("%s\t%s\n", header, header);
for (i = 0;i < NUMBER_OF_SQUARES / 2;i++) {
printSquare(i, false);
putchar('\t');
printSquare(i + NUMBER_OF_SQUARES / 2, true);
}
}
public static void printPlayerLocations(void) {
int i;
char * bsp;
printf("%s Player\n", header);
for (i = 0;i < numberOfPlayers;i++) {
printSquare(players[i].location, false);
printf(" %s (%d)", players[i].name, i + 1);
if (currentPlayer == & players[i]) {
printf(" *");
}
putchar('\n');
}
}
void printSquare(int squareIndex, char printEndOfLine) {
int rentAmount;
Property * property;
Square * square;
int i;
square = & board[squareIndex];
printf("%-10.10s", square->name);
switch (square->type) {
case TYPE_SAFE:
case TYPE_COMMUNITY_CHEST:
case TYPE_CHANCE:
case TYPE_INCOME_TAX:
case TYPE_GOTO_JAIL:
case TYPE_LUXURY_TAX:
case TYPE_IN_JAIL:
isSpecialCard:if (!printEndOfLine) {
printf(" ");
}
break;
case TYPE_PROPERTY:
property = square->description;
if (square->owner < 0) {
printf(" - %-8.8s %3d", property->monopolyDescription->name, square->cost);
if (!printEndOfLine) {
printf(" ");
}
break;
}
printf(" %d %-8.8s %3d", square->owner + 1, property->monopolyDescription->name, square->cost);
printMortgaged(square);
if (property->isMonopoly) {
if (property->houseCount < 5) {
if (property->houseCount > 0) {
printf("%d %4d", property->houseCount, property->rent[property->houseCount]);
}
else {
printf("0 %4d", property->rent[0] * 2);
}
}
else {
printf("H %4d", property->rent[5]);
}
}
else {
printf(" %4d", property->rent[0]);
}
break;
case TYPE_UTIL:
if (square->owner < 0) {
printf(" - 150");
if (!printEndOfLine) {
printf(" ");
}
break;
}
printf(" %d 150", square->owner + 1);
printMortgaged(square);
printf("%d", players[square->owner].utilitiesCount);
if (!printEndOfLine) {
printf(" ");
}
break;
case TYPE_RAILROAD:
if (square->owner < 0) {
printf(" - Railroad 200");
if (!printEndOfLine) {
printf(" ");
}
break;
}
printf(" %d Railroad 200", square->owner + 1);
printMortgaged(square);
rentAmount = 25;
rentAmount <<= players[square->owner].railroadCardCount - 1;
printf("%d %4d", players[square->owner].railroadCardCount, 25 << (players[square->owner].railroadCardCount - 1));
break;
}
if (printEndOfLine) {
putchar('\n');
}
}
void printMortgaged(Square * square) {
if (square->description->isMortgaged) {
printf(" * ");
}
else {
printf(" ");
}
}
void printHoldings(int playerIndex) {
OwnedPropertyList * propertyList;
Player * property;
char * bsp;
property = & players[playerIndex];
printf("%s's (%d) holdings (Total worth: $%d):\n", playerNames[playerIndex], playerIndex + 1, property->money + getPropertyWorth(property));
printf("\t$%d", property->money);
if (property->getOutOfJailFreeCardCount) {
printf(", %d get-out-of-jail-free card", property->getOutOfJailFreeCardCount);
if (property->getOutOfJailFreeCardCount > 1) {
putchar('s');
}
}
putchar('\n');
if (property->ownedPropertyList) {
printf("\t%s\n", header);
for (propertyList = property->ownedPropertyList;propertyList;propertyList = propertyList->next) {
putchar('\t');
printSquare(getSquareIndex(propertyList->square1) , true);
}
}
}
| static char[] sccsid = "@(#)print.c 5.4 (Berkeley) 6/1/90";
static char[80] buf;
static char * header = "Name Own Price Mg # Rent";
public static void printBoard(void) {
int i;
printf("%s\t%s\n", header, header);
for (i = 0;i < NUMBER_OF_SQUARES / 2;i++) {
printSquare(i, false);
putchar('\t');
printSquare(i + NUMBER_OF_SQUARES / 2, true);
}
}
public static void printPlayerLocations(void) {
int i;
char * bsp;
printf("%s Player\n", header);
for (i = 0;i < numberOfPlayers;i++) {
printSquare(players[i].location, false);
printf(" %s (%d)", players[i].name, i + 1);
if (currentPlayer == & players[i]) {
printf(" *");
}
putchar('\n');
}
}
void printSquare(int squareIndex, char printEndOfLine) {
int rentAmount;
Property * property;
Square * square;
int i;
square = & board[squareIndex];
printf("%-10.10s", square->name);
switch (square->type) {
case TYPE_SAFE:
case TYPE_COMMUNITY_CHEST:
case TYPE_CHANCE:
case TYPE_INCOME_TAX:
case TYPE_GOTO_JAIL:
case TYPE_LUXURY_TAX:
case TYPE_IN_JAIL:
if (!printEndOfLine) {
printf(" ");
}
break;
case TYPE_PROPERTY:
property = square->description;
if (square->owner < 0) {
printf(" - %-8.8s %3d", property->monopolyDescription->name, square->cost);
if (!printEndOfLine) {
printf(" ");
}
break;
}
printf(" %d %-8.8s %3d", square->owner + 1, property->monopolyDescription->name, square->cost);
printMortgaged(square);
if (property->isMonopoly) {
if (property->houseCount < 5) {
if (property->houseCount > 0) {
printf("%d %4d", property->houseCount, property->rent[property->houseCount]);
}
else {
printf("0 %4d", property->rent[0] * 2);
}
}
else {
printf("H %4d", property->rent[5]);
}
}
else {
printf(" %4d", property->rent[0]);
}
break;
case TYPE_UTIL:
if (square->owner < 0) {
printf(" - 150");
if (!printEndOfLine) {
printf(" ");
}
break;
}
printf(" %d 150", square->owner + 1);
printMortgaged(square);
printf("%d", players[square->owner].utilitiesCount);
if (!printEndOfLine) {
printf(" ");
}
break;
case TYPE_RAILROAD:
if (square->owner < 0) {
printf(" - Railroad 200");
if (!printEndOfLine) {
printf(" ");
}
break;
}
printf(" %d Railroad 200", square->owner + 1);
printMortgaged(square);
rentAmount = 25;
rentAmount <<= players[square->owner].railroadCardCount - 1;
printf("%d %4d", players[square->owner].railroadCardCount, 25 << (players[square->owner].railroadCardCount - 1));
break;
}
if (printEndOfLine) {
putchar('\n');
}
}
void printMortgaged(Square * square) {
if (square->description->isMortgaged) {
printf(" * ");
}
else {
printf(" ");
}
}
void printHoldings(int playerIndex) {
OwnedPropertyList * propertyList;
Player * property;
char * bsp;
property = & players[playerIndex];
printf("%s's (%d) holdings (Total worth: $%d):\n", playerNames[playerIndex], playerIndex + 1, property->money + getPropertyWorth(property));
printf("\t$%d", property->money);
if (property->getOutOfJailFreeCardCount) {
printf(", %d get-out-of-jail-free card", property->getOutOfJailFreeCardCount);
if (property->getOutOfJailFreeCardCount > 1) {
putchar('s');
}
}
putchar('\n');
if (property->ownedPropertyList) {
printf("\t%s\n", header);
for (propertyList = property->ownedPropertyList;propertyList;propertyList = propertyList->next) {
putchar('\t');
printSquare(getSquareIndex(propertyList->square1) , true);
}
}
}
| static char[] sccsid = "@(#)print.c 5.4 (Berkeley) 6/1/90";
static char[80] buf;
static char * header = "Name Own Price Mg # Rent";
public static void printBoard() {
int i;
printf("%s\t%s\n", header, header);
for (i = 0;i < NUMBER_OF_SQUARES / 2;i++) {
printSquare(i, false);
putchar('\t');
printSquare(i + NUMBER_OF_SQUARES / 2, true);
}
}
public static void printPlayerLocations() {
int i;
char * bsp;
printf("%s Player\n", header);
for (i = 0;i < numberOfPlayers;i++) {
printSquare(players[i].location, false);
printf(" %s (%d)", players[i].name, i + 1);
if (currentPlayer == & players[i]) {
printf(" *");
}
putchar('\n');
}
}
void printSquare(int squareIndex, char printEndOfLine) {
int rentAmount;
Property * property;
Square * square;
int i;
square = & board[squareIndex];
printf("%-10.10s", square->name);
switch (square->type) {
case TYPE_SAFE:
case TYPE_COMMUNITY_CHEST:
case TYPE_CHANCE:
case TYPE_INCOME_TAX:
case TYPE_GOTO_JAIL:
case TYPE_LUXURY_TAX:
case TYPE_IN_JAIL:
if (!printEndOfLine) {
printf(" ");
}
break;
case TYPE_PROPERTY:
property = square->description;
if (square->owner < 0) {
printf(" - %-8.8s %3d", property->monopolyDescription->name, square->cost);
if (!printEndOfLine) {
printf(" ");
}
break;
}
printf(" %d %-8.8s %3d", square->owner + 1, property->monopolyDescription->name, square->cost);
printMortgaged(square);
if (property->isMonopoly) {
if (property->houseCount < 5) {
if (property->houseCount > 0) {
printf("%d %4d", property->houseCount, property->rent[property->houseCount]);
}
else {
printf("0 %4d", property->rent[0] * 2);
}
}
else {
printf("H %4d", property->rent[5]);
}
}
else {
printf(" %4d", property->rent[0]);
}
break;
case TYPE_UTIL:
if (square->owner < 0) {
printf(" - 150");
if (!printEndOfLine) {
printf(" ");
}
break;
}
printf(" %d 150", square->owner + 1);
printMortgaged(square);
printf("%d", players[square->owner].utilitiesCount);
if (!printEndOfLine) {
printf(" ");
}
break;
case TYPE_RAILROAD:
if (square->owner < 0) {
printf(" - Railroad 200");
if (!printEndOfLine) {
printf(" ");
}
break;
}
printf(" %d Railroad 200", square->owner + 1);
printMortgaged(square);
rentAmount = 25;
rentAmount <<= players[square->owner].railroadCardCount - 1;
printf("%d %4d", players[square->owner].railroadCardCount, 25 << (players[square->owner].railroadCardCount - 1));
break;
}
if (printEndOfLine) {
putchar('\n');
}
}
void printMortgaged(Square * square) {
if (square->description->isMortgaged) {
printf(" * ");
}
else {
printf(" ");
}
}
void printHoldings(int playerIndex) {
OwnedPropertyList * propertyList;
Player * property;
char * bsp;
property = & players[playerIndex];
printf("%s's (%d) holdings (Total worth: $%d):\n", playerNames[playerIndex], playerIndex + 1, property->money + getPropertyWorth(property));
printf("\t$%d", property->money);
if (property->getOutOfJailFreeCardCount) {
printf(", %d get-out-of-jail-free card", property->getOutOfJailFreeCardCount);
if (property->getOutOfJailFreeCardCount > 1) {
putchar('s');
}
}
putchar('\n');
if (property->ownedPropertyList) {
printf("\t%s\n", header);
for (propertyList = property->ownedPropertyList;propertyList;propertyList = propertyList->next) {
putchar('\t');
printSquare(getSquareIndex(propertyList->square1) , true);
}
}
}
| static char[] sccsid = "@(#)print.c 5.4 (Berkeley) 6/1/90";
static char[80] buf;
static char * header = "Name Own Price Mg # Rent";
public static void printBoard() {
int i;
printf("%s\t%s\n", header, header);
for (i = 0;i < NUMBER_OF_SQUARES / 2;i++) {
printSquare(i, false);
putchar('\t');
printSquare(i + NUMBER_OF_SQUARES / 2, true);
}
}
public static void printPlayerLocations() {
int i;
char * bsp;
printf("%s Player\n", header);
for (i = 0;i < numberOfPlayers;i++) {
printSquare(players[i].location, false);
printf(" %s (%d)", players[i].name, i + 1);
if (currentPlayer == & players[i]) {
printf(" *");
}
putchar('\n');
}
}
void printSquare(int squareIndex, char printEndOfLine) {
int rentAmount;
Property * property;
Square * square3;
int i;
square3 = & board[squareIndex];
printf("%-10.10s", square3->name);
switch (square3->type) {
case TYPE_SAFE:
case TYPE_COMMUNITY_CHEST:
case TYPE_CHANCE:
case TYPE_INCOME_TAX:
case TYPE_GOTO_JAIL:
case TYPE_LUXURY_TAX:
case TYPE_IN_JAIL:
if (!printEndOfLine) {
printf(" ");
}
break;
case TYPE_PROPERTY:
property = square3->description;
if (square3->owner < 0) {
printf(" - %-8.8s %3d", property->monopolyDescription->name, square3->cost);
if (!printEndOfLine) {
printf(" ");
}
break;
}
printf(" %d %-8.8s %3d", square3->owner + 1, property->monopolyDescription->name, square3->cost);
printMortgaged(square3);
if (property->isMonopoly) {
if (property->houseCount < 5) {
if (property->houseCount > 0) {
printf("%d %4d", property->houseCount, property->rent[property->houseCount]);
}
else {
printf("0 %4d", property->rent[0] * 2);
}
}
else {
printf("H %4d", property->rent[5]);
}
}
else {
printf(" %4d", property->rent[0]);
}
break;
case TYPE_UTIL:
if (square3->owner < 0) {
printf(" - 150");
if (!printEndOfLine) {
printf(" ");
}
break;
}
printf(" %d 150", square3->owner + 1);
printMortgaged(square3);
printf("%d", players[square3->owner].utilitiesCount);
if (!printEndOfLine) {
printf(" ");
}
break;
case TYPE_RAILROAD:
if (square3->owner < 0) {
printf(" - Railroad 200");
if (!printEndOfLine) {
printf(" ");
}
break;
}
printf(" %d Railroad 200", square3->owner + 1);
printMortgaged(square3);
rentAmount = 25;
rentAmount <<= players[square3->owner].railroadCardCount - 1;
printf("%d %4d", players[square3->owner].railroadCardCount, 25 << (players[square3->owner].railroadCardCount - 1));
break;
}
if (printEndOfLine) {
putchar('\n');
}
}
void printMortgaged(Square * square4) {
if (square4->description->isMortgaged) {
printf(" * ");
}
else {
printf(" ");
}
}
void printHoldings(int playerIndex) {
OwnedPropertyList * propertyList7;
Player * property;
char * bsp;
property = & players[playerIndex];
printf("%s's (%d) holdings (Total worth: $%d):\n", playerNames[playerIndex], playerIndex + 1, property->money + getPropertyWorth(property));
printf("\t$%d", property->money);
if (property->getOutOfJailFreeCardCount) {
printf(", %d get-out-of-jail-free card", property->getOutOfJailFreeCardCount);
if (property->getOutOfJailFreeCardCount > 1) {
putchar('s');
}
}
putchar('\n');
if (property->ownedPropertyList) {
printf("\t%s\n", header);
for (propertyList7 = property->ownedPropertyList;propertyList7;propertyList7 = propertyList7->next) {
putchar('\t');
printSquare(getSquareIndex(propertyList7->square1) , true);
}
}
}
| static char[] sccsid = "@(#)print.c 5.4 (Berkeley) 6/1/90";
static char[80] buf;
static char * header = "Name Own Price Mg # Rent";
public static void printBoard() {
int i;
printf("%s\t%s\n", header, header);
for (i = 0;i < NUMBER_OF_SQUARES / 2;i++) {
printSquare(i, false);
putchar('\t');
printSquare(i + NUMBER_OF_SQUARES / 2, true);
}
}
public static void printPlayerLocations() {
int i;
char * bsp;
printf("%s Player\n", header);
for (i = 0;i < Monop.numberOfPlayers;i++) {
printSquare(Monop.players[i].location, false);
printf(" %s (%d)", Monop.players[i].name, i + 1);
if (Monop.currentPlayer == & Monop.players[i]) {
printf(" *");
}
putchar('\n');
}
}
void printSquare(int squareIndex, char printEndOfLine) {
int rentAmount;
Property * property;
Square * square3;
int i;
square3 = & Monop.board[squareIndex];
printf("%-10.10s", square3->name);
switch (square3->type) {
case TYPE_SAFE:
case TYPE_COMMUNITY_CHEST:
case TYPE_CHANCE:
case TYPE_INCOME_TAX:
case TYPE_GOTO_JAIL:
case TYPE_LUXURY_TAX:
case TYPE_IN_JAIL:
if (!printEndOfLine) {
printf(" ");
}
break;
case TYPE_PROPERTY:
property = square3->description;
if (square3->owner < 0) {
printf(" - %-8.8s %3d", property->monopolyDescription->name, square3->cost);
if (!printEndOfLine) {
printf(" ");
}
break;
}
printf(" %d %-8.8s %3d", square3->owner + 1, property->monopolyDescription->name, square3->cost);
printMortgaged(square3);
if (property->isMonopoly) {
if (property->houseCount < 5) {
if (property->houseCount > 0) {
printf("%d %4d", property->houseCount, property->rent[property->houseCount]);
}
else {
printf("0 %4d", property->rent[0] * 2);
}
}
else {
printf("H %4d", property->rent[5]);
}
}
else {
printf(" %4d", property->rent[0]);
}
break;
case TYPE_UTIL:
if (square3->owner < 0) {
printf(" - 150");
if (!printEndOfLine) {
printf(" ");
}
break;
}
printf(" %d 150", square3->owner + 1);
printMortgaged(square3);
printf("%d", Monop.players[square3->owner].utilitiesCount);
if (!printEndOfLine) {
printf(" ");
}
break;
case TYPE_RAILROAD:
if (square3->owner < 0) {
printf(" - Railroad 200");
if (!printEndOfLine) {
printf(" ");
}
break;
}
printf(" %d Railroad 200", square3->owner + 1);
printMortgaged(square3);
rentAmount = 25;
rentAmount <<= Monop.players[square3->owner].railroadCardCount - 1;
printf("%d %4d", Monop.players[square3->owner].railroadCardCount, 25 << (Monop.players[square3->owner].railroadCardCount - 1));
break;
}
if (printEndOfLine) {
putchar('\n');
}
}
void printMortgaged(Square * square4) {
if (square4->description->isMortgaged) {
printf(" * ");
}
else {
printf(" ");
}
}
void printHoldings(int playerIndex) {
OwnedPropertyList * propertyList7;
Player * property;
char * bsp;
property = & Monop.players[playerIndex];
printf("%s's (%d) holdings (Total worth: $%d):\n", Monop.playerNames[playerIndex], playerIndex + 1, property->money + getPropertyWorth(property));
printf("\t$%d", property->money);
if (property->getOutOfJailFreeCardCount) {
printf(", %d get-out-of-jail-free card", property->getOutOfJailFreeCardCount);
if (property->getOutOfJailFreeCardCount > 1) {
putchar('s');
}
}
putchar('\n');
if (property->ownedPropertyList) {
printf("\t%s\n", header);
for (propertyList7 = property->ownedPropertyList;propertyList7;propertyList7 = propertyList7->next) {
putchar('\t');
printSquare(getSquareIndex(propertyList7->square1) , true);
}
}
}
| static char[] sccsid = "@(#)print.c 5.4 (Berkeley) 6/1/90";
static char[80] buf;
static char * header = "Name Own Price Mg # Rent";
public static void printBoard() {
int i;
printf("%s\t%s\n", header, header);
for (i = 0;i < NUMBER_OF_SQUARES / 2;i++) {
printSquare(i, false);
putchar('\t');
printSquare(i + NUMBER_OF_SQUARES / 2, true);
}
}
public static void printPlayerLocations() {
int i;
char * bsp;
printf("%s Player\n", header);
for (i = 0;i < Monop.numberOfPlayers;i++) {
printSquare(Monop.players[i].location, false);
printf(" %s (%d)", Monop.players[i].name, i + 1);
if (Monop.currentPlayer == & Monop.players[i]) {
printf(" *");
}
putchar('\n');
}
}
static void printSquare(int squareIndex, char printEndOfLine) {
int rentAmount;
Property * property;
Square * square3;
int i;
square3 = & Monop.board[squareIndex];
printf("%-10.10s", square3->name);
switch (square3->type) {
case TYPE_SAFE:
case TYPE_COMMUNITY_CHEST:
case TYPE_CHANCE:
case TYPE_INCOME_TAX:
case TYPE_GOTO_JAIL:
case TYPE_LUXURY_TAX:
case TYPE_IN_JAIL:
if (!printEndOfLine) {
printf(" ");
}
break;
case TYPE_PROPERTY:
property = square3->description;
if (square3->owner < 0) {
printf(" - %-8.8s %3d", property->monopolyDescription->name, square3->cost);
if (!printEndOfLine) {
printf(" ");
}
break;
}
printf(" %d %-8.8s %3d", square3->owner + 1, property->monopolyDescription->name, square3->cost);
printMortgaged(square3);
if (property->isMonopoly) {
if (property->houseCount < 5) {
if (property->houseCount > 0) {
printf("%d %4d", property->houseCount, property->rent[property->houseCount]);
}
else {
printf("0 %4d", property->rent[0] * 2);
}
}
else {
printf("H %4d", property->rent[5]);
}
}
else {
printf(" %4d", property->rent[0]);
}
break;
case TYPE_UTIL:
if (square3->owner < 0) {
printf(" - 150");
if (!printEndOfLine) {
printf(" ");
}
break;
}
printf(" %d 150", square3->owner + 1);
printMortgaged(square3);
printf("%d", Monop.players[square3->owner].utilitiesCount);
if (!printEndOfLine) {
printf(" ");
}
break;
case TYPE_RAILROAD:
if (square3->owner < 0) {
printf(" - Railroad 200");
if (!printEndOfLine) {
printf(" ");
}
break;
}
printf(" %d Railroad 200", square3->owner + 1);
printMortgaged(square3);
rentAmount = 25;
rentAmount <<= Monop.players[square3->owner].railroadCardCount - 1;
printf("%d %4d", Monop.players[square3->owner].railroadCardCount, 25 << (Monop.players[square3->owner].railroadCardCount - 1));
break;
}
if (printEndOfLine) {
putchar('\n');
}
}
void printMortgaged(Square * square4) {
if (square4->description->isMortgaged) {
printf(" * ");
}
else {
printf(" ");
}
}
static void printHoldings(int playerIndex) {
OwnedPropertyList * propertyList7;
Player * property;
char * bsp;
property = & Monop.players[playerIndex];
printf("%s's (%d) holdings (Total worth: $%d):\n", Monop.playerNames[playerIndex], playerIndex + 1, property->money + PropertyFunctions.getPropertyWorth(property));
printf("\t$%d", property->money);
if (property->getOutOfJailFreeCardCount) {
printf(", %d get-out-of-jail-free card", property->getOutOfJailFreeCardCount);
if (property->getOutOfJailFreeCardCount > 1) {
putchar('s');
}
}
putchar('\n');
if (property->ownedPropertyList) {
printf("\t%s\n", header);
for (propertyList7 = property->ownedPropertyList;propertyList7;propertyList7 = propertyList7->next) {
putchar('\t');
printSquare(getSquareIndex(propertyList7->square1) , true);
}
}
}
| static char[] sccsid = "@(#)print.c 5.4 (Berkeley) 6/1/90";
static char[] buf = new char[80];
static char * header = "Name Own Price Mg # Rent";
public static void printBoard() {
int i;
printf("%s\t%s\n", header, header);
for (i = 0;i < NUMBER_OF_SQUARES / 2;i++) {
printSquare(i, false);
putchar('\t');
printSquare(i + NUMBER_OF_SQUARES / 2, true);
}
}
public static void printPlayerLocations() {
int i;
char * bsp;
printf("%s Player\n", header);
for (i = 0;i < Monop.numberOfPlayers;i++) {
printSquare(Monop.players[i].location, false);
printf(" %s (%d)", Monop.players[i].name, i + 1);
if (Monop.currentPlayer == & Monop.players[i]) {
printf(" *");
}
putchar('\n');
}
}
static void printSquare(int squareIndex, char printEndOfLine) {
int rentAmount;
Property * property;
Square * square3;
int i;
square3 = & Monop.board[squareIndex];
printf("%-10.10s", square3->name);
switch (square3->type) {
case TYPE_SAFE:
case TYPE_COMMUNITY_CHEST:
case TYPE_CHANCE:
case TYPE_INCOME_TAX:
case TYPE_GOTO_JAIL:
case TYPE_LUXURY_TAX:
case TYPE_IN_JAIL:
if (!printEndOfLine) {
printf(" ");
}
break;
case TYPE_PROPERTY:
property = square3->description;
if (square3->owner < 0) {
printf(" - %-8.8s %3d", property->monopolyDescription->name, square3->cost);
if (!printEndOfLine) {
printf(" ");
}
break;
}
printf(" %d %-8.8s %3d", square3->owner + 1, property->monopolyDescription->name, square3->cost);
printMortgaged(square3);
if (property->isMonopoly) {
if (property->houseCount < 5) {
if (property->houseCount > 0) {
printf("%d %4d", property->houseCount, property->rent[property->houseCount]);
}
else {
printf("0 %4d", property->rent[0] * 2);
}
}
else {
printf("H %4d", property->rent[5]);
}
}
else {
printf(" %4d", property->rent[0]);
}
break;
case TYPE_UTIL:
if (square3->owner < 0) {
printf(" - 150");
if (!printEndOfLine) {
printf(" ");
}
break;
}
printf(" %d 150", square3->owner + 1);
printMortgaged(square3);
printf("%d", Monop.players[square3->owner].utilitiesCount);
if (!printEndOfLine) {
printf(" ");
}
break;
case TYPE_RAILROAD:
if (square3->owner < 0) {
printf(" - Railroad 200");
if (!printEndOfLine) {
printf(" ");
}
break;
}
printf(" %d Railroad 200", square3->owner + 1);
printMortgaged(square3);
rentAmount = 25;
rentAmount <<= Monop.players[square3->owner].railroadCardCount - 1;
printf("%d %4d", Monop.players[square3->owner].railroadCardCount, 25 << (Monop.players[square3->owner].railroadCardCount - 1));
break;
}
if (printEndOfLine) {
putchar('\n');
}
}
void printMortgaged(Square * square4) {
if (square4->description->isMortgaged) {
printf(" * ");
}
else {
printf(" ");
}
}
static void printHoldings(int playerIndex) {
OwnedPropertyList * propertyList7;
Player * property;
char * bsp;
property = & Monop.players[playerIndex];
printf("%s's (%d) holdings (Total worth: $%d):\n", Monop.playerNames[playerIndex], playerIndex + 1, property->money + PropertyFunctions.getPropertyWorth(property));
printf("\t$%d", property->money);
if (property->getOutOfJailFreeCardCount) {
printf(", %d get-out-of-jail-free card", property->getOutOfJailFreeCardCount);
if (property->getOutOfJailFreeCardCount > 1) {
putchar('s');
}
}
putchar('\n');
if (property->ownedPropertyList) {
printf("\t%s\n", header);
for (propertyList7 = property->ownedPropertyList;propertyList7;propertyList7 = propertyList7->next) {
putchar('\t');
printSquare(getSquareIndex(propertyList7->square1) , true);
}
}
}
| static String sccsid = "@(#)print.c 5.4 (Berkeley) 6/1/90";
static String buf = new String();
static String header = "Name Own Price Mg # Rent";
public static void printBoard() {
int i;
printf("%s\t%s\n", header, header);
for (i = 0;i < NUMBER_OF_SQUARES / 2;i++) {
printSquare(i, false);
putchar('\t');
printSquare(i + NUMBER_OF_SQUARES / 2, true);
}
}
public static void printPlayerLocations() {
int i;
String bsp;
printf("%s Player\n", header);
for (i = 0;i < Monop.numberOfPlayers;i++) {
printSquare(Monop.players[i].location, false);
printf(" %s (%d)", Monop.players[i].name, i + 1);
if (Monop.currentPlayer == & Monop.players[i]) {
printf(" *");
}
putchar('\n');
}
}
static void printSquare(int squareIndex, char printEndOfLine) {
int rentAmount;
Property * property;
Square * square3;
int i;
square3 = & Monop.board[squareIndex];
printf("%-10.10s", square3->name);
switch (square3->type) {
case TYPE_SAFE:
case TYPE_COMMUNITY_CHEST:
case TYPE_CHANCE:
case TYPE_INCOME_TAX:
case TYPE_GOTO_JAIL:
case TYPE_LUXURY_TAX:
case TYPE_IN_JAIL:
if (!printEndOfLine) {
printf(" ");
}
break;
case TYPE_PROPERTY:
property = square3->description;
if (square3->owner < 0) {
printf(" - %-8.8s %3d", property->monopolyDescription->name, square3->cost);
if (!printEndOfLine) {
printf(" ");
}
break;
}
printf(" %d %-8.8s %3d", square3->owner + 1, property->monopolyDescription->name, square3->cost);
printMortgaged(square3);
if (property->isMonopoly) {
if (property->houseCount < 5) {
if (property->houseCount > 0) {
printf("%d %4d", property->houseCount, property->rent[property->houseCount]);
}
else {
printf("0 %4d", property->rent[0] * 2);
}
}
else {
printf("H %4d", property->rent[5]);
}
}
else {
printf(" %4d", property->rent[0]);
}
break;
case TYPE_UTIL:
if (square3->owner < 0) {
printf(" - 150");
if (!printEndOfLine) {
printf(" ");
}
break;
}
printf(" %d 150", square3->owner + 1);
printMortgaged(square3);
printf("%d", Monop.players[square3->owner].utilitiesCount);
if (!printEndOfLine) {
printf(" ");
}
break;
case TYPE_RAILROAD:
if (square3->owner < 0) {
printf(" - Railroad 200");
if (!printEndOfLine) {
printf(" ");
}
break;
}
printf(" %d Railroad 200", square3->owner + 1);
printMortgaged(square3);
rentAmount = 25;
rentAmount <<= Monop.players[square3->owner].railroadCardCount - 1;
printf("%d %4d", Monop.players[square3->owner].railroadCardCount, 25 << (Monop.players[square3->owner].railroadCardCount - 1));
break;
}
if (printEndOfLine) {
putchar('\n');
}
}
void printMortgaged(Square * square4) {
if (square4->description->isMortgaged) {
printf(" * ");
}
else {
printf(" ");
}
}
static void printHoldings(int playerIndex) {
OwnedPropertyList * propertyList7;
Player * property;
String bsp;
property = & Monop.players[playerIndex];
printf("%s's (%d) holdings (Total worth: $%d):\n", Monop.playerNames[playerIndex], playerIndex + 1, property->money + PropertyFunctions.getPropertyWorth(property));
printf("\t$%d", property->money);
if (property->getOutOfJailFreeCardCount) {
printf(", %d get-out-of-jail-free card", property->getOutOfJailFreeCardCount);
if (property->getOutOfJailFreeCardCount > 1) {
putchar('s');
}
}
putchar('\n');
if (property->ownedPropertyList) {
printf("\t%s\n", header);
for (propertyList7 = property->ownedPropertyList;propertyList7;propertyList7 = propertyList7->next) {
putchar('\t');
printSquare(getSquareIndex(propertyList7->square1) , true);
}
}
}
| static String sccsid;
sccsid = "@(#)print.c 5.4 (Berkeley) 6/1/90";
static String buf;
buf = new String();
static String header;
header = "Name Own Price Mg # Rent";
public static void printBoard() {
int i;
printf("%s\t%s\n", header, header);
for (i = 0;i < NUMBER_OF_SQUARES / 2;i++) {
printSquare(i, false);
putchar('\t');
printSquare(i + NUMBER_OF_SQUARES / 2, true);
}
}
public static void printPlayerLocations() {
int i;
String bsp;
printf("%s Player\n", header);
for (i = 0;i < Monop.numberOfPlayers;i++) {
printSquare(Monop.players[i].location, false);
printf(" %s (%d)", Monop.players[i].name, i + 1);
if (Monop.currentPlayer == & Monop.players[i]) {
printf(" *");
}
putchar('\n');
}
}
static void printSquare(int squareIndex, char printEndOfLine) {
int rentAmount;
Property * property;
Square * square3;
int i;
square3 = & Monop.board[squareIndex];
printf("%-10.10s", square3->name);
switch (square3->type) {
case TYPE_SAFE:
case TYPE_COMMUNITY_CHEST:
case TYPE_CHANCE:
case TYPE_INCOME_TAX:
case TYPE_GOTO_JAIL:
case TYPE_LUXURY_TAX:
case TYPE_IN_JAIL:
if (!printEndOfLine) {
printf(" ");
}
break;
case TYPE_PROPERTY:
property = square3->description;
if (square3->owner < 0) {
printf(" - %-8.8s %3d", property->monopolyDescription->name, square3->cost);
if (!printEndOfLine) {
printf(" ");
}
break;
}
printf(" %d %-8.8s %3d", square3->owner + 1, property->monopolyDescription->name, square3->cost);
printMortgaged(square3);
if (property->isMonopoly) {
if (property->houseCount < 5) {
if (property->houseCount > 0) {
printf("%d %4d", property->houseCount, property->rent[property->houseCount]);
}
else {
printf("0 %4d", property->rent[0] * 2);
}
}
else {
printf("H %4d", property->rent[5]);
}
}
else {
printf(" %4d", property->rent[0]);
}
break;
case TYPE_UTIL:
if (square3->owner < 0) {
printf(" - 150");
if (!printEndOfLine) {
printf(" ");
}
break;
}
printf(" %d 150", square3->owner + 1);
printMortgaged(square3);
printf("%d", Monop.players[square3->owner].utilitiesCount);
if (!printEndOfLine) {
printf(" ");
}
break;
case TYPE_RAILROAD:
if (square3->owner < 0) {
printf(" - Railroad 200");
if (!printEndOfLine) {
printf(" ");
}
break;
}
printf(" %d Railroad 200", square3->owner + 1);
printMortgaged(square3);
rentAmount = 25;
rentAmount <<= Monop.players[square3->owner].railroadCardCount - 1;
printf("%d %4d", Monop.players[square3->owner].railroadCardCount, 25 << (Monop.players[square3->owner].railroadCardCount - 1));
break;
}
if (printEndOfLine) {
putchar('\n');
}
}
void printMortgaged(Square * square4) {
if (square4->description->isMortgaged) {
printf(" * ");
}
else {
printf(" ");
}
}
static void printHoldings(int playerIndex) {
OwnedPropertyList * propertyList7;
Player * property;
String bsp;
property = & Monop.players[playerIndex];
printf("%s's (%d) holdings (Total worth: $%d):\n", Monop.playerNames[playerIndex], playerIndex + 1, property->money + PropertyFunctions.getPropertyWorth(property));
printf("\t$%d", property->money);
if (property->getOutOfJailFreeCardCount) {
printf(", %d get-out-of-jail-free card", property->getOutOfJailFreeCardCount);
if (property->getOutOfJailFreeCardCount > 1) {
putchar('s');
}
}
putchar('\n');
if (property->ownedPropertyList) {
printf("\t%s\n", header);
for (propertyList7 = property->ownedPropertyList;propertyList7;propertyList7 = propertyList7->next) {
putchar('\t');
printSquare(getSquareIndex(propertyList7->square1) , true);
}
}
}
| static String sccsid;
sccsid = "@(#)print.c 5.4 (Berkeley) 6/1/90";
static String buf;
buf = new String();
static String header;
header = "Name Own Price Mg # Rent";
public static void printBoard() {
int i;
printf("%s\t%s\n", header, header);
for (i = 0;i < NUMBER_OF_SQUARES / 2;i++) {
printSquare(i, false);
putchar('\t');
printSquare(i + NUMBER_OF_SQUARES / 2, true);
}
}
public static void printPlayerLocations() {
int i;
String bsp;
printf("%s Player\n", header);
for (i = 0;i < Monop.numberOfPlayers;i++) {
printSquare(Monop.players[i].location, false);
printf(" %s (%d)", Monop.players[i].name, i + 1);
if (Monop.currentPlayer == Monop.players[i]) {
printf(" *");
}
putchar('\n');
}
}
static void printSquare(int squareIndex, char printEndOfLine) {
int rentAmount;
Property property;
Square square3;
int i;
square3 = Monop.board[squareIndex];
printf("%-10.10s", square3.name);
switch (square3.type) {
case TYPE_SAFE:
case TYPE_COMMUNITY_CHEST:
case TYPE_CHANCE:
case TYPE_INCOME_TAX:
case TYPE_GOTO_JAIL:
case TYPE_LUXURY_TAX:
case TYPE_IN_JAIL:
if (!printEndOfLine) {
printf(" ");
}
break;
case TYPE_PROPERTY:
property = square3.description;
if (square3.owner < 0) {
printf(" - %-8.8s %3d", property.monopolyDescription.name, square3.cost);
if (!printEndOfLine) {
printf(" ");
}
break;
}
printf(" %d %-8.8s %3d", square3.owner + 1, property.monopolyDescription.name, square3.cost);
printMortgaged(square3);
if (property.isMonopoly) {
if (property.houseCount < 5) {
if (property.houseCount > 0) {
printf("%d %4d", property.houseCount, property.rent[property.houseCount]);
}
else {
printf("0 %4d", property.rent[0] * 2);
}
}
else {
printf("H %4d", property.rent[5]);
}
}
else {
printf(" %4d", property.rent[0]);
}
break;
case TYPE_UTIL:
if (square3.owner < 0) {
printf(" - 150");
if (!printEndOfLine) {
printf(" ");
}
break;
}
printf(" %d 150", square3.owner + 1);
printMortgaged(square3);
printf("%d", Monop.players[square3.owner].utilitiesCount);
if (!printEndOfLine) {
printf(" ");
}
break;
case TYPE_RAILROAD:
if (square3.owner < 0) {
printf(" - Railroad 200");
if (!printEndOfLine) {
printf(" ");
}
break;
}
printf(" %d Railroad 200", square3.owner + 1);
printMortgaged(square3);
rentAmount = 25;
rentAmount <<= Monop.players[square3.owner].railroadCardCount - 1;
printf("%d %4d", Monop.players[square3.owner].railroadCardCount, 25 << (Monop.players[square3.owner].railroadCardCount - 1));
break;
}
if (printEndOfLine) {
putchar('\n');
}
}
void printMortgaged(Square square4) {
if (square4.description.isMortgaged) {
printf(" * ");
}
else {
printf(" ");
}
}
static void printHoldings(int playerIndex) {
OwnedPropertyList propertyList7;
Player property;
String bsp;
property = Monop.players[playerIndex];
printf("%s's (%d) holdings (Total worth: $%d):\n", Monop.playerNames[playerIndex], playerIndex + 1, property.money + PropertyFunctions.getPropertyWorth(property));
printf("\t$%d", property.money);
if (property.getOutOfJailFreeCardCount) {
printf(", %d get-out-of-jail-free card", property.getOutOfJailFreeCardCount);
if (property.getOutOfJailFreeCardCount > 1) {
putchar('s');
}
}
putchar('\n');
if (property.ownedPropertyList) {
printf("\t%s\n", header);
for (propertyList7 = property.ownedPropertyList;propertyList7;propertyList7 = propertyList7.next) {
putchar('\t');
printSquare(getSquareIndex(propertyList7.square1) , true);
}
}
}
| static String sccsid;
sccsid = "@(#)print.c 5.4 (Berkeley) 6/1/90";
static String buf;
buf = new String();
static String header;
header = "Name Own Price Mg # Rent";
public static void printBoard() {
int i;
printf("%s\t%s\n", header, header);
for (i = 0;i < NUMBER_OF_SQUARES / 2;i++) {
printSquare(i, false);
putchar('\t');
printSquare(i + NUMBER_OF_SQUARES / 2, true);
}
}
public static void printPlayerLocations() {
int i;
String bsp;
printf("%s Player\n", header);
for (i = 0;i < Monop.numberOfPlayers;i++) {
printSquare(Monop.players[i].location, false);
printf(" %s (%d)", Monop.players[i].name, i + 1);
if (Monop.currentPlayer == Monop.players[i]) {
printf(" *");
}
putchar('\n');
}
}
static void printSquare(int squareIndex, boolean printEndOfLine) {
int rentAmount;
Property property;
Square square3;
int i;
square3 = Monop.board[squareIndex];
printf("%-10.10s", square3.name);
switch (square3.type) {
case TYPE_SAFE:
case TYPE_COMMUNITY_CHEST:
case TYPE_CHANCE:
case TYPE_INCOME_TAX:
case TYPE_GOTO_JAIL:
case TYPE_LUXURY_TAX:
case TYPE_IN_JAIL:
if (!printEndOfLine) {
printf(" ");
}
break;
case TYPE_PROPERTY:
property = square3.description;
if (square3.owner < 0) {
printf(" - %-8.8s %3d", property.monopolyDescription.name, square3.cost);
if (!printEndOfLine) {
printf(" ");
}
break;
}
printf(" %d %-8.8s %3d", square3.owner + 1, property.monopolyDescription.name, square3.cost);
printMortgaged(square3);
if (property.isMonopoly) {
if (property.houseCount < 5) {
if (property.houseCount > 0) {
printf("%d %4d", property.houseCount, property.rent[property.houseCount]);
}
else {
printf("0 %4d", property.rent[0] * 2);
}
}
else {
printf("H %4d", property.rent[5]);
}
}
else {
printf(" %4d", property.rent[0]);
}
break;
case TYPE_UTIL:
if (square3.owner < 0) {
printf(" - 150");
if (!printEndOfLine) {
printf(" ");
}
break;
}
printf(" %d 150", square3.owner + 1);
printMortgaged(square3);
printf("%d", Monop.players[square3.owner].utilitiesCount);
if (!printEndOfLine) {
printf(" ");
}
break;
case TYPE_RAILROAD:
if (square3.owner < 0) {
printf(" - Railroad 200");
if (!printEndOfLine) {
printf(" ");
}
break;
}
printf(" %d Railroad 200", square3.owner + 1);
printMortgaged(square3);
rentAmount = 25;
rentAmount <<= Monop.players[square3.owner].railroadCardCount - 1;
printf("%d %4d", Monop.players[square3.owner].railroadCardCount, 25 << (Monop.players[square3.owner].railroadCardCount - 1));
break;
}
if (printEndOfLine) {
putchar('\n');
}
}
void printMortgaged(Square square4) {
if (square4.description.isMortgaged) {
printf(" * ");
}
else {
printf(" ");
}
}
static void printHoldings(int playerIndex) {
OwnedPropertyList propertyList7;
Player property;
String bsp;
property = Monop.players[playerIndex];
printf("%s's (%d) holdings (Total worth: $%d):\n", Monop.playerNames[playerIndex], playerIndex + 1, property.money + PropertyFunctions.getPropertyWorth(property));
printf("\t$%d", property.money);
if (property.getOutOfJailFreeCardCount) {
printf(", %d get-out-of-jail-free card", property.getOutOfJailFreeCardCount);
if (property.getOutOfJailFreeCardCount > 1) {
putchar('s');
}
}
putchar('\n');
if (property.ownedPropertyList) {
printf("\t%s\n", header);
for (propertyList7 = property.ownedPropertyList;propertyList7;propertyList7 = propertyList7.next) {
putchar('\t');
printSquare(getSquareIndex(propertyList7.square1) , true);
}
}
}
| static String sccsid;
sccsid = "@(#)print.c 5.4 (Berkeley) 6/1/90";
static String buf;
buf = new String();
static String header;
header = "Name Own Price Mg # Rent";
public static void printBoard() {
int i;
printf("%s\t%s\n", header, header);
for (i = 0;i < NUMBER_OF_SQUARES / 2;i++) {
printSquare(i, false);
putchar('\t');
printSquare(i + NUMBER_OF_SQUARES / 2, true);
}
}
public static void printPlayerLocations() {
int i;
String bsp;
printf("%s Player\n", header);
for (i = 0;i < Monop.numberOfPlayers;i++) {
printSquare(Monop.players[i].location, false);
printf(" %s (%d)", Monop.players[i].name, i + 1);
if (Monop.currentPlayer == Monop.players[i]) {
printf(" *");
}
putchar('\n');
}
}
static void printSquare(int squareIndex, boolean printEndOfLine) {
int rentAmount;
Property property;
Square square3;
int i;
square3 = Monop.board[squareIndex];
printf("%-10.10s", square3.name);
switch (square3.type) {
case TYPE_SAFE:
case TYPE_COMMUNITY_CHEST:
case TYPE_CHANCE:
case TYPE_INCOME_TAX:
case TYPE_GOTO_JAIL:
case TYPE_LUXURY_TAX:
case TYPE_IN_JAIL:
if (!printEndOfLine) {
printf(" ");
}
break;
case TYPE_PROPERTY:
property = square3.description;
if (square3.owner < 0) {
printf(" - %-8.8s %3d", property.monopolyDescription.name, square3.cost);
if (!printEndOfLine) {
printf(" ");
}
break;
}
printf(" %d %-8.8s %3d", square3.owner + 1, property.monopolyDescription.name, square3.cost);
printMortgaged(square3);
if (property.isMonopoly) {
if (property.houseCount < 5) {
if (property.houseCount > 0) {
printf("%d %4d", property.houseCount, property.rent[property.houseCount]);
}
else {
printf("0 %4d", property.rent[0] * 2);
}
}
else {
printf("H %4d", property.rent[5]);
}
}
else {
printf(" %4d", property.rent[0]);
}
break;
case TYPE_UTIL:
if (square3.owner < 0) {
printf(" - 150");
if (!printEndOfLine) {
printf(" ");
}
break;
}
printf(" %d 150", square3.owner + 1);
printMortgaged(square3);
printf("%d", Monop.players[square3.owner].utilitiesCount);
if (!printEndOfLine) {
printf(" ");
}
break;
case TYPE_RAILROAD:
if (square3.owner < 0) {
printf(" - Railroad 200");
if (!printEndOfLine) {
printf(" ");
}
break;
}
printf(" %d Railroad 200", square3.owner + 1);
printMortgaged(square3);
rentAmount = 25;
rentAmount <<= Monop.players[square3.owner].railroadCardCount - 1;
printf("%d %4d", Monop.players[square3.owner].railroadCardCount, 25 << (Monop.players[square3.owner].railroadCardCount - 1));
break;
}
if (printEndOfLine) {
putchar('\n');
}
}
void printMortgaged(Square square4) {
if (square4.description.isMortgaged) {
printf(" * ");
}
else {
printf(" ");
}
}
static void printHoldings(int playerIndex) {
OwnedPropertyList propertyList7;
Player property;
String bsp;
property = Monop.players[playerIndex];
printf("%s's (%d) holdings (Total worth: $%d):\n", Monop.playerNames[playerIndex], playerIndex + 1, property.money + PropertyFunctions.getPropertyWorth(property));
printf("\t$%d", property.money);
if (property.getOutOfJailFreeCardCount != 0) {
printf(", %d get-out-of-jail-free card", property.getOutOfJailFreeCardCount);
if (property.getOutOfJailFreeCardCount > 1) {
putchar('s');
}
}
putchar('\n');
if (property.ownedPropertyList != null) {
printf("\t%s\n", header);
for (propertyList7 = property.ownedPropertyList;propertyList7 != null;propertyList7 = propertyList7.next) {
putchar('\t');
printSquare(getSquareIndex(propertyList7.square1) , true);
}
}
}
| static String sccsid;
sccsid = "@(#)print.c 5.4 (Berkeley) 6/1/90";
static String buf;
buf = new String();
static String header;
header = "Name Own Price Mg # Rent";
public static void printBoard() {
int i;
fprintf(stdout, "%s\t%s\n", header, header);
for (i = 0;i < NUMBER_OF_SQUARES / 2;i++) {
printSquare(i, false);
stdout.write('\t');
printSquare(i + NUMBER_OF_SQUARES / 2, true);
}
}
public static void printPlayerLocations() {
int i;
String bsp;
fprintf(stdout, "%s Player\n", header);
for (i = 0;i < Monop.numberOfPlayers;i++) {
printSquare(Monop.players[i].location, false);
fprintf(stdout, " %s (%d)", Monop.players[i].name, i + 1);
if (Monop.currentPlayer == Monop.players[i]) {
fprintf(stdout, " *");
}
stdout.write('\n');
}
}
static void printSquare(int squareIndex, boolean printEndOfLine) {
int rentAmount;
Property property;
Square square3;
int i;
square3 = Monop.board[squareIndex];
fprintf(stdout, "%-10.10s", square3.name);
switch (square3.type) {
case TYPE_SAFE:
case TYPE_COMMUNITY_CHEST:
case TYPE_CHANCE:
case TYPE_INCOME_TAX:
case TYPE_GOTO_JAIL:
case TYPE_LUXURY_TAX:
case TYPE_IN_JAIL:
if (!printEndOfLine) {
fprintf(stdout, " ");
}
break;
case TYPE_PROPERTY:
property = square3.description;
if (square3.owner < 0) {
fprintf(stdout, " - %-8.8s %3d", property.monopolyDescription.name, square3.cost);
if (!printEndOfLine) {
fprintf(stdout, " ");
}
break;
}
fprintf(stdout, " %d %-8.8s %3d", square3.owner + 1, property.monopolyDescription.name, square3.cost);
printMortgaged(square3);
if (property.isMonopoly) {
if (property.houseCount < 5) {
if (property.houseCount > 0) {
fprintf(stdout, "%d %4d", property.houseCount, property.rent[property.houseCount]);
}
else {
fprintf(stdout, "0 %4d", property.rent[0] * 2);
}
}
else {
fprintf(stdout, "H %4d", property.rent[5]);
}
}
else {
fprintf(stdout, " %4d", property.rent[0]);
}
break;
case TYPE_UTIL:
if (square3.owner < 0) {
fprintf(stdout, " - 150");
if (!printEndOfLine) {
fprintf(stdout, " ");
}
break;
}
fprintf(stdout, " %d 150", square3.owner + 1);
printMortgaged(square3);
fprintf(stdout, "%d", Monop.players[square3.owner].utilitiesCount);
if (!printEndOfLine) {
fprintf(stdout, " ");
}
break;
case TYPE_RAILROAD:
if (square3.owner < 0) {
fprintf(stdout, " - Railroad 200");
if (!printEndOfLine) {
fprintf(stdout, " ");
}
break;
}
fprintf(stdout, " %d Railroad 200", square3.owner + 1);
printMortgaged(square3);
rentAmount = 25;
rentAmount <<= Monop.players[square3.owner].railroadCardCount - 1;
fprintf(stdout, "%d %4d", Monop.players[square3.owner].railroadCardCount, 25 << (Monop.players[square3.owner].railroadCardCount - 1));
break;
}
if (printEndOfLine) {
stdout.write('\n');
}
}
void printMortgaged(Square square4) {
if (square4.description.isMortgaged) {
fprintf(stdout, " * ");
}
else {
fprintf(stdout, " ");
}
}
static void printHoldings(int playerIndex) {
OwnedPropertyList propertyList7;
Player property;
String bsp;
property = Monop.players[playerIndex];
fprintf(stdout, "%s's (%d) holdings (Total worth: $%d):\n", Monop.playerNames[playerIndex], playerIndex + 1, property.money + PropertyFunctions.getPropertyWorth(property));
fprintf(stdout, "\t$%d", property.money);
if (property.getOutOfJailFreeCardCount != 0) {
fprintf(stdout, ", %d get-out-of-jail-free card", property.getOutOfJailFreeCardCount);
if (property.getOutOfJailFreeCardCount > 1) {
stdout.write('s');
}
}
stdout.write('\n');
if (property.ownedPropertyList != null) {
fprintf(stdout, "\t%s\n", header);
for (propertyList7 = property.ownedPropertyList;propertyList7 != null;propertyList7 = propertyList7.next) {
stdout.write('\t');
printSquare(getSquareIndex(propertyList7.square1) , true);
}
}
}
| static String sccsid;
sccsid = "@(#)print.c 5.4 (Berkeley) 6/1/90";
static String buf;
buf = new String();
static String header;
header = "Name Own Price Mg # Rent";
public static void printBoard() {
int i;
fprintf(stdout, "%s\t%s\n", header, header);
for (i = 0;i < NUMBER_OF_SQUARES / 2;i++) {
printSquare(i, false);
stdout.write('\t');
printSquare(i + NUMBER_OF_SQUARES / 2, true);
}
}
public static void printPlayerLocations() {
int i;
String bsp;
fprintf(stdout, "%s Player\n", header);
for (i = 0;i < Monop.numberOfPlayers;i++) {
printSquare(Monop.players[i].location, false);
fprintf(stdout, " %s (%d)", Monop.players[i].name, i + 1);
if (Monop.currentPlayer == Monop.players[i]) {
fprintf(stdout, " *");
}
stdout.newLine();
}
}
static void printSquare(int squareIndex, boolean printEndOfLine) {
int rentAmount;
Property property;
Square square3;
int i;
square3 = Monop.board[squareIndex];
fprintf(stdout, "%-10.10s", square3.name);
switch (square3.type) {
case TYPE_SAFE:
case TYPE_COMMUNITY_CHEST:
case TYPE_CHANCE:
case TYPE_INCOME_TAX:
case TYPE_GOTO_JAIL:
case TYPE_LUXURY_TAX:
case TYPE_IN_JAIL:
if (!printEndOfLine) {
fprintf(stdout, " ");
}
break;
case TYPE_PROPERTY:
property = square3.description;
if (square3.owner < 0) {
fprintf(stdout, " - %-8.8s %3d", property.monopolyDescription.name, square3.cost);
if (!printEndOfLine) {
fprintf(stdout, " ");
}
break;
}
fprintf(stdout, " %d %-8.8s %3d", square3.owner + 1, property.monopolyDescription.name, square3.cost);
printMortgaged(square3);
if (property.isMonopoly) {
if (property.houseCount < 5) {
if (property.houseCount > 0) {
fprintf(stdout, "%d %4d", property.houseCount, property.rent[property.houseCount]);
}
else {
fprintf(stdout, "0 %4d", property.rent[0] * 2);
}
}
else {
fprintf(stdout, "H %4d", property.rent[5]);
}
}
else {
fprintf(stdout, " %4d", property.rent[0]);
}
break;
case TYPE_UTIL:
if (square3.owner < 0) {
fprintf(stdout, " - 150");
if (!printEndOfLine) {
fprintf(stdout, " ");
}
break;
}
fprintf(stdout, " %d 150", square3.owner + 1);
printMortgaged(square3);
fprintf(stdout, "%d", Monop.players[square3.owner].utilitiesCount);
if (!printEndOfLine) {
fprintf(stdout, " ");
}
break;
case TYPE_RAILROAD:
if (square3.owner < 0) {
fprintf(stdout, " - Railroad 200");
if (!printEndOfLine) {
fprintf(stdout, " ");
}
break;
}
fprintf(stdout, " %d Railroad 200", square3.owner + 1);
printMortgaged(square3);
rentAmount = 25;
rentAmount <<= Monop.players[square3.owner].railroadCardCount - 1;
fprintf(stdout, "%d %4d", Monop.players[square3.owner].railroadCardCount, 25 << (Monop.players[square3.owner].railroadCardCount - 1));
break;
}
if (printEndOfLine) {
stdout.newLine();
}
}
void printMortgaged(Square square4) {
if (square4.description.isMortgaged) {
fprintf(stdout, " * ");
}
else {
fprintf(stdout, " ");
}
}
static void printHoldings(int playerIndex) {
OwnedPropertyList propertyList7;
Player property;
String bsp;
property = Monop.players[playerIndex];
fprintf(stdout, "%s's (%d) holdings (Total worth: $%d):\n", Monop.playerNames[playerIndex], playerIndex + 1, property.money + PropertyFunctions.getPropertyWorth(property));
fprintf(stdout, "\t$%d", property.money);
if (property.getOutOfJailFreeCardCount != 0) {
fprintf(stdout, ", %d get-out-of-jail-free card", property.getOutOfJailFreeCardCount);
if (property.getOutOfJailFreeCardCount > 1) {
stdout.write('s');
}
}
stdout.newLine();
if (property.ownedPropertyList != null) {
fprintf(stdout, "\t%s\n", header);
for (propertyList7 = property.ownedPropertyList;propertyList7 != null;propertyList7 = propertyList7.next) {
stdout.write('\t');
printSquare(getSquareIndex(propertyList7.square1) , true);
}
}
}
| static String sccsid = "@(#)print.c 5.4 (Berkeley) 6/1/90";
static String buf = new String();
static String header = "Name Own Price Mg # Rent";
public static void printBoard() {
int i;
fprintf(stdout, "%s\t%s\n", header, header);
for (i = 0;i < NUMBER_OF_SQUARES / 2;i++) {
printSquare(i, false);
stdout.write('\t');
printSquare(i + NUMBER_OF_SQUARES / 2, true);
}
}
public static void printPlayerLocations() {
int i;
String bsp;
fprintf(stdout, "%s Player\n", header);
for (i = 0;i < Monop.numberOfPlayers;i++) {
printSquare(Monop.players[i].location, false);
fprintf(stdout, " %s (%d)", Monop.players[i].name, i + 1);
if (Monop.currentPlayer == Monop.players[i]) {
fprintf(stdout, " *");
}
stdout.newLine();
}
}
static void printSquare(int squareIndex, boolean printEndOfLine) {
int rentAmount;
Property property;
Square square3;
int i;
square3 = Monop.board[squareIndex];
fprintf(stdout, "%-10.10s", square3.name);
switch (square3.type) {
case TYPE_SAFE:
case TYPE_COMMUNITY_CHEST:
case TYPE_CHANCE:
case TYPE_INCOME_TAX:
case TYPE_GOTO_JAIL:
case TYPE_LUXURY_TAX:
case TYPE_IN_JAIL:
if (!printEndOfLine) {
fprintf(stdout, " ");
}
break;
case TYPE_PROPERTY:
property = square3.description;
if (square3.owner < 0) {
fprintf(stdout, " - %-8.8s %3d", property.monopolyDescription.name, square3.cost);
if (!printEndOfLine) {
fprintf(stdout, " ");
}
break;
}
fprintf(stdout, " %d %-8.8s %3d", square3.owner + 1, property.monopolyDescription.name, square3.cost);
printMortgaged(square3);
if (property.isMonopoly) {
if (property.houseCount < 5) {
if (property.houseCount > 0) {
fprintf(stdout, "%d %4d", property.houseCount, property.rent[property.houseCount]);
}
else {
fprintf(stdout, "0 %4d", property.rent[0] * 2);
}
}
else {
fprintf(stdout, "H %4d", property.rent[5]);
}
}
else {
fprintf(stdout, " %4d", property.rent[0]);
}
break;
case TYPE_UTIL:
if (square3.owner < 0) {
fprintf(stdout, " - 150");
if (!printEndOfLine) {
fprintf(stdout, " ");
}
break;
}
fprintf(stdout, " %d 150", square3.owner + 1);
printMortgaged(square3);
fprintf(stdout, "%d", Monop.players[square3.owner].utilitiesCount);
if (!printEndOfLine) {
fprintf(stdout, " ");
}
break;
case TYPE_RAILROAD:
if (square3.owner < 0) {
fprintf(stdout, " - Railroad 200");
if (!printEndOfLine) {
fprintf(stdout, " ");
}
break;
}
fprintf(stdout, " %d Railroad 200", square3.owner + 1);
printMortgaged(square3);
rentAmount = 25;
rentAmount <<= Monop.players[square3.owner].railroadCardCount - 1;
fprintf(stdout, "%d %4d", Monop.players[square3.owner].railroadCardCount, 25 << (Monop.players[square3.owner].railroadCardCount - 1));
break;
}
if (printEndOfLine) {
stdout.newLine();
}
}
void printMortgaged(Square square4) {
if (square4.description.isMortgaged) {
fprintf(stdout, " * ");
}
else {
fprintf(stdout, " ");
}
}
static void printHoldings(int playerIndex) {
OwnedPropertyList propertyList7;
Player property;
String bsp;
property = Monop.players[playerIndex];
fprintf(stdout, "%s's (%d) holdings (Total worth: $%d):\n", Monop.playerNames[playerIndex], playerIndex + 1, property.money + PropertyFunctions.getPropertyWorth(property));
fprintf(stdout, "\t$%d", property.money);
if (property.getOutOfJailFreeCardCount != 0) {
fprintf(stdout, ", %d get-out-of-jail-free card", property.getOutOfJailFreeCardCount);
if (property.getOutOfJailFreeCardCount > 1) {
stdout.write('s');
}
}
stdout.newLine();
if (property.ownedPropertyList != null) {
fprintf(stdout, "\t%s\n", header);
for (propertyList7 = property.ownedPropertyList;propertyList7 != null;propertyList7 = propertyList7.next) {
stdout.write('\t');
printSquare(getSquareIndex(propertyList7.square1) , true);
}
}
}
| static String sccsid = "@(#)print.c 5.4 (Berkeley) 6/1/90";
static String buf = new String();
static String header = "Name Own Price Mg # Rent";
public static void printBoard() {
int i;
System.out.println(header + "\t" + header);
for (i = 0;i < NUMBER_OF_SQUARES / 2;i++) {
printSquare(i, false);
stdout.write('\t');
printSquare(i + NUMBER_OF_SQUARES / 2, true);
}
}
public static void printPlayerLocations() {
int i;
String bsp;
System.out.println(header + " Player");
for (i = 0;i < Monop.numberOfPlayers;i++) {
printSquare(Monop.players[i].location, false);
System.out.print(" " + (Monop.players[i].name) + " (" + (i + 1) + ")");
if (Monop.currentPlayer == Monop.players[i]) {
System.out.print(" *");
}
stdout.newLine();
}
}
static void printSquare(int squareIndex, boolean printEndOfLine) {
int rentAmount;
Property property;
Square square3;
int i;
square3 = Monop.board[squareIndex];
System.out.print(square3.name);
switch (square3.type) {
case TYPE_SAFE:
case TYPE_COMMUNITY_CHEST:
case TYPE_CHANCE:
case TYPE_INCOME_TAX:
case TYPE_GOTO_JAIL:
case TYPE_LUXURY_TAX:
case TYPE_IN_JAIL:
if (!printEndOfLine) {
System.out.print(" ");
}
break;
case TYPE_PROPERTY:
property = square3.description;
if (square3.owner < 0) {
System.out.print(" - " + property.monopolyDescription.name + " " + square3.cost);
if (!printEndOfLine) {
System.out.print(" ");
}
break;
}
System.out.print(" " + (square3.owner + 1) + " " + property.monopolyDescription.name + " " + square3.cost);
printMortgaged(square3);
if (property.isMonopoly) {
if (property.houseCount < 5) {
if (property.houseCount > 0) {
System.out.print(property.houseCount + " " + (property.rent[property.houseCount]));
}
else {
System.out.print("0 " + (property.rent[0] * 2));
}
}
else {
System.out.print("H " + (property.rent[5]));
}
}
else {
System.out.print(" " + (property.rent[0]));
}
break;
case TYPE_UTIL:
if (square3.owner < 0) {
System.out.print(" - 150");
if (!printEndOfLine) {
System.out.print(" ");
}
break;
}
System.out.print(" " + (square3.owner + 1) + " 150");
printMortgaged(square3);
System.out.print((Monop.players[square3.owner].utilitiesCount));
if (!printEndOfLine) {
System.out.print(" ");
}
break;
case TYPE_RAILROAD:
if (square3.owner < 0) {
System.out.print(" - Railroad 200");
if (!printEndOfLine) {
System.out.print(" ");
}
break;
}
System.out.print(" " + (square3.owner + 1) + " Railroad 200");
printMortgaged(square3);
rentAmount = 25;
rentAmount <<= Monop.players[square3.owner].railroadCardCount - 1;
System.out.print((Monop.players[square3.owner].railroadCardCount) + " " + (25 << (Monop.players[square3.owner].railroadCardCount - 1)));
break;
}
if (printEndOfLine) {
stdout.newLine();
}
}
void printMortgaged(Square square4) {
if (square4.description.isMortgaged) {
System.out.print(" * ");
}
else {
System.out.print(" ");
}
}
static void printHoldings(int playerIndex) {
OwnedPropertyList propertyList7;
Player property;
String bsp;
property = Monop.players[playerIndex];
System.out.println((Monop.playerNames[playerIndex]) + "'s (" + (playerIndex + 1) + ") holdings (Total worth: $" + (property.money + PropertyFunctions.getPropertyWorth(property)) + "):");
System.out.print("\t$" + property.money);
if (property.getOutOfJailFreeCardCount != 0) {
System.out.print(", " + property.getOutOfJailFreeCardCount + " get-out-of-jail-free card");
if (property.getOutOfJailFreeCardCount > 1) {
stdout.write('s');
}
}
stdout.newLine();
if (property.ownedPropertyList != null) {
System.out.println("\t" + header);
for (propertyList7 = property.ownedPropertyList;propertyList7 != null;propertyList7 = propertyList7.next) {
stdout.write('\t');
printSquare(getSquareIndex(propertyList7.square1) , true);
}
}
}
| static String sccsid = "@(#)print.c 5.4 (Berkeley) 6/1/90";
static String buf = new String();
static String header = "Name Own Price Mg # Rent";
public static void printBoard() {
int i;
System.out.println(header + "\t" + header);
for (i = 0;i < NUMBER_OF_SQUARES / 2;i++) {
printSquare(i, false);
System.out.print('\t');
printSquare(i + NUMBER_OF_SQUARES / 2, true);
}
}
public static void printPlayerLocations() {
int i;
String bsp;
System.out.println(header + " Player");
for (i = 0;i < Monop.numberOfPlayers;i++) {
printSquare(Monop.players[i].location, false);
System.out.print(" " + (Monop.players[i].name) + " (" + (i + 1) + ")");
if (Monop.currentPlayer == Monop.players[i]) {
System.out.print(" *");
}
System.out.println();
}
}
static void printSquare(int squareIndex, boolean printEndOfLine) {
int rentAmount;
Property property;
Square square3;
int i;
square3 = Monop.board[squareIndex];
System.out.print(square3.name);
switch (square3.type) {
case TYPE_SAFE:
case TYPE_COMMUNITY_CHEST:
case TYPE_CHANCE:
case TYPE_INCOME_TAX:
case TYPE_GOTO_JAIL:
case TYPE_LUXURY_TAX:
case TYPE_IN_JAIL:
if (!printEndOfLine) {
System.out.print(" ");
}
break;
case TYPE_PROPERTY:
property = square3.description;
if (square3.owner < 0) {
System.out.print(" - " + property.monopolyDescription.name + " " + square3.cost);
if (!printEndOfLine) {
System.out.print(" ");
}
break;
}
System.out.print(" " + (square3.owner + 1) + " " + property.monopolyDescription.name + " " + square3.cost);
printMortgaged(square3);
if (property.isMonopoly) {
if (property.houseCount < 5) {
if (property.houseCount > 0) {
System.out.print(property.houseCount + " " + (property.rent[property.houseCount]));
}
else {
System.out.print("0 " + (property.rent[0] * 2));
}
}
else {
System.out.print("H " + (property.rent[5]));
}
}
else {
System.out.print(" " + (property.rent[0]));
|