From cf93286d937b7f635e9807d7f103807fb5813ca9 Mon Sep 17 00:00:00 2001 From: jsancho Date: Sun, 25 Oct 2009 12:05:36 +0000 Subject: [PATCH] --- gacela_tetris.lisp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/gacela_tetris.lisp b/gacela_tetris.lisp index aadcb52..8295710 100644 --- a/gacela_tetris.lisp +++ b/gacela_tetris.lisp @@ -94,14 +94,23 @@ (defun remove-rows-completed (grid) (let ((res (remove-if (lambda (x) (row-completed x)) grid))) + (inc-points (- (length grid) (length res))) (labels ((fill (grid n) (cond ((< n 1) grid) (t (fill (cons (make-list 14) grid) (- n 1)))))) (fill res (- 20 (length res)))))) -(let ((points 0)) +(let ((points 0) (lines 0)) (defun get-points () - points)) + points) + + (defun get-lines () + lines) + + (defun inc-points (l) + (incf points + (labels ((more-lines-better + (incf lines l))) (let ((tetramine (random-tetramine)) (x 6) (y 0) (next (random-tetramine)) @@ -138,7 +147,10 @@ (draw-grid (join-grids tetramine grid x y)) (translate 440 440) (draw-grid next) - (render-text "Hola" font))) + (translate -40 -100) + (render-text (format nil "Points: ~d" (get-points)) font) + (translate 0 -30) + (render-text (format nil "Lines: ~d" (get-lines)) font))) (let ((frame 0.0) (fps (make-timer)) (update (make-timer))) (start-timer update) -- 2.39.2