A function to print current Risk map, with small land numbers, number of soldiers and "something" more for each land.
"something" is whatever you put in $some_array_of_size_40[$land_number]
I use this to debug heuristics calculation (menaces from each land to a given one, number of moves to each land, ...)
Based on my table-map thing, of course.
By : gatopeich
<?PHP
$map_head ="<html>
<head>
<title>Risk Table Map</title>
<style type=\"text/css\">
table {font-size:10;}
td { text-align: left; vertical-align: top;}
.N_America { background-color: #ffff22;}
.S_America { background-color: #2255ff;}
.Europe { background-color: #ff22ff;}
.Asia { background-color: #55ff55;}
.Africa { background-color: #aa5533;}
.Oceania { background-color: #ffa000;}
.bridge { background-color: #a0a0a0;}
.A { background-color: #ff0000; font-size:12;font-weight:bold;}
.B { background-color: #00ff00; font-size:12;font-weight:bold;}
.C { background-color: #0000ff; font-size:12;font-weight:bold;}
.D { background-color: #ffff00; font-size:12;font-weight:bold;}
.X { background-color: #808080;}
</style>
</head>
<body>
";
$map_start="<table cellpadding=0 cellspacing=0 border=1 width=100% bgcolor=#ddddff>
<tr>
<td>'</td><td>'</td><td>'</td><td>'</td><td>'</td>
<td class=N_America rowspan=3 colspan=3>";
$map_land[]=2;
//<table align=center class="A"><td>11</td></table>
$map[]="</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td class=Asia rowspan=4 colspan=1>";
$map_land[]=20;
//<table align=center class="B"><td>11</td></table>
$map[]="</td><td class=Asia>";
$map_land[]=21;
//<table align=center class="C"><td>11</td></table>
$map[]="</td><td class=Asia rowspan=3 colspan=1>";
$map_land[]= 22;
//<table align=center class=D><td>1</td></table>
$map[]="</td><td>'</td></tr><tr><td>'</td><td>'</td><td>'</td><td class=N_America rowspan=2 colspan=2>";
$map_land[]= 1;
$map[]="</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td class=Asia rowspan=4 colspan=2>";
$map_land[]= 19;
$map[]="</td><td class=Asia>";
$map_land[]= 23;
$map[]="</td><td>'</td></tr><tr><td class=bridge>-</td><td class=N_America rowspan=2 colspan=2>";
$map_land[]= 0;
$map[]="</td><td class=bridge rowspan=2 colspan=1>-</td><td>'</td><td>'</td><td class=Europe rowspan=3 colspan=2>";
$map_land[]= 13;
$map[]="</td><td class=Europe rowspan=5 colspan=2>";
$map_land[]= 14;
$map[]="</td><td class=Asia rowspan=3 colspan=1>";
$map_land[]= 24;
$map[]="</td><td class=bridge>-</td></tr><tr><td>'</td><td class=N_America rowspan=4 colspan=1>";
$map_land[]= 3;
$map[]="</td><td class=N_America rowspan=4 colspan=4>";
$map_land[]= 4;
$map[]="</td><td class=Europe>";
$map_land[]= 12;
$map[]="</td><td class=bridge>-</td><td class=Asia>";
$map_land[]= 25;
$map[]="</td><td>'</td></tr><tr><td>'</td><td>'</td><td>'</td><td class=bridge rowspan=1 colspan=2>-</td><td class=Europe rowspan=2 colspan=1>";
$map_land[]= 15;
$map[]="</td><td class=Asia rowspan=4 colspan=2>";
$map_land[]= 29;
$map[]="</td><td>'</td><td>'</td></tr><tr><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td class=Europe rowspan=2 colspan=2>";
$map_land[]= 17;
$map[]="</td><td class=Asia colspan=2 rowspan=2>";
$map_land[]= 27;
$map[]="</td><td>'</td><td>'</td></tr><tr><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td class=Europe rowspan=3 colspan=1>";
$map_land[]= 16;
$map[]="</td><td>'</td><td>'</td></tr><tr><td>'</td><td>'</td><td>'</td><td class=N_America rowspan=2 colspan=2>";
$map_land[]= 5;
$map[]="</td><td class=N_America rowspan=2 colspan=2>";
$map_land[]= 6;
$map[]="</td><td>'</td><td>'</td><td>'</td><td class=Europe rowspan=1 colspan=3>";
$map_land[]= 18;
$map[]="</td><td class=Asia rowspan=4 colspan=2>";
$map_land[]= 26;
$map[]="</td><td class=Asia rowspan=5 colspan=1>";
$map_land[]= 28;
$map[]="</td><td>'</td><td>'</td></tr><tr><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td class=bridge>-</td><td>'</td><td class=Asia rowspan=3 colspan=1>";
$map_land[]= 30;
$map[]="</td><td>'</td><td>'</td><td>'</td></tr><tr><td>'</td><td>'</td><td>'</td><td>'</td><td class=N_America rowspan=2 colspan=2>";
$map_land[]= 7;
$map[]="</td><td>'</td><td>'</td><td>'</td><td>'</td><td class=Africa rowspan=4 colspan=1>";
$map_land[]= 31;
$map[]="</td><td class=Africa rowspan=1 colspan=3>";
$map_land[]= 32;
$map[]="</td><td>'</td><td>'</td><td>'</td></tr><tr><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td class=Africa rowspan=2 colspan=3>";
$map_land[]= 33;
$map[]="</td><td class=bridge>-</td><td>'</td><td>'</td></tr><tr><td>'</td><td>'</td><td>'</td><td>'</td><td class=S_America rowspan=1 colspan=3>";
$map_land[]= 8;
$map[]="</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td class=Oceania>";
$map_land[]= 36;
$map[]="</td><td class=Oceania>";
$map_land[]= 37;
$map[]="</td><td>'</td></tr><tr><td>'</td><td>'</td><td>'</td><td>'</td><td class=S_America rowspan=2 colspan=2>";
$map_land[]= 10;
$map[]="</td><td class=S_America rowspan=3 colspan=3>";
$map_land[]= 9;
$map[]="</td><td class=bridge>-</td><td class=Africa rowspan=2 colspan=1>";
$map_land[]= 34;
$map[]="</td><td class=Africa rowspan=3 colspan=2>";
$map_land[]= 35;
$map[]="</td><td>'</td><td>'</td><td>'</td><td>'</td><td class=Oceania rowspan=2 colspan=1>";
$map_land[]= 38;
$map[]="</td><td class=Oceania rowspan=2 colspan=1>";
$map_land[]= 39;
$map[]="</td><td>'</td></tr><tr><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td></tr><tr><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td class=S_America rowspan=3 colspan=1>";
$map_land[]= 11;
$map[]="</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td></tr><tr><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td></tr><tr><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td><td>'</td></tr></table>";
function print_map($game, $other_data=null){
global $map_start, $map_land, $map;
print $map_start;
foreach($map_land as $i=> $land){
print $land;
if(isset($other_data[$land])) print ", $other_data[$land]";
print "<table border=1 align=center class=".$game->landowners[$land]."><td>".$game->nosoldiers[$land]."</td></table>";
print $map[$i];
}
}
?>
| 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 Contest Code Articles
More By Codewalkers
developerWorks - FREE Tools! |
You'll get answers to many questions and more from David Barnes, Lead Evangelist for IBM Emerging Internet Technologies. David will discuss aspects of Web 2.0 that bring value to corporations, academia, and government. He'll also discuss IBM's vision around Web 2.0, including the importance of remixability and consumability. The discussion will culminate with examples of various IBM Software Group solutions you can use to get ahead of the Web 2.0 adoption curve. FREE! Go There Now!
|
|
|
|
Join this webcast, to learn how the Rational Process Library can help with compliance issues, drive process improvement, and assist in service-oriented architecture (SOA) or Agile development. We will take a peek into the Rational Process Library with content around software and systems engineering (including RUP), operations and systems management, program and portfolio management, and asset and SOA governance. FREE! Go There Now!
|
|
|
|
Hear how IBM Rational Project and Portfolio Management integrated solutions help teams put the right tools and processes in place to maximize the effectiveness and efficiency of project teams and ensure that the business vision is being executed correctly. Learn how to automate and integrate requirements prioritization, top-down project planning, communications and controls, and methodology deployment to keep your scope, costs, and schedules under control. Tackle with an end-to-end approach the management of scope and scope changes, usage of methodology to control and empower project teams, and optimization of resources to align activity costs with the overall project plan. FREE! Go There Now!
|
|
|
|
Join this webcast to see how IBM Data Studio Developer and pureQuery can take the pain out of Java data access. uApplications developed using both Java and SQL have become a common requirement. Database connectivity using Java Database Connectivity (JDBC) to create an application is a multi-step tedious process, and tooling that covers both SQL and Java has been unavailable, until now. IBM Data Studio introduces the pureQuery platform: a high-performance, Java data access platform focused on simplifying the tasks of developing, managing, and optimizing database applications and services. FREE! Go There Now!
|
|
|
|
In this tutorial, you can learn how to install and configure the IBM Rational Asset Manager Eclipse client, explore the different views in the Asset Management perspective, learn various search techniques, work with existing assets, and submit a new asset. FREE! Go There Now!
|
|
|
|
XML has become a common way of storing business data as flat files and many data server vendors including IBM have provided ways to store this data within relational database systems. Increasingly collections of XML files are accessed like databases using an xQuery and other XML standard mechanisms. Businesses find the need to combine the traditional tabular structured data with XML formatted data. In this webcast, you’ll learn about IBM’s WebSphere Federation Server technology, which provides users with the ability to integrate these two data formats. FREE! Go There Now!
|
|
|
|
This webcast outlines the best practices that must be instituted to gain the maximum benefit from SOA while maintaining high quality of service. Whether you are deploying new applications or managing and monitoring your existing infrastructure, learn how you can ensure high quality of services with SOA based solutions from IBM. All registrants who attend this live Web Seminar will receive complimentary access to a white paper titled “Maintaining QoS in an SOA Environment”. FREE! Go There Now!
|
|
|
|
Join this Rational Talks to You teleconference on December 11 at 1:00 pm ET to get tips on building your own plugins with Rational Method Composer. Get your questions answered! FREE! Go There Now!
|
|
|
|
Whether you are creating new applications or modifying existing ones, managing integration of new components with traditional z/OS elements is a critical part of building and deploying modern applications. Listen to this webcast to see how IBM can help you optimize your development process using an IDE like Rational Developer for System z that integrates with management tools, such as ClearCase to manage your application development on mainframes. FREE! Go There Now!
|
|
|
|
In this webcast, you'll get an introduction to the eXtreme Transaction Processing (XTP) features of WebSphere Extended Deployment and the common architectural traits required by XTP applications. See how WebSphere Extended Deployment's ObjectGrid feature provides a state-of-the-art infrastructure for hosting XTP applications. FREE! Go There Now!
|
|
|
|
All FREE IBM® developerWorks Tools! |