Place bombs randomly

This commit is contained in:
Paul-Henri Froidmont 2019-12-04 00:13:57 +01:00 committed by Paul-Henri Froidmont
parent 0b20ec98e3
commit fd1aef44ef
4 changed files with 36 additions and 11 deletions

View file

@ -1,12 +1,15 @@
module Main where
import Lib
import System.Environment
import System.Random
main :: IO ()
main =
putStrLn $
printBoard
[ [Bomb Revealed, Value 1 Revealed, Value 0 Revealed]
, [Value 1 Revealed, Value 1 Revealed, Value 0 Revealed]
, [Value 0 Revealed, Value 0 Revealed, Value 0 Revealed]
]
main = do
args <- getArgs
let boardWidth = read (head args)
boardLength = read (args !! 1)
bombs = read (args !! 2)
generator <- newStdGen
putStrLn . printBoard . revealAll . createBoard boardWidth boardLength $
generateRandomCoordinates (boardWidth-1) (boardLength-1) bombs generator