-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added jail functionality fixes#10 #30
base: main
Are you sure you want to change the base?
Conversation
…nged to be inline with monopoly
@@ -20,7 +23,7 @@ def __init__(self, num_players) -> None: | |||
7: Property(0, "Chance", -4, (32,23), COLORS.CHANCE, 0, 0, 0, 0, 0, 0, 0, 0, 0), | |||
8: Property(0, "Vermont Avenue", -1, (32,16), COLORS.LIGHTBLUE, 100, 50, 6, 30, 90, 270, 400, 550, 50), | |||
9: Property(0, "Connecticut Avenue", -1, (32,9), COLORS.LIGHTBLUE, 120, 50, 8, 40, 100, 300, 450, 600, 60), | |||
10: Property(0, "Jail", -7, (32,23), COLORS.LIGHTGRAY, 0, 0, 0, 0, 0, 0, 0, 0, 0), | |||
10: Property(0, "Jail", -6, (32,2), COLORS.LIGHTGRAY, 0, 0, 0, 0, 0, 0, 0, 0, 0), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
printing bug fixed
@@ -30,7 +33,7 @@ def __init__(self, num_players) -> None: | |||
17: Property(0, "Community Chest", -3, (11,2), COLORS.COMMUNITY, 0, 0, 0, 0, 0, 0, 0, 0, 0), | |||
18: Property(0, "Tennessee Avenue", -1, (8,2), COLORS.ORANGE, 180, 100, 14, 70, 200, 550, 750, 950, 90), | |||
19: Property(0, "New York Avenue", -1, (5,2), COLORS.ORANGE, 200, 100, 16, 80, 220, 600, 800, 1000, 100), | |||
20: Property(0, "Free Parking", -1, (2,2), COLORS.LIGHTGRAY, 0, 0, 0, 0, 0, 0, 0, 0, 0), | |||
20: Property(0, "Free Parking", -8, (2,2), COLORS.LIGHTGRAY, 0, 0, 0, 0, 0, 0, 0, 0, 0), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be identified as special code -8
@@ -52,7 +55,7 @@ def __init__(self, num_players) -> None: | |||
39: Property(0, "Boardwalk", -1, (29,72), COLORS.BLUE, 400, 200, 50, 200, 600, 1400, 1700, 2000, 200), | |||
} | |||
|
|||
def update_location(self, player:Player, roll: int, update_history, new = None) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed this definition because update_history is used exclusively once.. makes more sense to hardcode in monopoly.py (see change there)
update_history(f"{players[turn].name} cannot roll after paying the fine.") | ||
return # End the turn after paying the fine | ||
update_history(f"{players[turn].name} paid $50 to post bail.") | ||
break |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed terminology and allow player to move after paying fine. this is typical monopoly gameplay
|
||
if players[turn].jail: | ||
left_jail, reason = players[turn].attempt_jail_roll(dice) | ||
if left_jail: | ||
if reason == "doubles": | ||
update_history(f"{players[turn].name} rolled doubles and got out of jail!") | ||
elif reason == "third_turn": | ||
update_history(f"{players[turn].name} didn't roll doubles on their third turn. They paid $50 and left jail.") | ||
update_history(f"{players[turn].name} didn't roll doubles on their third turn. They paid $50 to post bail.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
terminology changes
players[turn].go_to_jail() | ||
# board.locations[players[turn].location].players.remove(turn) | ||
board.locations[10].players.append(turn) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
relocated this to properly print after movement. looks better
@Ossedda The last change I would like you to add is allowing a player to use a "get out of jail free" card. This is located in player_class and should be easy to implement. Test all cases sufficiently. Great work! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see earlier comments :)
Apologies on the initial jail logic. Second guessed myself on it last second :) |
@Ossedda update on this? |
Added jail functionality to the game. Players that land in jail are given a choice to roll for doubles or pay a $50 fine to get out of jail. Players that roll doubles get out of jail and move that amount of spaces according to their roll. Players that do not roll doubles three times in a row while in jail are forced to pay the $50 fine. Players that pay the fine are also not able to move the turn they pay, voluntary or not. Changes were made in player_class.py in order to accommodate players being in a jailed state.