Skip to content

Instantly share code, notes, and snippets.

View koppi's full-sized avatar

Jakob Markus Flierl koppi

View GitHub Profile
@koppi
koppi / cwrx.c
Last active December 31, 2022 19:57
ncurses morse decoder for Linux.
/*
* cwrx.c - ncurses morse decoder for Linux
*
* Copyright (c) 2011 - 2023 Jakob Flierl <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
@koppi
koppi / ttt.c
Created December 22, 2021 14:57
Tic tac toe in C.
/* Tic tac toe in C. */
#include <stdio.h>
#define P printf
enum { X = 'X', O = 'O', N = '\0', C = 'C' };
static char ck(char b[9]) {
int i, w[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 0, 3, 6,
1, 4, 7, 2, 5, 8, 0, 4, 8, 2, 4, 6};
for (i = 0; i < 24; i += 3) {
if (b[w[i + 0]] == X && b[w[i + 1]] == X && b[w[i + 2]] == X)
return X;