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 

Feb 2026

Christmas (2025) is over
 2025 
▼ show ▼
 2024 
▼ show ▼
 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

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

Archive

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