I have a game , user vs computer and I want to randomly choose who starts the game. I have
a = getStdRandom $ randomR (0, 1)
This gets a random number 0 or 1. However it is a IO int, so I can't have a if statement comparing it to a number like
if a == 0 then userStarts else computerStarts
I have tried to compare IO int with IO int and it doesn't work, and I have also tried
I am very new to Haskell, not sure how to approach this.
Aucun commentaire:
Enregistrer un commentaire