anticipation
Loading...
Searching...
No Matches
main.cpp File Reference
#include <iostream>
#include <cstdlib>
#include <thread>
#include "GPIO.h"
#include "GamePlayer.h"
#include <unistd.h>
Include dependency graph for main.cpp:

Functions

int main (int argc, char *argv[])
 

Detailed Description

Author
Walter Schilling (schil.nosp@m.ling.nosp@m.@msoe.nosp@m..edu)
Version
1.0

LICENSE

This code is developed as part of the MSOE SWE4211 Real Time Systems course, but can be freely used by others.

SWE4211 Real Time Systems is a required course for students studying the discipline of software engineering.

This Software is provided under the License on an "AS IS" basis and without warranties of any kind concerning the Software, including without limitation merchantability, fitness for a particular purpose, absence of defects or errors, accuracy, and non-infringement of intellectual property rights other than copyright. This disclaimer of warranty is an essential part of the License and a condition for the grant of any rights to this Software.

DESCRIPTION

This file contains the main logic that allows a user to play the game of anticipation.

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

This is the main program. It will instantiate two game players, start their threads, wait for the threads to finish, and then determine who has the lower time.

  1. Declare a pair of Game players, initializing with the appropriate GPIO pin / port numbers that you will be using.

  2. Start each of the two threads up using the C++ thread library that was covered in Operating Systems.

  3. Wait for the game threads to end. Do this by waiting for the threads to die off.

  4. Print out the total latency in ms for the two players.

  5. Turn off all lights.

  6. Determine the winner of the game and print out the information to the console.
  7. Turn on the green light for the winner.

  8. Wait 15 seconds and exit, with the lights turning off then.

Here is the call graph for this function: