Files
PolyCubeCounting/julia/Shape.jl
2023-08-25 16:18:57 +02:00

53 lines
1.2 KiB
Julia

include("SortingModifiers.jl")
struct Shape
cubes::Set{Tuple{Int8, Int8, Int8}}
recentCubes::Set{Tuple{Int8, Int8, Int8}}
orderedLists::Vector{Vector{Tuple{Int8, Int8, Int8}}}
end
function trypush!(S::Shape, t::Tuple{Int8, Int8, Int8})
if t S.cubes
return false
else
push!(S.cubes, t)
for i 1:24
index = searchsortedfirst(S.orderedLists[i], t, by=SortingModifiers[i])
insert!(S.orderedLists, index, t)
end
return true
end
end
function getCube()
return Shape(
{(0, 0, 0)},
{(0, 0, 0)},
[
[(0, 0, 0)],
[(0, 0, 0)],
[(0, 0, 0)],
[(0, 0, 0)],
[(0, 0, 0)],
[(0, 0, 0)],
[(0, 0, 0)],
[(0, 0, 0)],
[(0, 0, 0)],
[(0, 0, 0)],
[(0, 0, 0)],
[(0, 0, 0)],
[(0, 0, 0)],
[(0, 0, 0)],
[(0, 0, 0)],
[(0, 0, 0)],
[(0, 0, 0)],
[(0, 0, 0)],
[(0, 0, 0)],
[(0, 0, 0)],
[(0, 0, 0)],
[(0, 0, 0)],
[(0, 0, 0)],
[(0, 0, 0)],
])
end