@@ -30,6 +30,9 @@ const TILE_SHAPES = {
3030 'null4' : [ 1 , 3 ] ,
3131} ;
3232
33+ // Chance of showing a random wall tile other than the default.
34+ const RANDOM_TILE_RATE = 0.2 ;
35+
3336module . exports = class Subtype extends EventEmitter {
3437 constructor ( maze , config ) {
3538 super ( ) ;
@@ -137,10 +140,10 @@ module.exports = class Subtype extends EventEmitter {
137140 ) ;
138141 }
139142
140- getEmptyTile ( x , y , adjacentToPath ) {
143+ getEmptyTile ( x , y , adjacentToPath , innerCorner ) {
141144 let tile ;
142145 // Empty square. Use null0 for large areas, with null1-4 for borders.
143- if ( ! adjacentToPath && Math . random ( ) > 0.3 ) {
146+ if ( innerCorner || ( ! adjacentToPath && Math . random ( ) > RANDOM_TILE_RATE ) ) {
144147 this . wallMap [ y ] [ x ] = 0 ;
145148 tile = 'null0' ;
146149 } else {
@@ -167,12 +170,13 @@ module.exports = class Subtype extends EventEmitter {
167170 this . isOnPathStr_ ( col , row + 1 ) + // South.
168171 this . isOnPathStr_ ( col - 1 , row ) ; // East.
169172
170- const adjacentToPath = ( tile !== '00000' ) ;
171-
172173 // Draw the tile.
173174 if ( ! TILE_SHAPES [ tile ] ) {
175+ const adjacentToPath = tile !== '00000' ;
176+ const innerCorner = adjacentToPath && tile . split ( '1' ) . length > 2 ;
177+
174178 // We have an empty square. Handle it differently based on skin.
175- tile = this . getEmptyTile ( col , row , adjacentToPath ) ;
179+ tile = this . getEmptyTile ( col , row , adjacentToPath , innerCorner ) ;
176180 }
177181
178182 this . drawTile ( svg , TILE_SHAPES [ tile ] , row , col , tileId ) ;
0 commit comments