git @ Cat's Eye Technologies Whothm / 6acdff2
An off-by-one error is all that it was. Chris Pressey 1 year, 11 months ago
2 changed file(s) with 5 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
113113 fengari.load(`
114114 local parser = Parser.new(whothm_prog)
115115 local machine = parser.parse()
116 local bitmap = BitMap.new(50, 50)
116 local bitmap = BitMap.new(128, 128)
117117 debug("Running machine")
118118 machine.run(bitmap)
119119 debug("Plotting on canvas")
112112 if bottom > b_h then bottom = b_h end
113113
114114 local px, py
115 for py = y,bottom do
116 for px = x,right do
115 for py = y,bottom-1 do
116 for px = x,right-1 do
117117 bitmap.modify_pixel(px, py, tt)
118118 end
119119 end
153153
154154 -- x, y here are zero-based
155155 methods.modify_pixel = function(x, y, tt)
156 local pos = y * width + x + 1
157 if x < width and y < height then
156 if x >= 0 and x < width and y >= 0 and y < height then
157 local pos = y * width + x + 1
158158 data[pos] = tt.apply(data[pos], true)
159159 end
160160 end