bard-legends-framework 0.9.4 → 0.9.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/game-entities/attachable/attachable.spec.d.ts +1 -0
- package/dist/game-entities/attachable/attachable.spec.js +136 -0
- package/dist/game-entities/controller/controller.spec.d.ts +1 -0
- package/dist/game-entities/controller/controller.spec.js +128 -0
- package/dist/game-entities/entity/entity.spec.d.ts +1 -0
- package/dist/game-entities/entity/entity.spec.js +301 -0
- package/dist/game-entities/scene/scene.spec.d.ts +1 -0
- package/dist/game-entities/scene/scene.spec.js +231 -0
- package/dist/game-entities/service/service.spec.d.ts +1 -0
- package/dist/game-entities/service/service.spec.js +245 -0
- package/dist/game-entities/view/view.spec.d.ts +1 -0
- package/dist/game-entities/view/view.spec.js +514 -0
- package/dist/lib/animator/animator.spec.d.ts +1 -0
- package/dist/lib/animator/animator.spec.js +615 -0
- package/dist/lib/libraries/animator/animator.spec.d.ts +1 -0
- package/dist/lib/libraries/animator/animator.spec.js +615 -0
- package/dist/physics/helpers/closest-available-space.helper.spec.d.ts +1 -0
- package/dist/physics/helpers/closest-available-space.helper.spec.js +71 -0
- package/dist/utilities/libraries/animator/animator.spec.d.ts +1 -0
- package/dist/utilities/libraries/animator/animator.spec.js +670 -0
- package/dist/utilities/libraries/data-structures/grid/grid.spec.d.ts +1 -0
- package/dist/utilities/libraries/data-structures/grid/grid.spec.js +140 -0
- package/dist/utilities/libraries/grid-algorithms/closest-available-space/closest-available-space.helper.spec.d.ts +1 -0
- package/dist/utilities/libraries/grid-algorithms/closest-available-space/closest-available-space.helper.spec.js +70 -0
- package/dist/utilities/libraries/grid-algorithms/path-finder/path-finder.spec.d.ts +1 -0
- package/dist/utilities/libraries/grid-algorithms/path-finder/path-finder.spec.js +164 -0
- package/dist/utilities/libraries/grid-algorithms/vector-field-path-finder/vector-field-path-finder.spec.d.ts +1 -0
- package/dist/utilities/libraries/grid-algorithms/vector-field-path-finder/vector-field-path-finder.spec.js +232 -0
- package/dist/utilities/libraries/path-finder/path-finder.spec.d.ts +1 -0
- package/dist/utilities/libraries/path-finder/path-finder.spec.js +133 -0
- package/package.json +6 -1
- package/.cursorignore +0 -4
- package/.eslintrc.js +0 -212
- package/.vscode/launch.json +0 -15
- package/.vscode/settings.json +0 -22
- package/dist/_interfaces/index.js.map +0 -1
- package/dist/game-entities/attachable/attachable.js.map +0 -1
- package/dist/game-entities/attachable/attachable.spec.js.map +0 -1
- package/dist/game-entities/attachable/attachable.store.js.map +0 -1
- package/dist/game-entities/attachable/attachable.test.js.map +0 -1
- package/dist/game-entities/attachable/destroyable.js.map +0 -1
- package/dist/game-entities/attachable/helpers/decorate-actions-lib.js.map +0 -1
- package/dist/game-entities/attachable/helpers/referance-variable.js.map +0 -1
- package/dist/game-entities/attachable/interfaces.js.map +0 -1
- package/dist/game-entities/base/attachable.js.map +0 -1
- package/dist/game-entities/base/attachable.test.js.map +0 -1
- package/dist/game-entities/base/destroyable.js.map +0 -1
- package/dist/game-entities/base/helpers/attachable.store.js.map +0 -1
- package/dist/game-entities/base/helpers/decorate-actions-lib.js.map +0 -1
- package/dist/game-entities/base/helpers/referance-variable.js.map +0 -1
- package/dist/game-entities/base/interfaces.js.map +0 -1
- package/dist/game-entities/controller/controller.js.map +0 -1
- package/dist/game-entities/controller/controller.spec.js.map +0 -1
- package/dist/game-entities/controller/controller.test.js.map +0 -1
- package/dist/game-entities/entity/entity.js.map +0 -1
- package/dist/game-entities/entity/entity.spec.js.map +0 -1
- package/dist/game-entities/entity/entity.test.js.map +0 -1
- package/dist/game-entities/entity/helpers/entity-store.helper.js.map +0 -1
- package/dist/game-entities/entity/helpers/entity-views.helper.js.map +0 -1
- package/dist/game-entities/entity/helpers/view-creation.helper.js.map +0 -1
- package/dist/game-entities/entity/singleton-entity.js.map +0 -1
- package/dist/game-entities/entity/singleton-entity.test.js.map +0 -1
- package/dist/game-entities/index.js.map +0 -1
- package/dist/game-entities/scene/scene.js.map +0 -1
- package/dist/game-entities/scene/scene.spec.js.map +0 -1
- package/dist/game-entities/scene/scene.test.js.map +0 -1
- package/dist/game-entities/service/service.js.map +0 -1
- package/dist/game-entities/service/service.spec.js.map +0 -1
- package/dist/game-entities/service/service.test.js.map +0 -1
- package/dist/game-entities/update-cycle.js.map +0 -1
- package/dist/game-entities/update-loop.js.map +0 -1
- package/dist/game-entities/view/view.js.map +0 -1
- package/dist/game-entities/view/view.spec.js.map +0 -1
- package/dist/game-entities/view/view.test.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/animator/animations.js.map +0 -1
- package/dist/lib/animator/animator.js.map +0 -1
- package/dist/lib/animator/animator.spec.js.map +0 -1
- package/dist/lib/animator/index.js.map +0 -1
- package/dist/lib/libraries/animator/animations.js.map +0 -1
- package/dist/lib/libraries/animator/animator.js.map +0 -1
- package/dist/lib/libraries/animator/animator.spec.js.map +0 -1
- package/dist/lib/libraries/animator/index.js.map +0 -1
- package/dist/lib/libraries/path-finder/path-finder.js.map +0 -1
- package/dist/lib/path-finder/path-finder.js.map +0 -1
- package/dist/lib/services/keyboard/keyboard.js.map +0 -1
- package/dist/lib/services/mouse/mouse.service.js.map +0 -1
- package/dist/lib/services/mouse/mouser-target-focus.service.js.map +0 -1
- package/dist/lib/update-loop.js.map +0 -1
- package/dist/physics/entitity-types/immovable-physics-entity.js.map +0 -1
- package/dist/physics/entitity-types/movable-entity.js.map +0 -1
- package/dist/physics/entitity-types/movable-physics-entity.js.map +0 -1
- package/dist/physics/entitity-types/physics-entity.js.map +0 -1
- package/dist/physics/entity-types/immovable-physics-entity.js.map +0 -1
- package/dist/physics/entity-types/movable-entity.js.map +0 -1
- package/dist/physics/entity-types/movable-physics-entity.js.map +0 -1
- package/dist/physics/entity-types/physics-entity.js.map +0 -1
- package/dist/physics/helpers/closest-available-space.helper.js.map +0 -1
- package/dist/physics/helpers/closest-available-space.helper.spec.js.map +0 -1
- package/dist/physics/helpers/p2js.helper.js.map +0 -1
- package/dist/physics/helpers/shape-factory.js.map +0 -1
- package/dist/physics/index.js.map +0 -1
- package/dist/physics/interfaces.js.map +0 -1
- package/dist/physics/libs/p2js.helper.js.map +0 -1
- package/dist/physics/libs/physics-body-groups.js.map +0 -1
- package/dist/physics/libs/position-to-grid-position-converter.js.map +0 -1
- package/dist/physics/module//342/232/234/357/270/217gateways/controllers/physics-internal.controller.js.map +0 -1
- package/dist/physics/module//342/232/234/357/270/217gateways/controllers/physics.controller.js.map +0 -1
- package/dist/physics/module//342/232/234/357/270/217gateways/dtos/requests.dto.js.map +0 -1
- package/dist/physics/module//342/232/234/357/270/217gateways/dtos/responses.dto.js.map +0 -1
- package/dist/physics/module//342/232/234/357/270/217gateways/dtos/shared-interfaces.dto.js.map +0 -1
- package/dist/physics/module//342/232/234/357/270/217gateways/index.js.map +0 -1
- package/dist/physics/module//342/232/234/357/270/217gateways/physics-internal.gateway.js.map +0 -1
- package/dist/physics/module//342/232/234/357/270/217gateways/physics.gateway.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/availability-grid.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/border.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/collision/collisions.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/collision/hit-test.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/collision/physics-body-group.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/collisions.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/creation/border.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/creation/materials.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/creation/physics-world.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/creation/shape-creation.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/debug-visuals.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/eliptic-explosion.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/explosion.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/explosions/eliptic-explosion.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/explosions/explosion.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/explosions/helpers/ray-cast-hit-converter.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/helpers/ray-cast-hit-converter.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/impact/eliptic-explosion.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/impact/explosion.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/impact/impact.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/impact/ray-cast-hit-converter.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/materials.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/path-finder.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/path-finding/availability-grid-cache.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/path-finding/availability-grid.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/path-finding/path-finder.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/physics-world.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/query/physics-query.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/ray-casting/ray-casting.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/ray-casting.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/shape-creation.service.js.map +0 -1
- package/dist/physics/module//360/237/223/220services/test-visuals/test-visuals.service.js.map +0 -1
- package/dist/physics/module//360/237/247/212entities/border.entity.js.map +0 -1
- package/dist/physics/module//360/237/247/212entities/data-structures/availability-grid-cache.js.map +0 -1
- package/dist/physics/module//360/237/247/212entities/physics-world.entity.js.map +0 -1
- package/dist/physics/physics-world.js.map +0 -1
- package/dist/physics/sub-elements/available-spaces/helpers/availability-grid.helper.js.map +0 -1
- package/dist/physics/sub-elements/available-spaces/physics-availability-grid.js.map +0 -1
- package/dist/physics/sub-elements/available-spaces/physics-available-spaces.js.map +0 -1
- package/dist/physics/sub-elements/collisions/contact-equation-orginiser.js.map +0 -1
- package/dist/physics/sub-elements/collisions/physics-collision.js.map +0 -1
- package/dist/physics/sub-elements/elements/physics-body-groups.js.map +0 -1
- package/dist/physics/sub-elements/elements/physics-materials.js.map +0 -1
- package/dist/physics/sub-elements/elements/physics-world-borders.js.map +0 -1
- package/dist/physics/sub-elements/physics-body-groups.js.map +0 -1
- package/dist/physics/sub-elements/physics-collision.js.map +0 -1
- package/dist/physics/sub-elements/physics-materials.js.map +0 -1
- package/dist/physics/sub-elements/physics-world-borders.js.map +0 -1
- package/dist/physics/sub-elements/raycasting/physics-body-explosion-hit.js.map +0 -1
- package/dist/physics/sub-elements/raycasting/physics-explosion.js.map +0 -1
- package/dist/physics/sub-elements/raycasting/ray-cast.js.map +0 -1
- package/dist/pixi/components/display-object-array.js.map +0 -1
- package/dist/pixi/components/helpers/smooth-scroller.js.map +0 -1
- package/dist/pixi/components/helpers/smooth-scroller.test.js.map +0 -1
- package/dist/pixi/components/mouse-wheel-listener.ui.js.map +0 -1
- package/dist/pixi/components/scroll-area.ui.js.map +0 -1
- package/dist/pixi/components/scroll-mask.ui.js.map +0 -1
- package/dist/pixi/display-object/components/filters.js.map +0 -1
- package/dist/pixi/display-object/components/glow-effect.js.map +0 -1
- package/dist/pixi/display-object/components/glow-filter.js.map +0 -1
- package/dist/pixi/display-object/container-attributes.js.map +0 -1
- package/dist/pixi/display-object/container.js.map +0 -1
- package/dist/pixi/display-object/display-object-attributes.js.map +0 -1
- package/dist/pixi/display-object/display-object.js.map +0 -1
- package/dist/pixi/display-object/filters/base-filters/alpha-primer-color.filter.js.map +0 -1
- package/dist/pixi/display-object/filters/base-filters/blur.filter.js.map +0 -1
- package/dist/pixi/display-object/filters/base-filters/contrast-filter.js.map +0 -1
- package/dist/pixi/display-object/filters/base-filters/expand-with-alpha-color.js.map +0 -1
- package/dist/pixi/display-object/filters/base-filters/expand-with-color-gradient.js.map +0 -1
- package/dist/pixi/display-object/filters/base-filters/expand-with-color.filter.js.map +0 -1
- package/dist/pixi/display-object/filters/base-filters/expand-with-color.js.map +0 -1
- package/dist/pixi/display-object/filters/composite-filters/glow-filter.js.map +0 -1
- package/dist/pixi/display-object/filters/helpers/gaussian-values.helper.js.map +0 -1
- package/dist/pixi/display-object/filters/helpers/gaussian-values.helper.test.js.map +0 -1
- package/dist/pixi/display-object/filters/templates/checking-neighbors.template.js.map +0 -1
- package/dist/pixi/display-object/filters/templates/plane.template.js.map +0 -1
- package/dist/pixi/display-object/filters.js.map +0 -1
- package/dist/pixi/display-object/index.js.map +0 -1
- package/dist/pixi/display-object/objects/components/filters.js.map +0 -1
- package/dist/pixi/display-object/objects/container.js.map +0 -1
- package/dist/pixi/display-object/objects/graphics/graphics.js.map +0 -1
- package/dist/pixi/display-object/objects/graphics/helpers/dashed-line.helper.js.map +0 -1
- package/dist/pixi/display-object/objects/graphics.js.map +0 -1
- package/dist/pixi/display-object/objects/helpers/filters.js.map +0 -1
- package/dist/pixi/display-object/objects/helpers/glow-sprite-generator.js.map +0 -1
- package/dist/pixi/display-object/objects/placeholder.js.map +0 -1
- package/dist/pixi/display-object/objects/premade-objects/sprite-with-glowing-shapes.js.map +0 -1
- package/dist/pixi/display-object/objects/sprite/glow-sprite-generator.js.map +0 -1
- package/dist/pixi/display-object/objects/sprite/sprite.js.map +0 -1
- package/dist/pixi/display-object/objects/sprite.js.map +0 -1
- package/dist/pixi/display-object/objects/text/helpers/index.js.map +0 -1
- package/dist/pixi/display-object/objects/text/helpers/process-steps/1-data-in-converter/pixi-text-style-converter.js.map +0 -1
- package/dist/pixi/display-object/objects/text/helpers/process-steps/1-data-in-converter/rich-text-data-in-converter.js.map +0 -1
- package/dist/pixi/display-object/objects/text/helpers/process-steps/1-data-in-converter/rich-text-data-in-converter.test.js.map +0 -1
- package/dist/pixi/display-object/objects/text/helpers/process-steps/2-wrapping-text/consistent-space-text-wrapper.js.map +0 -1
- package/dist/pixi/display-object/objects/text/helpers/process-steps/2-wrapping-text/consistent-space-text-wrapper.test.js.map +0 -1
- package/dist/pixi/display-object/objects/text/helpers/process-steps/2-wrapping-text/rich-text-typewriter.js.map +0 -1
- package/dist/pixi/display-object/objects/text/helpers/process-steps/2-wrapping-text/rich-text-typewriter.test.js.map +0 -1
- package/dist/pixi/display-object/objects/text/helpers/process-steps/3-data-out-converter/rich-text-data-out-converter.js.map +0 -1
- package/dist/pixi/display-object/objects/text/helpers/process-steps/3-data-out-converter/rich-text-data-out-converter.test.js.map +0 -1
- package/dist/pixi/display-object/objects/text/helpers/rich-text-to-plane-text.js.map +0 -1
- package/dist/pixi/display-object/objects/text/helpers/rich-text-to-plane-text.test.js.map +0 -1
- package/dist/pixi/display-object/objects/text/rich-text.js.map +0 -1
- package/dist/pixi/display-object/objects/text/text.js.map +0 -1
- package/dist/pixi/display-object/objects/text.js.map +0 -1
- package/dist/pixi/display-object/premade-objects/sprite-with-glowing-shapes.js.map +0 -1
- package/dist/pixi/game.js.map +0 -1
- package/dist/pixi/helpers/game-assets.js.map +0 -1
- package/dist/pixi/helpers/glow-sprite-generator.js.map +0 -1
- package/dist/pixi/helpers/pixi-container.helper.js.map +0 -1
- package/dist/pixi/helpers/position-conversion.helper.js.map +0 -1
- package/dist/pixi/helpers/position-conversion.helper.test.js.map +0 -1
- package/dist/pixi/helpers/screen-position-to-stage.helper.js.map +0 -1
- package/dist/pixi/helpers/screen-position-to-stage.helper.test.js.map +0 -1
- package/dist/pixi/index.js.map +0 -1
- package/dist/pixi/modules/CAMERA/camera.js.map +0 -1
- package/dist/pixi/modules/CAMERA/index.js.map +0 -1
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/camera-view.gateway.js.map +0 -1
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/camera.gateway.js.map +0 -1
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/controllers/camera-view.controller.js.map +0 -1
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/controllers/camera.controller.js.map +0 -1
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/dtos/requests.dto.js.map +0 -1
- package/dist/pixi/modules/CAMERA//342/232/234/357/270/217gateways/index.js.map +0 -1
- package/dist/pixi/modules/CAMERA//360/237/223/220services/camera.service.js.map +0 -1
- package/dist/pixi/modules/CAMERA//360/237/247/212entities/camera.entity.js.map +0 -1
- package/dist/pixi/modules/CAMERA//360/237/247/251views/camera.view.js.map +0 -1
- package/dist/pixi/services/keyboard/keyboard.js.map +0 -1
- package/dist/pixi/services/mouse/mouse-target-focus.service.js.map +0 -1
- package/dist/pixi/services/mouse/mouse.service.js.map +0 -1
- package/dist/services/keyboard/keyboard.js.map +0 -1
- package/dist/services/mouse/mouse.service.js.map +0 -1
- package/dist/services/mouse/mouser-target-focus.service.js.map +0 -1
- package/dist/utilities/index.js.map +0 -1
- package/dist/utilities/libraries/animator/animating-content/fade-in-content.js.map +0 -1
- package/dist/utilities/libraries/animator/animating-content/slide-in-content.js.map +0 -1
- package/dist/utilities/libraries/animator/animating-content/state-animation.js.map +0 -1
- package/dist/utilities/libraries/animator/animating-content/state-animation.test.js.map +0 -1
- package/dist/utilities/libraries/animator/animations.js.map +0 -1
- package/dist/utilities/libraries/animator/animator.js.map +0 -1
- package/dist/utilities/libraries/animator/animator.spec.js.map +0 -1
- package/dist/utilities/libraries/animator/animator.test.js.map +0 -1
- package/dist/utilities/libraries/animator/index.js.map +0 -1
- package/dist/utilities/libraries/animator/state-animation/slide-state-animation.js.map +0 -1
- package/dist/utilities/libraries/animator/state-animation/slide-state-animation.test.js.map +0 -1
- package/dist/utilities/libraries/animator/state-animation/state-animation.js.map +0 -1
- package/dist/utilities/libraries/animator/state-animation/state-animation.test.js.map +0 -1
- package/dist/utilities/libraries/animator/state-animation/visit-disappear-state-animation.js.map +0 -1
- package/dist/utilities/libraries/animator/state-animation/visit-disappear-state-animation.test.js.map +0 -1
- package/dist/utilities/libraries/binary-heap/binary-heap.js.map +0 -1
- package/dist/utilities/libraries/data-structures/binary-heap/binary-heap.js.map +0 -1
- package/dist/utilities/libraries/data-structures/grid/grid.js.map +0 -1
- package/dist/utilities/libraries/data-structures/grid/grid.spec.js.map +0 -1
- package/dist/utilities/libraries/data-structures/grid/grid.test.js.map +0 -1
- package/dist/utilities/libraries/data-structures/grid/position-to-grid-position-converter.js.map +0 -1
- package/dist/utilities/libraries/data-structures/queue/queue.js.map +0 -1
- package/dist/utilities/libraries/data-structures/queue/queue.test.js.map +0 -1
- package/dist/utilities/libraries/data-structures/vector-set/vector-set.js.map +0 -1
- package/dist/utilities/libraries/delta-time/delta-time.js.map +0 -1
- package/dist/utilities/libraries/grid-algorithms/closest-available-space/closest-available-space.helper.js.map +0 -1
- package/dist/utilities/libraries/grid-algorithms/closest-available-space/closest-available-space.helper.spec.js.map +0 -1
- package/dist/utilities/libraries/grid-algorithms/closest-available-space/closest-available-space.helper.test.js.map +0 -1
- package/dist/utilities/libraries/grid-algorithms/path-finder/path-finder.js.map +0 -1
- package/dist/utilities/libraries/grid-algorithms/path-finder/path-finder.spec.js.map +0 -1
- package/dist/utilities/libraries/grid-algorithms/path-finder/path-finder.test.js.map +0 -1
- package/dist/utilities/libraries/grid-algorithms/position-to-grid-position-converter.js.map +0 -1
- package/dist/utilities/libraries/grid-algorithms/vector-field-path-finder/vector-field-path-finder.js.map +0 -1
- package/dist/utilities/libraries/grid-algorithms/vector-field-path-finder/vector-field-path-finder.spec.js.map +0 -1
- package/dist/utilities/libraries/grid-algorithms/vector-field-path-finder/vector-field-path-finder.test.js.map +0 -1
- package/dist/utilities/libraries/path-finder/path-finder.js.map +0 -1
- package/dist/utilities/libraries/path-finder/path-finder.spec.js.map +0 -1
- package/dist/utilities/services/keyboard/keyboard.js.map +0 -1
- package/dist/utilities/services/mouse/helpers/mouse-position.helper.js.map +0 -1
- package/dist/utilities/services/mouse/helpers/mouse-position.helper.test.js.map +0 -1
- package/dist/utilities/services/mouse/mouse-target-focus.service.js.map +0 -1
- package/dist/utilities/services/mouse/mouse.service.js.map +0 -1
- package/dist/utilities/services/mouse/mouser-target-focus.service.js.map +0 -1
- package/package.json.bak +0 -60
- package/scripts/prepare-package-json.ts +0 -23
- package/tsconfig.json +0 -24
- package/vitest.config.ts +0 -27
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const helpers_lib_1 = require("helpers-lib");
|
|
4
|
+
const vitest_1 = require("vitest");
|
|
5
|
+
const grid_1 = require("./grid");
|
|
6
|
+
(0, vitest_1.describe)('Grid', () => {
|
|
7
|
+
let grid;
|
|
8
|
+
(0, vitest_1.beforeEach)(() => {
|
|
9
|
+
grid = grid_1.Grid.createNew({ x: 3, y: 3 }, true);
|
|
10
|
+
});
|
|
11
|
+
(0, vitest_1.test)('should be defined', () => {
|
|
12
|
+
(0, vitest_1.expect)(grid).toBeDefined();
|
|
13
|
+
});
|
|
14
|
+
(0, vitest_1.test)('should set and get values', () => {
|
|
15
|
+
grid.setArea({ topLeft: { x: 0, y: 0 }, bottomRight: { x: 1, y: 1 } }, false);
|
|
16
|
+
(0, vitest_1.expect)(grid.get({ x: 0, y: 0 })).toBeFalsy();
|
|
17
|
+
(0, vitest_1.expect)(grid.get({ x: 0, y: 1 })).toBeFalsy();
|
|
18
|
+
(0, vitest_1.expect)(grid.get({ x: 1, y: 0 })).toBeFalsy();
|
|
19
|
+
(0, vitest_1.expect)(grid.get({ x: 1, y: 1 })).toBeFalsy();
|
|
20
|
+
});
|
|
21
|
+
(0, vitest_1.test)('should throw an error if area is outside of the grid', () => {
|
|
22
|
+
(0, vitest_1.expect)(() => grid.setArea({ topLeft: { x: 0, y: 0 }, bottomRight: { x: 3, y: 3 } }, false)).toThrow();
|
|
23
|
+
});
|
|
24
|
+
(0, vitest_1.test)('should crop area outside of the grid 1', () => {
|
|
25
|
+
(0, vitest_1.expect)(grid.cropPartsOutsideOfTheGrid({ topLeft: { x: -1, y: -1 }, bottomRight: { x: 3, y: 3 } })).toEqual({
|
|
26
|
+
topLeft: { x: 0, y: 0 },
|
|
27
|
+
bottomRight: { x: 2, y: 2 }
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
(0, vitest_1.test)('should crop area outside of the grid 2', () => {
|
|
31
|
+
(0, vitest_1.expect)(grid.cropPartsOutsideOfTheGrid({ topLeft: { x: 3, y: 3 }, bottomRight: { x: 4, y: 4 } })).toEqual({
|
|
32
|
+
topLeft: { x: 2, y: 2 },
|
|
33
|
+
bottomRight: { x: 2, y: 2 }
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
(0, vitest_1.test)('should crop area outside of the grid 2', () => {
|
|
37
|
+
(0, vitest_1.expect)(grid.cropPartsOutsideOfTheGrid({ topLeft: { x: -1, y: -1 }, bottomRight: { x: -1, y: -1 } })).toEqual({
|
|
38
|
+
topLeft: { x: 0, y: 0 },
|
|
39
|
+
bottomRight: { x: 0, y: 0 }
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
(0, vitest_1.test)('should check if area is within bounds', () => {
|
|
43
|
+
(0, vitest_1.expect)(grid.isAreaWithinBounds({ topLeft: { x: 0, y: 0 }, bottomRight: { x: 1, y: 1 } })).toBeTruthy();
|
|
44
|
+
(0, vitest_1.expect)(grid.isAreaWithinBounds({ topLeft: { x: 0, y: 0 }, bottomRight: { x: 3, y: 3 } })).toBeFalsy();
|
|
45
|
+
});
|
|
46
|
+
(0, vitest_1.test)('should check if point is within bounds', () => {
|
|
47
|
+
(0, vitest_1.expect)(grid.isPointWithinBounds({ x: 0, y: 0 })).toBeTruthy();
|
|
48
|
+
(0, vitest_1.expect)(grid.isPointWithinBounds({ x: 1, y: 1 })).toBeTruthy();
|
|
49
|
+
(0, vitest_1.expect)(grid.isPointWithinBounds({ x: 3, y: 3 })).toBeFalsy();
|
|
50
|
+
});
|
|
51
|
+
(0, vitest_1.test)('should set area within bounds', () => {
|
|
52
|
+
grid.safeSetArea({ topLeft: { x: 0, y: 0 }, bottomRight: { x: 3, y: 3 } }, false);
|
|
53
|
+
(0, vitest_1.expect)(grid.get({ x: 0, y: 0 })).toBeFalsy();
|
|
54
|
+
(0, vitest_1.expect)(grid.get({ x: 0, y: 1 })).toBeFalsy();
|
|
55
|
+
(0, vitest_1.expect)(grid.get({ x: 1, y: 0 })).toBeFalsy();
|
|
56
|
+
(0, vitest_1.expect)(grid.get({ x: 1, y: 1 })).toBeFalsy();
|
|
57
|
+
});
|
|
58
|
+
(0, vitest_1.test)('should return neighbor positions only adjacent', () => {
|
|
59
|
+
(0, vitest_1.expect)(grid.getNeighborPositions({ x: 1, y: 1 })).toEqual([
|
|
60
|
+
{ x: 0, y: 1 },
|
|
61
|
+
{ x: 1, y: 0 },
|
|
62
|
+
{ x: 1, y: 2 },
|
|
63
|
+
{ x: 2, y: 1 }
|
|
64
|
+
]);
|
|
65
|
+
});
|
|
66
|
+
(0, vitest_1.test)('should return neighbor positions with diagonals', () => {
|
|
67
|
+
(0, vitest_1.expect)(grid.getNeighborPositions({ x: 1, y: 1 }, { includeDiagonals: true })).toEqual([
|
|
68
|
+
{ x: 0, y: 1 },
|
|
69
|
+
{ x: 1, y: 0 },
|
|
70
|
+
{ x: 1, y: 2 },
|
|
71
|
+
{ x: 2, y: 1 },
|
|
72
|
+
{ x: 0, y: 0 },
|
|
73
|
+
{ x: 0, y: 2 },
|
|
74
|
+
{ x: 2, y: 0 },
|
|
75
|
+
{ x: 2, y: 2 }
|
|
76
|
+
]);
|
|
77
|
+
});
|
|
78
|
+
(0, vitest_1.test)('should return neighbor positions only adjacent at the edge', () => {
|
|
79
|
+
(0, vitest_1.expect)(grid.getNeighborPositions({ x: 2, y: 2 })).toEqual([
|
|
80
|
+
{ x: 1, y: 2 },
|
|
81
|
+
{ x: 2, y: 1 }
|
|
82
|
+
]);
|
|
83
|
+
});
|
|
84
|
+
(0, vitest_1.test)('should return neighbor positions at the edge with diagonals', () => {
|
|
85
|
+
(0, vitest_1.expect)(grid.getNeighborPositions({ x: 0, y: 0 }, { includeDiagonals: true })).toEqual([
|
|
86
|
+
{ x: 0, y: 1 },
|
|
87
|
+
{ x: 1, y: 0 },
|
|
88
|
+
{ x: 1, y: 1 }
|
|
89
|
+
]);
|
|
90
|
+
});
|
|
91
|
+
(0, vitest_1.test)('should iterate over all values', () => {
|
|
92
|
+
grid.setArea({ topLeft: { x: 1, y: 0 }, bottomRight: { x: 1, y: 1 } }, false);
|
|
93
|
+
let values = [];
|
|
94
|
+
grid.forEach((value, position) => values.push({ value, position }));
|
|
95
|
+
(0, vitest_1.expect)(values).toEqual([
|
|
96
|
+
{ value: true, position: { x: 0, y: 0 } },
|
|
97
|
+
{ value: false, position: { x: 1, y: 0 } },
|
|
98
|
+
{ value: true, position: { x: 2, y: 0 } },
|
|
99
|
+
{ value: true, position: { x: 0, y: 1 } },
|
|
100
|
+
{ value: false, position: { x: 1, y: 1 } },
|
|
101
|
+
{ value: true, position: { x: 2, y: 1 } },
|
|
102
|
+
{ value: true, position: { x: 0, y: 2 } },
|
|
103
|
+
{ value: true, position: { x: 1, y: 2 } },
|
|
104
|
+
{ value: true, position: { x: 2, y: 2 } }
|
|
105
|
+
]);
|
|
106
|
+
});
|
|
107
|
+
(0, vitest_1.test)('should map over all values', () => {
|
|
108
|
+
grid.setArea({ topLeft: { x: 1, y: 0 }, bottomRight: { x: 1, y: 1 } }, false);
|
|
109
|
+
let newGrid = grid.map((value, position) => (position.x + position.y) * (value ? 1 : -1));
|
|
110
|
+
(0, vitest_1.expect)(newGrid.get({ x: 0, y: 0 })).toBe(0);
|
|
111
|
+
(0, vitest_1.expect)(newGrid.get({ x: 1, y: 0 })).toBe(-1);
|
|
112
|
+
(0, vitest_1.expect)(newGrid.get({ x: 2, y: 0 })).toBe(2);
|
|
113
|
+
(0, vitest_1.expect)(newGrid.get({ x: 0, y: 1 })).toBe(1);
|
|
114
|
+
(0, vitest_1.expect)(newGrid.get({ x: 1, y: 1 })).toBe(-2);
|
|
115
|
+
(0, vitest_1.expect)(newGrid.get({ x: 2, y: 1 })).toBe(3);
|
|
116
|
+
(0, vitest_1.expect)(newGrid.get({ x: 0, y: 2 })).toBe(2);
|
|
117
|
+
(0, vitest_1.expect)(newGrid.get({ x: 1, y: 2 })).toBe(3);
|
|
118
|
+
(0, vitest_1.expect)(newGrid.get({ x: 2, y: 2 })).toBe(4);
|
|
119
|
+
(0, vitest_1.expect)(newGrid.size).toEqual({ x: 3, y: 3 });
|
|
120
|
+
});
|
|
121
|
+
(0, vitest_1.test)('should find the neighbor direction from a vector', () => {
|
|
122
|
+
(0, vitest_1.expect)(grid_1.Grid.vectorToNeighborDirection({ x: 0, y: 1 })).toEqual({ x: 0, y: 1 });
|
|
123
|
+
(0, vitest_1.expect)(grid_1.Grid.vectorToNeighborDirection({ x: 1, y: 0 })).toEqual({ x: 1, y: 0 });
|
|
124
|
+
(0, vitest_1.expect)(grid_1.Grid.vectorToNeighborDirection({ x: 0, y: -1 })).toEqual({ x: 0, y: -1 });
|
|
125
|
+
(0, vitest_1.expect)(grid_1.Grid.vectorToNeighborDirection({ x: -1, y: 0 })).toEqual({ x: -1, y: 0 });
|
|
126
|
+
(0, vitest_1.expect)(grid_1.Grid.vectorToNeighborDirection({ x: 0.5, y: 2 })).toEqual({ x: 0, y: 1 });
|
|
127
|
+
(0, vitest_1.expect)(grid_1.Grid.vectorToNeighborDirection({ x: 2, y: -0.5 })).toEqual({ x: 1, y: 0 });
|
|
128
|
+
(0, vitest_1.expect)(grid_1.Grid.vectorToNeighborDirection({ x: 0.5, y: -2 })).toEqual({ x: 0, y: -1 });
|
|
129
|
+
(0, vitest_1.expect)(grid_1.Grid.vectorToNeighborDirection({ x: -2, y: -0.5 })).toEqual({ x: -1, y: 0 });
|
|
130
|
+
let middle = grid_1.Grid.vectorToNeighborDirection({ x: 1, y: 1 });
|
|
131
|
+
(0, vitest_1.expect)(helpers_lib_1.Vector.isEqual(middle, { x: 0, y: 1 }) || helpers_lib_1.Vector.isEqual(middle, { x: 1, y: 0 })).toBeTruthy();
|
|
132
|
+
});
|
|
133
|
+
(0, vitest_1.test)('should find the neighbor direction with diagonals from a vector', () => {
|
|
134
|
+
(0, vitest_1.expect)(grid_1.Grid.vectorToNeighborDirection({ x: 0, y: 1 }, { includeDiagonals: true })).toEqual({ x: 0, y: 1 });
|
|
135
|
+
(0, vitest_1.expect)(grid_1.Grid.vectorToNeighborDirection({ x: 1, y: 1 }, { includeDiagonals: true })).toEqual({ x: 1, y: 1 });
|
|
136
|
+
(0, vitest_1.expect)(grid_1.Grid.vectorToNeighborDirection({ x: -1, y: -1 }, { includeDiagonals: true })).toEqual({ x: -1, y: -1 });
|
|
137
|
+
(0, vitest_1.expect)(grid_1.Grid.vectorToNeighborDirection({ x: 2, y: 1 }, { includeDiagonals: true })).toEqual({ x: 1, y: 0 });
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
//# sourceMappingURL=grid.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const vitest_1 = require("vitest");
|
|
4
|
+
const closest_available_space_helper_1 = require("./closest-available-space.helper");
|
|
5
|
+
const grid_1 = require("../../data-structures/grid/grid");
|
|
6
|
+
(0, vitest_1.describe)('findClosestAvailableSpace', () => {
|
|
7
|
+
let grid;
|
|
8
|
+
(0, vitest_1.beforeEach)(() => {
|
|
9
|
+
grid = grid_1.Grid.createNew({ x: 10, y: 10 }, true);
|
|
10
|
+
});
|
|
11
|
+
(0, vitest_1.test)('should return no change vector if the location is available', () => {
|
|
12
|
+
let boundingBox = { topLeft: { x: 50, y: 50 }, bottomRight: { x: 60, y: 60 } };
|
|
13
|
+
(0, vitest_1.expect)(closest_available_space_helper_1.ClosestAvailableSpaceHelper.findByConvertingGridSpace(grid, boundingBox, 10)).toEqual({ x: 0, y: 0 });
|
|
14
|
+
});
|
|
15
|
+
(0, vitest_1.test)('should support object positions outside of the world size', () => {
|
|
16
|
+
let boundingBox = { topLeft: { x: -5, y: -5 }, bottomRight: { x: 5, y: 5 } };
|
|
17
|
+
(0, vitest_1.expect)(closest_available_space_helper_1.ClosestAvailableSpaceHelper.findByConvertingGridSpace(grid, boundingBox, 10)).toEqual({ x: 5, y: 5 });
|
|
18
|
+
boundingBox = { topLeft: { x: -5, y: -5 }, bottomRight: { x: 15, y: 15 } };
|
|
19
|
+
(0, vitest_1.expect)(closest_available_space_helper_1.ClosestAvailableSpaceHelper.findByConvertingGridSpace(grid, boundingBox, 10)).toEqual({ x: 5, y: 5 });
|
|
20
|
+
boundingBox = { topLeft: { x: 95, y: 95 }, bottomRight: { x: 105, y: 105 } };
|
|
21
|
+
(0, vitest_1.expect)(closest_available_space_helper_1.ClosestAvailableSpaceHelper.findByConvertingGridSpace(grid, boundingBox, 10)).toEqual({ x: -5, y: -5 });
|
|
22
|
+
boundingBox = { topLeft: { x: 85, y: 85 }, bottomRight: { x: 105, y: 105 } };
|
|
23
|
+
(0, vitest_1.expect)(closest_available_space_helper_1.ClosestAvailableSpaceHelper.findByConvertingGridSpace(grid, boundingBox, 10)).toEqual({ x: -5, y: -5 });
|
|
24
|
+
});
|
|
25
|
+
(0, vitest_1.test)('should find the no change vector space next to an existing object', () => {
|
|
26
|
+
grid.setArea({ topLeft: { x: 0, y: 0 }, bottomRight: { x: 0, y: 0 } }, false);
|
|
27
|
+
let boundingBox = { topLeft: { x: 10, y: 10 }, bottomRight: { x: 20, y: 20 } };
|
|
28
|
+
(0, vitest_1.expect)(closest_available_space_helper_1.ClosestAvailableSpaceHelper.findByConvertingGridSpace(grid, boundingBox, 10)).toEqual({ x: 0, y: 0 });
|
|
29
|
+
});
|
|
30
|
+
(0, vitest_1.test)('should find the closest available space if trying to spawn in occupied space', () => {
|
|
31
|
+
grid.setArea({ topLeft: { x: 0, y: 0 }, bottomRight: { x: 1, y: 1 } }, false);
|
|
32
|
+
let boundingBox = { topLeft: { x: 5, y: 5 }, bottomRight: { x: 15, y: 15 } };
|
|
33
|
+
(0, vitest_1.expect)(closest_available_space_helper_1.ClosestAvailableSpaceHelper.findByConvertingGridSpace(grid, boundingBox, 10)).toEqual({ x: -5, y: 15 });
|
|
34
|
+
});
|
|
35
|
+
(0, vitest_1.test)('should find the closest available space if trying to spawn in crowded space', () => {
|
|
36
|
+
// Crowded space
|
|
37
|
+
// 0 1 2 3 4 5 6 7 8 9
|
|
38
|
+
// 0 □ 1 1 1 2 2 □ □ □ □
|
|
39
|
+
// 1 □ 1 1 1 2 2 □ □ □ □
|
|
40
|
+
// 2 □ 1 1 1 2 2 □ □ □ □
|
|
41
|
+
// 3 3 3 3 ■ ■ ■ □ □ □ □
|
|
42
|
+
// 4 □ □ □ ■ ■ ■ □ □ □ □
|
|
43
|
+
// 5 □ □ 4 ■ ■ ■ 6 6 6 □
|
|
44
|
+
// 6 □ □ 4 5 5 5 □ □ □ □
|
|
45
|
+
grid.setArea({ topLeft: { x: 1, y: 0 }, bottomRight: { x: 3, y: 2 } }, false); // 1
|
|
46
|
+
grid.setArea({ topLeft: { x: 4, y: 0 }, bottomRight: { x: 5, y: 2 } }, false); // 2
|
|
47
|
+
grid.setArea({ topLeft: { x: 0, y: 3 }, bottomRight: { x: 1, y: 3 } }, false); // 3
|
|
48
|
+
grid.setArea({ topLeft: { x: 2, y: 5 }, bottomRight: { x: 2, y: 6 } }, false); // 4
|
|
49
|
+
grid.setArea({ topLeft: { x: 3, y: 6 }, bottomRight: { x: 5, y: 6 } }, false); // 5
|
|
50
|
+
grid.setArea({ topLeft: { x: 6, y: 5 }, bottomRight: { x: 8, y: 5 } }, false); // 6
|
|
51
|
+
let boundingBox = { topLeft: { x: 10, y: 20 }, bottomRight: { x: 40, y: 50 } };
|
|
52
|
+
(0, vitest_1.expect)(closest_available_space_helper_1.ClosestAvailableSpaceHelper.findByConvertingGridSpace(grid, boundingBox, 10)).toEqual({ x: 20, y: 10 });
|
|
53
|
+
});
|
|
54
|
+
(0, vitest_1.test)('should not fooled by initial position occupying more space in grid and find narrower gap 1', () => {
|
|
55
|
+
grid.setArea({ topLeft: { x: 1, y: 0 }, bottomRight: { x: 4, y: 3 } }, false);
|
|
56
|
+
let boundingBox = { topLeft: { x: 4, y: 2 }, bottomRight: { x: 12, y: 20 } };
|
|
57
|
+
(0, vitest_1.expect)(closest_available_space_helper_1.ClosestAvailableSpaceHelper.findByConvertingGridSpace(grid, boundingBox, 10)).toEqual({ x: -3, y: -1 });
|
|
58
|
+
});
|
|
59
|
+
(0, vitest_1.test)('should not fooled by initial position occupying more space in grid and find narrower gap 2', () => {
|
|
60
|
+
grid.setArea({ topLeft: { x: 1, y: 0 }, bottomRight: { x: 4, y: 3 } }, false);
|
|
61
|
+
let boundingBox = { topLeft: { x: -6, y: -8 }, bottomRight: { x: 2, y: 10 } };
|
|
62
|
+
(0, vitest_1.expect)(closest_available_space_helper_1.ClosestAvailableSpaceHelper.findByConvertingGridSpace(grid, boundingBox, 10)).toEqual({ x: 7, y: 9 });
|
|
63
|
+
});
|
|
64
|
+
(0, vitest_1.test)('should return undefined if there is no available space', () => {
|
|
65
|
+
grid.setArea({ topLeft: { x: 0, y: 0 }, bottomRight: { x: 9, y: 9 } }, false);
|
|
66
|
+
let boundingBox = { topLeft: { x: 0, y: 0 }, bottomRight: { x: 10, y: 10 } };
|
|
67
|
+
(0, vitest_1.expect)(closest_available_space_helper_1.ClosestAvailableSpaceHelper.findByConvertingGridSpace(grid, boundingBox, 10)).toBeUndefined();
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
//# sourceMappingURL=closest-available-space.helper.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const vitest_1 = require("vitest");
|
|
4
|
+
const grid_1 = require("../../data-structures/grid/grid");
|
|
5
|
+
const path_finder_1 = require("./path-finder");
|
|
6
|
+
(0, vitest_1.describe)('PATH_FINDER', () => {
|
|
7
|
+
(0, vitest_1.test)('basic 1', () => {
|
|
8
|
+
let grid = grid_1.Grid.createByValues([[true]]);
|
|
9
|
+
let result = path_finder_1.PathFinder.findPath(grid, { x: 0, y: 0 }, { x: 0, y: 0 }, { includeDiagonals: true });
|
|
10
|
+
(0, vitest_1.expect)(result).toEqual({ directPathAvailable: true, path: [{ x: 0, y: 0 }] });
|
|
11
|
+
});
|
|
12
|
+
(0, vitest_1.test)('basic 2', () => {
|
|
13
|
+
let grid = grid_1.Grid.createByValues([[false]]);
|
|
14
|
+
let result = path_finder_1.PathFinder.findPath(grid, { x: 0, y: 0 }, { x: 0, y: 0 }, { includeDiagonals: true });
|
|
15
|
+
(0, vitest_1.expect)(result).toEqual({ directPathAvailable: true, path: [{ x: 0, y: 0 }] });
|
|
16
|
+
});
|
|
17
|
+
(0, vitest_1.test)('should give the shortest path without diagonals', () => {
|
|
18
|
+
let grid = grid_1.Grid.createByValues([
|
|
19
|
+
[true, true, true, true],
|
|
20
|
+
[true, false, false, true],
|
|
21
|
+
[true, false, false, true],
|
|
22
|
+
[true, false, false, true]
|
|
23
|
+
]);
|
|
24
|
+
let result = path_finder_1.PathFinder.findPath(grid, { x: 0, y: 0 }, { x: 3, y: 3 }, { includeDiagonals: false });
|
|
25
|
+
(0, vitest_1.expect)(result).toEqual({
|
|
26
|
+
directPathAvailable: true,
|
|
27
|
+
path: [
|
|
28
|
+
{ x: 0, y: 0 },
|
|
29
|
+
{ x: 1, y: 0 },
|
|
30
|
+
{ x: 2, y: 0 },
|
|
31
|
+
{ x: 3, y: 0 },
|
|
32
|
+
{ x: 3, y: 1 },
|
|
33
|
+
{ x: 3, y: 2 },
|
|
34
|
+
{ x: 3, y: 3 }
|
|
35
|
+
]
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
(0, vitest_1.test)('should give the shortest path 1', () => {
|
|
39
|
+
let grid = grid_1.Grid.createByValues([
|
|
40
|
+
[true, true, true, true],
|
|
41
|
+
[true, false, false, true],
|
|
42
|
+
[true, false, false, true],
|
|
43
|
+
[true, false, false, true]
|
|
44
|
+
]);
|
|
45
|
+
let result = path_finder_1.PathFinder.findPath(grid, { x: 0, y: 0 }, { x: 3, y: 3 }, { includeDiagonals: true });
|
|
46
|
+
(0, vitest_1.expect)(result).toEqual({
|
|
47
|
+
directPathAvailable: true,
|
|
48
|
+
path: [
|
|
49
|
+
{ x: 0, y: 0 },
|
|
50
|
+
{ x: 1, y: 0 },
|
|
51
|
+
{ x: 2, y: 0 },
|
|
52
|
+
{ x: 3, y: 1 },
|
|
53
|
+
{ x: 3, y: 2 },
|
|
54
|
+
{ x: 3, y: 3 }
|
|
55
|
+
]
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
(0, vitest_1.test)('should give the shortest path 2', () => {
|
|
59
|
+
let grid = grid_1.Grid.createByValues([
|
|
60
|
+
[true, true, true, false],
|
|
61
|
+
[true, false, false, false],
|
|
62
|
+
[true, true, false, true],
|
|
63
|
+
[true, false, true, true]
|
|
64
|
+
]);
|
|
65
|
+
let result = path_finder_1.PathFinder.findPath(grid, { x: 0, y: 0 }, { x: 3, y: 3 }, { includeDiagonals: true });
|
|
66
|
+
(0, vitest_1.expect)(result).toEqual({
|
|
67
|
+
directPathAvailable: true,
|
|
68
|
+
path: [
|
|
69
|
+
{ x: 0, y: 0 },
|
|
70
|
+
{ x: 0, y: 1 },
|
|
71
|
+
{ x: 1, y: 2 },
|
|
72
|
+
{ x: 2, y: 3 },
|
|
73
|
+
{ x: 3, y: 3 }
|
|
74
|
+
]
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
(0, vitest_1.test)('should give the shortest path 3', () => {
|
|
78
|
+
let grid = grid_1.Grid.createByValues([
|
|
79
|
+
[true, false, false, true, false],
|
|
80
|
+
[true, false, true, false, true],
|
|
81
|
+
[true, false, true, false, true],
|
|
82
|
+
[false, true, false, false, true]
|
|
83
|
+
]);
|
|
84
|
+
let result = path_finder_1.PathFinder.findPath(grid, { x: 0, y: 0 }, { x: 4, y: 3 }, { includeDiagonals: true });
|
|
85
|
+
(0, vitest_1.expect)(result).toEqual({
|
|
86
|
+
directPathAvailable: true,
|
|
87
|
+
path: [
|
|
88
|
+
{ x: 0, y: 0 },
|
|
89
|
+
{ x: 0, y: 1 },
|
|
90
|
+
{ x: 0, y: 2 },
|
|
91
|
+
{ x: 1, y: 3 },
|
|
92
|
+
{ x: 2, y: 2 },
|
|
93
|
+
{ x: 2, y: 1 },
|
|
94
|
+
{ x: 3, y: 0 },
|
|
95
|
+
{ x: 4, y: 1 },
|
|
96
|
+
{ x: 4, y: 2 },
|
|
97
|
+
{ x: 4, y: 3 }
|
|
98
|
+
]
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
(0, vitest_1.test)('should give the shortest path backwards 3', () => {
|
|
102
|
+
let grid = grid_1.Grid.createByValues([
|
|
103
|
+
[true, false, false, true, false],
|
|
104
|
+
[true, false, true, false, true],
|
|
105
|
+
[true, false, true, false, true],
|
|
106
|
+
[false, true, false, false, true]
|
|
107
|
+
]);
|
|
108
|
+
let result = path_finder_1.PathFinder.findPath(grid, { x: 4, y: 3 }, { x: 0, y: 0 }, { includeDiagonals: true });
|
|
109
|
+
(0, vitest_1.expect)(result).toEqual({
|
|
110
|
+
directPathAvailable: true,
|
|
111
|
+
path: [
|
|
112
|
+
{ x: 4, y: 3 },
|
|
113
|
+
{ x: 4, y: 2 },
|
|
114
|
+
{ x: 4, y: 1 },
|
|
115
|
+
{ x: 3, y: 0 },
|
|
116
|
+
{ x: 2, y: 1 },
|
|
117
|
+
{ x: 2, y: 2 },
|
|
118
|
+
{ x: 1, y: 3 },
|
|
119
|
+
{ x: 0, y: 2 },
|
|
120
|
+
{ x: 0, y: 1 },
|
|
121
|
+
{ x: 0, y: 0 }
|
|
122
|
+
]
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
(0, vitest_1.test)('should give the shortest path to closest position', () => {
|
|
126
|
+
let grid = grid_1.Grid.createByValues([
|
|
127
|
+
[true, true, true, false],
|
|
128
|
+
[true, false, false, false],
|
|
129
|
+
[true, false, false, false],
|
|
130
|
+
[true, true, false, true]
|
|
131
|
+
]);
|
|
132
|
+
let result = path_finder_1.PathFinder.findPath(grid, { x: 0, y: 0 }, { x: 3, y: 3 }, { includeDiagonals: true });
|
|
133
|
+
(0, vitest_1.expect)(result).toEqual({
|
|
134
|
+
directPathAvailable: false,
|
|
135
|
+
path: [
|
|
136
|
+
{ x: 0, y: 0 },
|
|
137
|
+
{ x: 0, y: 1 },
|
|
138
|
+
{ x: 0, y: 2 },
|
|
139
|
+
{ x: 1, y: 3 }
|
|
140
|
+
]
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
/*
|
|
144
|
+
test('stress test', () => {
|
|
145
|
+
let size = 800;
|
|
146
|
+
let centerPos = { x: Math.floor(size / 2), y: Math.floor(size / 2) };
|
|
147
|
+
|
|
148
|
+
let bigGrid = Grid.createNew({ x: size, y: size }, true);
|
|
149
|
+
for (let x = 0; x < size; x++) {
|
|
150
|
+
for (let y = 0; y < size; y++) {
|
|
151
|
+
if (Vector.getDistance(centerPos, { x, y }) < size / 4) {
|
|
152
|
+
bigGrid.set({ x, y }, false);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
let start = new Date();
|
|
158
|
+
PathFinder.findPath(bigGrid, { x: 0, y: 0 }, { x: size - 1, y: size - 1 }, { includeDiagonals: true });
|
|
159
|
+
let end = new Date();
|
|
160
|
+
|
|
161
|
+
console.info(end.getTime() - start.getTime());
|
|
162
|
+
});*/
|
|
163
|
+
});
|
|
164
|
+
//# sourceMappingURL=path-finder.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const vitest_1 = require("vitest");
|
|
4
|
+
const helpers_lib_1 = require("helpers-lib");
|
|
5
|
+
const grid_1 = require("../../data-structures/grid/grid");
|
|
6
|
+
const vector_field_path_finder_1 = require("./vector-field-path-finder");
|
|
7
|
+
(0, vitest_1.describe)('VectorFieldPathFinder', () => {
|
|
8
|
+
(0, vitest_1.describe)('weight grid', () => {
|
|
9
|
+
(0, vitest_1.test)('basic 1', () => {
|
|
10
|
+
let targetArea = { topLeft: { x: 0, y: 0 }, bottomRight: { x: 0, y: 0 } };
|
|
11
|
+
let availabilityGrid = grid_1.Grid.createNew({ x: 1, y: 1 }, true);
|
|
12
|
+
let pathFinder = new vector_field_path_finder_1.VectorFieldPathFinder(targetArea, availabilityGrid);
|
|
13
|
+
(0, vitest_1.expect)(pathFinder['weightGrid'].get({ x: 0, y: 0 })).toBe(0);
|
|
14
|
+
});
|
|
15
|
+
(0, vitest_1.test)('basic 2', () => {
|
|
16
|
+
let targetArea = { topLeft: { x: 0, y: 0 }, bottomRight: { x: 1, y: 1 } };
|
|
17
|
+
let availabilityGrid = grid_1.Grid.createByValues([
|
|
18
|
+
[true, true],
|
|
19
|
+
[true, true]
|
|
20
|
+
]);
|
|
21
|
+
let pathFinder = new vector_field_path_finder_1.VectorFieldPathFinder(targetArea, availabilityGrid);
|
|
22
|
+
(0, vitest_1.expect)(pathFinder['weightGrid'].get({ x: 0, y: 0 })).toBe(0);
|
|
23
|
+
(0, vitest_1.expect)(pathFinder['weightGrid'].get({ x: 1, y: 0 })).toBe(0);
|
|
24
|
+
(0, vitest_1.expect)(pathFinder['weightGrid'].get({ x: 0, y: 1 })).toBe(0);
|
|
25
|
+
(0, vitest_1.expect)(pathFinder['weightGrid'].get({ x: 1, y: 1 })).toBe(0);
|
|
26
|
+
});
|
|
27
|
+
(0, vitest_1.test)('sample 1', () => {
|
|
28
|
+
let targetArea = { topLeft: { x: 0, y: 0 }, bottomRight: { x: 0, y: 0 } };
|
|
29
|
+
let availabilityGrid = grid_1.Grid.createByValues([
|
|
30
|
+
[true, true],
|
|
31
|
+
[true, true]
|
|
32
|
+
]);
|
|
33
|
+
let pathFinder = new vector_field_path_finder_1.VectorFieldPathFinder(targetArea, availabilityGrid);
|
|
34
|
+
(0, vitest_1.expect)(pathFinder['weightGrid'].get({ x: 0, y: 0 })).toBe(0);
|
|
35
|
+
(0, vitest_1.expect)(pathFinder['weightGrid'].get({ x: 1, y: 0 })).toBe(10);
|
|
36
|
+
(0, vitest_1.expect)(pathFinder['weightGrid'].get({ x: 0, y: 1 })).toBe(10);
|
|
37
|
+
(0, vitest_1.expect)(pathFinder['weightGrid'].get({ x: 1, y: 1 })).toBe(14);
|
|
38
|
+
});
|
|
39
|
+
(0, vitest_1.test)('sample 2', () => {
|
|
40
|
+
let targetArea = { topLeft: { x: 0, y: 0 }, bottomRight: { x: 1, y: 1 } };
|
|
41
|
+
let availabilityGrid = grid_1.Grid.createNew({ x: 3, y: 3 }, true);
|
|
42
|
+
let pathFinder = new vector_field_path_finder_1.VectorFieldPathFinder(targetArea, availabilityGrid);
|
|
43
|
+
(0, vitest_1.expect)(pathFinder['weightGrid']['_grid']).toEqual([
|
|
44
|
+
[0, 0, 10],
|
|
45
|
+
[0, 0, 10],
|
|
46
|
+
[10, 10, 14]
|
|
47
|
+
]);
|
|
48
|
+
});
|
|
49
|
+
(0, vitest_1.test)('sample 3', () => {
|
|
50
|
+
let targetArea = { topLeft: { x: 1, y: 1 }, bottomRight: { x: 2, y: 2 } };
|
|
51
|
+
let availabilityGrid = grid_1.Grid.createNew({ x: 3, y: 3 }, true);
|
|
52
|
+
let pathFinder = new vector_field_path_finder_1.VectorFieldPathFinder(targetArea, availabilityGrid);
|
|
53
|
+
(0, vitest_1.expect)(pathFinder['weightGrid']['_grid']).toEqual([
|
|
54
|
+
[14, 10, 10],
|
|
55
|
+
[10, 0, 0],
|
|
56
|
+
[10, 0, 0]
|
|
57
|
+
]);
|
|
58
|
+
});
|
|
59
|
+
(0, vitest_1.test)('complex 1', () => {
|
|
60
|
+
let targetArea = { topLeft: { x: 0, y: 0 }, bottomRight: { x: 0, y: 0 } };
|
|
61
|
+
let availabilityGrid = grid_1.Grid.createByValues([
|
|
62
|
+
[true, false, true],
|
|
63
|
+
[true, true, true],
|
|
64
|
+
[false, false, true],
|
|
65
|
+
[false, false, true]
|
|
66
|
+
]);
|
|
67
|
+
let pathFinder = new vector_field_path_finder_1.VectorFieldPathFinder(targetArea, availabilityGrid);
|
|
68
|
+
let h = pathFinder['getHighestWeight'](availabilityGrid.size);
|
|
69
|
+
(0, vitest_1.expect)(pathFinder['weightGrid']['_grid']).toEqual([
|
|
70
|
+
[0, h, 28],
|
|
71
|
+
[10, 14, 24],
|
|
72
|
+
[h, h, 28],
|
|
73
|
+
[h, h, 38]
|
|
74
|
+
]);
|
|
75
|
+
});
|
|
76
|
+
(0, vitest_1.test)('complex 2', () => {
|
|
77
|
+
let targetArea = { topLeft: { x: 0, y: 0 }, bottomRight: { x: 1, y: 1 } };
|
|
78
|
+
let availabilityGrid = grid_1.Grid.createByValues([
|
|
79
|
+
[true, true, false, true],
|
|
80
|
+
[true, true, false, true],
|
|
81
|
+
[false, false, true, true]
|
|
82
|
+
]);
|
|
83
|
+
let pathFinder = new vector_field_path_finder_1.VectorFieldPathFinder(targetArea, availabilityGrid);
|
|
84
|
+
let h = pathFinder['getHighestWeight'](availabilityGrid.size);
|
|
85
|
+
(0, vitest_1.expect)(pathFinder['weightGrid']['_grid']).toEqual([
|
|
86
|
+
[0, 0, h, 38],
|
|
87
|
+
[0, 0, h, 28],
|
|
88
|
+
[h, h, 14, 24]
|
|
89
|
+
]);
|
|
90
|
+
});
|
|
91
|
+
(0, vitest_1.test)('complex 3', () => {
|
|
92
|
+
let targetArea = { topLeft: { x: 2, y: 2 }, bottomRight: { x: 3, y: 3 } };
|
|
93
|
+
let availabilityGrid = grid_1.Grid.createByValues([
|
|
94
|
+
[true, true, false, true],
|
|
95
|
+
[true, true, false, true],
|
|
96
|
+
[false, false, true, true],
|
|
97
|
+
[false, false, true, true]
|
|
98
|
+
]);
|
|
99
|
+
let pathFinder = new vector_field_path_finder_1.VectorFieldPathFinder(targetArea, availabilityGrid);
|
|
100
|
+
let h = pathFinder['getHighestWeight'](availabilityGrid.size);
|
|
101
|
+
(0, vitest_1.expect)(pathFinder['weightGrid']['_grid']).toEqual([
|
|
102
|
+
[28, 24, h, 20],
|
|
103
|
+
[24, 14, h, 10],
|
|
104
|
+
[h, h, 0, 0],
|
|
105
|
+
[h, h, 0, 0]
|
|
106
|
+
]);
|
|
107
|
+
});
|
|
108
|
+
(0, vitest_1.test)('unreachable area 1', () => {
|
|
109
|
+
let targetArea = { topLeft: { x: 0, y: 0 }, bottomRight: { x: 0, y: 0 } };
|
|
110
|
+
let availabilityGrid = grid_1.Grid.createByValues([
|
|
111
|
+
[true, false, true, false, true],
|
|
112
|
+
[true, false, true, false, true],
|
|
113
|
+
[true, false, false, false, true],
|
|
114
|
+
[true, false, false, false, true],
|
|
115
|
+
[true, true, true, true, true]
|
|
116
|
+
]);
|
|
117
|
+
let pathFinder = new vector_field_path_finder_1.VectorFieldPathFinder(targetArea, availabilityGrid);
|
|
118
|
+
let h = pathFinder['getHighestWeight'](availabilityGrid.size);
|
|
119
|
+
(0, vitest_1.expect)(pathFinder['weightGrid']['_grid']).toEqual([
|
|
120
|
+
[0, h, h, h, 108],
|
|
121
|
+
[10, h, h, h, 98],
|
|
122
|
+
[20, h, h, h, 88],
|
|
123
|
+
[30, h, h, h, 78],
|
|
124
|
+
[40, 44, 54, 64, 74]
|
|
125
|
+
]);
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
(0, vitest_1.describe)('getDirectionToTarget', () => {
|
|
129
|
+
(0, vitest_1.test)('sample 1', () => {
|
|
130
|
+
let targetArea = { topLeft: { x: 0, y: 0 }, bottomRight: { x: 0, y: 0 } };
|
|
131
|
+
let availabilityGrid = grid_1.Grid.createByValues([
|
|
132
|
+
[true, true],
|
|
133
|
+
[true, true]
|
|
134
|
+
]);
|
|
135
|
+
let pathFinder = new vector_field_path_finder_1.VectorFieldPathFinder(targetArea, availabilityGrid);
|
|
136
|
+
(0, vitest_1.expect)(pathFinder.getDirectionToTarget({ x: 1, y: 1 })).toEqual(-helpers_lib_1.Radian.get45);
|
|
137
|
+
});
|
|
138
|
+
(0, vitest_1.test)('sample 2', () => {
|
|
139
|
+
let targetArea = { topLeft: { x: 0, y: 0 }, bottomRight: { x: 0, y: 0 } };
|
|
140
|
+
let availabilityGrid = grid_1.Grid.createByValues([
|
|
141
|
+
[true, true, true],
|
|
142
|
+
[false, true, true]
|
|
143
|
+
]);
|
|
144
|
+
let pathFinder = new vector_field_path_finder_1.VectorFieldPathFinder(targetArea, availabilityGrid);
|
|
145
|
+
(0, vitest_1.expect)(pathFinder.getDirectionToTarget({ x: 2, y: 1 })).toEqual(helpers_lib_1.Radian.vectorToRadian({ x: -2, y: -1 }));
|
|
146
|
+
});
|
|
147
|
+
(0, vitest_1.test)('sample 3', () => {
|
|
148
|
+
let targetArea = { topLeft: { x: 0, y: 0 }, bottomRight: { x: 0, y: 0 } };
|
|
149
|
+
let availabilityGrid = grid_1.Grid.createByValues([
|
|
150
|
+
[true, false, true],
|
|
151
|
+
[true, false, true],
|
|
152
|
+
[true, true, true]
|
|
153
|
+
]);
|
|
154
|
+
let pathFinder = new vector_field_path_finder_1.VectorFieldPathFinder(targetArea, availabilityGrid);
|
|
155
|
+
(0, vitest_1.expect)(pathFinder.getDirectionToTarget({ x: 2, y: 0 })).toEqual(helpers_lib_1.Radian.get180);
|
|
156
|
+
});
|
|
157
|
+
(0, vitest_1.test)('sample 4', () => {
|
|
158
|
+
let targetArea = { topLeft: { x: 0, y: 0 }, bottomRight: { x: 0, y: 0 } };
|
|
159
|
+
let availabilityGrid = grid_1.Grid.createByValues([
|
|
160
|
+
[true, false, false],
|
|
161
|
+
[true, false, false]
|
|
162
|
+
]);
|
|
163
|
+
let pathFinder = new vector_field_path_finder_1.VectorFieldPathFinder(targetArea, availabilityGrid);
|
|
164
|
+
(0, vitest_1.expect)(pathFinder.getDirectionToTarget({ x: 2, y: 0 })).toBeUndefined();
|
|
165
|
+
});
|
|
166
|
+
});
|
|
167
|
+
(0, vitest_1.describe)('edge cases', () => {
|
|
168
|
+
(0, vitest_1.test)('should create an instance', () => {
|
|
169
|
+
let targetArea = { topLeft: { x: 0, y: 0 }, bottomRight: { x: 0, y: 0 } };
|
|
170
|
+
let availabilityGrid = grid_1.Grid.createNew({ x: 1, y: 1 }, true);
|
|
171
|
+
(0, vitest_1.expect)(new vector_field_path_finder_1.VectorFieldPathFinder(targetArea, availabilityGrid)).toBeTruthy();
|
|
172
|
+
});
|
|
173
|
+
(0, vitest_1.test)('should activate unavailable target cells of the target area', () => {
|
|
174
|
+
let targetArea = { topLeft: { x: 0, y: 0 }, bottomRight: { x: 0, y: 0 } };
|
|
175
|
+
let availabilityGrid = grid_1.Grid.createNew({ x: 1, y: 1 }, false);
|
|
176
|
+
let pathFinder = new vector_field_path_finder_1.VectorFieldPathFinder(targetArea, availabilityGrid);
|
|
177
|
+
(0, vitest_1.expect)(pathFinder['weightGrid'].get({ x: 0, y: 0 })).toBe(0);
|
|
178
|
+
});
|
|
179
|
+
(0, vitest_1.test)('should select closest grid cells if the target is outside of the grid', () => {
|
|
180
|
+
let targetArea = { topLeft: { x: 3, y: -1 }, bottomRight: { x: 3, y: 1 } };
|
|
181
|
+
let availabilityGrid = grid_1.Grid.createNew({ x: 3, y: 3 }, true);
|
|
182
|
+
let pathFinder = new vector_field_path_finder_1.VectorFieldPathFinder(targetArea, availabilityGrid);
|
|
183
|
+
(0, vitest_1.expect)(pathFinder['weightGrid']['_grid']).toEqual([
|
|
184
|
+
[20, 10, 0],
|
|
185
|
+
[20, 10, 0],
|
|
186
|
+
[24, 14, 10]
|
|
187
|
+
]);
|
|
188
|
+
});
|
|
189
|
+
(0, vitest_1.test)('should return undefined if starting position and its neighbors are unreachable', () => {
|
|
190
|
+
let targetArea = { topLeft: { x: 0, y: 0 }, bottomRight: { x: 0, y: 0 } };
|
|
191
|
+
let availabilityGrid = grid_1.Grid.createByValues([
|
|
192
|
+
[true, false, false],
|
|
193
|
+
[true, false, false]
|
|
194
|
+
]);
|
|
195
|
+
let pathFinder = new vector_field_path_finder_1.VectorFieldPathFinder(targetArea, availabilityGrid);
|
|
196
|
+
(0, vitest_1.expect)(pathFinder.getDirectionToTarget({ x: 2, y: 1 })).toBeUndefined();
|
|
197
|
+
});
|
|
198
|
+
(0, vitest_1.test)('should find the direction if starting position is unreachable but there is a reachable neighbor', () => {
|
|
199
|
+
let targetArea = { topLeft: { x: 0, y: 0 }, bottomRight: { x: 0, y: 0 } };
|
|
200
|
+
let availabilityGrid = grid_1.Grid.createByValues([
|
|
201
|
+
[true, true, false],
|
|
202
|
+
[true, false, false]
|
|
203
|
+
]);
|
|
204
|
+
let pathFinder = new vector_field_path_finder_1.VectorFieldPathFinder(targetArea, availabilityGrid);
|
|
205
|
+
(0, vitest_1.expect)(pathFinder.getDirectionToTarget({ x: 2, y: 1 })).toEqual(-helpers_lib_1.Radian.get45);
|
|
206
|
+
});
|
|
207
|
+
(0, vitest_1.test)('should return undefined if starting point is inside target area', () => {
|
|
208
|
+
let targetArea = { topLeft: { x: 0, y: 0 }, bottomRight: { x: 1, y: 1 } };
|
|
209
|
+
let availabilityGrid = grid_1.Grid.createNew({ x: 2, y: 2 }, true);
|
|
210
|
+
let pathFinder = new vector_field_path_finder_1.VectorFieldPathFinder(targetArea, availabilityGrid);
|
|
211
|
+
(0, vitest_1.expect)(pathFinder.getDirectionToTarget({ x: 0, y: 0 })).toBeUndefined();
|
|
212
|
+
});
|
|
213
|
+
(0, vitest_1.test)('should return closest cell result if starting point is outside of the grid', () => {
|
|
214
|
+
let targetArea = { topLeft: { x: 0, y: 0 }, bottomRight: { x: 0, y: 0 } };
|
|
215
|
+
let availabilityGrid = grid_1.Grid.createNew({ x: 2, y: 1 }, true);
|
|
216
|
+
let pathFinder = new vector_field_path_finder_1.VectorFieldPathFinder(targetArea, availabilityGrid);
|
|
217
|
+
(0, vitest_1.expect)(pathFinder.getDirectionToTarget({ x: 2, y: 0 })).toEqual(-helpers_lib_1.Radian.get90);
|
|
218
|
+
});
|
|
219
|
+
(0, vitest_1.test)('if average direction is pointing blocked path, it should pick random available direction', () => {
|
|
220
|
+
let targetArea = { topLeft: { x: 0, y: 0 }, bottomRight: { x: 0, y: 0 } };
|
|
221
|
+
let availabilityGrid = grid_1.Grid.createByValues([
|
|
222
|
+
[true, true, true],
|
|
223
|
+
[true, false, true],
|
|
224
|
+
[true, true, true]
|
|
225
|
+
]);
|
|
226
|
+
let pathFinder = new vector_field_path_finder_1.VectorFieldPathFinder(targetArea, availabilityGrid);
|
|
227
|
+
let result = pathFinder.getDirectionToTarget({ x: 2, y: 2 });
|
|
228
|
+
(0, vitest_1.expect)(result === -helpers_lib_1.Radian.get90 || result === 0).toBeTruthy();
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
});
|
|
232
|
+
//# sourceMappingURL=vector-field-path-finder.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|