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

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

Archive

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