2013-10-06 19:04:04 +0000 <jmcarthur> and it looks like it has been done now
2013-10-06 19:05:23 +0000DanielDiaz(~dhelta@191.Red-88-0-88.dynamicIP.rima-tde.net)
2013-10-06 19:05:36 +0000DanielDiaz(~dhelta@191.Red-88-0-88.dynamicIP.rima-tde.net) ()
2013-10-06 19:06:02 +0000maverick_(5ed0854d@gateway/web/freenode/ip.94.208.133.77)
2013-10-06 19:06:48 +0000 <maverick_> Hey, I'm trying to compute a minimax tree for Tic Tac Toe given a game tree, but I'm a bit stuck with the function
2013-10-06 19:07:12 +0000 <jmcarthur> Jeanne-Kamikaze: the main point is so you can catch up if you're gone for a while, or refer to things that were said before that you forgot. it's searchable, linkable, etc.
2013-10-06 19:07:26 +0000 <jmcarthur> maverick_: hello!
2013-10-06 19:07:38 +0000 <maverick_> jmcarthur: Hey
2013-10-06 19:07:58 +0000 <jmcarthur> maverick_: what's giving you problems? (i'm leaving soon, but others may be able to help too)
2013-10-06 19:10:56 +0000 <maverick_> jmcarthur: I'm trying to create a computer oppenent for the Tic Tac Toe game and now I need to compute a minimax tree out of gametree but I don't really know where to start. minimax :: Player ! Rose Board ! Rose Int should be the type signature
2013-10-06 19:11:02 +0000 <maverick_> ! must be a ->
2013-10-06 19:11:04 +0000tac(~tac-tics@2602:306:bdb4:5100:4853:961f:4bf6:29d) ("Leaving")
2013-10-06 19:13:15 +0000 <jmcarthur> what is the Int? how is Board defined? how is Player defined?
2013-10-06 19:14:01 +0000 <jmcarthur> for that matter, what is Rose? a rose tree?
2013-10-06 19:14:07 +0000 <maverick_> Yup
2013-10-06 19:14:18 +0000 <maverick_> So Rose Board is the gametree you give to the function minimax
2013-10-06 19:14:18 +0000 <maverick_> gameTree :: Player -> Board -> Rose Board
2013-10-06 19:14:37 +0000 <maverick_> http://i.imgur.com/ahbn8k7.jpg
2013-10-06 19:14:53 +0000 <maverick_> You have to rotate the picture :p
2013-10-06 19:14:58 +0000 <jmcarthur> got it
2013-10-06 19:15:18 +0000 <maverick_> In the leaves -1 is when the AI loses, 1 is when he wins and 0 is a draw
2013-10-06 19:15:49 +0000 <maverick_> So I have to build a tree like that so the AI knows in this example he has to take the right sub tree since he has more chances to win there
2013-10-06 19:16:18 +0000 <jmcarthur> understood
2013-10-06 19:16:26 +0000phyrex1an(~phyrex1an@cm-84.211.97.217.getinternet.no)
2013-10-06 19:16:57 +0000mithsv(~mithsv@ip51cf3d13.direct-adsl.nl) (Quit: Computer has gone to sleep.)
2013-10-06 19:17:04 +0000 <jmcarthur> so at each level you basically have available to you the following pieces of information: Player and Forest Int
2013-10-06 19:17:23 +0000 <jmcarthur> and you need to produce an Int from that
2013-10-06 19:17:32 +0000 <jmcarthur> sticking that into the tree you are generating
2013-10-06 19:17:40 +0000 <maverick_> Actually yes
2013-10-06 19:17:45 +0000 <maverick_> So In the end I wil lget a Rose Int
2013-10-06 19:17:49 +0000 <jmcarthur> right
2013-10-06 19:17:49 +0000 <maverick_> Tree of Ints
2013-10-06 19:18:27 +0000 <jmcarthur> what do you have so far? (use lpaste.net if it's more than a couple lines)
2013-10-06 19:18:50 +0000 <maverick_> For the function minimax I have nothing actually
2013-10-06 19:19:00 +0000 <jmcarthur> well, you have a type signature! :)
2013-10-06 19:19:00 +0000 <maverick_> I do have some other functions that I probably have to use
2013-10-06 19:19:25 +0000 <maverick_> I have a function that gives the possible moves given a board
2013-10-06 19:19:33 +0000 <maverick_> And a function that creates a gametree
2013-10-06 19:19:41 +0000 <jmcarthur> i think i know what i would do, so i'm just going to try to ask suggestive questions
2013-10-06 19:19:53 +0000 <jmcarthur> how is the Player argument supposed to be used?
2013-10-06 19:21:08 +0000 <jmcarthur> by which i mean, why is it needed?
2013-10-06 19:21:10 +0000 <maverick_> The first argument of minimax is the Player we are calculating the minimax tree for. This argument stays constant throughout the whole computation.
2013-10-06 19:21:23 +0000 <jmcarthur> why does it stay constant?
2013-10-06 19:22:06 +0000 <maverick_> Because I'm supposed to use a helper function
2013-10-06 19:22:16 +0000 <maverick_> That takes another player argument
2013-10-06 19:22:36 +0000 <maverick_> And this is the player that is allowed to make move
2013-10-06 19:22:55 +0000 <maverick_> And switches at every level of the tree when I want to recurse through it
2013-10-06 19:23:11 +0000 <jmcarthur> i don't think i understand. this sounds like a homework assignment? could you put the full text of the problem description on lpaste or something?
2013-10-06 19:23:30 +0000 <jmcarthur> because now it sounds like there are some restrictions that would prevent me from pushing you in certain directions
2013-10-06 19:23:45 +0000_justjust(~justjust@146-52-43-55-dynip.superkabel.de) (Quit: Leaving.)
2013-10-06 19:25:22 +0000 <maverick_> http://lpaste.net/7400387500373442560
2013-10-06 19:25:31 +0000 <maverick_> Here is the problem discription
2013-10-06 19:26:29 +0000 <jmcarthur> ah i see, those aren't requirements but hints
2013-10-06 19:26:59 +0000 <maverick_> Yup idd
2013-10-06 19:27:21 +0000jxv(~jxv@76-219-78-35.lightspeed.irvnca.sbcglobal.net)
2013-10-06 19:27:48 +0000 <jmcarthur> so i would indeed start by writing a helper function as suggested
2013-10-06 19:27:57 +0000 <jmcarthur> perhaps beginning with its type
2013-10-06 19:28:23 +0000 <maverick_> I think the type is the same
2013-10-06 19:28:26 +0000 <maverick_> As the normal function
2013-10-06 19:28:31 +0000ozataman_(~ozataman@pool-108-41-231-51.nycmny.fios.verizon.net)
2013-10-06 19:28:32 +0000 <jmcarthur> "It is useful to introduce a helper function minimax0 that takes another Player
2013-10-06 19:28:34 +0000 <jmcarthur> argument."
2013-10-06 19:28:39 +0000 <jmcarthur> key word: "another"
2013-10-06 19:29:27 +0000 <maverick_> I have a function nextPlayer
2013-10-06 19:29:38 +0000 <maverick_> So probably nextPlayer p would be it's parameter
2013-10-06 19:29:47 +0000 <jmcarthur> sounds good
2013-10-06 19:30:01 +0000 <maverick_> nextPlayer :: Player -> Player
2013-10-06 19:30:20 +0000rishabhjain_(~anonymous@14.139.122.114)
2013-10-06 19:30:28 +0000 <maverick_> nextPlayer P1 gives P2 for instance and also changed the symbol to O
2013-10-06 19:30:50 +0000 <jmcarthur> the symbol?
2013-10-06 19:30:55 +0000 <jmcarthur> oh, i see
2013-10-06 19:30:58 +0000 <jmcarthur> tic tac toe
2013-10-06 19:31:13 +0000 <maverick_> Yup
2013-10-06 19:31:21 +0000 <jmcarthur> although i don't see how that type signature affects the symbol at all
2013-10-06 19:31:28 +0000 <jmcarthur> since there is no symbol in the signature
2013-10-06 19:31:34 +0000rishabhjain(~anonymous@14.139.122.114) (Read error: Connection reset by peer)
2013-10-06 19:31:34 +0000rishabhjain_rishabhjain
2013-10-06 19:31:35 +0000 <maverick_> symbol :: Player -> Field
2013-10-06 19:31:41 +0000 <jmcarthur> ah
2013-10-06 19:31:43 +0000 <maverick_> Another function :p
2013-10-06 19:32:20 +0000 <jmcarthur> anyway, so now that we know the type of the helper function (just the same as your minimax function, but with that extra player argument) we can try writing out the cases we're going to pattern match on
2013-10-06 19:32:40 +0000 <jmcarthur> we have helpers for the player arguments, so probably we're going to match on the tree
2013-10-06 19:34:38 +0000 <maverick_> The helper function also has minimax' :: Player -> Rose Board -> Rose Int then/
2013-10-06 19:34:39 +0000mithsv(~mithsv@ip51cf3d13.direct-adsl.nl)
2013-10-06 19:35:23 +0000 <jmcarthur> but how are you going to keep track of the player that can move right now?
2013-10-06 19:36:05 +0000 <maverick_> Hmm
2013-10-06 19:36:36 +0000 <maverick_> With the nextPlayer function I'd guess
2013-10-06 19:36:52 +0000 <jmcarthur> applied to what?
2013-10-06 19:37:08 +0000 <jmcarthur> remember, nextPlayer doesn't have any state
2013-10-06 19:37:18 +0000 <jmcarthur> you have to have something to supply to it
2013-10-06 19:37:52 +0000 <maverick_> Hmm
2013-10-06 19:38:51 +0000 <maverick_> Doesn't the gametree do that? http://lpaste.net/6792277576447426560
2013-10-06 19:39:00 +0000 <jmcarthur> i'm sorry, i do have to go now. hopeful somebody else here can pick up where i left off, or if not then you can always try #haskell again
2013-10-06 19:39:33 +0000 <maverick_> Aha ok np :)
2013-10-06 19:39:37 +0000 <maverick_> Btw
2013-10-06 19:39:39 +0000 <jmcarthur> yes, the gametree *also* has to do that, but that's just for determining symbols. you also need to know this to be able to determine values of moves
2013-10-06 19:40:21 +0000 <maverick_> Hmm I see
2013-10-06 19:50:21 +0000ozataman_(~ozataman@pool-108-41-231-51.nycmny.fios.verizon.net) (Quit: ozataman_)
2013-10-06 19:56:50 +0000scottj(~scott@206.212.250.58)
2013-10-06 20:02:46 +0000rishabhjain(~anonymous@14.139.122.114) (Quit: rishabhjain)