コアダンプの数だけ強くなれるよ

見習いエンジニアの備忘log

2017-02-08から1日間の記事一覧

linuxでkbhit()

LinuxでWindowsのkbhit()相当を実装する。kbhit.h #ifndef _KBHIT_H_ #define _KBHIT_H_ #include <stdbool.h> #include <termios.h> #include <unistd.h> extern void KB_open(void); extern void KB_close(void); extern bool kbhit(void); extern char linux_getch(void); #endif /* _KBHI</unistd.h></termios.h></stdbool.h>…

HTML,JavaScriptで格子を描画

HTML5のCanvas機能でオセロの盤面ぽい格子を描く。canvas.html <html> <head> <meta charset="UTF-8"> </head> <body> <canvas id="canv" width="500" height="500"></canvas> <script> var ctx = document.getElementById("canv").getContext('2d'); // 描画内容を指定する // 背景を500×500の緑で描画 ctx.fillStyle = "rg…</body></html>