<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Tue, 21 May 2013 13:50:16 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Adam Jensen's Blog: Spades and the Strategy Pattern]]></title>
      <guid>http://www.phpdeveloper.org/news/12126</guid>
      <link>http://www.phpdeveloper.org/news/12126</link>
      <description><![CDATA[<p>
<i>Adam Jensen</i> has submitted <a href="http://jazzslider.wordpress.com/2009/03/12/spades-and-the-strategy-pattern/">a new post</a> he's written up about the idea he had for a spades game written in PHP. There's no fancy graphics or computer AI but there is a good example of using the <a href="http://en.wikipedia.org/wiki/Strategy_pattern">Strategy Pattern</a> between the players and interfaces in this CLI script.
</p>
<blockquote>
Here's the project (and I deliberately didn't check to see if anyone's done this before): write a command-line PHP script that runs any number of automated spades games, involving a variety of players utilizing different play algorithms.
</blockquote>
<p>
The Strategy Pattern comes in with the players - each influences how the player will bid and what cards it will choose to play. He gives the code for these two interfaces - Spades_Player_Interface and Spades_Strategy_Interface. He also sets up a randomizing class and several of the other "structure" classes (Spades_Play, Spades_Card, etc). 
</p>
<p>
<a href="http://jazzslider.wordpress.com/2009/03/12/spades-and-the-strategy-pattern/">This post</a> is just the start of the project. If there's enough interest, <i>Adam</i> will release the source for the project including some of the other strategies he's considering.
</p>]]></description>
      <pubDate>Thu, 12 Mar 2009 13:44:01 -0500</pubDate>
    </item>
  </channel>
</rss>
