added -c falg to count shapes

This commit is contained in:
Maxime Vorwerk
2023-08-29 15:45:04 +02:00
parent 54bb880865
commit 41fe3c325d

View File

@@ -13,8 +13,11 @@ function main()
"-g" "-g"
help = "generator" help = "generator"
arg_type = Int arg_type = Int
"-c"
help = "shape count"
action = :store_true
"-l" "-l"
help = "list" help = "shape list"
action = :store_true action = :store_true
"-p" "-p"
help = "plot n_cubes i_shape" help = "plot n_cubes i_shape"
@@ -28,6 +31,9 @@ function main()
if generate !== nothing && generate > 0 if generate !== nothing && generate > 0
scanForShapes(generate) scanForShapes(generate)
end end
if get(parsed_args, "c", false)
countShapes()
end
if get(parsed_args, "l", false) if get(parsed_args, "l", false)
listShapes() listShapes()
end end
@@ -72,9 +78,20 @@ function scanForShapes(MaxSize::Int64)
serialize("results.bin", sanitizedData) serialize("results.bin", sanitizedData)
end end
function countShapes()
T = deserialize("results.bin")
n = T[1]
for i 1:n
print("n = ")
print(i)
print(": ")
println(length(T[2][i]))
end
end
function listShapes() function listShapes()
T = deserialize("results.bin") T = deserialize("results.bin")
print("size: ") print("max size: ")
println(T[1]) println(T[1])
for V T[2] for V T[2]
for v V for v V