Let the player select a color to paint the upper left tile.
(displayMode)
| 134 | |
| 135 | |
| 136 | def askForPlayerMove(displayMode): |
| 137 | """Let the player select a color to paint the upper left tile.""" |
| 138 | while True: |
| 139 | bext.fg('white') |
| 140 | print('Choose one of ', end='') |
| 141 | |
| 142 | if displayMode == COLOR_MODE: |
| 143 | bext.fg('red') |
| 144 | print('(R)ed ', end='') |
| 145 | bext.fg('green') |
| 146 | print('(G)reen ', end='') |
| 147 | bext.fg('blue') |
| 148 | print('(B)lue ', end='') |
| 149 | bext.fg('yellow') |
| 150 | print('(Y)ellow ', end='') |
| 151 | bext.fg('cyan') |
| 152 | print('(C)yan ', end='') |
| 153 | bext.fg('purple') |
| 154 | print('(P)urple ', end='') |
| 155 | elif displayMode == SHAPE_MODE: |
| 156 | bext.fg('red') |
| 157 | print('(H)eart, ', end='') |
| 158 | bext.fg('green') |
| 159 | print('(T)riangle, ', end='') |
| 160 | bext.fg('blue') |
| 161 | print('(D)iamond, ', end='') |
| 162 | bext.fg('yellow') |
| 163 | print('(B)all, ', end='') |
| 164 | bext.fg('cyan') |
| 165 | print('(C)lub, ', end='') |
| 166 | bext.fg('purple') |
| 167 | print('(S)pade, ', end='') |
| 168 | bext.fg('white') |
| 169 | print('or QUIT:') |
| 170 | response = input('> ').upper() |
| 171 | if response == 'QUIT': |
| 172 | print('Thanks for playing!') |
| 173 | sys.exit() |
| 174 | if displayMode == COLOR_MODE and response in tuple('RGBYCP'): |
| 175 | # Return a tile type number based on the response: |
| 176 | return {'R': 0, 'G': 1, 'B': 2, |
| 177 | 'Y': 3, 'C': 4, 'P': 5}[response] |
| 178 | if displayMode == SHAPE_MODE and response in tuple('HTDBCS'): |
| 179 | # Return a tile type number based on the response: |
| 180 | return {'H': 0, 'T': 1, 'D':2, |
| 181 | 'B': 3, 'C': 4, 'S': 5}[response] |
| 182 | |
| 183 | |
| 184 | def changeTile(tileType, board, x, y, charToChange=None): |