-
Notifications
You must be signed in to change notification settings - Fork 0
/
game_constants.py
83 lines (71 loc) · 2.08 KB
/
game_constants.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# Author: Mark Mendez
# Date: 03/01/2022
QUIT_MESSAGE = '\\q'
QUIT_MESSAGE_PRINTABLE = r'\q'
# Message printed when local process encounters an error receiving a packet from the opponent process
PACKET_RECEIVE_ERROR_MESSAGE = 'Opponent had an error.'
# Use strings to represent players, so they can be used in dicts
# and are compatible with the json library
PLAYER_1 = '1'
PLAYER_2 = '2'
# Represent a tie.
# This should have the same data type as the players but represent neither of them.
TIE = 'tie'
# Choose a string that will distinguish replies
REPLY_LINE_PREFIX = 'vs '
# This prints after a player takes their turn and before the round results are received
WAITING_FOR_OPPONENT_MESSAGE = 'Waiting for opponent'
# This prints when each player is taking their turn
TURN_PROMPT = r'What is your next move (R / P / S) if you have them, or \q to quit?' + '\n'
# Keep a simple list of all moves
ALL_MOVES = ['R', 'P', 'S']
# Define which moves are defeated by a given move
MOVE_PRIORITY = {
'R': 'S',
'P': 'R',
'S': 'P'
}
# The game guarantees that both players always have at least REGEN_THRESHOLD move options.
# When it's time to regenerate a move, the game adds REGEN_QUANTITY_EACH to a random option,
# REGEN_ITERATIONS times.
REGEN_THRESHOLD = 3
REGEN_QUANTITY_EACH = 1
REGEN_ITERATIONS = 2
# Define stage choices
STAGES = {
'HEAVEN': {
'R': 3,
'P': 3,
'S': 3,
},
'OFFICE': {
'R': 1,
'P': 2,
'S': 2,
},
'RAINFOREST': {
'R': 2,
'P': 3,
'S': 1,
},
'MOUNTAIN': {
'R': 2,
'P': 1,
'S': 1,
},
'ASTEROID': {
'R': 3,
'P': 1,
'S': 2,
},
'ARMORY': {
'R': 2,
'P': 1,
'S': 3,
},
}
# Choose the message that displays to the client player who selects the stage
STAGE_CHOICE_PROMPT = ('You are player 1.\n\nChoose a stage by entering its name. ' +
'R, P, and S show how many of Rock, Paper, and Scissors each player gets.\n\n' +
f'{STAGES}\n\n'
)