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

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

Archive

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