spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / experts / javascript / column46


A DOM-Based Snakes Game, Part I (2)

Developer News
OpenOffice 3.2 Lands Amid Critical Changes
Red Hat, IBM Firmly in KVM Virtualization Camp
Red Hat Talks Up Open Source Cloud Plans

The Game Architecture

The architecture of the game board is based on the DIV container (see sketch below). This container includes 299 HTML tags, numbered 0 to 298. The tag types are also shown in the sketch below. The board is divided into several areas. The right most column is the <BR> column. This column's tags simulate a "new line" at the end of every row. The other 286 tags are <IMG> tags and constitute the game's visible board. The visible board is surrounded by a border that includes its outer images. (See the hashed images in the sketch below.) The images inside the border constitute the core of the board and is where the action takes place. The core includes 220 images, arranged in 11 rows of 20 images each. Every image on the board can be found by its row and column numbers. There are 23 columns, numbered 0 to 22. Likewise, there are 13 rows, numbered 0 to 12. The border includes columns 0 and 21, and rows 0 and 12. Column 22 is the <BR> column. As you can see from the sketch below, each image is also accessible as an element of a single array that includes all the images, numbered 0 to 298. We'll show you later in this column how to convert a row-column coordinates to a single array indexing.

http://www.internet.com

Produced by Yehuda Shiran and Tomer Shiran


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers

webref The latest from WebReference.com Browse >
Installing and Using Meeplace, the Business Review CMS · Sending an HTML and Plain Text E-newsletter with ASP.NET, Part 2 · Create Multilingual Web Sites with Windows Unicode Fonts
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
MySql View Technique for Grouping Crosstab Column Data · Why You Need a Mobile Web Site · Tame Web Marketing with Social Media Management


Created: August 16, 1999
Revised: August 16, 1999

URL: http://www.webreference.com/js/column46/architect.html