Place bombs randomly
This commit is contained in:
parent
0b20ec98e3
commit
fd1aef44ef
4 changed files with 36 additions and 11 deletions
17
app/Main.hs
17
app/Main.hs
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue