Power Grid Board Game Timer. Acts like a chess timer for 3-6 people. Uses an ADXL accelerometer to pause the timer and change players. Uses an LCD screen to prompt the players for input, read that input, and change between rounds.

Dependencies:   DmTouch_UniGraphic UniGraphic-forLdelaney17FinalProject mbed

Committer:
ldelaney17
Date:
Wed Jan 25 16:30:13 2017 +0000
Revision:
5:e07903df9510
Parent:
4:e14c199c2466
publish commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ldelaney17 2:e6788e73de54 1 #include "game.h"
ldelaney17 2:e6788e73de54 2
ldelaney17 2:e6788e73de54 3 void game_setup(){
ldelaney17 4:e14c199c2466 4 step_number = 0;
ldelaney17 4:e14c199c2466 5 clock_running = false;
ldelaney17 4:e14c199c2466 6 current_clock.reset();
ldelaney17 2:e6788e73de54 7 init_num_players();
ldelaney17 4:e14c199c2466 8 set_start_time();
ldelaney17 4:e14c199c2466 9 set_bonus_time();
ldelaney17 4:e14c199c2466 10 next_step(); // set_player_order();
ldelaney17 4:e14c199c2466 11 }
ldelaney17 4:e14c199c2466 12 void song_setup(){
ldelaney17 4:e14c199c2466 13 enum notes{ C_4 = 262, D_4 = 294, E_4 = 330, F_4 = 349, G_4 = 392, A_4 = 440,
ldelaney17 4:e14c199c2466 14 Bb_4 = 466, C_5 = 523, Db_5 = 554, D_5 = 587, E_5 = 659, F_5 = 698,
ldelaney17 4:e14c199c2466 15 G_5 = 784, A_5 = 880};
ldelaney17 4:e14c199c2466 16
ldelaney17 4:e14c199c2466 17 float freq_j[31] = {C_5,F_5,C_5,F_4,C_5,F_5,C_5,C_5,F_5,C_5,F_5,A_5,G_5,F_5,E_5,D_5,Db_5,C_5,F_5,C_5,F_4,C_5,F_5,C_5,F_5,D_5,C_5,Bb_4,A_4,G_4,F_4};
ldelaney17 4:e14c199c2466 18 float beat_j[31] = {1,1,1,1,1,1,2,1,1,1,1,1.5,.5,.5,.5,.5,.5,1,1,1,1,1,1,2,1.5,.5,1,1,1,1,1};
ldelaney17 4:e14c199c2466 19 vector<float> f (freq_j, freq_j + sizeof(freq_j) / sizeof(freq_j[0]));
ldelaney17 4:e14c199c2466 20 vector<float> b (beat_j, beat_j + sizeof(beat_j) / sizeof(beat_j[0]));
ldelaney17 4:e14c199c2466 21 jeopardy = new Song(f, b, 31, 120);
ldelaney17 4:e14c199c2466 22
ldelaney17 4:e14c199c2466 23
ldelaney17 4:e14c199c2466 24 float freq_s[8] = {F_5, E_5, D_5, C_5, Bb_4, A_4, G_4, F_4};
ldelaney17 4:e14c199c2466 25 float beat_s[8] = {1, 1, 1, 1, 1, 1, 1, 5};
ldelaney17 4:e14c199c2466 26 vector<float> f_s (freq_s, freq_s + sizeof(freq_s) / sizeof(freq_s[0]));
ldelaney17 4:e14c199c2466 27 vector<float> b_s (beat_s, beat_s + sizeof(beat_s) / sizeof(beat_s[0]));
ldelaney17 4:e14c199c2466 28 scale = new Song(f_s, b_s,8, 120);
ldelaney17 4:e14c199c2466 29
ldelaney17 4:e14c199c2466 30 float freq_b[1] = {F_5};
ldelaney17 4:e14c199c2466 31 float beat_b[1] = {60};
ldelaney17 4:e14c199c2466 32 vector<float> f_b (freq_b, freq_b + sizeof(freq_s) / sizeof(freq_s[0]));
ldelaney17 4:e14c199c2466 33 vector<float> b_b (beat_b, beat_b + sizeof(beat_s) / sizeof(beat_s[0]));
ldelaney17 4:e14c199c2466 34 beep = new Song(f_b, b_b, 1, 120);
ldelaney17 2:e6788e73de54 35 }
ldelaney17 2:e6788e73de54 36
ldelaney17 2:e6788e73de54 37 void init_num_players(){
ldelaney17 2:e6788e73de54 38 prompt(6, "Select the number of players\r\n"); //sets waiting_for_touch to true
ldelaney17 2:e6788e73de54 39 while(waiting_for_touch == true){ //until a valid input is read, spin our wheels here
ldelaney17 2:e6788e73de54 40 wait(0.1); // can busy wait during setup
ldelaney17 2:e6788e73de54 41 }
ldelaney17 2:e6788e73de54 42 num_players = prompt_input_val; // set based on the circle touched
ldelaney17 2:e6788e73de54 43 stringstream ss;
ldelaney17 2:e6788e73de54 44 ss << "press 1 to confirm that " << num_players << " players is correct. Press 2 to select a different number";
ldelaney17 2:e6788e73de54 45 prompt(2, ss.str());
ldelaney17 2:e6788e73de54 46 while(waiting_for_touch == true){ //until a valid input is read
ldelaney17 2:e6788e73de54 47 wait(0.1); // can busy wait during setup
ldelaney17 2:e6788e73de54 48 }
ldelaney17 2:e6788e73de54 49 int choice = prompt_input_val;
ldelaney17 2:e6788e73de54 50 switch(choice){
ldelaney17 2:e6788e73de54 51 case 1:
ldelaney17 2:e6788e73de54 52 return;
ldelaney17 2:e6788e73de54 53 break;
ldelaney17 2:e6788e73de54 54 case 2:
ldelaney17 2:e6788e73de54 55 init_num_players();
ldelaney17 2:e6788e73de54 56 return;
ldelaney17 2:e6788e73de54 57 break;
ldelaney17 2:e6788e73de54 58 }
ldelaney17 2:e6788e73de54 59 }
ldelaney17 2:e6788e73de54 60
ldelaney17 3:22c644f16365 61 //blocking wait function
ldelaney17 3:22c644f16365 62 void set_player_order(){
ldelaney17 3:22c644f16365 63 player_order.clear();
ldelaney17 3:22c644f16365 64 for (int i = 0; i < num_players; i++){
ldelaney17 3:22c644f16365 65 prompt(num_players, "select the player number with the most cities. \r\nIn case of a tie, the higher numbered power \r\nplant goes first\r\n");
ldelaney17 3:22c644f16365 66 while (waiting_for_touch){
ldelaney17 3:22c644f16365 67 wait(0.05); //blocking busy wait
ldelaney17 3:22c644f16365 68 }
ldelaney17 3:22c644f16365 69 player_order.push_back(prompt_input_val);
ldelaney17 3:22c644f16365 70 }
ldelaney17 3:22c644f16365 71 //TODO: if has duplicates, display message "invalid turn order" and call set_player_order
ldelaney17 3:22c644f16365 72
ldelaney17 3:22c644f16365 73 stringstream ss;
ldelaney17 3:22c644f16365 74 ss << "press 1 to confirm that player order is correct. \r\nPress 2 to change";
ldelaney17 3:22c644f16365 75 ss << "\r\nPlayer Order:\t";
ldelaney17 3:22c644f16365 76 for (int i = 0; i < num_players; i++){
ldelaney17 3:22c644f16365 77 ss << player_order[i] << "\t";
ldelaney17 3:22c644f16365 78 }
ldelaney17 3:22c644f16365 79 prompt(2, ss.str());
ldelaney17 3:22c644f16365 80 while(waiting_for_touch == true){ //until a valid input is read
ldelaney17 3:22c644f16365 81 wait(0.1); // can busy wait during setup
ldelaney17 3:22c644f16365 82 }
ldelaney17 3:22c644f16365 83 int choice = prompt_input_val;
ldelaney17 3:22c644f16365 84 switch(choice){
ldelaney17 3:22c644f16365 85 case 1:
ldelaney17 3:22c644f16365 86 return;
ldelaney17 3:22c644f16365 87 break;
ldelaney17 3:22c644f16365 88 case 2:
ldelaney17 3:22c644f16365 89 set_player_order();
ldelaney17 3:22c644f16365 90 return;
ldelaney17 3:22c644f16365 91 break;
ldelaney17 3:22c644f16365 92 }
ldelaney17 3:22c644f16365 93 }
ldelaney17 2:e6788e73de54 94
ldelaney17 4:e14c199c2466 95 void set_start_time(){
ldelaney17 4:e14c199c2466 96 //TODO: let the user input a start time
ldelaney17 4:e14c199c2466 97 prompt(5, "Select a starting amount of time per player:\r\n1: 1:00\t2: 1:30\t3: 2:30\t 4: 5:00\t 5: 10:00");
ldelaney17 4:e14c199c2466 98 while (waiting_for_touch){ //busy wait during setup
ldelaney17 4:e14c199c2466 99 wait(0.1);
ldelaney17 4:e14c199c2466 100 }
ldelaney17 4:e14c199c2466 101 int time_choice = prompt_input_val;
ldelaney17 4:e14c199c2466 102 stringstream ss;
ldelaney17 4:e14c199c2466 103 float start_time;
ldelaney17 4:e14c199c2466 104 switch(time_choice){
ldelaney17 4:e14c199c2466 105 case 1:
ldelaney17 4:e14c199c2466 106 start_time = 60;
ldelaney17 4:e14c199c2466 107 break;
ldelaney17 4:e14c199c2466 108 case 2:
ldelaney17 4:e14c199c2466 109 start_time = 90;
ldelaney17 4:e14c199c2466 110 break;
ldelaney17 4:e14c199c2466 111 case 3:
ldelaney17 4:e14c199c2466 112 start_time = 150;
ldelaney17 4:e14c199c2466 113 break;
ldelaney17 4:e14c199c2466 114 case 4:
ldelaney17 4:e14c199c2466 115 start_time = 300;
ldelaney17 4:e14c199c2466 116 break;
ldelaney17 4:e14c199c2466 117 case 5:
ldelaney17 4:e14c199c2466 118 start_time = 600;
ldelaney17 4:e14c199c2466 119 break;
ldelaney17 4:e14c199c2466 120 default: //never run this line
ldelaney17 4:e14c199c2466 121 start_time = 0;
ldelaney17 4:e14c199c2466 122 break;
ldelaney17 4:e14c199c2466 123 }
ldelaney17 4:e14c199c2466 124 ss << "press 1 to confirm that " << start_time << " seconds is correct. Press 2 to select a different time";
ldelaney17 4:e14c199c2466 125 prompt(2, ss.str());
ldelaney17 4:e14c199c2466 126 while(waiting_for_touch == true){ //until a valid input is read
ldelaney17 4:e14c199c2466 127 wait(0.1); // can busy wait during setup
ldelaney17 4:e14c199c2466 128 }
ldelaney17 4:e14c199c2466 129 int choice = prompt_input_val;
ldelaney17 4:e14c199c2466 130 switch(choice){
ldelaney17 4:e14c199c2466 131 case 1:
ldelaney17 4:e14c199c2466 132 for (int i = 0; i < num_players; i++) //if chosen, initialize the timers
ldelaney17 4:e14c199c2466 133 {
ldelaney17 4:e14c199c2466 134 player_timers.push_back(start_time);
ldelaney17 4:e14c199c2466 135 }
ldelaney17 4:e14c199c2466 136 return;
ldelaney17 4:e14c199c2466 137 break;
ldelaney17 4:e14c199c2466 138 case 2:
ldelaney17 4:e14c199c2466 139 set_start_time();
ldelaney17 4:e14c199c2466 140 return;
ldelaney17 4:e14c199c2466 141 break;
ldelaney17 4:e14c199c2466 142 }
ldelaney17 4:e14c199c2466 143 }
ldelaney17 4:e14c199c2466 144
ldelaney17 4:e14c199c2466 145 void set_bonus_time(){
ldelaney17 4:e14c199c2466 146 //TODO: let the user input a bonus time that will be added to a player's timer each time their timer is started (many times per round)
ldelaney17 4:e14c199c2466 147 prompt(5, "Select a bonus amount of time that will be added to a player's timer each time their timer is started:\r\n1: 0:01\t2: 0:05\t3: 0:10\t 4: 0:15\t 5: 0:30");
ldelaney17 4:e14c199c2466 148 while (waiting_for_touch){ //busy wait during setup
ldelaney17 4:e14c199c2466 149 wait(0.1);
ldelaney17 4:e14c199c2466 150 }
ldelaney17 4:e14c199c2466 151 int time_choice = prompt_input_val;
ldelaney17 4:e14c199c2466 152 stringstream ss;
ldelaney17 4:e14c199c2466 153 float start_time;
ldelaney17 4:e14c199c2466 154 switch(time_choice){
ldelaney17 4:e14c199c2466 155 case 1:
ldelaney17 4:e14c199c2466 156 bonus_time = 1;
ldelaney17 4:e14c199c2466 157 break;
ldelaney17 4:e14c199c2466 158 case 2:
ldelaney17 4:e14c199c2466 159 bonus_time = 5;
ldelaney17 4:e14c199c2466 160 break;
ldelaney17 4:e14c199c2466 161 case 3:
ldelaney17 4:e14c199c2466 162 bonus_time = 10;
ldelaney17 4:e14c199c2466 163 break;
ldelaney17 4:e14c199c2466 164 case 4:
ldelaney17 4:e14c199c2466 165 bonus_time = 15;
ldelaney17 4:e14c199c2466 166 break;
ldelaney17 4:e14c199c2466 167 case 5:
ldelaney17 4:e14c199c2466 168 bonus_time = 30;
ldelaney17 4:e14c199c2466 169 break;
ldelaney17 4:e14c199c2466 170 default: //never run this line
ldelaney17 4:e14c199c2466 171 bonus_time = 0;
ldelaney17 4:e14c199c2466 172 break;
ldelaney17 4:e14c199c2466 173 }
ldelaney17 4:e14c199c2466 174 ss << "press 1 to confirm that " << bonus_time << " seconds is correct. Press 2 to select a different time";
ldelaney17 4:e14c199c2466 175 prompt(2, ss.str());
ldelaney17 4:e14c199c2466 176 while(waiting_for_touch == true){ //until a valid input is read
ldelaney17 4:e14c199c2466 177 wait(0.1); // can busy wait during setup
ldelaney17 4:e14c199c2466 178 }
ldelaney17 4:e14c199c2466 179 int choice = prompt_input_val;
ldelaney17 4:e14c199c2466 180 switch(choice){
ldelaney17 4:e14c199c2466 181 case 1:
ldelaney17 4:e14c199c2466 182 return;
ldelaney17 4:e14c199c2466 183 break;
ldelaney17 4:e14c199c2466 184 case 2:
ldelaney17 4:e14c199c2466 185 set_bonus_time();
ldelaney17 4:e14c199c2466 186 return;
ldelaney17 4:e14c199c2466 187 break;
ldelaney17 4:e14c199c2466 188 }
ldelaney17 4:e14c199c2466 189 }
ldelaney17 4:e14c199c2466 190
ldelaney17 4:e14c199c2466 191 void next_step(){
ldelaney17 4:e14c199c2466 192 pc.printf("starting next step\r\n");
ldelaney17 4:e14c199c2466 193 pause_timer();
ldelaney17 4:e14c199c2466 194 pc.printf("after pause_timer\r\n");
ldelaney17 4:e14c199c2466 195 if (step_number == 4)
ldelaney17 4:e14c199c2466 196 step_number = 0;
ldelaney17 4:e14c199c2466 197 else
ldelaney17 4:e14c199c2466 198 step_number++;
ldelaney17 4:e14c199c2466 199
ldelaney17 4:e14c199c2466 200 stringstream ss;
ldelaney17 4:e14c199c2466 201 ss << "Step number " << step_number << ": ";
ldelaney17 4:e14c199c2466 202 pc.printf("entering step_number (%d) switch\r\n", step_number);
ldelaney17 4:e14c199c2466 203 switch(step_number-1){ //based on the last step
ldelaney17 4:e14c199c2466 204 case 0: //determine player order (immediately call again to move to the "auction power plants" phase
ldelaney17 4:e14c199c2466 205 set_player_order();
ldelaney17 4:e14c199c2466 206 next_step();
ldelaney17 4:e14c199c2466 207 return;
ldelaney17 4:e14c199c2466 208 break;
ldelaney17 4:e14c199c2466 209 case 1: //auction power plants, standard turn order
ldelaney17 4:e14c199c2466 210 ss << "Auction Power Plants";
ldelaney17 4:e14c199c2466 211 current_player = player_order[0];
ldelaney17 4:e14c199c2466 212 start_timer(current_player);
ldelaney17 4:e14c199c2466 213 break;
ldelaney17 4:e14c199c2466 214 case 2: //buy resources, reverse player order
ldelaney17 4:e14c199c2466 215 ss << "Buy Resources";
ldelaney17 4:e14c199c2466 216 reverse_player_order();
ldelaney17 4:e14c199c2466 217 current_player = player_order[0];
ldelaney17 4:e14c199c2466 218 current_player_index = 0;
ldelaney17 4:e14c199c2466 219 start_timer(current_player);
ldelaney17 4:e14c199c2466 220 break;
ldelaney17 4:e14c199c2466 221 case 3: //building, reverse player order (same as buying resources)
ldelaney17 4:e14c199c2466 222 ss << "Building";
ldelaney17 4:e14c199c2466 223 current_player = player_order[0];
ldelaney17 4:e14c199c2466 224 current_player_index = 0;
ldelaney17 4:e14c199c2466 225 start_timer(current_player);
ldelaney17 4:e14c199c2466 226 break;
ldelaney17 4:e14c199c2466 227 case 4: //bureacracy, normal player order (reverse order of building)
ldelaney17 4:e14c199c2466 228 ss << "Bureacracy";
ldelaney17 4:e14c199c2466 229 reverse_player_order();
ldelaney17 4:e14c199c2466 230 current_player = player_order[0];
ldelaney17 4:e14c199c2466 231 current_player_index = 0;
ldelaney17 4:e14c199c2466 232 start_timer(current_player);
ldelaney17 4:e14c199c2466 233 break;
ldelaney17 4:e14c199c2466 234 }
ldelaney17 4:e14c199c2466 235 ss << "\r\nPres the button to move to the next step";
ldelaney17 4:e14c199c2466 236 prompt(1, ss.str()); //display a single button and the message
ldelaney17 4:e14c199c2466 237 }
ldelaney17 4:e14c199c2466 238
ldelaney17 4:e14c199c2466 239
ldelaney17 4:e14c199c2466 240 //TODO: it would be nice to include the phase changes, but it doesn't affect the
ldelaney17 4:e14c199c2466 241 // parts of gameplay I am focusing on
ldelaney17 4:e14c199c2466 242 /* prompt(2, "is this a new phase?\r\n1: yes\t 2: no");
ldelaney17 4:e14c199c2466 243 while(waiting_for_touch == true){ //until a valid input is read
ldelaney17 4:e14c199c2466 244 wait(0.1); // can busy wait between rounds
ldelaney17 4:e14c199c2466 245 }
ldelaney17 4:e14c199c2466 246 int choice = prompt_input_val;
ldelaney17 4:e14c199c2466 247 switch(choice){
ldelaney17 4:e14c199c2466 248 case 1:
ldelaney17 4:e14c199c2466 249 new_phase();
ldelaney17 4:e14c199c2466 250 return;
ldelaney17 4:e14c199c2466 251 break;
ldelaney17 4:e14c199c2466 252 case 2:
ldelaney17 4:e14c199c2466 253 //not a new phase
ldelaney17 4:e14c199c2466 254 break;
ldelaney17 4:e14c199c2466 255 }
ldelaney17 4:e14c199c2466 256 */
ldelaney17 4:e14c199c2466 257
ldelaney17 4:e14c199c2466 258 void reverse_player_order(){
ldelaney17 4:e14c199c2466 259 reverse(player_order.begin(),player_order.end()); //yay for library functions!
ldelaney17 4:e14c199c2466 260 }
ldelaney17 4:e14c199c2466 261
ldelaney17 4:e14c199c2466 262
ldelaney17 4:e14c199c2466 263 //FIXME: be sure to update the previous player's timer when it is paused
ldelaney17 4:e14c199c2466 264 void start_timer(int player_num){
ldelaney17 4:e14c199c2466 265 pc.printf("starting timer for player %d\r\n", player_num);
ldelaney17 4:e14c199c2466 266 player_timers[player_num] += bonus_time; //add the bonus for unpausing their timer
ldelaney17 4:e14c199c2466 267 unpause_timer(); //do the rest of the start_timer() stuff
ldelaney17 4:e14c199c2466 268 pc.printf("timer started\r\n");
ldelaney17 4:e14c199c2466 269 }
ldelaney17 4:e14c199c2466 270 void unpause_timer(){
ldelaney17 4:e14c199c2466 271 current_clock.stop(); //just in case
ldelaney17 4:e14c199c2466 272 current_clock.reset(); //set to zero
ldelaney17 4:e14c199c2466 273 current_clock.start(); //start it ticking
ldelaney17 4:e14c199c2466 274 clock_running = true; // let everything else know that the clock is actively running
ldelaney17 4:e14c199c2466 275 pc.printf("not attatching songs to timeouts\r\n");
ldelaney17 4:e14c199c2466 276 //time_after_warning.attach(jeopardy, &Song::play, time_after_warning_sound);
ldelaney17 4:e14c199c2466 277 //time_before_warning.attach(scale, &Song::play, player_timers[player_num] - time_before_warning_sound);
ldelaney17 4:e14c199c2466 278 //pc.printf("songs attached\r\n");
ldelaney17 4:e14c199c2466 279 pc.printf("end of unpause_timer\r\n");
ldelaney17 4:e14c199c2466 280
ldelaney17 4:e14c199c2466 281 }
ldelaney17 4:e14c199c2466 282
ldelaney17 4:e14c199c2466 283 void pause_timer(){
ldelaney17 4:e14c199c2466 284 current_clock.stop();
ldelaney17 4:e14c199c2466 285 clock_running = false;
ldelaney17 4:e14c199c2466 286 update_timer(); //resets the timer after updating the player's remaining time
ldelaney17 4:e14c199c2466 287 }
ldelaney17 4:e14c199c2466 288
ldelaney17 4:e14c199c2466 289 //pauses clock if running, starts clock if paused
ldelaney17 4:e14c199c2466 290 void toggle_pause(){
ldelaney17 4:e14c199c2466 291 if (clock_running == true){
ldelaney17 4:e14c199c2466 292 pc.printf("pausing timer from toggle\r\n");
ldelaney17 4:e14c199c2466 293 pause_timer();
ldelaney17 4:e14c199c2466 294 clock_running = false;
ldelaney17 4:e14c199c2466 295 }
ldelaney17 4:e14c199c2466 296 else{
ldelaney17 4:e14c199c2466 297 pc.printf("unpausing timer from toggle\r\n");
ldelaney17 4:e14c199c2466 298 unpause_timer(); //start without adding bonus time
ldelaney17 4:e14c199c2466 299 clock_running = true;
ldelaney17 4:e14c199c2466 300 }
ldelaney17 4:e14c199c2466 301 }
ldelaney17 4:e14c199c2466 302
ldelaney17 4:e14c199c2466 303 void next_player(){
ldelaney17 4:e14c199c2466 304 pause_timer(); //also calls update_timer
ldelaney17 4:e14c199c2466 305 current_player_index++;
ldelaney17 4:e14c199c2466 306 if (current_player_index >= num_players)
ldelaney17 4:e14c199c2466 307 current_player_index = 0;
ldelaney17 4:e14c199c2466 308 current_player = player_order[current_player_index];
ldelaney17 4:e14c199c2466 309 start_timer(current_player);
ldelaney17 4:e14c199c2466 310 }
ldelaney17 4:e14c199c2466 311
ldelaney17 4:e14c199c2466 312 void update_timer(){
ldelaney17 4:e14c199c2466 313 if (clock_running)
ldelaney17 4:e14c199c2466 314 current_clock.stop();
ldelaney17 4:e14c199c2466 315
ldelaney17 4:e14c199c2466 316 player_timers[current_player-1] -= (current_clock.read_ms() / 1000);
ldelaney17 4:e14c199c2466 317 current_clock.reset();
ldelaney17 4:e14c199c2466 318 /*if (player_timers[current_player] <= 0)
ldelaney17 4:e14c199c2466 319 beep->play();
ldelaney17 4:e14c199c2466 320 else if (player_timers[current_player] < time_before_warning_sound)
ldelaney17 4:e14c199c2466 321 scale->play();*/
ldelaney17 4:e14c199c2466 322
ldelaney17 4:e14c199c2466 323 if(clock_running)
ldelaney17 4:e14c199c2466 324 current_clock.start();
ldelaney17 4:e14c199c2466 325 }
ldelaney17 4:e14c199c2466 326
ldelaney17 4:e14c199c2466 327 void display_timer(){
ldelaney17 4:e14c199c2466 328 stringstream ss;
ldelaney17 4:e14c199c2466 329 ss << "Player " << current_player << ": " << static_cast<double>(player_timers[current_player-1] - (current_clock.read_ms() /1000)) << "\r\n";
ldelaney17 4:e14c199c2466 330 display_msg_no_clear(ss.str());
ldelaney17 4:e14c199c2466 331 }