This commit is contained in:
2025-11-22 15:40:22 +01:00
parent 1dd8020cbb
commit 7a8efd8e5e
3 changed files with 6 additions and 8 deletions

2
build
View File

@@ -1,6 +1,6 @@
#!/bin/bash
LIB_INCLUDE="-lglfw -lGL -lm"
g++ -g -g2 -DOS_LINUX=1 -DDJSTDLIB_DEBUG=1 -xc -std=c99 ./src/main.c -o ./target/somaesque $LIB_INCLUDE
gcc -g -g2 -DOS_LINUX=1 -DDJSTDLIB_DEBUG=1 -xc -std=c99 ./src/main.c -o ./target/somaesque $LIB_INCLUDE
./target/somaesque

View File

@@ -132,7 +132,7 @@ void backtrackSolve(Arena *arena, Solver *solver, uint64 working_solution, size_
SomaSolutionList *solutions = solver->solutions;
size_t start = offsets->data[curr_piece];
size_t end = offsets->data[curr_piece + 1];
size_t num_pieces = offsets->length;
size_t num_pieces = offsets->length - 1;
for (size_t i = start; i < end; i++) {
bool successful_fuse = !collides(working_solution, input->data[i]);
if (successful_fuse) {
@@ -168,7 +168,7 @@ SomaSolutionList getSolutionRotations(Arena *arena, SomaSolution *solution, int
dims[2],
};
VoxelSpaceList pieceRotations = getAllRotations(arena, &space);
for (int rot_i = 0; rot_i < pieceRotations.length; rot_i++) {
for (EachIn(pieceRotations, rot_i)) {
AppendList(&result.data[rot_i], pieceRotations.data[rot_i].space);
}
}
@@ -228,7 +228,7 @@ SomaSolutionList solve(uint64 *reprs_in, uint32 reprs_in_count, int dims[3]) {
OffsetList offsets = PushList(arena, OffsetList, reprs_in_count + 1);
VoxelSpaceReprList polycubes = EmptyList();
VoxelSpaceReprList polycubes = PushList(arena, VoxelSpaceReprList, 0);
Space empty_voxel_space = {
0,
@@ -248,7 +248,6 @@ SomaSolutionList solve(uint64 *reprs_in, uint32 reprs_in_count, int dims[3]) {
VoxelSpaceReprList positions = getAllPositionsInPrism(permsArena, &space, dims);
possibleCombos += positions.length;
VoxelSpaceReprList_underlying *insertion = PushArray(arena, uint64, positions.capacity);
polycubes.data = insertion;
polycubes.capacity += positions.capacity;
polycubes.length += positions.length;
memcpy(insertion, positions.data, positions.capacity * ListElementSize(VoxelSpaceReprList));
@@ -270,8 +269,7 @@ SomaSolutionList solve(uint64 *reprs_in, uint32 reprs_in_count, int dims[3]) {
AppendList(&offsets, polycubes.length);
SomaSolutionList solutions = PushList(permsArena, SomaSolutionList, (size_t)floor(sqrt(possibleCombos)));
SomaSolution initialSoln = PushFullList(permsArena, SomaSolution, reprs_in_count);
AppendList(&solutions, initialSoln);
AppendList(&solutions, PushFullList(permsArena, SomaSolution, reprs_in_count));
Solver solver = {
&polycubes,