Skip to content

Commit

Permalink
tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
jaspervdj committed Feb 21, 2024
1 parent b8d030a commit 202f26c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/Patat/Transition/Matrix.hs
Original file line number Diff line number Diff line change
Expand Up @@ -62,23 +62,25 @@ transition config (Size rows cols) initial final rgen =
initialParticles = do
(x, y, cell) <- posCells initial
let idx = y * cols + x
speed <- [speeds V.! idx, speeds V.! idx * 1.5, speeds V.! idx * 2]
pure Particle
{ pX = fromIntegral x
, pInitialY = fromIntegral y
, pFinalY = if up V.! idx then 0 else fromIntegral rows
, pSpeed = speeds V.! idx
, pSpeed = speed
, pCell = cell
}

finalParticles :: [Particle]
finalParticles = do
(x, y, cell) <- posCells final
let idx = y * cols + x
speed <- [speeds V.! idx, speeds V.! idx * 1.5, speeds V.! idx * 2]
pure Particle
{ pX = fromIntegral x
, pInitialY = if up V.! idx then 0 else fromIntegral rows
, pInitialY = if up V.! idx then -1 else fromIntegral rows
, pFinalY = fromIntegral y
, pSpeed = speeds V.! idx
, pSpeed = speed
, pCell = cell
}

Expand Down

0 comments on commit 202f26c

Please sign in to comment.