| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -94,7 +94,6 @@ or changed without updating this reference. Search for `SettingsStorage`. | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					``` | 
					 | 
					 | 
					 | 
					``` | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					{ | 
					 | 
					 | 
					 | 
					{ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  log: 'info', // default log level | 
					 | 
					 | 
					 | 
					  log: 'info', // default log level | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  allowTemplateAugmenting: false, // sloppy mode | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  retryTemplate: 30,    // retry attempts within one template | 
					 | 
					 | 
					 | 
					  retryTemplate: 30,    // retry attempts within one template | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  attemptTemplates: 50, // number of templates to try on failure | 
					 | 
					 | 
					 | 
					  attemptTemplates: 50, // number of templates to try on failure | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  svgEffects: false,    // fancy mode | 
					 | 
					 | 
					 | 
					  svgEffects: false,    // fancy mode | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -125,19 +124,20 @@ Algorithm Quirks | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					Every board must be solvable, otherwise it wouldn't be much of a game. Generating a valid board | 
					 | 
					 | 
					 | 
					Every board must be solvable, otherwise it wouldn't be much of a game. Generating a valid board | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					turned out quite a bit more challenging than I thought. My algorithm is based in some heuristics | 
					 | 
					 | 
					 | 
					turned out quite a bit more challenging than I thought. My algorithm is based in some heuristics | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					and good deal of luck.  | 
					 | 
					 | 
					 | 
					and luck. | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					To make things more fun, besides the marble matching rules, the board must be laid out in one of  | 
					 | 
					 | 
					 | 
					To make things more fun, besides the marble matching rules, the board must be laid out in one of  | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					several pre-defined shapes of exactly 55 tiles. The algorithm can sometimes get itself into a dead  | 
					 | 
					 | 
					 | 
					several pre-defined shapes of exactly 55 tiles. The algorithm can sometimes get itself into a dead  | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					end while placing marbles on the board. I experimented with backtracking, but the current version  | 
					 | 
					 | 
					 | 
					end while placing marbles on the board. After some experimentation I settled on a recursive algorithm | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					simply retries the whole thing with a different random seed. There are configurable retry limits | 
					 | 
					 | 
					 | 
					with a heuristic and backtracking. There are configurable retry limits and max recursion / retry | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					as a failsafe. If the given template fails many consecutive times, the algorithm opts to switch to  | 
					 | 
					 | 
					 | 
					counter as a failsafe. If the given template fails many consecutive times, the algorithm opts to switch to  | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					a different template. Some templates are harder than others, and some random seeds just seem to  | 
					 | 
					 | 
					 | 
					a different template. Some templates are harder than others, and some random seeds just seem to  | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					have a problem. | 
					 | 
					 | 
					 | 
					have a problem. | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					A workaround I added is called Sloppy Mode. When the algorithm can't place a marble, it may choose | 
					 | 
					 | 
					 | 
					I added a few extra rules to the generation algorithm to make the boards harder: Vitae and Mors should not | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					to add a new tile to the template, trying to keep the overall shape as tidy as possible. This may | 
					 | 
					 | 
					 | 
					appear as the first few marbles to remove, since they tend to eliminate any choice; and metals start a few | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					hurt game difficulty, but is generally much faster than retrying over and over. | 
					 | 
					 | 
					 | 
					levels deeper still. This gives the player a lot more room to make a mistake in the beginning.  | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					At least you can enjoy the Undo and Try Again buttons! | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					If you're curious about the inner workings, open dev tools and enable debug logging with the `debug=1` | 
					 | 
					 | 
					 | 
					If you're curious about the inner workings, open dev tools and enable debug logging with the `debug=1` | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					GET parameter. | 
					 | 
					 | 
					 | 
					GET parameter. | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
  |