<feed xmlns='http://www.w3.org/2005/Atom'>
<title>puzzles/grid.c, branch rockbox</title>
<subtitle>My sgt-puzzles tree</subtitle>
<link rel='alternate' type='text/html' href='https://www.franklinwei.com/cgit/puzzles/'/>
<entry>
<title>grid.c: fix size miscalculation in Floret tiling.</title>
<updated>2020-04-12T13:37:47+00:00</updated>
<author>
<name>Simon Tatham</name>
<email>anakin@pobox.com</email>
</author>
<published>2020-04-12T13:37:47+00:00</published>
<link rel='alternate' type='text/html' href='https://www.franklinwei.com/cgit/puzzles/commit/?id=2a0e91bc76738e36e89abd4dcae5f13bc063d210'/>
<id>2a0e91bc76738e36e89abd4dcae5f13bc063d210</id>
<content type='text'>
A Floret grid of height h usually alternates columns of h hexagonal
florets with columns of h-1. An exception is when h=1, in which case
alternating columns of 1 and 0 florets would leave the grid
disconnected. So in that situation all columns have 1 floret in them,
and the starting y-coordinate oscillates to make the grid tile
sensibly.

However, that special case wasn't taken account of when calculating
the grid height. As a result the anomalous extra florets in the
height-1 tiling fell off the bottom of the puzzle window.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
A Floret grid of height h usually alternates columns of h hexagonal
florets with columns of h-1. An exception is when h=1, in which case
alternating columns of 1 and 0 florets would leave the grid
disconnected. So in that situation all columns have 1 floret in them,
and the starting y-coordinate oscillates to make the grid tile
sensibly.

However, that special case wasn't taken account of when calculating
the grid height. As a result the anomalous extra florets in the
height-1 tiling fell off the bottom of the puzzle window.
</pre>
</div>
</content>
</entry>
<entry>
<title>Use C99 bool within source modules.</title>
<updated>2018-11-13T21:48:24+00:00</updated>
<author>
<name>Simon Tatham</name>
<email>anakin@pobox.com</email>
</author>
<published>2018-11-13T21:45:44+00:00</published>
<link rel='alternate' type='text/html' href='https://www.franklinwei.com/cgit/puzzles/commit/?id=5f5b284c0bddbe67de14b2d2bfb596bc7ba1298a'/>
<id>5f5b284c0bddbe67de14b2d2bfb596bc7ba1298a</id>
<content type='text'>
This is the main bulk of this boolification work, but although it's
making the largest actual change, it should also be the least
disruptive to anyone interacting with this code base downstream of me,
because it doesn't modify any interface between modules: all the
inter-module APIs were updated one by one in the previous commits.
This just cleans up the code within each individual source file to use
bool in place of int where I think that makes things clearer.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This is the main bulk of this boolification work, but although it's
making the largest actual change, it should also be the least
disruptive to anyone interacting with this code base downstream of me,
because it doesn't modify any interface between modules: all the
inter-module APIs were updated one by one in the previous commits.
This just cleans up the code within each individual source file to use
bool in place of int where I think that makes things clearer.
</pre>
</div>
</content>
</entry>
<entry>
<title>Replace TRUE/FALSE with C99 true/false throughout.</title>
<updated>2018-11-13T21:48:24+00:00</updated>
<author>
<name>Simon Tatham</name>
<email>anakin@pobox.com</email>
</author>
<published>2018-11-13T21:44:02+00:00</published>
<link rel='alternate' type='text/html' href='https://www.franklinwei.com/cgit/puzzles/commit/?id=a550ea0a47374705a37f36b0f05ffe9e4c8161fb'/>
<id>a550ea0a47374705a37f36b0f05ffe9e4c8161fb</id>
<content type='text'>
This commit removes the old #defines of TRUE and FALSE from puzzles.h,
and does a mechanical search-and-replace throughout the code to
replace them with the C99 standard lowercase spellings.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This commit removes the old #defines of TRUE and FALSE from puzzles.h,
and does a mechanical search-and-replace throughout the code to
replace them with the C99 standard lowercase spellings.
</pre>
</div>
</content>
</entry>
<entry>
<title>New grid type: the trihexagonal tiling, or 'kagome lattice'.</title>
<updated>2017-11-18T15:26:13+00:00</updated>
<author>
<name>Simon Tatham</name>
<email>anakin@pobox.com</email>
</author>
<published>2017-11-18T15:16:40+00:00</published>
<link rel='alternate' type='text/html' href='https://www.franklinwei.com/cgit/puzzles/commit/?id=8af0c29615fdfe30035f2d4c3a7d2ccf06d6efa9'/>
<id>8af0c29615fdfe30035f2d4c3a7d2ccf06d6efa9</id>
<content type='text'>
Regular hexagons and equilateral triangles in strict alternation, with
two of each interleaved around each vertex.
https://en.wikipedia.org/wiki/Trihexagonal_tiling

Thanks to Michael Quevillon for the patch.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Regular hexagons and equilateral triangles in strict alternation, with
two of each interleaved around each vertex.
https://en.wikipedia.org/wiki/Trihexagonal_tiling

Thanks to Michael Quevillon for the patch.
</pre>
</div>
</content>
</entry>
<entry>
<title>Make the code base clean under -Wwrite-strings.</title>
<updated>2017-10-01T15:35:40+00:00</updated>
<author>
<name>Simon Tatham</name>
<email>anakin@pobox.com</email>
</author>
<published>2017-10-01T13:45:12+00:00</published>
<link rel='alternate' type='text/html' href='https://www.franklinwei.com/cgit/puzzles/commit/?id=a58c1b216bb1d4547f7b2ef2703fe2d0cd3b5cac'/>
<id>a58c1b216bb1d4547f7b2ef2703fe2d0cd3b5cac</id>
<content type='text'>
I've also added that warning option and -Werror to the build script,
so that I'll find out if I break this property in future.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
I've also added that warning option and -Werror to the build script,
so that I'll find out if I break this property in future.
</pre>
</div>
</content>
</entry>
<entry>
<title>New Loopy tiling: 'Great Great Dodecagonal'.</title>
<updated>2017-04-24T16:09:39+00:00</updated>
<author>
<name>Simon Tatham</name>
<email>anakin@pobox.com</email>
</author>
<published>2017-04-23T06:41:46+00:00</published>
<link rel='alternate' type='text/html' href='https://www.franklinwei.com/cgit/puzzles/commit/?id=e37d915f447e02b52236cee454dfe68749c6d876'/>
<id>e37d915f447e02b52236cee454dfe68749c6d876</id>
<content type='text'>
Officially known as the '3-4-6-12 tiling', according to, e.g.,
https://en.wikipedia.org/wiki/3-4-6-12_tiling .

Thanks to Michael Quevillon for contributing this patch (and for
choosing a less hard-to-remember name for the tiling :-).
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Officially known as the '3-4-6-12 tiling', according to, e.g.,
https://en.wikipedia.org/wiki/3-4-6-12_tiling .

Thanks to Michael Quevillon for contributing this patch (and for
choosing a less hard-to-remember name for the tiling :-).
</pre>
</div>
</content>
</entry>
<entry>
<title>Sort out abs/fabs confusion.</title>
<updated>2015-04-10T06:58:26+00:00</updated>
<author>
<name>Simon Tatham</name>
<email>anakin@pobox.com</email>
</author>
<published>2015-04-10T06:55:16+00:00</published>
<link rel='alternate' type='text/html' href='https://www.franklinwei.com/cgit/puzzles/commit/?id=7f64f4a50e46304b7bad011a1251e146ab63ca15'/>
<id>7f64f4a50e46304b7bad011a1251e146ab63ca15</id>
<content type='text'>
My Mac has just upgraded itself to include a version of clang which
warns if you use abs() on a floating-point value, or fabs() on an
integer. Fixed the two occurrences that came up in this build (and
which were actual build failures, because of -Werror), one in each
direction.

I think both were benign. The potentially dangerous one was using abs
in place of fabs in grid_find_incentre(), because that could actually
lose precision, but I think that function had plenty of precision to
spare (grid point separation being of the order of tens of pixels) so
nothing should have gone seriously wrong with the old code.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
My Mac has just upgraded itself to include a version of clang which
warns if you use abs() on a floating-point value, or fabs() on an
integer. Fixed the two occurrences that came up in this build (and
which were actual build failures, because of -Werror), one in each
direction.

I think both were benign. The potentially dangerous one was using abs
in place of fabs in grid_find_incentre(), because that could actually
lose precision, but I think that function had plenty of precision to
spare (grid point separation being of the order of tens of pixels) so
nothing should have gone seriously wrong with the old code.
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix grid generation crashes at Penrose 3x3 sizes. What seemed to be</title>
<updated>2013-05-10T17:56:00+00:00</updated>
<author>
<name>Simon Tatham</name>
<email>anakin@pobox.com</email>
</author>
<published>2013-05-10T17:56:00+00:00</published>
<link rel='alternate' type='text/html' href='https://www.franklinwei.com/cgit/puzzles/commit/?id=b6ee9debcfe46c7ed4e958511e754f150f4e9773'/>
<id>b6ee9debcfe46c7ed4e958511e754f150f4e9773</id>
<content type='text'>
happening was that at the point of calling grid_make_consistent, the
grid had no faces or vertices, probably because grid_trim_vigorously
had removed them all, causing grid_make_consistent to try to allocate
a negative amount of memory and die in snewn.

Fixed by detecting this case in new_desc_penrose and retrying until
generation is successful. (It wasn't happening 100% of the time, just
_most_ of the time.) The same verification step is also used in
validate_desc_penrose in case a user manages to manually construct a
set of parameters leading to this failure mode.

[originally from svn r9840]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
happening was that at the point of calling grid_make_consistent, the
grid had no faces or vertices, probably because grid_trim_vigorously
had removed them all, causing grid_make_consistent to try to allocate
a negative amount of memory and die in snewn.

Fixed by detecting this case in new_desc_penrose and retrying until
generation is successful. (It wasn't happening 100% of the time, just
_most_ of the time.) The same verification step is also used in
validate_desc_penrose in case a user manages to manually construct a
set of parameters leading to this failure mode.

[originally from svn r9840]
</pre>
</div>
</content>
</entry>
<entry>
<title>Giant const patch of doom: add a 'const' to every parameter in every</title>
<updated>2013-04-13T10:37:32+00:00</updated>
<author>
<name>Simon Tatham</name>
<email>anakin@pobox.com</email>
</author>
<published>2013-04-13T10:37:32+00:00</published>
<link rel='alternate' type='text/html' href='https://www.franklinwei.com/cgit/puzzles/commit/?id=251b21c41813055d9c416378508b1ee038bc3dac'/>
<id>251b21c41813055d9c416378508b1ee038bc3dac</id>
<content type='text'>
puzzle backend function which ought to have it, and propagate those
consts through to per-puzzle subroutines as needed.

I've recently had to do that to a few specific parameters which were
being misused by particular puzzles (r9657, r9830), which suggests
that it's probably a good idea to do the whole lot pre-emptively
before the next such problem shows up.

[originally from svn r9832]
[r9657 == 3b250baa02a7332510685948bf17576c397b8ceb]
[r9830 == 0b93de904a98f119b1a95d3a53029f1ed4bfb9b3]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
puzzle backend function which ought to have it, and propagate those
consts through to per-puzzle subroutines as needed.

I've recently had to do that to a few specific parameters which were
being misused by particular puzzles (r9657, r9830), which suggests
that it's probably a good idea to do the whole lot pre-emptively
before the next such problem shows up.

[originally from svn r9832]
[r9657 == 3b250baa02a7332510685948bf17576c397b8ceb]
[r9830 == 0b93de904a98f119b1a95d3a53029f1ed4bfb9b3]
</pre>
</div>
</content>
</entry>
<entry>
<title>Revamp the triangular grid generation in Loopy, which I've been</title>
<updated>2013-04-11T12:51:05+00:00</updated>
<author>
<name>Simon Tatham</name>
<email>anakin@pobox.com</email>
</author>
<published>2013-04-11T12:51:05+00:00</published>
<link rel='alternate' type='text/html' href='https://www.franklinwei.com/cgit/puzzles/commit/?id=ed82ef5c0e74de5ef743e61aebad59b2acea7a49'/>
<id>ed82ef5c0e74de5ef743e61aebad59b2acea7a49</id>
<content type='text'>
meaning to revisit for a while. The new version generates more nicely
symmetric grids (best at even heights, but still improved even at odd
heights), and avoids any 'ears' on the grid (triangles at the corners
connected to only one other triangle, which tend to be boringly easy
places to start solving).

I've reused the grid-description-string mechanism invented for the
Penrose tilings as a versioning mechanism for the triangular grids, so
that old game descriptions should still be valid, and new triangular-
grid game descriptions begin with an "0_" prefix to indicate that they
are based on the new-style construction.

[originally from svn r9824]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
meaning to revisit for a while. The new version generates more nicely
symmetric grids (best at even heights, but still improved even at odd
heights), and avoids any 'ears' on the grid (triangles at the corners
connected to only one other triangle, which tend to be boringly easy
places to start solving).

I've reused the grid-description-string mechanism invented for the
Penrose tilings as a versioning mechanism for the triangular grids, so
that old game descriptions should still be valid, and new triangular-
grid game descriptions begin with an "0_" prefix to indicate that they
are based on the new-style construction.

[originally from svn r9824]
</pre>
</div>
</content>
</entry>
</feed>
