An off-by-one error is all that it was.
Chris Pressey
1 year, 11 months ago
113 | 113 |
fengari.load(`
|
114 | 114 |
local parser = Parser.new(whothm_prog)
|
115 | 115 |
local machine = parser.parse()
|
116 | |
local bitmap = BitMap.new(50, 50)
|
|
116 |
local bitmap = BitMap.new(128, 128)
|
117 | 117 |
debug("Running machine")
|
118 | 118 |
machine.run(bitmap)
|
119 | 119 |
debug("Plotting on canvas")
|
112 | 112 |
if bottom > b_h then bottom = b_h end
|
113 | 113 |
|
114 | 114 |
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
|
117 | 117 |
bitmap.modify_pixel(px, py, tt)
|
118 | 118 |
end
|
119 | 119 |
end
|
|
153 | 153 |
|
154 | 154 |
-- x, y here are zero-based
|
155 | 155 |
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
|
158 | 158 |
data[pos] = tt.apply(data[pos], true)
|
159 | 159 |
end
|
160 | 160 |
end
|