summary refs log tree commit diff
path: root/bin/typo.c
diff options
context:
space:
mode:
Diffstat (limited to 'bin/typo.c')
-rw-r--r--bin/typo.c87
1 files changed, 0 insertions, 87 deletions
diff --git a/bin/typo.c b/bin/typo.c
deleted file mode 100644
index 660c8249..00000000
--- a/bin/typo.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/* Copyright (c) 2017, Curtis McEnroe <programble@gmail.com>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <curses.h>
-#include <err.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sysexits.h>
-#include <time.h>
-
-static const char *WORDS[] = {
-#include "words.txt"
-};
-#define WORDS_LEN (sizeof(WORDS) / sizeof(WORDS[0]))
-
-static const char **targets;
-static size_t targetsLen;
-
-static void setTarget(size_t i) {
-    const char *target;
-    size_t len;
-    do {
-        target = WORDS[arc4random_uniform(WORDS_LEN)];
-        len = strlen(target);
-    } while (len < 3 || len > 9);
-    targets[i] = target;
-    move(i, 0);
-    clrtoeol();
-    mvaddstr(i, arc4random_uniform(COLS - len), target);
-}
-
-int main() {
-    initscr();
-    cbreak();
-    echo();
-
-    targetsLen = LINES - 2;
-    targets = calloc(targetsLen, sizeof(*targets));
-    for (size_t i = 0; i < targetsLen; ++i) {
-        setTarget(i);
-    }
-    mvhline(LINES - 2, 0, ACS_HLINE, COLS);
-
-    time_t start = time(NULL);
-    if (start < 0) err(EX_OSERR, "time");
-
-    int letterCount = 0;
-    for (;;) {
-        time_t now = time(NULL);
-        if (now < 0) err(EX_OSERR, "time");
-
-        double wpm = (double)letterCount / 5.0 / difftime(now, start) * 60.0;
-
-        char *wpmDisplay;
-        int len = asprintf(&wpmDisplay, "%.2f WPM ", wpm);
-        if (len < 0) err(EX_OSERR, "asprintf");
-
-        move(LINES - 1, 0);
-        clrtoeol();
-        mvaddstr(LINES - 1, COLS - len, wpmDisplay);
-        free(wpmDisplay);
-
-        move(LINES - 1, 0);
-        char word[16];
-        getnstr(word, sizeof(word));
-
-        for (size_t i = 0; i < targetsLen; ++i) {
-            if (strcmp(word, targets[i])) continue;
-            setTarget(i);
-            letterCount += strlen(word);
-            break;
-        }
-    }
-}
dfecdbf3456&follow=1'>Add IRCDefault to colors enumJune McEnroe 2018-09-13Return a format->split even at the end of the stringJune McEnroe 2018-09-13Fix weird tab-complete after commaJune McEnroe 2018-09-13Rewrite UI againJune McEnroe 2018-09-12Add note about C-oJune McEnroe 2018-09-12Use formatParse split to position input cursorJune McEnroe 2018-09-12Factor out IRC formatting parsingJune McEnroe 2018-09-11Add /help equivalent to /manJune McEnroe 2018-09-11Don't render every PM as a pingJune McEnroe 2018-09-11Add urlOpenMatchJune McEnroe 2018-09-10Depend on man.sh for chroot.tar targetJune McEnroe 2018-09-10Set LESSSECURE=1 in man.shJune McEnroe 2018-09-10Add /man commandJune McEnroe 2018-09-10Install man page in chrootJune McEnroe 2018-09-10Install man pageJune McEnroe 2018-09-10Split keys into subsections and document colorsJune McEnroe 2018-09-10Add "blank" lines to chatte.1June McEnroe 2018-09-10Document key bindings in chatte.1June McEnroe 2018-09-08Document slash commands in chatte.1June McEnroe