summaryrefslogtreecommitdiff
path: root/img
diff options
context:
space:
mode:
Diffstat (limited to 'img')
-rw-r--r--img/better_disp.lua21
1 files changed, 20 insertions, 1 deletions
diff --git a/img/better_disp.lua b/img/better_disp.lua
index e9ccbf8..6cbcf4b 100644
--- a/img/better_disp.lua
+++ b/img/better_disp.lua
@@ -65,8 +65,16 @@ local function adjust_to_2_colors(R,gromlings,pdists)
all_current_colors[cidx] = true
end
+
while ncolors > 2 do
- print(ncolors)
+ print("- ncolors is "..ncolors)
+
+ io.write("all_current_colors: ")
+ for k in pairs(all_current_colors) do io.write(k," ") end
+ io.write("\ngromling_colors: ")
+ for k,v in pairs(gromling_colors) do print(k,v) end
+ print()
+
-- merge closest two colors until there are only 2 distinct ones left
local best_dist = 9999
local best_a = nil
@@ -90,12 +98,23 @@ local function adjust_to_2_colors(R,gromlings,pdists)
assert(best_a,"no best_a")
assert(best_b,"no best_b")
assert(best_a ~= best_b,"best a and b are the same")
+ print("mergng "..best_b.." into "..best_a)
all_current_colors[best_b] = false
ncolors=ncolors-1
for gidx,col in ipairs(gromling_colors) do
if col == best_b then gromling_colors[gidx] = best_a end
end
+
+
+
end
+ print("-#-- ncolors is "..ncolors)
+
+ io.write("all_current_colors: ")
+ for k in pairs(all_current_colors) do io.write(k," ") end
+ io.write("\ngromling_colors: ")
+ for k,v in pairs(gromling_colors) do print(k,v) end
+ print()
return gromling_colors
end