Merge remote-tracking branch 'origin/Mapping' into tessallation

Conflicts:
	src/Map/Graphics.hs
This commit is contained in:
Nicole Dresselhaus 2014-04-21 15:11:41 +02:00
commit 85e1fe6325
3 changed files with 28 additions and 5 deletions

14
src/Map/Maps.hs Normal file
View File

@ -0,0 +1,14 @@
module Map.Maps
where
import Map.Types
-- potentially to be expanded to Nodes
giveNeighbours :: (Int, Int) -> [(Int,Int)]
giveNeighbours (x,y) = filter (not . negative) all
where
all = if even y then [(x+1,y), (x-1,y), (x,y+1), (x,y-1), (x+1,y+1), (x+1,y-1)]
else [(x+1,y), (x-1,y), (x,y+1), (x,y-1), (x-1,y+1), (x-1,y-1)]
negative :: (Int, Int) -> Bool
negative (x,y) = x < 0 || y < 0

View File

@ -4,7 +4,16 @@ where
import Map.Types import Map.Types
import Data.Array import Data.Array
gauss2Dgeneral :: Floating q => q -> q -> q -> q -> q -> q -> q -> q -- general 2D-Gaussian
gauss2Dgeneral :: Floating q =>
q -- ^ Amplitude
-> q -- ^ Origin on X-Achsis
-> q -- ^ Origin on Y-Achsis
-> q -- ^ Sigma on X
-> q -- ^ Sigma on Y
-> q -- ^ Coordinate in question on X
-> q -- ^ Coordinate in question on Y
-> q -- ^ elevation on coordinate in question
gauss2Dgeneral amp x0 y0 sX sY x y = amp * exp(-(((x-x0)^2/(2 * sX^2))+((y-y0)^2/(2 * sY^2)))) gauss2Dgeneral amp x0 y0 sX sY x y = amp * exp(-(((x-x0)^2/(2 * sX^2))+((y-y0)^2/(2 * sY^2))))
gauss2D :: Floating q => q -> q -> q gauss2D :: Floating q => q -> q -> q

View File

@ -22,10 +22,10 @@ instance Show PlayerInfo where
show (NoPlayer) = "not occupied" show (NoPlayer) = "not occupied"
show (Occupied i) = "occupied by player " ++ (show i) show (Occupied i) = "occupied by player " ++ (show i)
-- | Path info, is this node part of a path? -- | Path info, is this node part of a path and if so, where does it lead?
data PathInfo = NoPath data PathInfo = NoPath
| Path
| Border | Border
| Paths [(XCoord, YCoord)]
deriving (Show, Eq) deriving (Show, Eq)
-- | What resources can be harvested here? -- | What resources can be harvested here?