Skip to content

Commit 4e5ec0b

Browse files
author
Josh Lory
committed
Merge branch 'master' into unit-test-get-nectar
2 parents fa26d05 + 729eef6 commit 4e5ec0b

File tree

5 files changed

+20
-36
lines changed

5 files changed

+20
-36
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Icon?
3939
/.cake_task_cache
4040

4141
# Build files
42-
/lib
42+
/dist
4343
/demo/dist
4444

4545
# VScode settings

package.json

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,11 @@
22
"name": "@code-dot-org/maze",
33
"version": "1.1.0",
44
"description": "standalone project for the Maze app type",
5-
"files": [
6-
"lib/maze.js"
7-
],
8-
"main": "lib/maze.js",
5+
"main": "dist/main.js",
96
"scripts": {
107
"build": "webpack -p",
11-
"build:dev": "webpack --progress --colors",
12-
"build:demo": "webpack --config demo/webpack.config.js",
8+
"build:dev": "webpack --progress --colors --mode=development",
9+
"build:demo": "webpack --config demo/webpack.config.js -p",
1310
"lint": "eslint --ext .js src/ test",
1411
"postversion": "git push && git push --tags && npm publish",
1512
"preversion": "npm run test",
@@ -29,7 +26,7 @@
2926
"babel-core": "^6.26.0",
3027
"babel-eslint": "^8.0.3",
3128
"babel-jest": "^22.1.0",
32-
"babel-loader": "^7.1.2",
29+
"babel-loader": "^7.1.4",
3330
"babel-plugin-add-module-exports": "^0.2.1",
3431
"babel-plugin-transform-class-properties": "^6.23.0",
3532
"babel-plugin-transform-es2015-classes": "^6.9.0",
@@ -38,12 +35,11 @@
3835
"codecov": "^3.0.0",
3936
"eslint": "^3.19.0",
4037
"eslint-plugin-babel": "^4.1.2",
41-
"file-loader": "^1.1.6",
42-
"html-webpack-plugin": "^2.30.1",
38+
"file-loader": "^1.1.11",
39+
"html-webpack-plugin": "^3.2.0",
4340
"jest": "^22.1.3",
44-
"prop-types": "^15.6.0",
45-
"webpack": "^3.8.1",
46-
"webpack-dev-server": "^2.9.5"
41+
"webpack": "^4.8.1",
42+
"webpack-cli": "^2.1.3"
4743
},
4844
"jest": {
4945
"coverageDirectory": "./coverage/",

src/bee.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ module.exports = class Bee extends Gatherer {
395395
/**
396396
* @override
397397
*/
398-
getEmptyTile(x, y, adjacentToPath, wallMap) {
398+
getEmptyTile(x, y, adjacentToPath) {
399399
// begin with three trees
400400
var tileChoices = ['null3', 'null4', 'null0'];
401401
var noTree = 'null1';

src/subtype.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
3336
module.exports = class Subtype extends EventEmitter {
3437
constructor(maze, {skin, level} = {}) {
3538
super();
@@ -136,10 +139,10 @@ module.exports = class Subtype extends EventEmitter {
136139
);
137140
}
138141

139-
getEmptyTile(x, y, adjacentToPath) {
142+
getEmptyTile(x, y, adjacentToPath, innerCorner) {
140143
let tile;
141144
// Empty square. Use null0 for large areas, with null1-4 for borders.
142-
if (!adjacentToPath && Math.random() > 0.3) {
145+
if (innerCorner || (!adjacentToPath && Math.random() > RANDOM_TILE_RATE)) {
143146
this.wallMap[y][x] = 0;
144147
tile = 'null0';
145148
} else {
@@ -166,12 +169,14 @@ module.exports = class Subtype extends EventEmitter {
166169
this.isOnPathStr_(col, row + 1) + // South.
167170
this.isOnPathStr_(col - 1, row); // East.
168171

169-
const adjacentToPath = (tile !== '00000');
170-
171172
// Draw the tile.
172173
if (!TILE_SHAPES[tile]) {
174+
const adjacentToPath = tile !== '00000';
175+
// Any block with 2, 3 or 4 orthogonal paths.
176+
const innerCorner = adjacentToPath && tile.split('1').length > 2;
177+
173178
// We have an empty square. Handle it differently based on skin.
174-
tile = this.getEmptyTile(col, row, adjacentToPath);
179+
tile = this.getEmptyTile(col, row, adjacentToPath, innerCorner);
175180
}
176181

177182
this.drawTile(svg, TILE_SHAPES[tile], row, col, tileId);

webpack.config.js

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,11 @@
1-
const path = require("path");
2-
const name = "maze";
3-
41
module.exports = {
5-
entry: './src/index.js',
62
output: {
7-
path: path.resolve(__dirname, "lib"),
8-
filename: name + ".js",
9-
library: name,
103
libraryTarget: 'umd',
11-
umdNamedDefine: true
124
},
13-
target: 'node',
145
module: {
156
rules: [{
167
test: /\.js$/,
178
loader: "babel-loader",
189
}]
1910
},
20-
resolve: {
21-
extensions: [".js"],
22-
},
23-
stats: {
24-
colors: true
25-
},
26-
devtool: 'source-map',
27-
devServer: { inline: true }
2811
};

0 commit comments

Comments
 (0)