Skip to content

Commit

Permalink
Fixes #19
Browse files Browse the repository at this point in the history
  • Loading branch information
nrkn committed Oct 27, 2015
1 parent 547e342 commit 4086024
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 95 deletions.
2 changes: 1 addition & 1 deletion hrm.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const parse = require( 'hrm-parser' )
const normalizeOptions = require( './normalize-options' )
const parse = require( './parse' )
const runtimeErrors = require( './runtime-errors' )

const asNumber = s =>
Expand Down
2 changes: 1 addition & 1 deletion normalize-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module.exports = options => {

if( options ){
if( !options.tiles ){
options = Object.assign( {}, { tiles: options } )
options = { tiles: options }
}

return Object.assign( {}, defaults, options )
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"scripts": {},
"dependencies": {
"hrm-level-data": "^1.0.0",
"hrm-parser": "^0.1.3",
"tv4": "^1.2.7"
}
}
60 changes: 0 additions & 60 deletions parse.js

This file was deleted.

28 changes: 0 additions & 28 deletions polyfills.js

This file was deleted.

8 changes: 4 additions & 4 deletions runtime-errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ const EmptyTileError = instrName => {
}
}

const OutOfBoundsError = instrName => {
const BadTileAddressError = address => {
return {
name: 'No Such Tile',
message: `No such tile! You can't ${ instrName } with a tile that isn't on the floor!`
name: 'Bad Tile Address',
message: `Bad tile address! Tile with address ${ address } does not exist! Where do you think you're going?`
}
}

Expand Down Expand Up @@ -88,7 +88,7 @@ module.exports = ( instr, arg, state ) => {
},
memory: ( name, address ) => {
if( address >= state.memorySize )
throw OutOfBoundsError( name )
throw BadTileAddressError( address )

if( state.memory[ address ] === undefined || state.memory[ address ] === null )
throw EmptyTileError( name )
Expand Down
2 changes: 1 addition & 1 deletion test/runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ a:
a:
JUMPN a
`,
"Out Of Bounds": `
"Bad Tile Address": `
COPYFROM 2
`,
"Instruction Not Allowed": `
Expand Down

0 comments on commit 4086024

Please sign in to comment.