#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <curses.h>
int main(int argc, char *argv[])
{
    char my_letter, user_letter;
    int score = 0;
    int start = time(NULL);
    srand(start);
    initscr();
    cbreak();
    noecho();
    nonl();
    intrflush(stdscr, FALSE);
    keypad(stdscr, TRUE);
    clear();
    while (score < 100)
    {
        clear();
        move(0, 0);
        addstr("Score: ");
        addch(((score/100) % 10) + '0');
        addch(((score/10) % 10) + '0');
        addch((score % 10) + '0');
        addstr("/100");
        my_letter = (rand() % 26) + 'a';
        move(1, 0);
        addstr("Type: ");
        addch(my_letter);
        move(2, 0);
        user_letter = getch();
        if (my_letter == user_letter)
        {
            score++;
        }
    }
    clear();
    endwin();
    printf("You win!\nIt took you %ld seconds!\n", time(NULL) - start);
    return 0;
}