From 22010bb6df8c4994d489380f5c75c1389f3f012a Mon Sep 17 00:00:00 2001 From: Phil Hagelberg Date: Mon, 23 Mar 2020 19:02:03 -0700 Subject: [PATCH] Skip over non-existent rows when moving in gui. --- gui.rkt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gui.rkt b/gui.rkt index 606333a..e7fdc8b 100644 --- a/gui.rkt +++ b/gui.rkt @@ -254,9 +254,14 @@ (send dia show #f))]) (send dia show #t))) +(define (non-existent-key? row col) + (and (< row 2) (or (= col 5) (= col 6)))) + (define (move st dx dy) (set-state-row! st (modulo (+ dy (state-row st)) rows)) - (set-state-col! st (modulo (+ dx (state-col st)) cols))) + (set-state-col! st (modulo (+ dx (state-col st)) cols)) + (when (non-existent-key? (state-row st) (state-col st)) + (move st dx dy))) (define (change-layer st dir) (set-state-layer! st (modulo (+ dir (state-layer st))