Making a Tic-Tac-Toe Game

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Making a Tic-Tac-Toe Game

Sudhanshu Jaiswal
Also called as Noughts and crosses or Xs and Os.

Hello everyone,

How do I start making a Two Player Tic Tac Toe game in Haskell?

The program basically has to show the 3*3 grid as coordinates and let each player choose his coordinates in his turn by entering the coordinates of the required cell. I also want to be able to check if a player has won and display it once the winning move has been made or the same for a Draw. 

What have I done? - I have read Learn You a Haskell till Modules and know basic I/O.

I don't want the code instead, I am interested in learning stuff and trying problems which would lead me to get the intuition and ability to make the game by myself.

I would be thankful if you folks could direct me to related problems which I could do or some advice as to how I should go about implementing such a program.
--
Sudhanshu  



_______________________________________________
Beginners mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Making a Tic-Tac-Toe Game

Theodore Lief Gannon
I know you said you didn't want code, but I think this will be helpful. Here is an example of what the very top of your logic might reasonably look like.

main :: IO ()
main = do
  someInitialization
  config <- someConfigurator
  result <- gameLoop $ makeInitialState config
  print result

gameLoop :: GameState -> IO GameResult
gameLoop gameState =
  let maybeEndState = discoverEndState gameState
  in case maybeEndState of
    Just endState -> return endState
    Nothing -> do
      playerMove <- fetchInput gameState
      gameLoop $ makeNextState playerMove


On Tue, Feb 21, 2017 at 8:35 AM, Sudhanshu Jaiswal <[hidden email]> wrote:
Also called as Noughts and crosses or Xs and Os.

Hello everyone,

How do I start making a Two Player Tic Tac Toe game in Haskell?

The program basically has to show the 3*3 grid as coordinates and let each player choose his coordinates in his turn by entering the coordinates of the required cell. I also want to be able to check if a player has won and display it once the winning move has been made or the same for a Draw. 

What have I done? - I have read Learn You a Haskell till Modules and know basic I/O.

I don't want the code instead, I am interested in learning stuff and trying problems which would lead me to get the intuition and ability to make the game by myself.

I would be thankful if you folks could direct me to related problems which I could do or some advice as to how I should go about implementing such a program.
--
Sudhanshu  



_______________________________________________
Beginners mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners



_______________________________________________
Beginners mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
KC
Reply | Threaded
Open this post in threaded view
|

Re: Making a Tic-Tac-Toe Game

KC
In reply to this post by Sudhanshu Jaiswal
If you want graphics there is
Making your first Haskell game
Which uses hGamer3D and aio 

--
--

Sent from an expensive device which will be obsolete in a few months! :D

Casey
   

On Feb 21, 2017 8:36 AM, "Sudhanshu Jaiswal" <[hidden email]> wrote:
Also called as Noughts and crosses or Xs and Os.

Hello everyone,

How do I start making a Two Player Tic Tac Toe game in Haskell?

The program basically has to show the 3*3 grid as coordinates and let each player choose his coordinates in his turn by entering the coordinates of the required cell. I also want to be able to check if a player has won and display it once the winning move has been made or the same for a Draw. 

What have I done? - I have read Learn You a Haskell till Modules and know basic I/O.

I don't want the code instead, I am interested in learning stuff and trying problems which would lead me to get the intuition and ability to make the game by myself.

I would be thankful if you folks could direct me to related problems which I could do or some advice as to how I should go about implementing such a program.
--
Sudhanshu  



_______________________________________________
Beginners mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners


_______________________________________________
Beginners mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners