summaryrefslogtreecommitdiff
path: root/img
diff options
context:
space:
mode:
authorubq323 <ubq323@ubq323.website>2022-08-07 01:06:33 +0100
committerubq323 <ubq323@ubq323.website>2022-08-07 01:06:33 +0100
commitceead33a32402c8203b83568d94d0d929fb5dc2f (patch)
tree083e804b21cfbfbfd824db9844e77e8878b1b90a /img
parenta3fbefc0d66c7f08daa848e76b5e7d979e594f7a (diff)
img
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