Contest Code
  Home arrow Contest Code arrow Risk - print_map($game, $some_array_of...
Codewalker Forums 
  Tutorials  
Database Articles  
Miscellaneous  
Navigation Usability  
PEAR Articles  
Programming Basics  
Server Administration  
XML Tutorials  
  Reviews  
Database Book Reviews  
Linux Book Reviews  
Miscellaneous Reviews  
PHP Book Reviews  
PHP Software Reviews  
Server Admin Reviews  
SQL Tool Reviews  
  Code Gallery  
Content Management Code  
Contest Code  
Counters Code  
Database Code  
Date Time Code  
Discussion Board Code  
Email Code  
File Manipulation Code  
GUI Code  
Link Farm Code  
Miscellaneous Code  
Search Code  
Site Navigation Code  
User Management Code  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Download TestComplete 
Forums Sitemap 
Weekly Newsletter 
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
CONTEST CODE

Risk - print_map($game, $some_array_of_size_40)
By: Codewalkers
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2003-07-16

    Table of Contents:

    Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    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

     

    IBM® developerWorks developerWorks - FREE Tools!


    NEW! IBM – Taking Web 2.0 to Work

    David Barnes, Lead Evangelist for IBM Emerging Internet Technologies 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!


    NEW! Accelerating Software Innovation on i on Power Systems

    Attend this launch webcast with Scott Hebner, Vice President of IBM Rational Marketing and Strategy, for an overview of Rational’s new software offerings and resources to help modernize and accelerate software innovation on i on Power Systems – while ensuring past application investments are protected and continue to grow. Learn how these solutions are helping customers extend their core i5/OS solutions toward modern architectures such as SOA and web technologies to deliver business improvements that stand the test of time.
    FREE! Go There Now!


    NEW! Achieving True Agility -- How process can change the behavior of your tools

    Achieving true agility is a never-ending effort. We will showcase how you can become agile incrementally, a few practices at the time.Which practices should any agile team strive to adopt? What additional practices should you consider based on your needs to scale? Adopting practices are however made much easier with the right tool support. What about if your tools adapt to your practices? We will take a look at how the Jazz technology can be leveraged to make your process change the behavior of your tools.
    FREE! Go There Now!


    NEW! Best Practices in Integrated Requirements Management

    Poor Requirements Management capabilities in an Enterprise have been linked to excessive project failures, escalating IT costs, and failure to deliver competitive advantage into the marketplace. Join Brianna M Smith from IBM Rational and learn about how successful organizations align IT and Business stakeholders through collaborative processes and tools for effective requirements management, and how an integrated approach across the IT lifecycle can provide unparalleled visibility and traceability to ensure that project teams are delivering on the business vision by "doing the right things" and "doing things right."
    FREE! Go There Now!


    NEW! Download a free trial of Lotus Quickr 8.0

    Visit IBM developerWorks to download a free trial version of Lotus Quickr 8.0, which enables collaboration by transforming the way everyday business content such as documents, rich media, photos, and video can be shared. Lotus Quickr makes it faster and easier to share content of all types (not just documents) within virtual teams. It is designed to make it easier to collaborate across organizational boundaries, while continuing to work within the context of familiar desktop applications.
    FREE! Go There Now!


    NEW! Download IBM WebSphere Portal V6.1 beta code

    Download the IBM WebSphere Portal V6.1 beta code and learn more about the rich features and enhancements in IBM WebSphere Portal V6.1. WebSphere Portal provides a composite application or business mashup framework and the advanced tooling needed to build flexible, SOA-based solutions, and scalability to meet the needs of any size organization.
    FREE! Go There Now!


    NEW! Evaluate IBM Rational Software Analyzer V7.0

    Download a free trial version of IBM Rational Software Analyzer Developer Edition V7.0 to identify bug defects earlier in the software development cycle. Rational Software Analyzer is an extensible software development solution that reduces the expense of bug-fixes by enabling static analysis code reviews and bug identification very early in the development cycle.
    FREE! Go There Now!


    NEW! Rational 'Talks to You' Teleconference Series

    This Fall, IBM Rational talks to you directly through a special teleconference series giving you access to the best minds in IBM Rational - product experts and market thought leaders who will answer your questions during these pre-scheduled telephone conference calls. Register today!
    FREE! Go There Now!


    NEW! Webcast: Quickly provide customized, integrated user interfaces with Lotus Notes 8

    IBM Lotus Notes 8 provides a wide range of developers the ability to provide customized, integrated user interfaces via composite applications and via custom sidebar and toolbar plug-ins. This webcast provides you with tips and techniques to use with out-of-the-box capabilities of Lotus Notes 8, and survey how you can share useful components within your own company and within a larger community.
    FREE! Go There Now!


    NEW! Webcast: What is new in Viper 2 for developers?

    Viper 2 brings a great value to developer communities including SQL, XML, PHP, Ruby, .NET and Java. You probably already know that DB2 Express-C is free for developers to develop, deploy and distribute. Viper 2 provides a variety of means that help move your application from the development stage to deployment more rapidly. This webcast shows how to best utilize the latest tools available for developing DB2 applications.
    FREE! Go There Now!



    All FREE IBM® developerWorks Tools!

    CONTEST CODE ARTICLES

    - Visual Map Editor And Generator
    - Corridors map generator
    - PHP-JAVA Class Code Generator
    - Risk - print_map($game, $some_array_of_size_...
    - Risk: The Original ShowGame/Map
    - Showgame2
    - Risk map output
    - CTF-Judge, better "auto" controls
    - Capture The Flag -- The JUDGE





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek