<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>PHP checkers game</title>
		<link>http://www.allegro.cc/forums/view/596770</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Sun, 13 Jul 2008 05:39:54 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
Ok, I&#39;m pretty good at php and I need some advice.</p><p>If I were to make a checkers game in php (probably using as well for data storage)<br />how would I go about making a checkers game.</p><p>I&#39;m not talking about coding samples, just the concept as to determining legitimate moves and the format I would use to store piece locations and capturing pieces, etc.</p><p>As I said I don&#39;t need any code examples just the a sound structural idea which if I understand I can easily translate that to code. </p><p>Thanks a billion <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (superstar4410)</author>
		<pubDate>Fri, 20 Jun 2008 01:45:05 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Are we to assume this is a multiplayer client-server program played within a web browser?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Matthew Leverton)</author>
		<pubDate>Fri, 20 Jun 2008 02:55:59 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
 Yes</p><p> Two human players playing on the same pc, turn based.</p><p>Not to different computer (good question)
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (superstar4410)</author>
		<pubDate>Fri, 20 Jun 2008 06:10:02 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Why use PHP at all? It sounds like all you need is some HTML and Javascript.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Matthew Leverton)</author>
		<pubDate>Fri, 20 Jun 2008 07:36:17 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>

Just because those were the project specs.</p><p>But yea I was thinking javascript myself because of it<br />client-side capabilities
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (superstar4410)</author>
		<pubDate>Fri, 20 Jun 2008 08:01:53 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>This sounds like you&#39;re asking for your homework to be done for you.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (James Stanley)</author>
		<pubDate>Tue, 24 Jun 2008 17:11:14 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Nah  not homework. </p><p>Actually I just got finished. <br />It was a job for someone. I was trying to get ideas, but I figured it out. </p><p>You can view it here  <a href="http://www.dimdigital.com/temp/checkers2.php">http://www.dimdigital.com/temp/checkers2.php</a></p><p>How it works is both players meet at that site and can play aganist each other<br />over the net.  Ajax  AND PHP/SQL</p><p>You can test it by opening up the link in two different browsers click on start game on both and pretend one window is red and the other is white, and play accordingly.</p><p>Yea I got the basic checkers javascript code online from here <br /><a href="http://us.geocities.com/blurglecruncheon/projects/checkers.htm">http://us.geocities.com/blurglecruncheon/projects/checkers.htm</a><br />I added the graphics the chat interface and I had to modified the code to <br />make it two players over the internet instead of two players on one computer.</p><p>Yeaa,I&#39;m proud of myself on that one <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (superstar4410)</author>
		<pubDate>Sat, 28 Jun 2008 07:10:03 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I tried, but got this:</p><pre>
Warning: mysql_connect(): Access denied for user &#39;dimdigit&#39;@&#39;web.ahp01.lax.affinity.com&#39; (using password: YES) in /nfs/cust/4/68/37/573864/web/temp/checkers2.php on line 2

Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /nfs/cust/4/68/37/573864/web/temp/checkers2.php on line 3

Warning: mysql_query(): Can&#39;t connect to local MySQL server through socket &#39;/var/lib/mysql/mysql.sock&#39; (2) in /nfs/cust/4/68/37/573864/web/temp/checkers2.php on line 6

Warning: mysql_query(): A link to the server could not be established in /nfs/cust/4/68/37/573864/web/temp/checkers2.php on line 6

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /nfs/cust/4/68/37/573864/web/temp/checkers2.php on line 8

Warning: mysql_query(): Can&#39;t connect to local MySQL server through socket &#39;/var/lib/mysql/mysql.sock&#39; (2) in /nfs/cust/4/68/37/573864/web/temp/checkers2.php on line 20

Warning: mysql_query(): A link to the server could not be established in /nfs/cust/4/68/37/573864/web/temp/checkers2.php on line 20
Error inserting table row
Can&#39;t connect to local MySQL server through socket &#39;/var/lib/mysql/mysql.sock&#39; (2) </pre><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (LennyLen)</author>
		<pubDate>Sat, 28 Jun 2008 21:04:23 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Try this link</p><p><a href="http://www.dimdigital.com/temp/checkers/checkers2.php">http://www.dimdigital.com/temp/checkers/checkers2.php</a>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (superstar4410)</author>
		<pubDate>Sun, 29 Jun 2008 03:37:33 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>That gives me a 404.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (LennyLen)</author>
		<pubDate>Sun, 29 Jun 2008 04:07:59 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I lost connection as I was uploading</p><p>Try this one, should work <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /></p><p><a href="http://www.dimdigital.com/checkers/checkers2.php">http://www.dimdigital.com/checkers/checkers2.php</a></p><p>Type in some names and click start game, (open up link in two browsers or play with your friend on another computer
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (superstar4410)</author>
		<pubDate>Sun, 29 Jun 2008 04:22:44 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Seems to be some broken logic. I made two turns as player red, as shown in the attached screenshot. With the last state, a dialog box came up that said &quot;There is a jump available&quot;, and now it won&#39;t let me do anything else but jump ... only where? <img src="http://www.allegro.cc/forums/smileys/tongue.gif" alt=":P" /></p><p>Also, I never made a move as player white, apparently the system didn&#39;t give a sh*t about my cheating attempt <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" /></p><p><span class="remote-thumbnail"><span class="json">{"name":"595752","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/b\/9\/b92262480ca485fd678ace3f20ea5ad3.png","w":287,"h":269,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/b\/9\/b92262480ca485fd678ace3f20ea5ad3"}</span><img src="http://www.allegro.cc//djungxnpq2nug.cloudfront.net/image/cache/b/9/b92262480ca485fd678ace3f20ea5ad3-240.jpg" alt="595752" width="240" height="224" /></span>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Indeterminatus)</author>
		<pubDate>Sun, 29 Jun 2008 06:31:43 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>More like incomplete logic than broken. <br /> <br />I didn&#39;t put in all the limit testers and controls.</p><p>Good learning project, that was my second AJAX project. My first<br />is this</p><p><a href="http://www.dimdigital.com/chat.php">http://www.dimdigital.com/chat.php</a></p><p>But I&#39;ll probably not be online to respond when you send a message to the link above.<br />Or I might, but mostly likely not.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (superstar4410)</author>
		<pubDate>Sun, 29 Jun 2008 20:44:38 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>A checkers game that doesn&#39;t check all the rules of checkers isn&#39;t anywhere near &#39;finished&#39;. It doesn&#39;t even really count as a checkers game.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Tobias Dammers)</author>
		<pubDate>Tue, 01 Jul 2008 00:36:16 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Ever heard of the honor system, just dont cheat. Since if you do the computer wont tell on you or stop you from doing it.</p><p>LOooLLL <img src="http://www.allegro.cc/forums/smileys/grin.gif" alt=";D" /></p><p>J/K  I&quot;m just being silly. What can I say I get lazy at times
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (superstar4410)</author>
		<pubDate>Tue, 01 Jul 2008 04:34:48 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Yeah, but then, why bother writing the game when you could just play checkers in MS Paint: draw a board, draw some pieces, mail crappy .bmp to opponent. There, I just coded my first checkers.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Tobias Dammers)</author>
		<pubDate>Fri, 04 Jul 2008 16:20:39 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>As an intellectual exercise making a browser based checkers game seems like a fun idea. However I have my doubts as why anyone would give you money to make one. Especially one that does not enforce the rules of the game. I know a little about php and don&#39;t think is is a very good language for making some thing complex like checkers.</p><p>Flash&#39;s action script, which I am just starting to learn, seems more robust especially since it can listen for mouse events without having to swap screens. It also has a interval call back so you can have the program query the database every few seconds.</p><p>As for coding concepts for a multilayer program:<br />Since the internet is a vast place you will probably need some sort of match making service to connect two players and then make sure nobody else accidentally butts in on their game. Microsoft&#39;s internet gaming zone did this by having a lobby with 200 game tables. Each table had three states empty, one person waiting for a game, and two people in a game. This lobby could be represented by in a database table containing the following fields:</p><p>player1Name     // some text so friends could identify each other.<br />player1UID	// unique ID randomly generated at game start and stored in<br />		// player&#39;s browser. The game will only accept moves from a player<br />		// if the plaer UID matches the UID of the board. <br />player2Name	// same description as player1<br />player2UID<br />isPlayer1turn	// boolean value where if false indcates player2&#39;s turn<br />boardState	// could be a string where<br />		// &#39; &#39; indicates an empty space,<br />      		// &#39;w&#39; indicates unkinged white pieces, <br />		// &#39;W&#39; indicates kinged white pieces,<br />		// &#39;b&#39; indicates unkinged black pieces, <br />		// &#39;B&#39; indicates kinged black pieces,</p><p>If you insist on doing this in php you probably also need to remember which piece the user selected in a separate field so you know which piece to move on the user&#39;s second click. However Actions script can remember this for you so the database only needs to remember stuff that should be communicated to the other user.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Wilson Saunders)</author>
		<pubDate>Wed, 09 Jul 2008 21:08:46 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You would probably do the interface with Javascript, otherwise you would be in for a pretty horrible coding experience.</p><p>I&#39;d say making it in flash is easier (the gui) in some aspects, and harder in some. It could not be made solely in flash for example, since flash can not connect to a database (unless you write a whole db interface using it&#39;s tcp/ip sockets... have fun with that <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" /> - and if it is possible you would have to store database passwords etc in a flash file, which is easily decompiled...). You would need a server-side layer (php or whatever) to process moves and return a correctly formated xml-file (or whatever you want to use for communicating). All logic would probably need to be on the server to prevent cheating...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Jonatan Hedborg)</author>
		<pubDate>Thu, 10 Jul 2008 03:16:26 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
I know a little about php and don&#39;t think is is a very good language for making some thing complex like checkers.
</p></div></div><p>
PHP is just fine, if you can handle it. However, for a browser-based game, client-side script is essential in avoiding unnecessary round-trips, so some javascript knowledge is a must.<br />The general idea would be a database that stores player information and game states; a php script that enforces the rules (not only of the checkers game itself, but also determining who plays against who, how the &quot;league&quot; is organized, etc.); and a DHTML front-end, probably duplicating a lot of the rules enforcement (e.g. filtering out illegal moves before sending them to the server).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Tobias Dammers)</author>
		<pubDate>Sun, 13 Jul 2008 05:39:54 +0000</pubDate>
	</item>
</rss>
