Send Beginners mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."
Today's Topics:
1. Re: A good data structure for representing a tic-tac-toe
board? (Peter Hall)
2. virtualenv vs (luc taesch)
3. Re: virtualenv vs (David McBride)
4. Re: A good data structure for representing a tic-tac-toe
board? (KC)
----------------------------------------------------------------------
Message: 1
Date: Tue, 19 Mar 2013 12:32:21 +0000
From: Peter Hall <[email protected]>
Subject: Re: [Haskell-beginners] A good data structure for
representing a tic-tac-toe board?
To: Lyndon Maydwell <[email protected]>
Cc: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Message-ID:
<caa6hak70o4200yy5yhkmx6umowp1xkjlxfc08wkejp1ymkd...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
Ah yes, that is nicer! I got too used to the limitations of the other
languages I use :)
Peter
On 19 March 2013 03:16, Lyndon Maydwell <[email protected]> wrote:
> If taking the array approach, I'd recommend using a single array indexed
> by the (x,y) position of the cell, this way neither direction has a greater
> implied significance. Diagonals should also be easier.
>
> Aside: Tony Morris wrote a very interesting exercise based on tic-tac-toe
> and it is available on Hackage:
> http://hackage.haskell.org/package/TicTacToe
>
>
> On Tue, Mar 19, 2013 at 3:49 AM, Peter Hall <[email protected]>wrote:
>
>> Start with a data type for the cell values, instead of Char. Then use an
>> Array of Arrays, containing those values.
>>
>> data Cell = Empty | O | X
>> type Board = Array Int Cell
>>
>> Finding winning "rows" and "columns" is easy. Diagonals are slightly more
>> complicated.
>>
>> Peter
>>
>>
>>
>> On 18 March 2013 15:54, Costello, Roger L. <[email protected]> wrote:
>>
>>> Hi Folks,
>>>
>>> Currently I am representing a tic-tac-toe board as a string, with 'X'
>>> denoting player 1 and 'O' denoting player 2. For example, I represent this
>>> 2x2 game board:
>>>
>>> 'X' |
>>> -----------------------
>>> | 'O'
>>>
>>> with this string: "X O"
>>>
>>> The nice thing about that representation is that it is each to identify
>>> which cells are filled or empty, and it is easy to mark a cell with an 'X'
>>> or 'O'.
>>>
>>> The problem with the representation is that it is difficult to determine
>>> when a player has won.
>>>
>>> Can you recommend a representation that makes it easy to:
>>>
>>> 1. determine when a player has won
>>> 2. identify cells that are filled or empty
>>> 3. mark an empty cell
>>>
>>> /Roger
>>>
>>> _______________________________________________
>>> Beginners mailing list
>>> [email protected]
>>> http://www.haskell.org/mailman/listinfo/beginners
>>>
>>
>>
>> _______________________________________________
>> Beginners mailing list
>> [email protected]
>> http://www.haskell.org/mailman/listinfo/beginners
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20130319/c6500a08/attachment-0001.htm>
------------------------------
Message: 2
Date: Tue, 19 Mar 2013 12:56:22 +0100
From: luc taesch <[email protected]>
Subject: [Haskell-beginners] virtualenv vs
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=iso-8859-1; format=flowed
I run ( again) in some dependencies issues , and considering using
virtualenv , or cabal-dev
any comment fro users on these tow ? recommendations ? what to do ?
what not to do ?
--------------
[virtualenv](http://paczesiowa.blogspot.be/2011/11/virtual-haskell-environment.html)
------------------------------
Message: 3
Date: Tue, 19 Mar 2013 09:49:51 -0400
From: David McBride <[email protected]>
Subject: Re: [Haskell-beginners] virtualenv vs
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Message-ID:
<can+tr41v-bsseeuje6d1446q7ibux4dwq80rujryck1ukga...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
Use hsenv, which is the successor to virthualenv. It is very easy to
use, and just works for most simple cases.
On Tue, Mar 19, 2013 at 7:56 AM, luc taesch <[email protected]> wrote:
> I run ( again) in some dependencies issues , and considering using
> virtualenv , or cabal-dev
>
> any comment fro users on these tow ? recommendations ? what to do ? what not
> to do ?
>
> --------------
> [virtualenv](http://paczesiowa.blogspot.be/2011/11/virtual-haskell-environment.html)
>
>
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
------------------------------
Message: 4
Date: Tue, 19 Mar 2013 20:36:26 -0700
From: KC <[email protected]>
Subject: Re: [Haskell-beginners] A good data structure for
representing a tic-tac-toe board?
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Message-ID:
<camlkxykhcnrp2yl1ow5jnbczhyedmgns19kssxtz56_dr8o...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
You may want more than one data structure.
For example, one for machine use and another for display to the user.
Since your data structure is "relatively" small, lists should be fast
enough and strings are lists.
On Mon, Mar 18, 2013 at 8:54 AM, Costello, Roger L. <[email protected]> wrote:
> Hi Folks,
>
> Currently I am representing a tic-tac-toe board as a string, with 'X'
> denoting player 1 and 'O' denoting player 2. For example, I represent this
> 2x2 game board:
>
> 'X' |
> -----------------------
> | 'O'
>
> with this string: "X O"
>
> The nice thing about that representation is that it is each to identify which
> cells are filled or empty, and it is easy to mark a cell with an 'X' or 'O'.
>
> The problem with the representation is that it is difficult to determine when
> a player has won.
>
> Can you recommend a representation that makes it easy to:
>
> 1. determine when a player has won
> 2. identify cells that are filled or empty
> 3. mark an empty cell
>
> /Roger
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
--
--
Regards,
KC
------------------------------
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
End of Beginners Digest, Vol 57, Issue 29
*****************************************