The shadow-box-model package

[maintain]

For discretized 2d collision detection, a binary array is a nice world model.


[Skip to ReadMe]

Properties

Version0.1.0
Dependenciesbase (==4.*), bitwise [details]
LicenseBSD3
AuthorScott Murphy <scottmurphy09@gmail.com>
MaintainerScott Murphy <scottmurphy09@gmail.com>
CategoryBits, Images, UI
Source repositoryhead: git clone https://github.com/plow-technologies/shadow-box-model.git
UploadedFri May 13 07:38:25 UTC 2016 by scottmurphy09

Modules

[Index]

Downloads

Maintainers' corner

For package maintainers and hackage trustees

Readme for shadow-box-model-0.1.0

shadow-box-model

shadow box is a tool for 2d collission detection on rectangular grids.

Installation

shadow-box-model can be installed with cabal install or cabal install --ghcjs

Usage

>>> either (fail) (putStrLn. showWorld) $ addModelToWorld 7 7 (shadowRect 3 3) (emptyWorld 10 10)
 _  _  _  _  _  _  _  _  _  _ 
 _  _  _  _  _  _  _  _  _  _ 
 _  _  _  _  _  _  _  _  _  _ 
 _  _  _  _  _  _  _  _  _  _ 
 _  _  _  _  _  _  _  _  _  _ 
 _  _  _  _  _  _  _  _  _  _ 
 _  _  _  _  _  _  _  _  _  _ 
 _  _  _  _  _  _  _  X  X  X 
 _  _  _  _  _  _  _  X  X  X 
 _  _  _  _  _  _  _  X  X  X 

>>> let (Right world1) = addModelToWorld 7 7 (shadowRect 3 3) (emptyWorld 10 10)

>>> let (Right world2) = addModelToWorld 1 1 (shadowRect 3 3) world1


>>> putStrLn . showWorld $ world2
 _  _  _  _  _  _  _  _  _  _ 
 _  X  X  X  _  _  _  _  _  _ 
 _  X  X  X  _  _  _  _  _  _ 
 _  X  X  X  _  _  _  _  _  _ 
 _  _  _  _  _  _  _  _  _  _ 
 _  _  _  _  _  _  _  _  _  _ 
 _  _  _  _  _  _  _  _  _  _ 
 _  _  _  _  _  _  _  X  X  X 
 _  _  _  _  _  _  _  X  X  X 
 _  _  _  _  _  _  _  X  X  X 

Also, the tests show nice use cases

How to run tests

cabal configure --enable-tests && cabal build && cabal test