mscroggs.co.uk
mscroggs.co.uk

subscribe

Comment

Comments

Comments in green were written by me. Comments in blue were not written by me.
@Dan: I have added symmetry optimization (still in VB.Net):

(Scanning for free space from top to bottom, left to right)
Only place 1x1 in one octant; The tests are simple, the savings are huge.

Even size: 8->36, 11->66, 12->78, 15->120
. . . . . . . . . .
. . . . . . . . . .
. . \ x x x x x . .
. . + \ x x x x . .
. . + + \ x x x . .
. . # # # # # # . .
. . # # # # # # . .
. . # # # # # # . .
. . . . . . . . . .
. . . . . . . . . .

Odd size: 9->45, 10->55, 13->91, 14->105
. . . . . . . . . . .
. . . . . . . . . . .
. . \ x x x x x x . .
. . + \ x x x x x . .
. . + + \ x x x x . .
. . = = = * x x x . .
. . # # # # # # # . .
. . # # # # # # # . .
. . # # # # # # # . .
. . . . . . . . . . .
. . . . . . . . . . .

+ No symmetry check needed
\ Check transpose only
= Check vertical flip only
* Check all 7 symmetries
. 1x1 impossible here
x don't place 1x1 here
# backtrack if 1x1 not placed yet

'8' 2,332 distinct: (12c/24t) 26 sec, (1t) 3m56s

'9' 216,285 distinct: (12c/24t) 3h32m41s, (1t) [32.2 hours estimated]

12c/24t is only getting a 9x improvement over single thread :(
I need to think about making an asm version :)
Lord Sméagol
on /blog/119
×1               
@Lord Sméagol: That's amazing. You've found the way for almost 8x speedup!
Danila P.
on /blog/119
×1               
@Danila P.: I think I have pushed VB.Net to its limit!
I moved the board from byte cells to 64 bit integer bitmaps (1 for each row);
using 8, 9, 10 variables for the 'active' rows instead of an array to reduce memory access.

I also partitioned the '9' and '10' search so other computers (I have a 6c/12t i7 3930K and a few quad cores) can assist using a mapped network drive.

All 2,332 distinct solutions of the '8' puzzle (12c/24t) now 16 secs (was 26 sec).

I have ported most of it to C ... just need to get the multi-threading working!
Lord Sméagol
on /blog/119
               

Archive

Show me a random blog post
 2026 

May 2026

World Cup stickers 2026

Apr 2026

A new puzzle every day
Mixing Wordle with other games

Feb 2026

Christmas (2025) is over
 2025 

Dec 2025

Christmas card 2025

Nov 2025

Christmas (2025) is coming!

Sep 2025

The partridge puzzle

Aug 2025

TMiP 2025 puzzle hunt

Jun 2025

A nonogram alphabet

Mar 2025

How to write a crossnumber

Jan 2025

Christmas (2024) is over
Friendly squares
 2024 

Dec 2024

A regular expression Christmas puzzle
Christmas card 2024

Nov 2024

Christmas (2024) is coming!

Feb 2024

Zines, pt. 2

Jan 2024

Christmas (2023) is over
 2023 
▼ show ▼
 2022 
▼ show ▼
 2021 
▼ show ▼
 2020 
▼ show ▼
 2019 
▼ show ▼
 2018 
▼ show ▼
 2017 
▼ show ▼
 2016 
▼ show ▼
 2015 
▼ show ▼
 2014 
▼ show ▼
 2013 
▼ show ▼
 2012 
▼ show ▼

Tags

tetris data visualisation newcastle arrangement puzzles ternary talking maths in public databet books phd turtles logo fractals dataset nine men's morris misleading statistics speed anscombe's quartet php golden ratio oeis plastic ratio statistics martin gardner advent calendar convergence sorting manchester science festival pokémon wordle javascript finite element method palindromes christmas card captain scarlet youtube platonic solids correlation london underground friendly squares ucl big internet math-off bodmas runge's phenomenon numerical analysis coventry boundary element methods standard deviation matrix of minors pascal's triangle matrices weather station frobel geometry computational complexity reuleaux polygons dates gather town dragon curves realhats chalkdust magazine matt parker inline code tennis wave scattering matrix multiplication hannah fry pi electromagnetic field bempp draughts pi approximation day noughts and crosses edinburgh signorini conditions crossnumber logic flexagons go simultaneous equations video games kenilworth cross stitch final fantasy pythagoras triangles rust numbers 24 hour maths recursion hyperbolic surfaces data thirteen machine learning datasaurus dozen zines manchester map projections pizza cutting chebyshev puzzles mathsjam sound bubble bobble arithmetic harriss spiral pac-man stirling numbers game show probability radio 4 stickers logs coins trigonometry wool nonograms weak imposition news estimation interpolation sport mathsteroids countdown raspberry pi curvature a gamut of games royal baby london european cup menace gaussian elimination quadrilaterals latex exponential growth matrix of cofactors bots wordle warwick live stream squares crochet partridge puzzle cambridge python graph theory finite group bluesky light mathslogicbot fence posts sobolev spaces determinants golden spiral folding paper folding tube maps fonts pokémon craft the aperiodical error bars crossnumbers geogebra kings rhombicuboctahedron probability accuracy propositional calculus world cup games hexapawn programming people maths christmas alphabets royal institution hats crosswords graphs rugby polynomials preconditioning football national lottery asteroids game of life tmip binary reddit gerry anderson regular expressions errors approximation inverse matrices braiding dinosaurs mean guest posts chess

Archive

Show me a random blog post
▼ show ▼
© Matthew Scroggs 2012–2026