* how does bouncing works in bounce.c ** handling ball bounces relative to screen size use LINES and COLS to determine the values for BOT_ROW and RIGHT_EDGE * responding to window size changes ** detect window size changes and exit the game with TILT ** how to determine if window size changes? *** could check LINES and COLS on every ball move or clock tick? *** or simply register a signal handler for SIGWINCH and set a flag to be handled in the main control flow * when is reentrancy / atomic variable access a problem? ** some variable types are more susceptible to partial updates than others ** structs with multiple fields ** large numeric values (larger than the size of a register or a slot in mem) * how signal blocking works and using it protect data ** both SIGIGN and blocking can prevent atomic operations from being interrupted *** SIGIGN means "I don't care" ... drop the signal on the floor *** blocking means "I sort of care" ... remember that the signal fired ** with blocking, it's important to keep the period of time the signal is blocked as short as possible *** most of the time you'll have some method to make the main loop handle the condition from the signal * review itimers and sigalrm ** there is only one itimer of each type that can be used ** if you want to drive multiple behaviors, use the shortest itimer setting required for any behavior and then just keep track of timer ticks ** x and y movement in bounce are two separate behaviors, each call to ball_move (the signal handler) updates the count ** adding another behavior means: add a counter for how many signal handler calls are needed before that behavior, and when you've counted that many do the thing ** bounce sets the itimer to trigger 50 times per second, so we just need to count to 50 to track one second * paddle design ** dynamically calculate the width: COLS - 3 per side / 3 ** width allows you to know where the left side and right side of the paddle are ** paddle_contact uses the paddle row, left, and right to determine if the ball is in contact with the paddle ** paddle_left and paddle_right need to limit movement ** never reference the paddle struct's data fields directly outside of paddle.c