Skip to content

Instantly share code, notes, and snippets.

/*
* tetris.c
*
* compile: gcc -o tetris -lncurses tetris.c
*
* tetrimino types
* 1: #### 2: ## 3: ## 4: ##
* ## ## ##
*
* 5: # 6: # 7: #
/*
* using Nucleo-F303K8
*/
#include "mbed.h"
AnalogIn l(A0),c(A1),r(A2),m(A3); // line sensor: l(eft), c(enter), m(arker)
float lvu=0, lvu1=0, lvu2=0, lvu3=0;
int sum=0;
float l0=0, l1=0, l2=0, l3=0;
float max0=0, min0=100, max1=0, min1=100, max2=0, min2 = 100, max3=0, min3=100;
(defparameter *board-size* 60)
(defparameter x-list '(-1 0 1 -1 1 -1 0 1))
(defparameter y-list '(-1 -1 -1 0 0 1 1 1))
(defparameter *board* (make-hash-table :test #'equal))
; anaphoric macro
; x moves from 0 to num
; y also moves from 0 to num
(defmacro double-loop (num &body body)
(let ((end (gensym)))