Proudly hosted with Dreamhost

Save $20 when signing up for Dreamhost by using the promo code amnuts20
If you find these scripts useful to you, appreciate the free support, or are just an all round nice person, then why not donate a little dosh to encourage me to continue? Every little helps!
|
Battleships By Email (BBE)
Play battleships against an opponent via email! No database required as all information is passed along a URL.
A database is used in the script, however, to allow for recording of wins and losses.
One problem with this script is that Outlook's maximum querystring length seems to be 255 characters (or there abouts), and the URL created by this script is almost always longer than that. However, it works great with other mail clients such as Mozilla, Eudora, Pine, Elm, Mutt, etc.
index.php
20.36kb in size last modified May 6, 2006 at 1:54pm 6172 views, 6373 downloads
makeboard.php
3.29kb in size last modified May 6, 2006 at 1:54pm 4708 views, 5552 downloads
makelegend.php
3.29kb in size last modified May 6, 2006 at 1:54pm 4773 views, 5478 downloads
makemap.php
437b in size last modified May 6, 2006 at 1:54pm 4432 views, 5501 downloads
setup.php
<?php
// // Battleships By Email // version 1.0.0 // // Andrew Collington, 2002 // php@amnuts.com, http://php.amnuts.com/ // // these two should be all you need to change define("BBEURL","http://php.amnuts.com/devarticles_bbe/index.php"); $dbVars = array( "user" => "username", "pass" => "password", "host" => "localhost", "name" => "battleships", "tbl_results" => "results" ); // players define("PLAYER1",0); define("PLAYER2",1); // directions define("E", 0); define("SE", 1); define("S", 2); define("SW", 3); define("W", 4); define("NW", 5); define("N", 6); define("NE", 7); // boards define("SPACER",2); define("FONT",2); define("BWIDTH",10); define("BDEPTH",10); define("PSIZE",14); // pixel size per square define("HIT",1); define("MISS",2); define("SEA",3); // directions $xincr = array(1, 1, 0, -1, -1, -1, 0, 1); $yincr = array(0, 1, 1, 1, 0, -1, -1, -1); // ships define("SHIPTYPES", 5); define("CARRIER",0); define("BATTLE",1); define("DESTROYER",2); define("SUBMARINE",3); define("PTBOAT",4); $ships = array( CARRIER => array( "name" => "Aircraft Carrier", "hits" => 0, "symbol" => "A", "length" => 5, "x" => 0, "y" => 0, "dir" => 0, "placed" => 0 ), BATTLE => array( "name" => "Battleship", "hits" => 0, "symbol" => "B", "length" => 4, "x" => 0, "y" => 0, "dir" => 0, "placed" => 0 ), DESTROYER => array( "name" => "Destroyer", "hits" => 0, "symbol" => "D", "length" => 3, "x" => 0, "y" => 0, "dir" => 0, "placed" => 0 ), SUBMARINE => array( "name" => "Submarine", "hits" => 0, "symbol" => "S", "length" => 3, "x" => 0, "y" => 0, "dir" => 0, "placed" => 0 ), PTBOAT => array( "name" => "PT Boat", "hits" => 0, "symbol" => "P", "length" => 2, "x" => 0, "y" => 0, "dir" => 0, "placed" => 0 ) ); $shipcolours = array( CARRIER => array(72,72,72), BATTLE => array(120,120,120), DESTROYER => array(148,148,148), SUBMARINE => array(169,169,169), PTBOAT => array(213,213,213) ); $misccolours = array( SEA => array(0,0,255), HIT => array(255,0,0), MISS => array(255,255,0) );
?>
2.27kb in size last modified May 6, 2006 at 1:54pm 4524 views, 5571 downloads
|