This is a PHP remake of the Parker Brothers' game, Boggle. I give all credit to them for thinking up such a great game! I (a PHP newbie) needed a silent version of the game since we have a newborn. Oh, make sure the timer.php file is in the same directory as the boggle.php. Enjoy!
By : T_Ringz
<html><head><title>Boggle</title></head>
<body align=center bgcolor=black>
<?php
$dice1=array("E","Y","R","L","T","T");
$dice2=array("E","O","S","S","I","T");
$dice3=array("N","H","Z","L","R","N");
$dice4=array("E","T","V","R","H","W");
$dice5=array("L","R","D","I","X","E");
$dice6=array("O","O","B","B","A","J");
$dice7=array("W","E","E","N","H","G");
$dice8=array("I","U","M","C","O","T");
$dice9=array("T","I","S","D","Y","I");
$dice10=array("E","N","S","I","E","U");
$dice11=array("A","H","O","P","C","S");
$dice12=array("H","Qu","I","M","M","U");
$dice13=array("A","G","E","E","N","A");
$dice14=array("O","O","A","T","T","W");
$dice15=array("K","S","A","F","P","F");
$dice16=array("Y","V","E","R","L","D");
$die=array("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16");
$die2=array("1"=>$dice1,"2"=>$dice2,"3"=>$dice3,"4"=>$dice4,"5"=>$dice5,"6"=>$dice6,"7"=>$dice7,"8"=>$dice8,"9"=>$dice9,"10"=>$dice10,"11"=>$dice11,"12"=>$dice12,"13"=>$dice13,"14"=>$dice14,"15"=>$dice15,"16"=>$dice16)
?>
<br><br><br><br><br><br><br><br>
<center><table border=1 bgcolor=white width=270><tr>
<?php
$gameboard=array();
$i=0;
while($i<=15)
{
$gameboard[$i]=randomize($gameboard, $i, $die);
$temp=$gameboard[$i];
$k=$i+1;
if ($i==4 or $i==8 or $i==12)
{
echo "</tr><tr>";
}
$boggletemp=$die2[$k];
$boggleletter=$boggletemp[rand(0,5)];
echo '<td align=center><font style=font-size:47 color=blue>'.$boggleletter.'</font></td>';
$i++;
}
function randomize($array1, $counter, $arrayX)
{
$array1[$counter]=$arrayX[rand(0,15)];
$temp = $array1[$counter];
if ((validation($temp, $array1))=="TRUE")
{
return $array1[$counter];
} else {
return (randomize ($array1, $counter, $arrayX));
}
}
function validation($temp2, $array2)
{
$outer=count($array2)-1;
for($j=0; $j<$outer; $j++)
{
if($temp2==$array2[$j])
{
return "FALSE";
}
}
return "TRUE";
}
?>
</table>
<p>
<form action=timer.php method=post>
<input type=submit value="Start Timer!">
</form>
<p>
</body>
</html>
Click to
Download File| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |
More Miscellaneous Code Articles
More By Codewalkers
developerWorks - FREE Tools! |
Build secure Web services with transport-level security using IBM Rational Application Developer V7 and IBM WebSphere Application Server V6.1. Follow this three-part series for step-by-step instructions about how to develop Web services and clients, configure HTTP basic authentication, and configure HTTP over SSL (HTTPS). This first part of the series walks you through building a Web service for a simple calculator application. You generate and test two different types of Web services clients: a Java Platform, Enterprise Edition (Java EE) client and a stand-alone Java client. You also handle user-defined exceptions in Web services. FREE! Go There Now!
|
|
|
|
Download a free trial version of IBM Rational Developer for System i V7.1, which provides a complete development environment for traditional i5/OS application development. IBM Rational Developer for System i is a new eclipse-based workstation offering for i5/OS application development that provides a comprehensive Integrated Development Environment for edit/compile/debug of traditional RPG/COBOL/C/C++ i5/OS applications. FREE! Go There Now!
|
|
|
|
Join this Rational Talks to You teleconference on November 29 at 1:00 pm ET to participate in an interactive discusssion with Grady Booch around architecture and reuse. Get your questions answered! FREE! Go There Now!
|
|
|
|
Join this Rational Talks to You teleconference on December 6 at 1:00 pm ET to participate in an agile application development discussion and get your questions answered on using IBM Rational Method Composer in a distributed environment.Get your questions answered! FREE! Go There Now!
|
|
|
|
Get a free trial download of the latest version of IBM Rational Method Composer V7.2 which helps you deliver customized yet consistent process guidance to your project teams and IT organization, and includes the latest version of IBM Rational Unified Process (RUP), which has provided process guidance to teams since 1996. FREE! Go There Now!
|
|
|
|
Get a free trial download of the latest version of IBM Rational Performance Tester V7.0.1, a load and performance testing solution for teams concerned about the scalability of their Web-based applications. Combining multiple ease-of-use features with granular detail, Rational Performance Tester simplifies the test-creation, load-generation and data-collection processes that help teams ensure the ability of their applications to accommodate required user loads. FREE! Go There Now!
|
|
|
|
Visit IBM developerWorks to try the IBM SOA Sandbox for people. The SOA Sandbox for people provides a trial environment with the necessary tooling and components required to enable consistent human and process interaction and collaboration, showing how you can improve user experience and business productivity. FREE! Go There Now!
|
|
|
|
Join this Rational Talks to You teleconference, to hear how Enterprise Generation Language (EGL) eliminates the need for tedious and error-prone low level coding, so developers can focus on business requirements. EGL extends the Rational software development platform with a simplified programming language that enables developers who have little or no experience with Java, Web technologies or Service Oriented Architecture, to create enterprise-class applications and services quickly and easily. It also allows developers who may have little or no mainframe programming experience to quickly create traditional mainframe components. FREE! Go There Now!
|
|
|
|
Join the IBM Watchfire team for an informative discussion on techniques and best practices to proactively manage Web application security and how to effectively build application security testing into the software development lifecycle (SDLC). In this Software Delivery Platform webcast you will learn: How to better understand potential web application security vulnerabilities, best practices and how to effectively integrate application security testing into the software development lifecycle, the importance of detecting and removing software vulnerabilities during application development. FREE! Go There Now!
|
|
|
|
The unprecedented scope of a service-oriented architecture (SOA) initiative brings to the forefront a number of management and governance issues that were sidestepped in the past. The key to a successful SOA implementation is managing and governing activities throughout the entire SOA delivery lifecycle by ensuring that services conform to the needs of all of the business’s stakeholders. Learn how service lifecycle management allows the business to ensure that the process by which services are defined, created, tested, deployed, optimized and retired is manageable, repeatable and auditable. FREE! Go There Now!
|
|
|
|
All FREE IBM® developerWorks Tools! |