From: Rachael Date: Sat, 22 Oct 2016 03:14:44 +0000 (-0700) Subject: maybe improved slithering algorithm if the snake is supposed to be going forward... X-Git-Url: https://hydra-www.ietfng.org/gitweb/?a=commitdiff_plain;h=1611da3c2b9fdb6ec22495de25ac3758c0cbd2ab;p=acmetensortoys-esp-lua_lamp maybe improved slithering algorithm if the snake is supposed to be going forward the entire time. --- diff --git a/draw-snake2.lua b/draw-snake2.lua index e6ce82e..8043f0c 100644 --- a/draw-snake2.lua +++ b/draw-snake2.lua @@ -10,7 +10,7 @@ return function(t,fb,g,r,b) local ix = 2 -- since we start effectively in state 1... local c = string.char(g,r,b) local ft = { -- flatten out - [1] = function() fb:set(27,c) fb:set(19,0,0,0) end + [1] = function() fb:set(25,c) fb:set(27,c) fb:set(17,0,0,0) fb:set(19,0,0,0) end -- stay that way , [2] = function() end -- look back @@ -24,9 +24,9 @@ return function(t,fb,g,r,b) -- slither 2 , [6] = function() fb:set(19,c) fb:set(20,0,0,0) fb:set(27,0,0,0) fb:set(28,c) end -- slither 1, heart off - , [7] = function() fb:set(20,c) fb:set(28,0,0,0) fb:set(14,0,0,0) end + , [7] = function() fb:set(18,c) fb:set(19,0,0,0) fb:set(20,c) fb:set(26,0,0,0) fb:set(27,c) fb:set(28,0,0,0) fb:set(14,0,0,0) end -- slither 2 - , [8] = function() fb:set(19,c) fb:set(20,0,0,0) fb:set(27,0,0,0) fb:set(28,c) end + , [8] = function() fb:set(17,c) fb:set(18,0,0,0) fb:set(19,c) fb:set(20,0,0,0) fb:set(25,0,0,0) fb:set(26,c) fb:set(27,0,0,0) fb:set(28,c) end } fb:fill(0,0,0) fb:set(25,c) fb:set(26,c) fb:set(27,c) fb:set(28,c) fb:set(29,c) fb:set(30,c)