From f9fc4d26ec5fca9ee175c8a6fbcdd0fa36f10947 Mon Sep 17 00:00:00 2001 From: sanine Date: Thu, 16 Nov 2023 14:50:00 -0600 Subject: clear out js files --- src/world/sense.test.js | 33 --------------------------------- 1 file changed, 33 deletions(-) delete mode 100644 src/world/sense.test.js (limited to 'src/world/sense.test.js') diff --git a/src/world/sense.test.js b/src/world/sense.test.js deleted file mode 100644 index 27ee2b5..0000000 --- a/src/world/sense.test.js +++ /dev/null @@ -1,33 +0,0 @@ -import { sense_read } from './sense.js'; - - -test("basic sense works", () => { - const flag_sense = { - size: 1, - read: (world, agent) => { - const {x, y} = agent; - return [ world.lattice[y-1][x].type === 'flag' ? 1.0 : 0.0 ] - }, - }; - - const lattice = [[ { type: 'flag' } ]]; - const agent = { x: 0, y: 1 }; - - expect(sense_read({lattice}, agent, flag_sense)).toEqual([1.0]); -}); - - -test("senses throw if the size is incorrect", () => { - const flag_sense = { - size: 2, - read: (world, agent) => { - const {x, y} = agent; - return [ world.lattice[y-1][x].type === 'flag' ? 1.0 : 0.0 ] - }, - } - - const lattice = [[ { type: 'flag' } ]]; - const agent = { x: 0, y: 1 }; - - expect(() => sense_read({lattice}, agent, flag_sense)).toThrow(); -}); -- cgit v1.2.1