@@ -29,13 +29,19 @@ let automaton: AutomatonBase
29
29
30
30
window . onload = ( ) => {
31
31
const getInitialAlgo = ( ) => {
32
- const path = window . location . pathname . slice ( 1 ) ; // Remove leading slash
32
+ const path = window . location . pathname . slice ( 1 ) // Remove leading slash
33
33
const validAlgos = [
34
- "cca-1D" , "cca-2D" , "cca-3D" , "conway" ,
35
- "immigration" , "quadlife" , "langton" , "entropy"
36
- ] ;
37
- return validAlgos . includes ( path ) ? path : "cca-2D" ;
38
- } ;
34
+ "cca-1D" ,
35
+ "cca-2D" ,
36
+ "cca-3D" ,
37
+ "conway" ,
38
+ "immigration" ,
39
+ "quadlife" ,
40
+ "langton" ,
41
+ "entropy" ,
42
+ ]
43
+ return validAlgos . includes ( path ) ? path : "cca-2D"
44
+ }
39
45
40
46
pane = new Pane ( {
41
47
title : "Parameters" ,
@@ -235,9 +241,9 @@ window.onload = () => {
235
241
236
242
algoSelector . on ( "change" , ( event ) => {
237
243
// Update URL when algorithm changes
238
- const newUrl = `/${ event . value } ` ;
239
- window . history . pushState ( { } , '' , newUrl ) ;
240
-
244
+ const newUrl = `/${ event . value } `
245
+ window . history . pushState ( { } , "" , newUrl )
246
+
241
247
switch ( event . value ) {
242
248
case "cca-1D" :
243
249
setCca1dBlades ( )
@@ -268,12 +274,12 @@ window.onload = () => {
268
274
} )
269
275
270
276
// Handle browser back/forward navigation
271
- window . addEventListener ( ' popstate' , ( ) => {
272
- const newAlgo = getInitialAlgo ( ) ;
277
+ window . addEventListener ( " popstate" , ( ) => {
278
+ const newAlgo = getInitialAlgo ( )
273
279
if ( newAlgo !== settings . algo ) {
274
- algoSelector . value = newAlgo ;
280
+ algoSelector . value = newAlgo
275
281
}
276
- } ) ;
282
+ } )
277
283
278
284
addBlinkerBtn . on ( "click" , ( ) => {
279
285
automaton . placePatternRandomly ( blinkerPattern ( ) )
0 commit comments