#include <cs20200.h>
#include <cs20201.h>
#include <cs20203.h>
#include <cs20205.h>
#include <cs20206.h>
#include <cs20207.h>
#include <cs20208.h>
#include <cs20209.h>
#include <cs20210.h>
#include <cs20211.h>
#include <cs20212.h>
#include <cs20213.h>
#include <cs20214.h>
#include <cs20216.h>
#include <cs20217.h>
#include <cs20218.h>
#include <cs20219.h>
#include <cs20220.h>
#include <cs20221.h>

#include <common.h>

#define NSTUDENTS 19
#define NMAINMENU 20

int main()
{
  initscr();
  cbreak();
  noecho();
  clear();
  curs_set(0);

  void (*games[NSTUDENTS])(void) = {
    cs20200_game,
    cs20201_game,
    cs20203_game,
    cs20205_game,
    cs20206_game,
    cs20207_game,
    cs20208_game,
    cs20209_game,
    cs20210_game,
    cs20211_game,
    cs20212_game,
    cs20213_game,
    cs20214_game,
    cs20216_game,
    cs20217_game,
    cs20218_game,
    cs20219_game,
    cs20220_game,
    cs20221_game
  };

  char *options[NMAINMENU] = {
    cs20200_name(),
    cs20201_name(),
    cs20203_name(),
    cs20205_name(),
    cs20206_name(),
    cs20207_name(),
    cs20208_name(),
    cs20209_name(),
    cs20210_name(),
    cs20211_name(),
    cs20212_name(),
    cs20213_name(),
    cs20214_name(),
    cs20216_name(),
    cs20217_name(),
    cs20218_name(),
    cs20219_name(),
    cs20220_name(),
    cs20221_name(), 
    "exit"
  };

  int choice = menu_select(stdscr, LINES, COLS, 
      "Select the game you want to play:", options, NMAINMENU);

  if(choice < NSTUDENTS) {
    clear();
    move(0, 0);
    games[choice]();
  }

  endwin();

  return 0;
}