<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Master Mind, Part 1</title>
	<atom:link href="http://programmingpraxis.com/2009/11/17/master-mind-part-1/feed/" rel="self" type="application/rss+xml" />
	<link>http://programmingpraxis.com/2009/11/17/master-mind-part-1/</link>
	<description>A collection of etudes, updated weekly, for the education and enjoyment of the savvy programmer</description>
	<lastBuildDate>Sat, 11 Feb 2012 09:48:16 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Master Mind, Part 1 « Programming Praxis Mind Manager</title>
		<link>http://programmingpraxis.com/2009/11/17/master-mind-part-1/#comment-769</link>
		<dc:creator><![CDATA[Master Mind, Part 1 « Programming Praxis Mind Manager]]></dc:creator>
		<pubDate>Wed, 18 Nov 2009 14:04:33 +0000</pubDate>
		<guid isPermaLink="false">http://programmingpraxis.com/?p=1606#comment-769</guid>
		<description><![CDATA[[...] from: Master Mind, Part 1 « Programming Praxis          By admin &#124; category: mind &#124; tags: carrey, clementine, girlfriend, mind, other-player, [...]]]></description>
		<content:encoded><![CDATA[<p>[...] from: Master Mind, Part 1 « Programming Praxis          By admin | category: mind | tags: carrey, clementine, girlfriend, mind, other-player, [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Remco Niemeijer</title>
		<link>http://programmingpraxis.com/2009/11/17/master-mind-part-1/#comment-768</link>
		<dc:creator><![CDATA[Remco Niemeijer]]></dc:creator>
		<pubDate>Tue, 17 Nov 2009 23:22:15 +0000</pubDate>
		<guid isPermaLink="false">http://programmingpraxis.com/?p=1606#comment-768</guid>
		<description><![CDATA[My Haskell solution (see http://bonsaicode.wordpress.com/2009/11/17/programming-praxis-master-mind-part-1/ for a version with comments):

[sourcecode lang=&quot;css&quot;]
import Data.List
import System.Random

match :: [Int] -&gt; [Int] -&gt; String
match code guess = concat $ zipWith replicate [bs, ws, ds] &quot;BW.&quot;
    where bs = length . filter id $ zipWith (==) code guess
          ds = length (foldr delete code guess)
          ws = length code - bs - ds

go :: [Int] -&gt; IO ()
go code = do hits &lt;- fmap (match code) readLn
             if all (== &#039;B&#039;) hits then putStrLn &quot;You Win!&quot;
                else putStr (hits ++ &quot;\nTry again: &quot;) &gt;&gt; go code

play :: Maybe [Int] -&gt; IO ()
play code = do putStr &quot;Enter your guess as a list: &quot;
               rnd &lt;- fmap (take 4 . randomRs (1, 8)) getStdGen
               go $ maybe rnd id code
[/sourcecode]]]></description>
		<content:encoded><![CDATA[<p>My Haskell solution (see <a href="http://bonsaicode.wordpress.com/2009/11/17/programming-praxis-master-mind-part-1/" rel="nofollow">http://bonsaicode.wordpress.com/2009/11/17/programming-praxis-master-mind-part-1/</a> for a version with comments):</p>
<pre class="brush: css;">
import Data.List
import System.Random

match :: [Int] -&gt; [Int] -&gt; String
match code guess = concat $ zipWith replicate [bs, ws, ds] &quot;BW.&quot;
    where bs = length . filter id $ zipWith (==) code guess
          ds = length (foldr delete code guess)
          ws = length code - bs - ds

go :: [Int] -&gt; IO ()
go code = do hits &lt;- fmap (match code) readLn
             if all (== 'B') hits then putStrLn &quot;You Win!&quot;
                else putStr (hits ++ &quot;\nTry again: &quot;) &gt;&gt; go code

play :: Maybe [Int] -&gt; IO ()
play code = do putStr &quot;Enter your guess as a list: &quot;
               rnd &lt;- fmap (take 4 . randomRs (1, 8)) getStdGen
               go $ maybe rnd id code
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Programming Praxis &#8211; Master Mind, Part 1 &#171; Bonsai Code</title>
		<link>http://programmingpraxis.com/2009/11/17/master-mind-part-1/#comment-767</link>
		<dc:creator><![CDATA[Programming Praxis &#8211; Master Mind, Part 1 &#171; Bonsai Code]]></dc:creator>
		<pubDate>Tue, 17 Nov 2009 23:21:57 +0000</pubDate>
		<guid isPermaLink="false">http://programmingpraxis.com/?p=1606#comment-767</guid>
		<description><![CDATA[[...] Remco Niemeijer  &#8230;aaaand we&#8217;re back. Sorry for the delay, life can get really busy. In yesterday&#8217;s Programming Praxis problem we have to create a program that will answer guesses for the game Master Mind. Let&#8217;s get to [...]]]></description>
		<content:encoded><![CDATA[<p>[...] Remco Niemeijer  &#8230;aaaand we&#8217;re back. Sorry for the delay, life can get really busy. In yesterday&#8217;s Programming Praxis problem we have to create a program that will answer guesses for the game Master Mind. Let&#8217;s get to [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: CodePlea</title>
		<link>http://programmingpraxis.com/2009/11/17/master-mind-part-1/#comment-766</link>
		<dc:creator><![CDATA[CodePlea]]></dc:creator>
		<pubDate>Tue, 17 Nov 2009 21:41:07 +0000</pubDate>
		<guid isPermaLink="false">http://programmingpraxis.com/?p=1606#comment-766</guid>
		<description><![CDATA[Here&#039;s my first ever TCL program: http://codepad.org/mzkVDiY6

It was an interesting exercise.]]></description>
		<content:encoded><![CDATA[<p>Here&#8217;s my first ever TCL program: <a href="http://codepad.org/mzkVDiY6" rel="nofollow">http://codepad.org/mzkVDiY6</a></p>
<p>It was an interesting exercise.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

