<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6459911684038758872</id><updated>2011-07-08T03:49:41.926-07:00</updated><category term='Research on Game Studio&apos;s'/><title type='text'>RamaKrishna</title><subtitle type='html'>Game Developer.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://ramakrishnanalluri.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6459911684038758872/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://ramakrishnanalluri.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Ram</name><uri>http://www.blogger.com/profile/06837494716141178442</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>4</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6459911684038758872.post-4373178780320436523</id><published>2010-03-21T01:29:00.000-07:00</published><updated>2010-03-21T01:34:40.888-07:00</updated><title type='text'>Common Functions</title><content type='html'>&lt;div&gt;//Common.h: Common formulas, procedures, etc..&lt;/div&gt;&lt;div&gt;////////////////////////////////////////////////////////////////////&lt;/div&gt;&lt;div&gt;//This is the freeware version 1.0&lt;/div&gt;&lt;div&gt;////////////////////////////////////////////////////////////////////&lt;/div&gt;&lt;div&gt;//&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;Included in the zipfile:&lt;/div&gt;&lt;div&gt;//ShelbyWorks Graphics Library V1.0 -- It's pretty nice, look it over&lt;/div&gt;&lt;div&gt;//Waveplay routine by Steven H. Don -- Pretty in depth and complicated&lt;/div&gt;&lt;div&gt;//Getpass.h by Thomas Grimes -- Password routine that only shows ***** when password is entered&lt;/div&gt;&lt;div&gt;//&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;None of these are related to this product, or to me&lt;/div&gt;&lt;div&gt;////////////////////////////////////////////////////////////////////////&lt;/div&gt;&lt;div&gt;//Made by Matt Selnekovic  instar@rocketmail.com &lt;-Feel free to send bug reports, etc.&lt;/div&gt;&lt;div&gt;//You MUST prototype the functions&lt;/div&gt;&lt;div&gt;//Good idea to print this out so you don't have to look it up each time&lt;/div&gt;&lt;div&gt;//This code was tested on Microsoft Visual C++, version 1.0 &lt;/div&gt;&lt;div&gt;/////////////////////////////////////////////////////////////////////////&lt;/div&gt;&lt;div&gt;//Visit my homepage which has nothing to do with programming, but oh well updates are coming sometime this millenia&lt;/div&gt;&lt;div&gt;//http://www.geocities.com/southbeach/lagoon/8410/index.html&lt;/div&gt;&lt;div&gt;/////////////////////////////////////////////////////////////////////////&lt;/div&gt;&lt;div&gt;//Sorry if the coding style varies slightly, I'm trying to get a consistant style, but it takes time  It is readable (to me) enough that I can make sense of it&lt;/div&gt;&lt;div&gt;/////////////////////////////////////////////////////////////////////////&lt;/div&gt;&lt;div&gt;//Yes, I know that many of these are implemented in some headers included with compilers already, but most are compiler specific and lots are macros, so I think that this will help clear some of it up&lt;/div&gt;&lt;div&gt;/////////////////////////////////////////////////////////////////////////&lt;/div&gt;&lt;div&gt;#include&lt;stdlib.h&gt;&lt;/div&gt;&lt;div&gt;#include&lt;time.h&gt;&lt;/div&gt;&lt;div&gt;#include&lt;dos.h&gt;&lt;/div&gt;&lt;div&gt;#include&lt;ctype.h&gt;&lt;/div&gt;&lt;div&gt;#include&lt;conio.h&gt;&lt;/div&gt;&lt;div&gt;#include"getpass.h"&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;//Make sure to put getpass.h and this file in the same directory, so this will work, or you could be like me and put all these files in the \include directory (cause I can never remember to put &lt;&gt;'s or ""'s)&lt;/div&gt;&lt;div&gt;#include&lt;string.h&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;////////////////////////////////&lt;/div&gt;&lt;div&gt;//Define PI to be 3.141592, and also define the function keys so they can be used in programs easily&lt;/div&gt;&lt;div&gt;//Use the F1 - F10 shortcuts with the getKey() function&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;#define PI 3.141592&lt;/div&gt;&lt;div&gt;#define F1 0x3b00&lt;/div&gt;&lt;div&gt;#define F2 0x3c00&lt;/div&gt;&lt;div&gt;#define F3 0x3d00&lt;/div&gt;&lt;div&gt;#define F4 0x3e00&lt;/div&gt;&lt;div&gt;#define F5 0x3f00&lt;/div&gt;&lt;div&gt;#define F6 0x4000&lt;/div&gt;&lt;div&gt;#define F7 0x4100&lt;/div&gt;&lt;div&gt;#define F8 0x4200&lt;/div&gt;&lt;div&gt;#define F9 0x4300&lt;/div&gt;&lt;div&gt;#define F10 0x4400&lt;/div&gt;&lt;div&gt;#define TRUE 1&lt;span class="Apple-tab-span" style="white-space:pre"&gt;			&lt;/span&gt;//True is 1&lt;/div&gt;&lt;div&gt;#define FALSE (!TRUE)&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;//False is not 1 or 0&lt;/div&gt;&lt;div&gt;#define COLS 80&lt;span class="Apple-tab-span" style="white-space:pre"&gt;			&lt;/span&gt;//DOS screen columns&lt;/div&gt;&lt;div&gt;#define ROWS 25&lt;span class="Apple-tab-span" style="white-space:pre"&gt;			&lt;/span&gt;//DOS screen rows&lt;/div&gt;&lt;div&gt;#define VIDEO 0x10&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;//Video interrupt&lt;/div&gt;&lt;div&gt;#define KEYBOARD 0x16&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;//Keyboard interrupt&lt;/div&gt;&lt;div&gt;#define MODE_13H 0x13 &lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;//VGA 320x200x256&lt;/div&gt;&lt;div&gt;#define TEXT_MODE 0x03 &lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;//Default Text Mode&lt;/div&gt;&lt;div&gt;#define SCREEN_WIDTH 320//Graphics information&lt;/div&gt;&lt;div&gt;#define SCREEN_HEIGHT 200&lt;/div&gt;&lt;div&gt;#define PALETTE_MASK 0x3C6&lt;/div&gt;&lt;div&gt;#define PALETTE_REGISTER_RD 0x3C7&lt;/div&gt;&lt;div&gt;#define PALETTE_REGISTER_WR 0x3C8&lt;/div&gt;&lt;div&gt;#define PALETTE_DATA 0x3C9&lt;/div&gt;&lt;div&gt;#define UPKEY 18432&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;//Define UPKEY as 18432 to be used with getKey returning an integer&lt;/div&gt;&lt;div&gt;#define DOWNKEY 20480&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;//Downkey is 20480 with getKey&lt;/div&gt;&lt;div&gt;#define LEFTKEY 19200&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;//Left is 19200&lt;/div&gt;&lt;div&gt;#define RIGHTKEY 19712&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;//Right is 19712&lt;/div&gt;&lt;div&gt;#define ESC 283&lt;span class="Apple-tab-span" style="white-space:pre"&gt;			&lt;/span&gt;//Escape is 283&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;//Common typedefs for data types, good for short quick access to commonly used variables&lt;/div&gt;&lt;div&gt;typedef unsigned char&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;    BYTE;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;//Unsigned char is a BYTE&lt;/div&gt;&lt;div&gt;typedef unsigned short      WORD;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;//Unsigned short integer is a WORD&lt;/div&gt;&lt;div&gt;typedef unsigned long       DWORD;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;//Unsigned long integer is a DWORD&lt;/div&gt;&lt;div&gt;typedef int&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;    &lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;BOOL;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;//Integer is a BOOL&lt;/div&gt;&lt;div&gt;typedef unsigned int &lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;UINT;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;//Unsigned integer is a UINT&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;///////////////////&lt;/div&gt;&lt;div&gt;//The Prototypes //&lt;/div&gt;&lt;div&gt;///////////////////&lt;/div&gt;&lt;div&gt;int square(int x);&lt;/div&gt;&lt;div&gt;int cube(int x);&lt;/div&gt;&lt;div&gt;float xToYth(int x, int y);&lt;/div&gt;&lt;div&gt;int maximum(int x,int y);&lt;/div&gt;&lt;div&gt;int minimum(int x, int y);&lt;/div&gt;&lt;div&gt;int rnd(int range);&lt;/div&gt;&lt;div&gt;int random(int range);&lt;/div&gt;&lt;div&gt;void pause(int delayp);&lt;/div&gt;&lt;div&gt;void doDOS(char *command);&lt;/div&gt;&lt;div&gt;void locate(int col, int row);&lt;/div&gt;&lt;div&gt;void cls(void);&lt;/div&gt;&lt;div&gt;int getKey(void);&lt;/div&gt;&lt;div&gt;int yorn(void);&lt;/div&gt;&lt;div&gt;void microDelay (long microSecs);&lt;/div&gt;&lt;div&gt;void milliDelay (long milliSecs);&lt;/div&gt;&lt;div&gt;void secDelay(long secs);&lt;/div&gt;&lt;div&gt;void minDelay(long mins);&lt;/div&gt;&lt;div&gt;void upperString(char *pS);&lt;/div&gt;&lt;div&gt;void lowerString(char *pS);&lt;/div&gt;&lt;div&gt;int password(char *prompt, char *pword);&lt;/div&gt;&lt;div&gt;float areaOfCircle(int r);&lt;/div&gt;&lt;div&gt;float circumference(int r);&lt;/div&gt;&lt;div&gt;float regionOfCircle(int r, int m);&lt;/div&gt;&lt;div&gt;float lengthOfArc(int r, int m);&lt;/div&gt;&lt;div&gt;float areaOfTriangle(int h, int b);&lt;/div&gt;&lt;div&gt;int areaOfRect(int l, int w);&lt;/div&gt;&lt;div&gt;float areaOfTrap(int h, int t, int b);&lt;/div&gt;&lt;div&gt;float areaOfQuadPD(int d, int e);&lt;/div&gt;&lt;div&gt;float areaOfPoly(int p, int t);&lt;/div&gt;&lt;div&gt;int volumeOfRect(int h, int w, int l);&lt;/div&gt;&lt;div&gt;int volumeOfPrism(int b, int h);&lt;/div&gt;&lt;div&gt;float volumeOfPyramid(int b, int h);&lt;/div&gt;&lt;div&gt;float volumeOfCylinder(int r, int h);&lt;/div&gt;&lt;div&gt;float volumeOfCone(int r, int h);&lt;/div&gt;&lt;div&gt;float volumeOfSphere(int r);&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;//////////////////////////////////////&lt;/div&gt;&lt;div&gt;//&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;M A T H  F U N C T I O N S &lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;    //&lt;/div&gt;&lt;div&gt;//////////////////////////////////////&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;int square(int x)//Squares an int&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;x*=x;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;return(x);&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;int cube(int x)//Cubes an int&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;x=x*x*x;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;return(x);&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;float xToYth(int x, int y)&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;//Stands for x to yth power&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;int i=0;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;//loop counter&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;int b=x;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;if(y==0)&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;return(1);&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;//If y is zero then return 1 (special case of powers)&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;if(y==1)&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;return(x);&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;//If y is one then return the x (another special case)&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;if(y==-1)&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;return(1/x);&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;//If y is negative one then return 1/x (another special case)&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;if(y&lt;0)&lt;span class="Apple-tab-span" style="white-space:pre"&gt;			&lt;/span&gt;//If y is less than -1, then you must put 1 over x to yth&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;{&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;i--;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;while(i&gt;y)&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;{&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;			&lt;/span&gt;i--;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;			&lt;/span&gt;x*=b;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;}&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;return((float)1/x);&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;}&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;if(y&gt;0)&lt;span class="Apple-tab-span" style="white-space:pre"&gt;			&lt;/span&gt;//Regular x to yth number&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;{&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;i++;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;while(i&lt;y)&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;{&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;			&lt;/span&gt;i++;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;			&lt;/span&gt;x*=b;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;}&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;return(x);&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;}&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;return(0);&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;//Return 0 if nothing above works(actually, all numbers work out, but the C++ compilier(mine) says that it doesn't have a default handler or something)&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;int maximum(int x,int y)//find larger number&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;if(x==y) &lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;return(0);&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;//Note: If this function returns a 0, then both are equal&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;if(x&lt;y)&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;x=y;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;return(x);&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;int minimum(int x, int y)//Find smaller number&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;if(x==y)&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;return(0);&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;//Note: If this function returns a 0, then both are equal&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;if(x&gt;y)&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;x=y;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;return(x);&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;int absolute(int x)//Find absolute value (distance from zero)&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;return(maximum(x,-x));&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;int isPos(int x)//Finds out if the number is positive, doesn't change it    use it for simple range checks&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;if(x==0)&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;return(FALSE);&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;//If number is 0, then it can't be either!(that's what I was taught in algebra)&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;if(x&gt;0)&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;return(TRUE);&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;else&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;return(FALSE);&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;int isNeg(int x)//Finds out if number is negative, doesn't change it&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;if(x==0)&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;return(FALSE);&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;//if number is 0, then it can't be negative, its not either&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;if(x&lt;0)&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;return(TRUE);&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;else&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;return(FALSE);&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;int toPos(int x)//Changes number to positive&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;if(isNeg(x))&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;x=-x;//Two negatives equal a postive (remember that from algebra?)&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;return(x);&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;int toNeg(int x)//Changes number to negative&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;if(isPos(x))&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;x=-x;//One negative equals... you get the picture&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;return(x);&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;int isEven(int x)//Finds if number is even&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;if(x%2==0)&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;return(TRUE);//If its remainder of division is 0, then it is even(return TRUE)&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;else&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;return(FALSE);&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;int isOdd(int x)//Finds if number is odd&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;if(x%2==1)&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;return(TRUE);&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;else&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;return(FALSE);&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;//////////////////////////////////////////////////////////////&lt;/div&gt;&lt;div&gt;//&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;B I O S  A N D  O T H E R  F U N C T I O N S&lt;span class="Apple-tab-span" style="white-space:pre"&gt;			&lt;/span&gt;//&lt;/div&gt;&lt;div&gt;//////////////////////////////////////////////////////////////&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;int rnd(int range)&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;//Requires STDLIB.h&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;int r;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;r=rand()%range;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;//Make random number, pare it down&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;return(r);&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;			&lt;/span&gt;&lt;/div&gt;&lt;div&gt;int random(int range)&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;//Call this function ONLY (for random numbers that is (Well, maybe  just be careful with the rnd function, it doesn't seed randomizer))&lt;/div&gt;&lt;div&gt;{&lt;span class="Apple-tab-span" style="white-space:pre"&gt;							&lt;/span&gt;//needs time.h&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;srand((unsigned)time(NULL));//Call timer, make unsigned, plant random seed&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;return(rnd(range));&lt;span class="Apple-tab-span" style="white-space:pre"&gt;			&lt;/span&gt;//Make random number, send to rnd() function&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;void pause(int delayp)&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;//This function takes in delayp*10000 to get time to wait so put in seconds or so&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;int delay;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;delayp*=10000;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;for(delay=0;delay&lt;delayp;delay++);&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;//wait loop, seems easy enough change 10000 if not long enough&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;void doDOS(char *command)&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;//This works in DOS programs, Windows programs might be messed up&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;system(command);&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;//Needs stdlib.h, simple enough&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;getch();&lt;span class="Apple-tab-span" style="white-space:pre"&gt;				&lt;/span&gt;//Wait here until key pressed&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;void locate(int col, int row)//Locate cursor at location on screen, also use in DOS programs only&lt;/div&gt;&lt;div&gt;{&lt;span class="Apple-tab-span" style="white-space:pre"&gt;							&lt;/span&gt; &lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;union REGS regs;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;regs.h.ah=0x02;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;regs.h.bh=0x00;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;regs.h.dh=row;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;regs.h.dl=col;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;int86(VIDEO,&amp;amp;regs,&amp;amp;regs);&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;void cls(void)&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;//clear screen, same as DOS command DOS programs only&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;union REGS regs;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;regs.h.ah=0x06;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;regs.h.al=0x00;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;regs.h.bh=0x07;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;regs.h.ch=0x00;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;regs.h.cl=0x00;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;regs.h.dh=ROWS-1;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;regs.h.dl=COLS-1;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;int86(VIDEO,&amp;amp;regs,&amp;amp;regs);&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;locate(0,0);&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;//Home cursor&lt;/div&gt;&lt;div&gt;}                                                         &lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;&lt;/div&gt;&lt;div&gt;int getKey(void)&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;//Reads keyboard for input, returns integer scancode  (For function keys, and combinations (shift, alt, control etc.))&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;union REGS regs;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;regs.h.ah=0x00;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;int86(KEYBOARD,&amp;amp;regs,&amp;amp;regs);&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;return(regs.x.ax);&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;int yorn(void)&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;//Gets a Y(es) or N(o) and returns TRUE for Y and FALSE for N  use it in if() statements or something&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;int done=FALSE;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;char c;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;while(!done)&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;{&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;c=toupper(getch());&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;if(c=='Y' || c=='N')&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;			&lt;/span&gt;done=TRUE;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;}&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;if(c=='Y') return(TRUE);&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;return(FALSE);&lt;/div&gt;&lt;div&gt;}&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;void microDelay(long microSecs)//A much better pause or delay function for C in microseconds&lt;/div&gt;&lt;div&gt;{       &lt;span class="Apple-tab-span" style="white-space:pre"&gt;						&lt;/span&gt;//Assembly code, don't try mucking with it (unless you know it)&lt;/div&gt;&lt;div&gt;  _asm {&lt;/div&gt;&lt;div&gt;    mov cx, word ptr [microSecs+2]&lt;/div&gt;&lt;div&gt;    mov dx, word ptr [microSecs]&lt;/div&gt;&lt;div&gt;    mov ah, 0x86&lt;/div&gt;&lt;div&gt;    int 0x15&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;void milliDelay(long milliSecs)//Milliseconds pause delay&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;microDelay(milliSecs*1000);&lt;/div&gt;&lt;div&gt;}&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;void secDelay(long secs)//Seconds delay&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;milliDelay(secs*1000);&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;void minDelay(long mins)//Minute delay, not that usefull, nobody wants to sit around for a minute&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;secDelay(mins*60);&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;void upperString(char *pS)//Makes a string uppercase, takes a string&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;while(*pS)//goes from start of string to the /0 (NULL) thing at the end &lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;{&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;if(islower(*pS))//If the character is lowercase...&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;			&lt;/span&gt;*pS=toupper(*pS);//Then make it uppercase and...&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;pS++;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;//go to the next character in the string&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;}&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;void lowerString(char *pS)//Makes a string lowercase, takes a string&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;while(*pS)&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;{&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;if(isupper(*pS))//Same as above(close, but reversed in key places)&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;			&lt;/span&gt;*pS=tolower(*pS);&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;pS++;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;}&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;int password(char *prompt, char *pword)//This password routine takes in two strings, first, the prompt message(add a \n at the end of it), and second, the actual password&lt;/div&gt;&lt;div&gt;{&lt;span class="Apple-tab-span" style="white-space:pre"&gt;										&lt;/span&gt;//This function basically simplifies the getpass function defined in getpass.h  it was given to me by Thomas Grimes, for which I thank him&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;int i=strcmp(getpass(prompt),pword);//String compare what you get from getpass, and the password&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;if(i==0)&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;//Strcmp returns three values 0 means exactly alike&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;return(TRUE);//If the person types the right one, then this returns TRUE(notice I didn't display the message confirming the right password, you do that&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;else&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;return(FALSE);//If the bloody scalawag doesn't then return FALSE&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;////////////////////////////////////////////////////////////////////////&lt;/div&gt;&lt;div&gt;//&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;G E O M E T R Y  F O R M U L A S&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;      &lt;span class="Apple-tab-span" style="white-space:pre"&gt;				&lt;/span&gt;  //&lt;/div&gt;&lt;div&gt;////////////////////////////////////////////////////////////////////////&lt;/div&gt;&lt;div&gt;//From here on in, I'll provide formula in comments for clarification //&lt;/div&gt;&lt;div&gt;//Also, in circle formulas r is radius, m is measure of degrees       //&lt;/div&gt;&lt;div&gt;//In triangles, h is height, b is base&lt;span class="Apple-tab-span" style="white-space:pre"&gt;				&lt;/span&gt;                  //&lt;/div&gt;&lt;div&gt;//In rectangles, l is length, w is width&lt;span class="Apple-tab-span" style="white-space:pre"&gt;							&lt;/span&gt;  //&lt;/div&gt;&lt;div&gt;////////////////////////////////////////////////////////////////////////&lt;/div&gt;&lt;div&gt;//Now you can write your own geometry program...           &lt;span class="Apple-tab-span" style="white-space:pre"&gt;			&lt;/span&gt;  //&lt;/div&gt;&lt;div&gt;//Actually, this could be useful for some types of graphics&lt;span class="Apple-tab-span" style="white-space:pre"&gt;			&lt;/span&gt;  //&lt;/div&gt;&lt;div&gt;////////////////////////////////////////////////////////////////////////&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;float areaOfCircle(int r)&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;float a;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;//area variable&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;//Finds area of a circle in terms of radius r&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;A=PI*r*r(r squared)&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;r*=r;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;//R squared&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;a=(float)PI*r;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;return(a);&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;float circumference(int r)&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;float c;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;//circumference variable&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;//finds circumference of circle&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;C=2*PI*r&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;c=(float)2*PI*r;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;return(c);&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;float regionOfCircle(int r, int m)&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;float a;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;//area variable&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;//find area of region in circle (think pie wedge)  m/360*PI*r*r (r squared)&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;a=(m/360)*(float)(PI*r*r);&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;return(a);&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;float lengthOfArc(int r, int m)&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;float l;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;//length variable&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;float c;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;//circumference variable&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;				&lt;/span&gt;//find length of arc in circle (think pie crust)&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;l/c=m/360&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;c=circumference(r);&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;l=c*(m/360);&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;return(l);&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;float areaOfTriangle(int h, int b)&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;float a;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;//area variable&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;//finds area of triangle&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;1/2*b*h&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;a=(float)0.5*(b*h);&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;return(a);&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;int areaOfRect(int l, int w)&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;&lt;/div&gt;&lt;div&gt;{&lt;span class="Apple-tab-span" style="white-space:pre"&gt;			&lt;/span&gt;//Note: Rectangles, squares, and parallelograms have same area formula&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;int a;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;//finds area of rectangle&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;l*w&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;a=l*w;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;return(a);&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;float areaOfTrap(int h, int t, int b) //H is height, T is top, B is base&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;float a=(float)0.5*h*(t+b);&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;//Area of trapezoid is 1/2 height times the sum of the two bases  1/2*H*(Top+Bottom)&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;return(a);&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;float areaOfQuadPD(int d, int e)&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;//Area of quadrilateral with perpendicular diagonals d is diagonal 1, e is diagonal 2 (doesn't matter what order)&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;float a=(float)0.5*d*e;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;return(a);&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;float areaOfPoly(int p, int t)&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;//Area of a regular polygon, p is perimeter, t is the apothem&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;float a=(float)0.5*p*t;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;//Area is 1/2 of perimeter times apothem&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;return(a);&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;int volumeOfRect(int h, int w, int l)&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;//Volume of a right rectangular prism&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;int v=h*w*l;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;//Volume is height times length times width&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;return(v);&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;int volumeOfPrism(int b, int h)&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;//Volume of generic prism, b is area of base, use above formulas to find&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;int v=b*h;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;//Volume of prism is area of base times height&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;return(v);&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;float volumeOfPyramid(int b, int h)&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;//Volume of pyramid&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;float v=(b*h)/3;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;//Volume of pyramid is 1/3 area of base times height &lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;return(v);&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;float volumeOfCylinder(int r, int h)&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;//r radius of base, h height&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;float v;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;r*=r;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;//R squared&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;v=(float)PI*r*h;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;//Volume of cylinder is PI*r*r*h&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;return(v);&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;float volumeOfCone(int r, int h)&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;float v;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;r*=r;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;//R squared&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;v=(float)(PI*r*h)/3;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;//Volume of cone is 1/3 of PI*r*r*h&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;return(v);&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;float volumeOfSphere(int r)&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;float x=4/3;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;float v;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;r=r*r*r;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;			&lt;/span&gt;//R cubed&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;v=(float)PI*r*x;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;//Volume of sphere is 4/3 PI*r*r*r&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;return(v);&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;&lt;/div&gt;&lt;div&gt;///////////////////////////////////////////////////////////&lt;/div&gt;&lt;div&gt;//Anything this or you do to your computer is not my fault.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;///////////////////////////////////////////////////////////&lt;/div&gt;&lt;div&gt;//COPYRIGHT INFORMATION&lt;/div&gt;&lt;div&gt;//This source code can be used by any person in their own programs for free.  The Author of this source code allows anyone to freely use this as they please in their own programs.  &lt;/div&gt;&lt;div&gt;//DOS is a copyright of Microsoft.  Other copyrights are trademarks of their respective owners.&lt;/div&gt;&lt;div&gt;//Copying this for commercial sale, exploitation, or any other uses not implied here is not allowed.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;2.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;//ShelbyWorks Graphics Library V1.0&lt;/div&gt;&lt;div&gt;//Graphic.h&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;#include &lt;stdio.h&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;#include &lt;conio.h&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;#include &lt;stdlib.h&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;#include &lt;dos.h&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;#include &lt;mem.h&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;#include &lt;math.h&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;#include &lt;string.h&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;#define sgn(x) ((x&lt;0)?-1:((x&gt;0)?1:0)) /* macro to return the sign of a&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;					&lt;/span&gt; number */&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;/* macro to skip bytes in a file */&lt;/div&gt;&lt;div&gt;#define fskip(fp,n)   \&lt;/div&gt;&lt;div&gt;{                     \&lt;/div&gt;&lt;div&gt;   int i;             \&lt;/div&gt;&lt;div&gt;                      \&lt;/div&gt;&lt;div&gt;   for (i=0;i&lt;n;i++)&gt;&lt;div&gt;      fgetc(fp);      \&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;typedef unsigned char  byte;&lt;/div&gt;&lt;div&gt;typedef unsigned short word;&lt;/div&gt;&lt;div&gt;typedef long           fixed16_16;&lt;/div&gt;&lt;div&gt;typedef unsigned long  dword;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;//Circle&lt;/div&gt;&lt;div&gt;fixed16_16 SIN_ACOS[1024];&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;word VID = 0;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;//for line draw alogorthim&lt;/div&gt;&lt;div&gt;byte *VGA=(byte *)0xA0000000L;        /* this points to video memory. */&lt;/div&gt;&lt;div&gt;byte *screen=(byte *)0xA0000000L;        /* this points to video memory. */&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;void SineTable()&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;word i;&lt;/div&gt;&lt;div&gt;for(i=0;i&lt;1024;i++)&gt;&lt;div&gt;  {&lt;/div&gt;&lt;div&gt;    SIN_ACOS[i]=sin(acos((float)i/1024))*0x10000L;&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;// maximum screen width&lt;/div&gt;&lt;div&gt;int getmaxx(void)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  {&lt;/div&gt;&lt;div&gt;    if (VID == 1)&lt;/div&gt;&lt;div&gt;    return 639;&lt;/div&gt;&lt;div&gt;    if (VID == 2)&lt;/div&gt;&lt;div&gt;    return 319;&lt;/div&gt;&lt;div&gt;   else&lt;/div&gt;&lt;div&gt;   return  0;&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;//maximum screen hieght&lt;/div&gt;&lt;div&gt;int getmaxy(void)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  {&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    if(VID == 1)&lt;/div&gt;&lt;div&gt;    return 479;&lt;/div&gt;&lt;div&gt;    if (VID == 2)&lt;/div&gt;&lt;div&gt;    return 199;&lt;/div&gt;&lt;div&gt;    else&lt;/div&gt;&lt;div&gt;    return 0;&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  //maximum  mumber of colors&lt;/div&gt;&lt;div&gt;int getmaxcolor(void)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  {&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    return 255;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;//sets screen to 320*200*250 VGA/EGA&lt;/div&gt;&lt;div&gt;void SetVGA()&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;VID = 2;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  union REGS regs;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  regs.h.ah = 0x00;&lt;/div&gt;&lt;div&gt;  regs.h.al = 0x13;&lt;/div&gt;&lt;div&gt;  int86(0x10, &amp;amp;regs, &amp;amp;regs);&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;//sets screen to 640*480*250 SVGA&lt;/div&gt;&lt;div&gt;void SetSVGA(void)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  {&lt;/div&gt;&lt;div&gt;  VID = 1;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    asm mov ax,0x4f02;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    asm mov bx,0x101;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    asm int 0x10;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;// sets 80x25 Text mode&lt;/div&gt;&lt;div&gt;void SetTEXT(void)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  {&lt;/div&gt;&lt;div&gt;  VID = 0;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    asm mov ax,0x0003;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    asm int 0x10;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;//Put Pixel VGA&lt;/div&gt;&lt;div&gt;void VGAPixel (unsigned int x, unsigned int y, unsigned char c)&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;  VGA[(y &lt;&lt;&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;//Put Pixel SVGA&lt;/div&gt;&lt;div&gt;void SVGAPixel (unsigned int x, unsigned int y, unsigned char c)&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;  VGA[y * 640 + x] = c;&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;// draws a line // Using Floating Point for Accuracy  //VGA ONLY&lt;/div&gt;&lt;div&gt;void drawline(float x1, float y1, float x2, float y2, byte color)&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;  int i,dx,dy,sdx,sdy,dxabs,dyabs,x,y,px,py;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  dx=x2-x1;      /* the horizontal distance of the line */&lt;/div&gt;&lt;div&gt;  dy=y2-y1;      /* the vertical distance of the line */&lt;/div&gt;&lt;div&gt;  dxabs=abs(dx);&lt;/div&gt;&lt;div&gt;  dyabs=abs(dy);&lt;/div&gt;&lt;div&gt;  sdx=sgn(dx);&lt;/div&gt;&lt;div&gt;  sdy=sgn(dy);&lt;/div&gt;&lt;div&gt;  x=dyabs&gt;&gt;1;&lt;/div&gt;&lt;div&gt;  y=dxabs&gt;&gt;1;&lt;/div&gt;&lt;div&gt;  px=x1;&lt;/div&gt;&lt;div&gt;  py=y1;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  VGA[py*320+px]=color;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  if (dxabs&gt;=dyabs) /* the line is more horizontal than vertical */&lt;/div&gt;&lt;div&gt;  {&lt;/div&gt;&lt;div&gt;    for(i=0;i&lt;dxabs;i++)&lt;/div&gt;&lt;div&gt;    {&lt;/div&gt;&lt;div&gt;      y+=dyabs;&lt;/div&gt;&lt;div&gt;      if (y&gt;=dxabs)&lt;/div&gt;&lt;div&gt;      {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;y-=dxabs;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;py+=sdy;&lt;/div&gt;&lt;div&gt;      }&lt;/div&gt;&lt;div&gt;      px+=sdx;&lt;/div&gt;&lt;div&gt;      VGAPixel(px,py,color);&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;  else /* the line is more vertical than horizontal */&lt;/div&gt;&lt;div&gt;  {&lt;/div&gt;&lt;div&gt;    for(i=0;i&lt;dyabs;i++)&lt;/div&gt;&lt;div&gt;    {&lt;/div&gt;&lt;div&gt;      x+=dxabs;&lt;/div&gt;&lt;div&gt;      if (x&gt;=dyabs)&lt;/div&gt;&lt;div&gt;      {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;x-=dyabs;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;px+=sdx;&lt;/div&gt;&lt;div&gt;      }&lt;/div&gt;&lt;div&gt;      py+=sdy;&lt;/div&gt;&lt;div&gt;      VGAPixel(px,py,color);&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;//Draws Non-Filled Rectangle    SVGA ONLY&lt;/div&gt;&lt;div&gt;void Rect(int left,int top, int right, int bottom, byte color)&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;  word top_offset,bottom_offset,i,temp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  if (top&gt;bottom)&lt;/div&gt;&lt;div&gt;  {&lt;/div&gt;&lt;div&gt;    temp=top;&lt;/div&gt;&lt;div&gt;    top=bottom;&lt;/div&gt;&lt;div&gt;    bottom=temp;&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;  if (left&gt;right)&lt;/div&gt;&lt;div&gt;  {&lt;/div&gt;&lt;div&gt;    temp=left;&lt;/div&gt;&lt;div&gt;    left=right;&lt;/div&gt;&lt;div&gt;    right=temp;&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  top_offset=(top&lt;&lt;8)+(top&lt;&lt;6);&lt;/div&gt;&lt;div&gt;  bottom_offset=(bottom&lt;&lt;8)+(bottom&lt;&lt;6);&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  for(i=left;i&lt;=right;i++)&lt;/div&gt;&lt;div&gt;  {&lt;/div&gt;&lt;div&gt;    VGA[top_offset+i]=color;&lt;/div&gt;&lt;div&gt;    VGA[bottom_offset+i]=color;&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;  for(i=top_offset;i&lt;=bottom_offset;i+=640)&lt;/div&gt;&lt;div&gt;  {&lt;/div&gt;&lt;div&gt;    VGA[left+i]=color;&lt;/div&gt;&lt;div&gt;    VGA[right+i]=color;&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;//Draws Filled in Rectangle SVGA ONLY&lt;/div&gt;&lt;div&gt;void SolidRect(int left,int top, int right, int bottom, byte color)&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;  word top_offset,bottom_offset,i,temp,width;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  if (top&gt;bottom)&lt;/div&gt;&lt;div&gt;  {&lt;/div&gt;&lt;div&gt;    temp=top;&lt;/div&gt;&lt;div&gt;    top=bottom;&lt;/div&gt;&lt;div&gt;    bottom=temp;&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;  if (left&gt;right)&lt;/div&gt;&lt;div&gt;  {&lt;/div&gt;&lt;div&gt;    temp=left;&lt;/div&gt;&lt;div&gt;    left=right;&lt;/div&gt;&lt;div&gt;    right=temp;&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  top_offset=(top&lt;&lt;8)+(top&lt;&lt;6)+left;&lt;/div&gt;&lt;div&gt;  bottom_offset=(bottom&lt;&lt;8)+(bottom&lt;&lt;6)+left;&lt;/div&gt;&lt;div&gt;  width=right-left+1;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  for(i=top_offset;i&lt;=bottom_offset;i+=640)&lt;/div&gt;&lt;div&gt;  {&lt;/div&gt;&lt;div&gt;    memset(&amp;amp;VGA[i],color,width);&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;//Bitmap Viewer Begins Here*******************************&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;//Bitmap File Structure&lt;/div&gt;&lt;div&gt;typedef struct tagBITMAP              /* the structure for a bitmap. */&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;  word width;&lt;/div&gt;&lt;div&gt;  word height;&lt;/div&gt;&lt;div&gt;  byte *data;&lt;/div&gt;&lt;div&gt;} BITMAP;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;//Bitmap Loader&lt;/div&gt;&lt;div&gt;void load_bmp(char *file,BITMAP *b)&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;  FILE *fp;&lt;/div&gt;&lt;div&gt;  long index;&lt;/div&gt;&lt;div&gt;  int x;&lt;/div&gt;&lt;div&gt;  int num_colors;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  /* open the file */&lt;/div&gt;&lt;div&gt;  if ((fp = fopen(file,"rb")) == NULL)&lt;/div&gt;&lt;div&gt;  {&lt;/div&gt;&lt;div&gt;    printf("Error opening file %s.\n",file);&lt;/div&gt;&lt;div&gt;    exit(1);&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  /* check to see if it is a valid bitmap file */&lt;/div&gt;&lt;div&gt;  if (fgetc(fp)!='B' || fgetc(fp)!='M')&lt;/div&gt;&lt;div&gt;  {&lt;/div&gt;&lt;div&gt;    fclose(fp);&lt;/div&gt;&lt;div&gt;    printf("%s is not a bitmap file.\n",file);&lt;/div&gt;&lt;div&gt;    exit(1);&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  /* read in the width and height of the image, and the&lt;/div&gt;&lt;div&gt;     number of colors used; ignore the rest */&lt;/div&gt;&lt;div&gt;  fskip(fp,16);&lt;/div&gt;&lt;div&gt;  fread(&amp;amp;b-&gt;width, sizeof(word), 1, fp);&lt;/div&gt;&lt;div&gt;  fskip(fp,2);&lt;/div&gt;&lt;div&gt;  fread(&amp;amp;b-&gt;height,sizeof(word), 1, fp);&lt;/div&gt;&lt;div&gt;  fskip(fp,22);&lt;/div&gt;&lt;div&gt;  fread(&amp;amp;num_colors,sizeof(word), 1, fp);&lt;/div&gt;&lt;div&gt;  fskip(fp,6);&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  /* assume we are working with an 8-bit file */&lt;/div&gt;&lt;div&gt;  if (num_colors==0) num_colors=256;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  /* try to allocate memory */&lt;/div&gt;&lt;div&gt;  if ((b-&gt;data = (byte *) malloc((word)(b-&gt;width*b-&gt;height))) == NULL)&lt;/div&gt;&lt;div&gt;  {&lt;/div&gt;&lt;div&gt;    fclose(fp);&lt;/div&gt;&lt;div&gt;    printf("Error allocating memory for file %s.\n",file);&lt;/div&gt;&lt;div&gt;    exit(1);&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  /* Ignore the palette information for now.&lt;/div&gt;&lt;div&gt;     See palette.c for code to read the palette info. */&lt;/div&gt;&lt;div&gt;  fskip(fp,num_colors*4);&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  /* read the bitmap */&lt;/div&gt;&lt;div&gt;  for(index=(b-&gt;height-1)*b-&gt;width;index&gt;=0;index-=b-&gt;width)&lt;/div&gt;&lt;div&gt;    for(x=0;x&lt;b-&gt;width;x++)&lt;/div&gt;&lt;div&gt;      b-&gt;data[(word)index+x]=(byte)fgetc(fp);&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  fclose(fp);&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;//Draws Bitmap  //TransParent  //SVGA ONLY&lt;/div&gt;&lt;div&gt;void draw_bmp(BITMAP *bmp,int x,int y)&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;  int i,j;&lt;/div&gt;&lt;div&gt;  word screen_offset = y * 640;&lt;/div&gt;&lt;div&gt;  word bitmap_offset = 0;&lt;/div&gt;&lt;div&gt;  byte data;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  for(j=0;j&lt;bmp-&gt;height;j++)&lt;/div&gt;&lt;div&gt;  {&lt;/div&gt;&lt;div&gt;    for(i=0;i&lt;bmp-&gt;width;i++,bitmap_offset++)&lt;/div&gt;&lt;div&gt;    {&lt;/div&gt;&lt;div&gt;      data = bmp-&gt;data[bitmap_offset];&lt;/div&gt;&lt;div&gt;      if (data) VGA[screen_offset+x+i] = data;&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;    screen_offset+=640;&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;void VGA_bmp(BITMAP *bmp,int x,int y)&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;  int i,j;&lt;/div&gt;&lt;div&gt;  word screen_offset = y * 320;&lt;/div&gt;&lt;div&gt;  word bitmap_offset = 0;&lt;/div&gt;&lt;div&gt;  byte data;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  for(j=0;j&lt;bmp-&gt;height;j++)&lt;/div&gt;&lt;div&gt;  {&lt;/div&gt;&lt;div&gt;    for(i=0;i&lt;bmp-&gt;width;i++,bitmap_offset++)&lt;/div&gt;&lt;div&gt;    {&lt;/div&gt;&lt;div&gt;      data = bmp-&gt;data[bitmap_offset];&lt;/div&gt;&lt;div&gt;      if (data) VGA[screen_offset+x+i] = data;&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;    screen_offset+=320;&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;//Ends Here*******************************&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;//Graphics Interchange Format (.GIF) 87a and 89a Veiwer&lt;/div&gt;&lt;div&gt;typedef&lt;/div&gt;&lt;div&gt;  struct GIFHeader {&lt;/div&gt;&lt;div&gt;    char          Signature [7];&lt;/div&gt;&lt;div&gt;    unsigned int  ScreenWidth, ScreenHeight;&lt;/div&gt;&lt;div&gt;    unsigned char Depth, Background, Zero;&lt;/div&gt;&lt;div&gt;  };&lt;/div&gt;&lt;div&gt;  struct GIFDescriptor {&lt;/div&gt;&lt;div&gt;    char          Separator;&lt;/div&gt;&lt;div&gt;    unsigned int  ImageLeft, ImageTop, ImageWidth, ImageHeight;&lt;/div&gt;&lt;div&gt;    unsigned char Depth;&lt;/div&gt;&lt;div&gt;  };&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;FILE                 *GIFFile;&lt;/div&gt;&lt;div&gt;  unsigned int         BPointer;&lt;/div&gt;&lt;div&gt;  unsigned char        Buffer [257];&lt;/div&gt;&lt;div&gt;  //GIF data is stored in blocks of a certain size&lt;/div&gt;&lt;div&gt;  unsigned char        BlockSize;&lt;/div&gt;&lt;div&gt;  //For loading the code&lt;/div&gt;&lt;div&gt;  unsigned char        CodeSize;&lt;/div&gt;&lt;div&gt;  char                 BitsIn;&lt;/div&gt;&lt;div&gt;  unsigned char        Temp;&lt;/div&gt;&lt;div&gt;  //Coordinates&lt;/div&gt;&lt;div&gt;  unsigned int         X, Y, tlX, tlY, brX, brY;&lt;/div&gt;&lt;div&gt;  //The string table&lt;/div&gt;&lt;div&gt;  unsigned int         Prefix [4096];&lt;/div&gt;&lt;div&gt;  unsigned char        Suffix [4096];&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt; void SetDAC(unsigned char DAC, unsigned char R, unsigned char G, unsigned char B)&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;  outportb (0x3C8, DAC);&lt;/div&gt;&lt;div&gt;  outportb (0x3C9, R);&lt;/div&gt;&lt;div&gt;  outportb (0x3C9, G);&lt;/div&gt;&lt;div&gt;  outportb (0x3C9, B);&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;unsigned char LoadByte ()&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;  //Read next block}&lt;/div&gt;&lt;div&gt;  if (BPointer == BlockSize) {&lt;/div&gt;&lt;div&gt;    fread (Buffer, BlockSize + 1, 1, GIFFile);&lt;/div&gt;&lt;div&gt;    BPointer = 0;&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  //Return byte&lt;/div&gt;&lt;div&gt;  return Buffer [BPointer++];&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;//Procedure to read the next code from the file&lt;/div&gt;&lt;div&gt;unsigned int ReadCode ()&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;  int           Counter;&lt;/div&gt;&lt;div&gt;  unsigned int  Code;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  Code = 0;&lt;/div&gt;&lt;div&gt;  //Read the code, bit by bit&lt;/div&gt;&lt;div&gt;  for (Counter = 0; Counter &lt;&gt;&lt;div&gt;    //Maybe, a new byte needs to be loaded with a further 8 bits&lt;/div&gt;&lt;div&gt;    if (++BitsIn == 9) {&lt;/div&gt;&lt;div&gt;      Temp = LoadByte ();&lt;/div&gt;&lt;div&gt;      BitsIn = 1;&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    //Add the current bit to the code&lt;/div&gt;&lt;div&gt;    if (Temp &amp;amp; 1) Code += 1 &lt;&lt;&gt;&lt;div&gt;    Temp &gt;&gt;= 1;&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;  return Code;&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;//Procedure to draw a pixel&lt;/div&gt;&lt;div&gt;void NextVGA (unsigned int c)&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;  //Actually draw the pixel on screen&lt;/div&gt;&lt;div&gt;  VGAPixel (X, Y, c &amp;amp; 255);&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  //Move to next row, if necessary&lt;/div&gt;&lt;div&gt;  if (++X == brX) {&lt;/div&gt;&lt;div&gt;    X = tlX;&lt;/div&gt;&lt;div&gt;    Y++;&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;void NextSVGA (unsigned int c)&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;  //Actually draw the pixel on screen&lt;/div&gt;&lt;div&gt;  SVGAPixel (X, Y, c &amp;amp; 255);&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  //Move to next row, if necessary&lt;/div&gt;&lt;div&gt;  if (++X == brX) {&lt;/div&gt;&lt;div&gt;    X = tlX;&lt;/div&gt;&lt;div&gt;    Y++;&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;//Local function to output a string. Returns the first character.&lt;/div&gt;&lt;div&gt;unsigned char OutString (unsigned int CurCode)&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;  unsigned int  OutCount;&lt;/div&gt;&lt;div&gt;  unsigned char OutCode [1024];&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  //If it's a single character, output that&lt;/div&gt;&lt;div&gt;  if (CurCode &lt;&gt;&lt;div&gt;    NextVGA (CurCode);&lt;/div&gt;&lt;div&gt;  } else {&lt;/div&gt;&lt;div&gt;    OutCount = 0;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    //Store the string, which ends up in reverse order&lt;/div&gt;&lt;div&gt;    do {&lt;/div&gt;&lt;div&gt;      OutCode [OutCount++] = Suffix [CurCode];&lt;/div&gt;&lt;div&gt;      CurCode = Prefix [CurCode];&lt;/div&gt;&lt;div&gt;    } while (CurCode &gt; 255);&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    //Add the last character&lt;/div&gt;&lt;div&gt;    OutCode [OutCount++] = CurCode;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    //Output all the string, in the correct order&lt;/div&gt;&lt;div&gt;    do {&lt;/div&gt;&lt;div&gt;      NextVGA (OutCode [--OutCount]);&lt;/div&gt;&lt;div&gt;    } while (OutCount);&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;  //Return 1st character&lt;/div&gt;&lt;div&gt;  return CurCode;&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;//This actually loads the GIF&lt;/div&gt;&lt;div&gt;void VGA_GIF (char *Filename)&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;  //For loading from the GIF file&lt;/div&gt;&lt;div&gt;  struct GIFHeader     Header;&lt;/div&gt;&lt;div&gt;  struct GIFDescriptor Descriptor;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  //Colour information&lt;/div&gt;&lt;div&gt;  unsigned char        BitsPerPixel,&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;       NumOfColours;&lt;/div&gt;&lt;div&gt;  unsigned int         DAC;&lt;/div&gt;&lt;div&gt;  unsigned char        Palette [256][3];&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  //For indexing the string table&lt;/div&gt;&lt;div&gt;  unsigned int         FirstFree, FreeCode;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  //All the code information&lt;/div&gt;&lt;div&gt;  unsigned char        InitCodeSize;&lt;/div&gt;&lt;div&gt;  unsigned int         Code, OldCode, MaxCode;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  //Special codes&lt;/div&gt;&lt;div&gt;  unsigned int         ClearCode, EOICode;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  //Check whether the GIF file exists, and open it&lt;/div&gt;&lt;div&gt;  GIFFile = fopen (Filename, "rb");&lt;/div&gt;&lt;div&gt;  if (GIFFile == 0) {&lt;/div&gt;&lt;div&gt;    SetTEXT ();&lt;/div&gt;&lt;div&gt;    printf ("Could not open file %s", Filename);&lt;/div&gt;&lt;div&gt;    return;&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  //Read header&lt;/div&gt;&lt;div&gt;  fread (&amp;amp;Header, 6, 1, GIFFile);&lt;/div&gt;&lt;div&gt;  Header.Signature [6] = 0;&lt;/div&gt;&lt;div&gt;  fread (&amp;amp;Header.ScreenWidth, sizeof (Header) - 7, 1, GIFFile);&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  //Check signature and terminator&lt;/div&gt;&lt;div&gt;  if ((strcmp (Header.Signature, "GIF87a")&lt;/div&gt;&lt;div&gt;    &amp;amp;&amp;amp; strcmp (Header.Signature, "GIF89a"))&lt;/div&gt;&lt;div&gt;    || Header.Zero) {&lt;/div&gt;&lt;div&gt;    SetTEXT ();&lt;/div&gt;&lt;div&gt;    printf ("Not a valid GIF file\n");&lt;/div&gt;&lt;div&gt;    return;&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  //Get amount of colours in image&lt;/div&gt;&lt;div&gt;  BitsPerPixel = 1 + (Header.Depth &amp;amp; 7);&lt;/div&gt;&lt;div&gt;  NumOfColours = (1 &lt;&lt;&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  //Load global colour map&lt;/div&gt;&lt;div&gt;  fread (Palette, 3, (NumOfColours + 1), GIFFile);&lt;/div&gt;&lt;div&gt;  for (DAC = 0; DAC &lt;= NumOfColours; DAC++)&lt;/div&gt;&lt;div&gt;    SetDAC (DAC, Palette [DAC][0] &gt;&gt; 2,&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt; Palette [DAC][1] &gt;&gt; 2,&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt; Palette [DAC][2] &gt;&gt; 2);&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  //Load the image descriptor&lt;/div&gt;&lt;div&gt;  fread (&amp;amp;Descriptor, sizeof (Descriptor), 1, GIFFile);&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  if (Descriptor.Separator != ',') {&lt;/div&gt;&lt;div&gt;    SetTEXT ();&lt;/div&gt;&lt;div&gt;    printf ("Incorrect image descriptor.\n");&lt;/div&gt;&lt;div&gt;    return;&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  //Get image corner coordinates&lt;/div&gt;&lt;div&gt;  tlX = Descriptor.ImageLeft;&lt;/div&gt;&lt;div&gt;  tlY = Descriptor.ImageTop;&lt;/div&gt;&lt;div&gt;  brX = tlX + Descriptor.ImageWidth;&lt;/div&gt;&lt;div&gt;  brY = tlY + Descriptor.ImageHeight;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  //Some restrictions apply&lt;/div&gt;&lt;div&gt;  if (Descriptor.Depth &amp;amp; 128) {&lt;/div&gt;&lt;div&gt;    SetTEXT ();&lt;/div&gt;&lt;div&gt;    printf ("Local colour maps not supported\n");&lt;/div&gt;&lt;div&gt;    return;&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;  if (Descriptor.Depth &amp;amp; 64) {&lt;/div&gt;&lt;div&gt;    SetTEXT ();&lt;/div&gt;&lt;div&gt;    printf ("Interlaced images not supported\n");&lt;/div&gt;&lt;div&gt;    return;&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  //Get initial code size&lt;/div&gt;&lt;div&gt;  fread (&amp;amp;CodeSize, 1, 1, GIFFile);&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  //GIF data is stored in blocks, so it's necessary to know the size&lt;/div&gt;&lt;div&gt;  fread (&amp;amp;BlockSize, 1, 1, GIFFile);&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  //Start loader&lt;/div&gt;&lt;div&gt;  BPointer = BlockSize;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  //Special codes used in the GIF spec&lt;/div&gt;&lt;div&gt;  ClearCode        = 1 &lt;&lt;&gt;&lt;div&gt;  EOICode          = ClearCode + 1;     //End of file&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  //Initialize the string table&lt;/div&gt;&lt;div&gt;  FirstFree        = ClearCode + 2;     //Strings start here&lt;/div&gt;&lt;div&gt;  FreeCode         = FirstFree;         //Strings can be added here&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  //Initial size of the code and its maximum value&lt;/div&gt;&lt;div&gt;  InitCodeSize     = ++CodeSize;&lt;/div&gt;&lt;div&gt;  MaxCode          = 1 &lt;&lt;&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  BitsIn = 8;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  //Start at top left of image&lt;/div&gt;&lt;div&gt;  X = Descriptor.ImageLeft;&lt;/div&gt;&lt;div&gt;  Y = Descriptor.ImageTop;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  do {&lt;/div&gt;&lt;div&gt;    //Read next code&lt;/div&gt;&lt;div&gt;    Code = ReadCode ();&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    //If it's an End-Of-Information code, stop processing&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt; if (Code == EOICode) break;&lt;/div&gt;&lt;div&gt;    //If it's a clear code...&lt;/div&gt;&lt;div&gt;    else if (Code == ClearCode) {&lt;/div&gt;&lt;div&gt;      //Clear the string table&lt;/div&gt;&lt;div&gt;      FreeCode = FirstFree;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;      //Set the code size to initial values&lt;/div&gt;&lt;div&gt;      CodeSize = InitCodeSize;&lt;/div&gt;&lt;div&gt;      MaxCode  = 1 &lt;&lt;&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;      //The next code may be read&lt;/div&gt;&lt;div&gt;      Code = ReadCode ();&lt;/div&gt;&lt;div&gt;      OldCode = Code;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;      //Set pixel&lt;/div&gt;&lt;div&gt;      NextVGA (Code);&lt;/div&gt;&lt;div&gt;    //Other codes&lt;/div&gt;&lt;div&gt;    } else {&lt;/div&gt;&lt;div&gt;      /*If the code is already in the string table, it's string is displayed,&lt;/div&gt;&lt;div&gt;      and the old string followed by the new string's first character is&lt;/div&gt;&lt;div&gt;      added to the string table.*/&lt;/div&gt;&lt;div&gt;      if (Code &lt;&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;Suffix [FreeCode] = OutString (Code);&lt;/div&gt;&lt;div&gt;      else {&lt;/div&gt;&lt;div&gt;      /*If it is not already in the string table, the old string followed by&lt;/div&gt;&lt;div&gt;      the old string's first character is added to the string table and&lt;/div&gt;&lt;div&gt;      displayed.*/&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;Suffix [FreeCode] = OutString (OldCode);&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;NextVGA (Suffix [FreeCode]);&lt;/div&gt;&lt;div&gt;      }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;      //Finish adding to string table&lt;/div&gt;&lt;div&gt;      Prefix [FreeCode++] = OldCode;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;      //If the code size needs to be adjusted, do so&lt;/div&gt;&lt;div&gt;      if (FreeCode &gt;= MaxCode &amp;amp;&amp;amp; CodeSize &lt;&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;CodeSize++;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;MaxCode &lt;&lt;= 1;&lt;/div&gt;&lt;div&gt;      }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;      //The current code is now old&lt;/div&gt;&lt;div&gt;      OldCode = Code;&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;  } while (Code != EOICode);&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  //Close the GIF file&lt;/div&gt;&lt;div&gt;  fclose (GIFFile);&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;//Problem See Note at bottom or Readme File&lt;/div&gt;&lt;div&gt;void SVGA_GIF (char *Filename)&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;  //For loading from the GIF file&lt;/div&gt;&lt;div&gt;  struct GIFHeader     Header;&lt;/div&gt;&lt;div&gt;  struct GIFDescriptor Descriptor;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  //Colour information&lt;/div&gt;&lt;div&gt;  unsigned char        BitsPerPixel,&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;       NumOfColours;&lt;/div&gt;&lt;div&gt;  unsigned int         DAC;&lt;/div&gt;&lt;div&gt;  unsigned char        Palette [256][3];&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  //For indexing the string table&lt;/div&gt;&lt;div&gt;  unsigned int         FirstFree, FreeCode;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  //All the code information&lt;/div&gt;&lt;div&gt;  unsigned char        InitCodeSize;&lt;/div&gt;&lt;div&gt;  unsigned int         Code, OldCode, MaxCode;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  //Special codes&lt;/div&gt;&lt;div&gt;  unsigned int         ClearCode, EOICode;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  //Check whether the GIF file exists, and open it&lt;/div&gt;&lt;div&gt;  GIFFile = fopen (Filename, "rb");&lt;/div&gt;&lt;div&gt;  if (GIFFile == 0) {&lt;/div&gt;&lt;div&gt;    SetTEXT ();&lt;/div&gt;&lt;div&gt;    printf ("Could not open file %s", Filename);&lt;/div&gt;&lt;div&gt;    return;&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  //Read header&lt;/div&gt;&lt;div&gt;  fread (&amp;amp;Header, 6, 1, GIFFile);&lt;/div&gt;&lt;div&gt;  Header.Signature [6] = 0;&lt;/div&gt;&lt;div&gt;  fread (&amp;amp;Header.ScreenWidth, sizeof (Header) - 7, 1, GIFFile);&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  //Check signature and terminator&lt;/div&gt;&lt;div&gt;  if ((strcmp (Header.Signature, "GIF87a")&lt;/div&gt;&lt;div&gt;    &amp;amp;&amp;amp; strcmp (Header.Signature, "GIF89a"))&lt;/div&gt;&lt;div&gt;    || Header.Zero) {&lt;/div&gt;&lt;div&gt;    SetTEXT ();&lt;/div&gt;&lt;div&gt;    printf ("Not a valid GIF file\n");&lt;/div&gt;&lt;div&gt;    return;&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  //Get amount of colours in image&lt;/div&gt;&lt;div&gt;  BitsPerPixel = 1 + (Header.Depth &amp;amp; 7);&lt;/div&gt;&lt;div&gt;  NumOfColours = (1 &lt;&lt;&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  //Load global colour map&lt;/div&gt;&lt;div&gt;  fread (Palette, 3, (NumOfColours + 1), GIFFile);&lt;/div&gt;&lt;div&gt;  for (DAC = 0; DAC &lt;= NumOfColours; DAC++)&lt;/div&gt;&lt;div&gt;    SetDAC (DAC, Palette [DAC][0] &gt;&gt; 2,&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt; Palette [DAC][1] &gt;&gt; 2,&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt; Palette [DAC][2] &gt;&gt; 2);&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  //Load the image descriptor&lt;/div&gt;&lt;div&gt;  fread (&amp;amp;Descriptor, sizeof (Descriptor), 1, GIFFile);&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  if (Descriptor.Separator != ',') {&lt;/div&gt;&lt;div&gt;    SetTEXT ();&lt;/div&gt;&lt;div&gt;    printf ("Incorrect image descriptor.\n");&lt;/div&gt;&lt;div&gt;    return;&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  //Get image corner coordinates&lt;/div&gt;&lt;div&gt;  tlX = Descriptor.ImageLeft;&lt;/div&gt;&lt;div&gt;  tlY = Descriptor.ImageTop;&lt;/div&gt;&lt;div&gt;  brX = tlX + Descriptor.ImageWidth;&lt;/div&gt;&lt;div&gt;  brY = tlY + Descriptor.ImageHeight;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  //Some restrictions apply&lt;/div&gt;&lt;div&gt;  if (Descriptor.Depth &amp;amp; 128) {&lt;/div&gt;&lt;div&gt;    SetTEXT ();&lt;/div&gt;&lt;div&gt;    printf ("Local colour maps not supported\n");&lt;/div&gt;&lt;div&gt;    return;&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;  if (Descriptor.Depth &amp;amp; 64) {&lt;/div&gt;&lt;div&gt;    SetTEXT ();&lt;/div&gt;&lt;div&gt;    printf ("Interlaced images not supported\n");&lt;/div&gt;&lt;div&gt;    return;&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  //Get initial code size&lt;/div&gt;&lt;div&gt;  fread (&amp;amp;CodeSize, 1, 1, GIFFile);&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  //GIF data is stored in blocks, so it's necessary to know the size&lt;/div&gt;&lt;div&gt;  fread (&amp;amp;BlockSize, 1, 1, GIFFile);&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  //Start loader&lt;/div&gt;&lt;div&gt;  BPointer = BlockSize;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  //Special codes used in the GIF spec&lt;/div&gt;&lt;div&gt;  ClearCode        = 1 &lt;&lt;&gt;&lt;div&gt;  EOICode          = ClearCode + 1;     //End of file&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  //Initialize the string table&lt;/div&gt;&lt;div&gt;  FirstFree        = ClearCode + 2;     //Strings start here&lt;/div&gt;&lt;div&gt;  FreeCode         = FirstFree;         //Strings can be added here&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  //Initial size of the code and its maximum value&lt;/div&gt;&lt;div&gt;  InitCodeSize     = ++CodeSize;&lt;/div&gt;&lt;div&gt;  MaxCode          = 1 &lt;&lt;&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  BitsIn = 8;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  //Start at top left of image&lt;/div&gt;&lt;div&gt;  X = Descriptor.ImageLeft;&lt;/div&gt;&lt;div&gt;  Y = Descriptor.ImageTop;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  do {&lt;/div&gt;&lt;div&gt;    //Read next code&lt;/div&gt;&lt;div&gt;    Code = ReadCode ();&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;    //If it's an End-Of-Information code, stop processing&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt; if (Code == EOICode) break;&lt;/div&gt;&lt;div&gt;    //If it's a clear code...&lt;/div&gt;&lt;div&gt;    else if (Code == ClearCode) {&lt;/div&gt;&lt;div&gt;      //Clear the string table&lt;/div&gt;&lt;div&gt;      FreeCode = FirstFree;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;      //Set the code size to initial values&lt;/div&gt;&lt;div&gt;      CodeSize = InitCodeSize;&lt;/div&gt;&lt;div&gt;      MaxCode  = 1 &lt;&lt;&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;      //The next code may be read&lt;/div&gt;&lt;div&gt;      Code = ReadCode ();&lt;/div&gt;&lt;div&gt;      OldCode = Code;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;      //Set pixel&lt;/div&gt;&lt;div&gt;      NextSVGA (Code);&lt;/div&gt;&lt;div&gt;    //Other codes&lt;/div&gt;&lt;div&gt;    } else {&lt;/div&gt;&lt;div&gt;      /*If the code is already in the string table, it's string is displayed,&lt;/div&gt;&lt;div&gt;      and the old string followed by the new string's first character is&lt;/div&gt;&lt;div&gt;      added to the string table.*/&lt;/div&gt;&lt;div&gt;      if (Code &lt;&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;Suffix [FreeCode] = OutString (Code);&lt;/div&gt;&lt;div&gt;      else {&lt;/div&gt;&lt;div&gt;      /*If it is not already in the string table, the old string followed by&lt;/div&gt;&lt;div&gt;      the old string's first character is added to the string table and&lt;/div&gt;&lt;div&gt;      displayed.*/&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;Suffix [FreeCode] = OutString (OldCode);&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;NextSVGA (Suffix [FreeCode]);&lt;/div&gt;&lt;div&gt;      }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;      //Finish adding to string table&lt;/div&gt;&lt;div&gt;      Prefix [FreeCode++] = OldCode;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;      //If the code size needs to be adjusted, do so&lt;/div&gt;&lt;div&gt;      if (FreeCode &gt;= MaxCode &amp;amp;&amp;amp; CodeSize &lt;&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;CodeSize++;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;MaxCode &lt;&lt;= 1;&lt;/div&gt;&lt;div&gt;      }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;      //The current code is now old&lt;/div&gt;&lt;div&gt;      OldCode = Code;&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;  } while (Code != EOICode);&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  //Close the GIF file&lt;/div&gt;&lt;div&gt;  fclose (GIFFile);&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;//Ends Here*******************************&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;//PaintBrush (.PCX) Graphics File Viewer     //VGA ONLY&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;void LoadPCX (char *FileName)&lt;/div&gt;&lt;div&gt;/*&lt;/div&gt;&lt;div&gt;  This loads in the actual PCX-file and displays it.&lt;/div&gt;&lt;div&gt;*/&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;   /*PCX Header structure*/&lt;/div&gt;&lt;div&gt;   struct PCXHeader {&lt;/div&gt;&lt;div&gt;     char Manufacturer, Version, Encoding, BitsPerPixel;&lt;/div&gt;&lt;div&gt;     int xMin, yMin, xMax, yMax;&lt;/div&gt;&lt;div&gt;     char Other[116];&lt;/div&gt;&lt;div&gt;   } Header;&lt;/div&gt;&lt;div&gt;   /*File handle*/&lt;/div&gt;&lt;div&gt;   FILE *PCXFile;&lt;/div&gt;&lt;div&gt;   /*Required for decoding and palette*/&lt;/div&gt;&lt;div&gt;   unsigned char DataByte, HowMany, Palette[256][3];&lt;/div&gt;&lt;div&gt;   int x, y, c;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;   /*Check to see whether the file exists and can be opened*/&lt;/div&gt;&lt;div&gt;   PCXFile = fopen (FileName, "rb");&lt;/div&gt;&lt;div&gt;   if (PCXFile == NULL)  {&lt;/div&gt;&lt;div&gt;      strcat (FileName,".PCX");&lt;/div&gt;&lt;div&gt;      PCXFile = fopen (FileName, "rb");&lt;/div&gt;&lt;div&gt;      if (PCXFile == NULL) {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;printf ("Couldn't open file.");&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;return;&lt;/div&gt;&lt;div&gt;      }&lt;/div&gt;&lt;div&gt;   }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;   /*Read in header information*/&lt;/div&gt;&lt;div&gt;   fread (&amp;amp;Header, 128, 1, PCXFile);&lt;/div&gt;&lt;div&gt;   /*Check to see whether we can display it*/&lt;/div&gt;&lt;div&gt;   if (Header.Version != 5) {&lt;/div&gt;&lt;div&gt;     /*If other version than 5 don't display*/&lt;/div&gt;&lt;div&gt;     fclose (PCXFile);&lt;/div&gt;&lt;div&gt;     return;&lt;/div&gt;&lt;div&gt;   }&lt;/div&gt;&lt;div&gt;   if (Header.xMax&gt;319 || Header.xMin&lt;0&gt;200 || Header.yMin&lt;0)&gt;&lt;div&gt;     /*If it doesn't fit on-screen, don't display*/&lt;/div&gt;&lt;div&gt;     fclose (PCXFile);&lt;/div&gt;&lt;div&gt;     return;&lt;/div&gt;&lt;div&gt;   }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;   /*Load in the palette*/&lt;/div&gt;&lt;div&gt;   fseek (PCXFile, -769, SEEK_END);&lt;/div&gt;&lt;div&gt;   /*Read in identifier*/&lt;/div&gt;&lt;div&gt;   fread (&amp;amp;DataByte, 1, 1, PCXFile);&lt;/div&gt;&lt;div&gt;   if (DataByte!=12) {&lt;/div&gt;&lt;div&gt;     /*If there is no palette, don't display*/&lt;/div&gt;&lt;div&gt;   }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;   fread (&amp;amp;Palette, 768, 1, PCXFile);&lt;/div&gt;&lt;div&gt;   for (c=0; c&lt;255;&gt;&lt;div&gt;     SetDAC (c,Palette[c][0] &gt;&gt; 2, Palette[c][1] &gt;&gt; 2, Palette[c][2] &gt;&gt; 2);&lt;/div&gt;&lt;div&gt;   }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;   /*Go back to start of graphic data*/&lt;/div&gt;&lt;div&gt;   fseek (PCXFile, 128, SEEK_SET);&lt;/div&gt;&lt;div&gt;   y=Header.yMin;&lt;/div&gt;&lt;div&gt;   x=Header.xMin;&lt;/div&gt;&lt;div&gt;   Header.xMax++;&lt;/div&gt;&lt;div&gt;   Header.yMax++;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;   /*Decode and display graphics*/&lt;/div&gt;&lt;div&gt;   while (y&lt;header.ymax)&gt;&lt;div&gt;      /*Read next byte*/&lt;/div&gt;&lt;div&gt;      fread (&amp;amp;DataByte, 1, 1, PCXFile);&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;      /*Reset counter*/&lt;/div&gt;&lt;div&gt;      HowMany=1;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;      /*If it is encoded, extract the count information and read in the colour byte*/&lt;/div&gt;&lt;div&gt;      if ((DataByte &amp;amp; 0xC0)==0xC0) {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;HowMany = (DataByte &amp;amp; 0x3F);&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;fread (&amp;amp;DataByte, 1, 1, PCXFile);&lt;/div&gt;&lt;div&gt;      }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;      /*Display it*/&lt;/div&gt;&lt;div&gt;      for (c=1; c&lt;=HowMany; c++) {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;/*Calculate on-screen offset, display Pixel and go to next pixel*/&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;screen[(((y &lt;&lt;&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;/*If End of Line reached, next line*/&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;if (x&gt;=Header.xMax) {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;  y++; x=Header.xMin;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;}&lt;/div&gt;&lt;div&gt;      }&lt;/div&gt;&lt;div&gt;   }&lt;/div&gt;&lt;div&gt;   fclose (PCXFile);&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;//Ends Here******************************************&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;//Sets Pallate to Blue   //VGA &amp;amp; SVGA&lt;/div&gt;&lt;div&gt;void BluePalette ()&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;int DAC;&lt;/div&gt;&lt;div&gt;for (DAC = 1; DAC &lt;&gt;&lt;div&gt;    SetDAC (DAC, DAC &gt;&gt; 3, DAC &gt;&gt; 3, 32 + (DAC &gt;&gt; 3));&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;//Sets Pallate to Red   //VGA &amp;amp; SVGA&lt;/div&gt;&lt;div&gt;void RedPalette ()&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;  int DAC;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  for (DAC = 1; DAC &lt;&gt;&lt;div&gt;    SetDAC (DAC,32 + (DAC &gt;&gt; 3), DAC &gt;&gt; 3, DAC &gt;&gt; 3);&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;//Sets Pallate to Green   //VGA &amp;amp; SVGA&lt;/div&gt;&lt;div&gt;void GreenPalette ()&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;  int DAC;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  for (DAC = 1; DAC &lt;&gt;&lt;div&gt;    SetDAC (DAC, DAC &gt;&gt; 3, 32 + (DAC &gt;&gt; 3), DAC &gt;&gt; 3);&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;//This rotates the palette     //VGA &amp;amp; SVGA&lt;/div&gt;&lt;div&gt;void RotatePal ()&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;  int DAC, OffSet;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  do {&lt;/div&gt;&lt;div&gt;    //Set up the new colours&lt;/div&gt;&lt;div&gt;    for (DAC = 0; DAC &lt;&gt;&lt;div&gt;      //don't change colour 0 or the screen border would flash&lt;/div&gt;&lt;div&gt;      if ((DAC + OffSet) &amp;amp; 0xFF)&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;SetDAC ((DAC + OffSet) &amp;amp; 0xFF, DAC &gt;&gt; 3, DAC &gt;&gt; 3, 32 + (DAC &gt;&gt; 3));&lt;/div&gt;&lt;div&gt;    OffSet++;&lt;/div&gt;&lt;div&gt;  } while (!kbhit());&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;//This makes a rain like pattern  //VGA ONLY!!!!! (for Now)&lt;/div&gt;&lt;div&gt;void MakeDrip ()&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;  unsigned int x, y, r, s;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  for (x = 0; x &lt;&gt;&lt;div&gt;    //For each column on screen, choose a different starting point...&lt;/div&gt;&lt;div&gt;      r = random (255) &lt;&lt;&gt;&lt;div&gt;      //...and speed&lt;/div&gt;&lt;div&gt;      s = (128 + random (128)) &lt;&lt;&gt;&lt;div&gt;       for (y = 0; y &lt;&gt;&lt;div&gt;      //Set each pixel on the column, don't use color 0&lt;/div&gt;&lt;div&gt;      if (!(r &amp;amp; 0xff00))&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;VGAPixel (x, y, 1);&lt;/div&gt;&lt;div&gt;      else&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;VGAPixel (x, y, r &gt;&gt; 8);&lt;/div&gt;&lt;div&gt;      //Move on to the next colour&lt;/div&gt;&lt;div&gt;      r += s;&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;void SVGA_circle(int x,int y, int radius, byte color)&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;SineTable();&lt;/div&gt;&lt;div&gt;  fixed16_16 n=0,invradius=(1/(float)radius)*0x10000L;&lt;/div&gt;&lt;div&gt;  int dx=0,dy=radius-1;&lt;/div&gt;&lt;div&gt;  word dxoffset,dyoffset,offset = (y*640)+x;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  while (dx&lt;=dy)&lt;/div&gt;&lt;div&gt;  {&lt;/div&gt;&lt;div&gt;    dxoffset = (dx * 640);&lt;/div&gt;&lt;div&gt;    dyoffset = (dy * 640);&lt;/div&gt;&lt;div&gt;    VGA[offset+dy-dxoffset] = color;  /* octant 0 */&lt;/div&gt;&lt;div&gt;    VGA[offset+dx-dyoffset] = color;  /* octant 1 */&lt;/div&gt;&lt;div&gt;    VGA[offset-dx-dyoffset] = color;  /* octant 2 */&lt;/div&gt;&lt;div&gt;    VGA[offset-dy-dxoffset] = color;  /* octant 3 */&lt;/div&gt;&lt;div&gt;    VGA[offset-dy+dxoffset] = color;  /* octant 4 */&lt;/div&gt;&lt;div&gt;    VGA[offset-dx+dyoffset] = color;  /* octant 5 */&lt;/div&gt;&lt;div&gt;    VGA[offset+dx+dyoffset] = color;  /* octant 6 */&lt;/div&gt;&lt;div&gt;    VGA[offset+dy+dxoffset] = color;  /* octant 7 */&lt;/div&gt;&lt;div&gt;    dx++;&lt;/div&gt;&lt;div&gt;    n+=invradius;&lt;/div&gt;&lt;div&gt;    dy = (int)((radius * SIN_ACOS[(int)(n&gt;&gt;6)]) &gt;&gt; 16);&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;void VGA_circle(int x,int y, int radius, byte color)&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;SineTable();&lt;/div&gt;&lt;div&gt;  fixed16_16 n=0,invradius=(1/(float)radius)*0x10000L;&lt;/div&gt;&lt;div&gt;  int dx=0,dy=radius-1;&lt;/div&gt;&lt;div&gt;  word dxoffset,dyoffset,offset = (y*320)+x;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  while (dx&lt;=dy)&lt;/div&gt;&lt;div&gt;  {&lt;/div&gt;&lt;div&gt;    dxoffset = (dx * 320);&lt;/div&gt;&lt;div&gt;    dyoffset = (dy * 320);&lt;/div&gt;&lt;div&gt;    VGA[offset+dy-dxoffset] = color;  /* octant 0 */&lt;/div&gt;&lt;div&gt;    VGA[offset+dx-dyoffset] = color;  /* octant 1 */&lt;/div&gt;&lt;div&gt;    VGA[offset-dx-dyoffset] = color;  /* octant 2 */&lt;/div&gt;&lt;div&gt;    VGA[offset-dy-dxoffset] = color;  /* octant 3 */&lt;/div&gt;&lt;div&gt;    VGA[offset-dy+dxoffset] = color;  /* octant 4 */&lt;/div&gt;&lt;div&gt;    VGA[offset-dx+dyoffset] = color;  /* octant 5 */&lt;/div&gt;&lt;div&gt;    VGA[offset+dx+dyoffset] = color;  /* octant 6 */&lt;/div&gt;&lt;div&gt;    VGA[offset+dy+dxoffset] = color;  /* octant 7 */&lt;/div&gt;&lt;div&gt;    dx++;&lt;/div&gt;&lt;div&gt;    n+=invradius;&lt;/div&gt;&lt;div&gt;    dy = (int)((radius * SIN_ACOS[(int)(n&gt;&gt;6)]) &gt;&gt; 16);&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;void VGA_SolidCircle(int x,int y, int radius, byte color)&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;SineTable();&lt;/div&gt;&lt;div&gt;  fixed16_16 n=0,invradius=(1/(float)radius)*0x10000L;&lt;/div&gt;&lt;div&gt;  int dx=0,dy=radius-1,i;&lt;/div&gt;&lt;div&gt;  word dxoffset,dyoffset,offset = (y&lt;&lt;8)+(y&lt;&lt;6)+x;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  while (dx&lt;=dy)&lt;/div&gt;&lt;div&gt;  {&lt;/div&gt;&lt;div&gt;    dxoffset = (dx&lt;&lt;8)&gt;&lt;div&gt;    dyoffset = (dy&lt;&lt;8)&gt;&lt;div&gt;    for(i=dy;i&gt;=dx;i--,dyoffset-=320)&lt;/div&gt;&lt;div&gt;    {&lt;/div&gt;&lt;div&gt;      VGA[offset+i -dxoffset] = color;  /* octant 0 */&lt;/div&gt;&lt;div&gt;      VGA[offset+dx-dyoffset] = color;  /* octant 1 */&lt;/div&gt;&lt;div&gt;      VGA[offset-dx-dyoffset] = color;  /* octant 2 */&lt;/div&gt;&lt;div&gt;      VGA[offset-i -dxoffset] = color;  /* octant 3 */&lt;/div&gt;&lt;div&gt;      VGA[offset-i +dxoffset] = color;  /* octant 4 */&lt;/div&gt;&lt;div&gt;      VGA[offset-dx+dyoffset] = color;  /* octant 5 */&lt;/div&gt;&lt;div&gt;      VGA[offset+dx+dyoffset] = color;  /* octant 6 */&lt;/div&gt;&lt;div&gt;      VGA[offset+i +dxoffset] = color;  /* octant 7 */&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;    dx++;&lt;/div&gt;&lt;div&gt;    n+=invradius;&lt;/div&gt;&lt;div&gt;    dy = (int)((radius * SIN_ACOS[(int)(n&gt;&gt;6)]) &gt;&gt; 16);&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;void SVGA_SolidCircle(int x,int y, int radius, byte color)&lt;/div&gt;&lt;div&gt;{&lt;/div&gt;&lt;div&gt;SineTable();&lt;/div&gt;&lt;div&gt;  fixed16_16 n=0,invradius=(1/(float)radius)*0x10000L;&lt;/div&gt;&lt;div&gt;  int dx=0,dy=radius-1,i;&lt;/div&gt;&lt;div&gt;  word dxoffset,dyoffset,offset = (y*640)+x;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;  while (dx&lt;=dy)&lt;/div&gt;&lt;div&gt;  {&lt;/div&gt;&lt;div&gt;    dxoffset = (dx*640);&lt;/div&gt;&lt;div&gt;    dyoffset = (dy*640);&lt;/div&gt;&lt;div&gt;    for(i=dy;i&gt;=dx;i--,dyoffset-=640)  //320 Looks Fat!!!!&lt;/div&gt;&lt;div&gt;    {&lt;/div&gt;&lt;div&gt;      VGA[offset+i -dxoffset] = color;  /* octant 0 */&lt;/div&gt;&lt;div&gt;      VGA[offset+dx-dyoffset] = color;  /* octant 1 */&lt;/div&gt;&lt;div&gt;      VGA[offset-dx-dyoffset] = color;  /* octant 2 */&lt;/div&gt;&lt;div&gt;      VGA[offset-i -dxoffset] = color;  /* octant 3 */&lt;/div&gt;&lt;div&gt;      VGA[offset-i +dxoffset] = color;  /* octant 4 */&lt;/div&gt;&lt;div&gt;      VGA[offset-dx+dyoffset] = color;  /* octant 5 */&lt;/div&gt;&lt;div&gt;      VGA[offset+dx+dyoffset] = color;  /* octant 6 */&lt;/div&gt;&lt;div&gt;      VGA[offset+i +dxoffset] = color;  /* octant 7 */&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;    dx++;&lt;/div&gt;&lt;div&gt;    n+=invradius;&lt;/div&gt;&lt;div&gt;    dy = (int)((radius * SIN_ACOS[(int)(n&gt;&gt;6)]) &gt;&gt; 16);&lt;/div&gt;&lt;div&gt;  }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;//MOST "//" style comments are mine&lt;/div&gt;&lt;div&gt;// all "/*" style comments were added from pieces of code added from other people&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;//SVGA_GIF Function draws 2 pictures!?! I can't figure out why. If you can please&lt;/div&gt;&lt;div&gt;//let me know thug_death@hotmail.com.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;//Copyright(c) 1998 ShelbyWorks Software&lt;/div&gt;&lt;div&gt;// All alorthims property of the respective owners&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;//Borland C++3.1+; Watcom C/C++; Microsoft C; Symantec C++&lt;/div&gt;&lt;div&gt;// NOT tested or approved for djgpp, Intel C/C++, or GNU gcc(Linux/Unix)&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6459911684038758872-4373178780320436523?l=ramakrishnanalluri.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramakrishnanalluri.blogspot.com/feeds/4373178780320436523/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ramakrishnanalluri.blogspot.com/2010/03/common-functions.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6459911684038758872/posts/default/4373178780320436523'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6459911684038758872/posts/default/4373178780320436523'/><link rel='alternate' type='text/html' href='http://ramakrishnanalluri.blogspot.com/2010/03/common-functions.html' title='Common Functions'/><author><name>Ram</name><uri>http://www.blogger.com/profile/06837494716141178442</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6459911684038758872.post-4543774283695975412</id><published>2010-03-21T01:20:00.000-07:00</published><updated>2010-03-21T01:24:36.050-07:00</updated><title type='text'>Game Programming information -- this article is inspired from a friend's research.</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: Cambria, Palatino, 'Palatino Linotype', Georgia, serif; font-size: 13px; line-height: 16px; "&gt;&lt;div class="topic" style="margin-left: 3em; margin-bottom: 2.4em; max-width: 33em; "&gt;&lt;p style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; "&gt;&lt;strong&gt;Welcome!&lt;/strong&gt; Common questions:&lt;/p&gt;&lt;ol style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; padding-left: 3em; "&gt;&lt;li&gt;&lt;a href="http://www.sloperama.com/advice/idea.htm" style="color: rgb(170, 68, 68); "&gt;How do I get started?&lt;/a&gt; (for everyone)&lt;/li&gt;&lt;li&gt;&lt;a href="http://web.archive.org/web/http://www.lupinegames.com/articles/path_to_dev.html" style="color: rgb(170, 68, 68); "&gt;How do I make games?&lt;/a&gt; (for programmers)&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.flipcode.com/articles/article_buildinggame.shtml" style="color: rgb(170, 68, 68); "&gt;How can I write my own (more complex) game?&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.gamedev.net/reference/articles/article866.asp" style="color: rgb(170, 68, 68); "&gt;How much fun is game programming?&lt;/a&gt;&lt;/li&gt;&lt;li class="local"&gt;&lt;a href="http://www-cs-students.stanford.edu/~amitp/Articles/Universities.html" style="color: rgb(170, 68, 68); "&gt;What do I need to learn in school?&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://gamesfromwithin.com/so-you-want-to-be-a-game-programmer" style="color: rgb(170, 68, 68); "&gt;What do I need to learn once I know how to program?&lt;/a&gt;&lt;/li&gt;&lt;li added="2007-01-06"&gt;&lt;a href="http://www.binarycreativity.com/2006/10/09/so-you-want-to-be-a-game-programmer-how-to-get-out-of-college-and-into-games/" style="color: rgb(170, 68, 68); "&gt;What do I do after school?&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; "&gt;&lt;strong&gt;What’s on this page?&lt;/strong&gt; I’m interested in producing complexity out of simple parts. &lt;em&gt;This page contains bookmarks&lt;/em&gt; that I collected while working on games; I did not write most of the content linked from here. As a result the set of links here reflects the types of things I needed to know: only a few specific topics (not everything related to game programming), general ideas instead of platform-specific information (graphics, sound, compilers), and ideas and designs instead of source code (I find it easier to go from an idea to code than from code to an idea). Other sites, like &lt;a href="http://www.gamedev.net/" style="color: rgb(170, 68, 68); "&gt;Gamedev&lt;/a&gt; and &lt;a href="http://www.gamasutra.com/" style="color: rgb(170, 68, 68); "&gt;Gamasutra&lt;/a&gt;, cover lots more topics than mine does. These are the topics I cover:&lt;/p&gt;&lt;ul style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; padding-left: 3em; "&gt;&lt;li&gt;&lt;a href="http://www-cs-students.stanford.edu/~amitp/gameprog.html#paths" style="color: rgb(170, 68, 68); "&gt;Shortest Paths&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www-cs-students.stanford.edu/~amitp/gameprog.html#ai" style="color: rgb(170, 68, 68); "&gt;AI&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www-cs-students.stanford.edu/~amitp/gameprog.html#oop" style="color: rgb(170, 68, 68); "&gt;Objects&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www-cs-students.stanford.edu/~amitp/gameprog.html#languages" style="color: rgb(170, 68, 68); "&gt;Scripting&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www-cs-students.stanford.edu/~amitp/gameprog.html#tiles" style="color: rgb(170, 68, 68); "&gt;Tiles&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www-cs-students.stanford.edu/~amitp/gameprog.html#hex" style="color: rgb(170, 68, 68); "&gt;Hexagons&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www-cs-students.stanford.edu/~amitp/gameprog.html#adv" style="color: rgb(170, 68, 68); "&gt;Adventure&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www-cs-students.stanford.edu/~amitp/gameprog.html#economics" style="color: rgb(170, 68, 68); "&gt;Economics&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; "&gt;&lt;strong&gt;Who am I?&lt;/strong&gt; I’m a &lt;a href="http://www.randomterrain.com/game-design-hobby.html" style="color: rgb(170, 68, 68); "&gt;hobbyist game programmer&lt;/a&gt;. I don’t work in the games industry, and I am not looking for a job. This page is the result of gathering information I needed for &lt;a href="http://www-cs-students.stanford.edu/~amitp/games.html" style="color: rgb(170, 68, 68); "&gt;my own games&lt;/a&gt;. I work on these games in my spare time, so development is fairly slow. I keep a &lt;a href="http://simblob.blogspot.com/" style="color: rgb(170, 68, 68); "&gt;blog diary&lt;/a&gt; about game development and game design.&lt;/p&gt;&lt;/div&gt;&lt;h2 id="paths" style="font-family: 'Lucida Grande', 'Lucida Sans Unicode', Tahoma, sans-serif; font-weight: bold; letter-spacing: -1px; margin-top: 1.2em; margin-right: 0px; margin-bottom: 1.2em; margin-left: 0px; font-size: 1.2em; "&gt;Shortest Paths&lt;/h2&gt;&lt;div class="topic" style="margin-left: 3em; margin-bottom: 2.4em; max-width: 33em; "&gt;&lt;p style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; "&gt;Determining how to move around on a map is an interesting problem. There are many different approaches, ranging from simple (&lt;em&gt;walk forward until you hit something&lt;/em&gt;) to the complex (&lt;em&gt;path finding algorithms with heuristics&lt;/em&gt;). These are pages about pathfinding in general, with some bias towards A*:&lt;/p&gt;&lt;ul style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; padding-left: 3em; "&gt;&lt;li&gt;&lt;a href="http://home1.stofanet.dk/breese/aaai99.html" style="color: rgb(170, 68, 68); "&gt;Overview of the main issues that come up when choosing a pathfinder&lt;/a&gt;&lt;/li&gt;&lt;li class="local"&gt;&lt;a href="http://theory.stanford.edu/~amitp/GameProgramming/" style="color: rgb(170, 68, 68); "&gt;&lt;strong&gt;Amit’s Notes about Path-Finding&lt;/strong&gt;&lt;/a&gt; (including A*) [last updated May 2009]&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.student.nada.kth.se/~f93-maj/pathfinder/" style="color: rgb(170, 68, 68); "&gt;Vehicle Pathfinding &lt;/a&gt;(long)&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.red3d.com/cwr/games/" style="color: rgb(170, 68, 68); "&gt;Game pathfinding and AI resources&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.red3d.com/breese/navigation.html" style="color: rgb(170, 68, 68); "&gt;Technical papers about navigation and paths&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; "&gt;These pages are about specific techniques for &lt;a href="http://www.cs.sunysb.edu/~algorith/files/shortest-path.shtml" style="color: rgb(170, 68, 68); "&gt;pathfinding&lt;/a&gt; and &lt;a href="http://www.cs.sunysb.edu/~algorith/files/motion-planning.shtml" style="color: rgb(170, 68, 68); "&gt;object movement&lt;/a&gt;:&lt;/p&gt;&lt;ul style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; padding-left: 3em; "&gt;&lt;li class="local"&gt;&lt;a href="http://www-cs-students.stanford.edu/~amitp/Articles/AStar2.html" style="color: rgb(170, 68, 68); "&gt;Finding the “best” path is hard&lt;/a&gt;&lt;/li&gt;&lt;li class="local"&gt;&lt;a href="http://www-cs-students.stanford.edu/~amitp/Articles/Regions.html" style="color: rgb(170, 68, 68); "&gt;Using Regions for Shortest Path&lt;/a&gt;&lt;/li&gt;&lt;li class="local"&gt;&lt;a href="http://www-cs-students.stanford.edu/~amitp/Articles/PathFinding.html" style="color: rgb(170, 68, 68); "&gt;Shortest Path vs. Maze Solving Algorithms&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.red3d.com/cwr/steer/Obstacle.html" style="color: rgb(170, 68, 68); "&gt;Applet showing obstacle avoidance&lt;/a&gt; (also see &lt;a href="http://www.red3d.com/cwr/steer/" style="color: rgb(170, 68, 68); "&gt;more steering behaviors&lt;/a&gt;)&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.red3d.com/cwr/steer/gdc99/" style="color: rgb(170, 68, 68); "&gt;Steering Behaviors&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.logos.t.u-tokyo.ac.jp/~franck/research_sum.htm" style="color: rgb(170, 68, 68); "&gt;Collision Avoidance Behavior of Pedestrians&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.google.com/search?q=terrain+analysis+realtime+strategy+games+pottinger" style="color: rgb(170, 68, 68); "&gt;Terrain Analysis&lt;/a&gt; used in Age of Empires&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.gamedev.net/reference/programming/features/motionplanning/" style="color: rgb(170, 68, 68); "&gt;Motion using Potential Fields&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://webdocs.cs.ualberta.ca/~games/pathfind/publications/cig2005.pdf" style="color: rgb(170, 68, 68); "&gt;Fringe Search&lt;/a&gt; [PDF] - possibly faster than A* for games (download the code &lt;a href="http://webdocs.cs.ualberta.ca/~games/pathfind/" style="color: rgb(170, 68, 68); "&gt;here&lt;/a&gt;)&lt;/li&gt;&lt;li&gt;&lt;a href="http://webdocs.cs.ualberta.ca/~silver/David_Silver/Publications_files/coop-path-AIWisdom.pdf" style="color: rgb(170, 68, 68); "&gt;Cooperative Pathfinding&lt;/a&gt; [PDF] - useful when you have many units moving in narrow spaces, and need the units to be aware of each other&lt;/li&gt;&lt;li&gt;&lt;a href="http://ai-depot.com/Tutorial/PathFinding.html" style="color: rgb(170, 68, 68); "&gt;Introduction to Pathfinding Algorithms&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://ai-depot.com/BotNavigation/Path.html" style="color: rgb(170, 68, 68); "&gt;More Pathfinding algorithms&lt;/a&gt; (minimum spanning tree, Dijkstra’s algorithm, Bellman-Ford, Floyd-Warshall, …)&lt;/li&gt;&lt;li&gt;&lt;a href="http://ai-depot.com/BotNavigation/Obstacle-Introduction.html" style="color: rgb(170, 68, 68); "&gt;Terrain recognition and obstacle avoidance&lt;/a&gt;&lt;/li&gt;&lt;li added="2008-05-18"&gt;&lt;a href="http://playtechs.blogspot.com/2007/05/pathfinding-in-space.html" style="color: rgb(170, 68, 68); "&gt;Movement in space&lt;/a&gt;, with spaceship acceleration. Also see &lt;a href="http://playtechs.blogspot.com/2007/05/pathfinding-in-space-part-2.html" style="color: rgb(170, 68, 68); "&gt;part 2&lt;/a&gt; and&lt;a href="http://playtechs.blogspot.com/2007/05/pathfinding-in-space-part-3.html" style="color: rgb(170, 68, 68); "&gt;part 3&lt;/a&gt;.&lt;/li&gt;&lt;/ul&gt;&lt;h3 style="font-family: 'Lucida Grande', 'Lucida Sans Unicode', Tahoma, sans-serif; font-weight: bold; letter-spacing: -1px; margin-top: 1.3em; margin-right: 0px; margin-bottom: 1.3em; margin-left: 0px; font-size: 1em; "&gt;A*&lt;/h3&gt;&lt;p style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; "&gt;My current favorite algorithm is A*, because it can handle varying terrain costs well, and it seems to be faster than most graph searching algorithms. However, there are several reasons not to use A*. A* deals with discrete steps, not with continuous movement; A* works on &lt;a href="http://mathworld.wolfram.com/Graph.html" style="color: rgb(170, 68, 68); "&gt;graphs&lt;/a&gt; and does not take full advantage of spatial coherence (i.e., a map location is very similar to its neighbors) or temporal coherence (e.g., if we already found a path a few seconds ago, it’s likely if we try again the path we find will be similar). If the game world is changing quickly it’s not worth planning very far ahead. &lt;a href="http://theory.stanford.edu/~amitp/GameProgramming/MapRepresentations.html" style="color: rgb(170, 68, 68); "&gt;Map representation&lt;/a&gt; [last updated May 2009] is an important but often overlooked problem; grids are commonly used but are not always the best choice.&lt;/p&gt;&lt;ul style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; padding-left: 3em; "&gt;&lt;li class="local"&gt;&lt;a href="http://www-cs-students.stanford.edu/~amitp/Articles/AStar5.html" style="color: rgb(170, 68, 68); "&gt;Intro to A*&lt;/a&gt;&lt;/li&gt;&lt;li added="2009-05-26"&gt;&lt;a href="http://www.ai-blog.net/archives/000152.html" style="color: rgb(170, 68, 68); "&gt;Using Navigation Meshes for pathfinding&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.policyalmanac.org/games/twoTiered.htm" style="color: rgb(170, 68, 68); "&gt;Multi-resolution A*&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.policyalmanac.org/games/binaryHeaps.htm" style="color: rgb(170, 68, 68); "&gt;Lists vs. Binary Heaps for A*&lt;/a&gt;&lt;/li&gt;&lt;li class="local"&gt;&lt;a href="http://www-cs-students.stanford.edu/~amitp/Articles/AStar3.html" style="color: rgb(170, 68, 68); "&gt;Choosing a heuristic for A*&lt;/a&gt; (and other performance notes)&lt;/li&gt;&lt;li added="2006-08-31"&gt;&lt;a href="http://www.cs.auckland.ac.nz/~burkhard/Reports/2003_SS_DanielWichmann2.pdf" style="color: rgb(170, 68, 68); "&gt;An analysis of heuristics for A*&lt;/a&gt; [PDF]&lt;/li&gt;&lt;li class="local"&gt;&lt;a href="http://www-cs-students.stanford.edu/~amitp/Articles/AStar4.html" style="color: rgb(170, 68, 68); "&gt;Speeding up A* by dropping admissibility&lt;/a&gt;&lt;/li&gt;&lt;li class="local"&gt;&lt;a href="http://groups.google.com/group/comp.ai.games/browse_thread/thread/626f00daec1fd67c/913aa24af835f6b1" style="color: rgb(170, 68, 68); "&gt;Path Finding&lt;/a&gt; [150+ message newsgroup discussion] [290k]&lt;/li&gt;&lt;li class="local"&gt;&lt;a href="http://www-cs-students.stanford.edu/~amitp/Articles/AStar1.html" style="color: rgb(170, 68, 68); "&gt;A* references&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h3 style="font-family: 'Lucida Grande', 'Lucida Sans Unicode', Tahoma, sans-serif; font-weight: bold; letter-spacing: -1px; margin-top: 1.3em; margin-right: 0px; margin-bottom: 1.3em; margin-left: 0px; font-size: 1em; "&gt;Code and Demos&lt;/h3&gt;&lt;ul style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; padding-left: 3em; "&gt;&lt;li&gt;&lt;a href="http://www.policyalmanac.org/games/aStarTutorial.htm" style="color: rgb(170, 68, 68); "&gt;A* for Beginners&lt;/a&gt; (with Basic code)&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.sephiroth.it/phpwiki/index.php?title=Path_finder" style="color: rgb(170, 68, 68); "&gt;A* overview&lt;/a&gt; and Flash demo&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.vision.ee.ethz.ch/~cvcourse/astar/AStar.html" style="color: rgb(170, 68, 68); "&gt;A Java Applet demonstrating A*&lt;/a&gt; (mirror site) (be sure to use the Fudge method for best results)&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.generation5.org/content/2002/ase.asp" style="color: rgb(170, 68, 68); "&gt;A* Explorer&lt;/a&gt; [Windows application] Lets you step through the A* algorithm.&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.stefan-baur.de/cs.web.mashup.pathfinding.html" style="color: rgb(170, 68, 68); "&gt;Another A* applet&lt;/a&gt; showing A*, Dijkstra’s algorithm, breadth-first search, and depth-first search.&lt;/li&gt;&lt;li&gt;&lt;a href="http://labs.zeh.com.br/blog/?p=8" style="color: rgb(170, 68, 68); "&gt;Flash pathfinding demo&lt;/a&gt;, includes source code.&lt;/li&gt;&lt;li class="local"&gt;&lt;a href="http://theory.stanford.edu/~amitp/GameProgramming/path.cpp" style="color: rgb(170, 68, 68); "&gt;My own A* code&lt;/a&gt; (C++ Source and &lt;a href="http://theory.stanford.edu/~amitp/GameProgramming/path.h" style="color: rgb(170, 68, 68); "&gt;header file&lt;/a&gt;), and &lt;a href="http://www-cs-students.stanford.edu/~amitp/Articles/Improvements-from-Petr.html" style="color: rgb(170, 68, 68); "&gt;Petr Sulla’s improvements&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;&lt;a href="http://aima.cs.berkeley.edu/python/search.html" style="color: rgb(170, 68, 68); "&gt;Python code for A* and other search algorithms&lt;/a&gt; - note that the&lt;code style="margin-top: 0px; margin-right: 0.2em; margin-bottom: 0px; margin-left: 0.2em; color: rgb(68, 68, 34); "&gt;astar_search&lt;/code&gt; function is only four lines long!&lt;/li&gt;&lt;/ul&gt;&lt;p style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; "&gt;The link to my A* code is to the second version [4-Feb-1998], with bug fixes, optimizations, and parameterization for different heuristics and cost functions. The first version of my code is available on &lt;a href="http://web.archive.org/web/20080125034409/http://www.gameai.com/software.html" style="color: rgb(170, 68, 68); "&gt;Steve Woodcock’s pages&lt;/a&gt;, and it may be easier to read and understand.&lt;/p&gt;&lt;p style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; "&gt;Search for more pages on &lt;a href="http://www.google.com/custom?cof=L:http%3A//www-cs-students.stanford.edu/%7Eamitp/header2/gameprog.gif;GL:0;BGC:%23f0f0f0;T:black;LC:%23802020;VLC:%23604040;ALC:%23ff00ff;GALT:%23808040;&amp;amp;q=%22%2Ba+star%22+algorithm" style="color: rgb(170, 68, 68); "&gt;A*&lt;/a&gt;, &lt;a href="http://www.google.com/custom?cof=L:http%3A//www-cs-students.stanford.edu/%7Eamitp/header2/gameprog.gif;GL:0;BGC:%23f0f0f0;T:black;LC:%23802020;VLC:%23604040;ALC:%23ff00ff;GALT:%23808040;&amp;amp;q=pathfinding+algorithms" style="color: rgb(170, 68, 68); "&gt;pathfinding&lt;/a&gt;.&lt;/p&gt;&lt;/div&gt;&lt;h2 id="tiles" style="font-family: 'Lucida Grande', 'Lucida Sans Unicode', Tahoma, sans-serif; font-weight: bold; letter-spacing: -1px; margin-top: 1.2em; margin-right: 0px; margin-bottom: 1.2em; margin-left: 0px; font-size: 1.2em; "&gt;Tile Based Games&lt;/h2&gt;&lt;div class="topic" style="margin-left: 3em; margin-bottom: 2.4em; max-width: 33em; "&gt;&lt;p style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; "&gt;There are two topics that come up with tile based games: display and world representation. The two issues are orthogonal. You can have a 2-D game without tiles; you can have a tile based game with a full 3-D view.&lt;/p&gt;&lt;ol class="spaced" style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; padding-left: 3em; "&gt;&lt;li style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; "&gt;Tile-based games tend to have top-down (2-D) or isometric (2.5-D) views.&lt;p style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; "&gt;2-D graphics allows artists to use more detail—they can control individual pixels and form complex shapes, which is harder in a world of 3-D polygons and texture mapping.&lt;/p&gt;&lt;ul style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; padding-left: 3em; "&gt;&lt;li&gt;&lt;a href="http://www.gamedev.net/reference/articles/article728.asp" style="color: rgb(170, 68, 68); "&gt;Tile-Based Games FAQ&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://web.archive.org/web/http://www.lupinegames.com/articles/isoeng4u.htm" style="color: rgb(170, 68, 68); "&gt;Isometric Engines - are they for you?&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.compuphase.com/axometr.htm" style="color: rgb(170, 68, 68); "&gt;Isometric, Dimetric, Axonometric projections&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://trac.bookofhook.com/bookofhook/trac.cgi/wiki/OverviewOfIsometricEngineDevelopment" style="color: rgb(170, 68, 68); "&gt;Overview of Isometric Engine Development&lt;/a&gt;&lt;/li&gt;&lt;li added="2006-10-14"&gt;&lt;a href="http://sc.tri-bit.com/Implementing_Iso_and_Iso_Hex_Grids_on_Tiled_Systems" style="color: rgb(170, 68, 68); "&gt;Implementing isometric tile systems&lt;/a&gt;&lt;/li&gt;&lt;li added="2007-03-18"&gt;&lt;a href="http://www.gamecareerguide.com/features/336/procedural_content_.php?page=1" style="color: rgb(170, 68, 68); "&gt;Procedural Content Generation&lt;/a&gt;: generating terrain, cities, buildings&lt;/li&gt;&lt;li added="2007-01-06"&gt;&lt;a href="http://gamearchitect.net/Articles/StreamingBestiary.html" style="color: rgb(170, 68, 68); "&gt;Streaming Data&lt;/a&gt;: how to choose tiles to load, if your entire map doesn’t fit into memory&lt;/li&gt;&lt;li added="2008-05-18"&gt;&lt;a href="http://playtechs.blogspot.com/2007/04/tileset-design-tip.html" style="color: rgb(170, 68, 68); "&gt;Offsetting background tiles&lt;/a&gt; for better terrain transitions&lt;/li&gt;&lt;li class="local"&gt;&lt;a href="http://www-cs-students.stanford.edu/~amitp/Articles/Tiletech.html" style="color: rgb(170, 68, 68); "&gt;Tile-based games techniques&lt;/a&gt;&lt;/li&gt;&lt;li added="2006-10-14"&gt;&lt;a href="http://sc.tri-bit.com/Computing_LOS_for_Large_Areas" style="color: rgb(170, 68, 68); "&gt;Computing Line of Sight for Large Areas&lt;/a&gt;&lt;/li&gt;&lt;li added="2008-05-18"&gt;&lt;a href="http://playtechs.blogspot.com/2007/03/raytracing-on-grid.html" style="color: rgb(170, 68, 68); "&gt;Line tracing on a grid&lt;/a&gt; — determining all tiles that are touched by a line&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.metanetsoftware.com/technique/tutorialB.html" style="color: rgb(170, 68, 68); "&gt;Collision, visibility, and grid representation in tile based games&lt;/a&gt;, including using edge information&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.useit.com/alertbox/981115.html" style="color: rgb(170, 68, 68); "&gt;Why 2D is Better than 3D&lt;/a&gt; (not specifically about games)&lt;/li&gt;&lt;li&gt;&lt;a href="http://simcity.ea.com/about/inside_scoop/3d1.php" style="color: rgb(170, 68, 68); "&gt;The use of 3D hardware in a 2D game&lt;/a&gt; (SimCity 4)&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.gamedev.net/community/forums/topic.asp?topic_id=437968&amp;amp;whichpage=1#2909631" style="color: rgb(170, 68, 68); "&gt;Just use 3d to implement your isometric game&lt;/a&gt;, and avoid the complexities of getting isometric graphics rendering just right&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;/li&gt;&lt;li style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; "&gt;Tile-based worlds are made by combining small pieces into interesting patterns.&lt;p style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; "&gt;Compare Chinese Hanzi (sixty thousand complex characters forming two hundred thousand words) to Roman letters (between twenty and thirty simple characters forming two hundred thousand words). It’s much easier to create new words with Roman letters than with Chinese characters. Or compare Lego Bricks from decades ago (mostly … bricks) to Lego Bricks today (mostly specialized pieces). It’s much easier to create new maps by combining a few simple reusable pieces than with a large set of customized components.&lt;/p&gt;&lt;ul style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; padding-left: 3em; "&gt;&lt;li class="local"&gt;&lt;a href="http://www-cs-students.stanford.edu/~amitp/Articles/LineOfSight.html" style="color: rgb(170, 68, 68); "&gt;Line Of Sight Algorithms&lt;/a&gt;&lt;/li&gt;&lt;li added="2008-05-18"&gt;&lt;a href="http://playtechs.blogspot.com/2007/03/2d-portal-visibility-part-1.html" style="color: rgb(170, 68, 68); "&gt;2d visibility on a grid, using polygons for computation&lt;/a&gt;, and&lt;a href="http://playtechs.blogspot.com/2007/03/2d-portal-visibility-part-2.html" style="color: rgb(170, 68, 68); "&gt;part 2&lt;/a&gt;, which improves the algorithm&lt;/li&gt;&lt;li class="local"&gt;&lt;a href="http://www-cs-students.stanford.edu/~amitp/Articles/RangeSighting.html" style="color: rgb(170, 68, 68); "&gt;Determining the range that a unit can move to&lt;/a&gt;&lt;/li&gt;&lt;li class="local"&gt;&lt;a href="http://www-cs-students.stanford.edu/~amitp/Articles/TileMultipleObjects.html" style="color: rgb(170, 68, 68); "&gt;Placing multiple objects on each tile&lt;/a&gt; [newsgroup discussion]&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.pixelenvy.ca/wa/river.html" style="color: rgb(170, 68, 68); "&gt;Algorithm for building rivers&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://members.gamedev.net/vertexnormal/tutorial_randlev1.html" style="color: rgb(170, 68, 68); "&gt;Generating Random Mazes&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.gamedev.net/columns/events/coverage/feature.asp?feature_id=51" style="color: rgb(170, 68, 68); "&gt;How objects work in Sims 2&lt;/a&gt; - instead of people looking for food, the food broadcasts its presence to the people; there’s a scripting language underneath.&lt;/li&gt;&lt;li added="2006-09-04"&gt;&lt;a href="http://pages.cs.wisc.edu/~schenney/research/replication/flowtiles/" style="color: rgb(170, 68, 68); "&gt;Using tiles for flows&lt;/a&gt; [video and paper] The idea is to put motion/flow information into the tiles instead of in the objects; it reminds me of the reversal of roles in The Sims objects&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.gameai.com/influ.thread.html" style="color: rgb(170, 68, 68); "&gt;Influence Maps Thread&lt;/a&gt; [65k, nearly impossible to read due to dark brown on black colors]&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.gamedev.net/reference/programming/features/arttilebase/" style="color: rgb(170, 68, 68); "&gt;Data structures for tile based games&lt;/a&gt;&lt;/li&gt;&lt;li class="local"&gt;&lt;a href="http://www-cs-students.stanford.edu/~amitp/Articles/TileFile.html" style="color: rgb(170, 68, 68); "&gt;A file format to handle linked lists of objects&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://members.gamedev.net/vertexnormal/turbulence_tutorial.html" style="color: rgb(170, 68, 68); "&gt;Using Turbulence to generate roads&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.centralpictures.com/ce/tpapers.html" style="color: rgb(170, 68, 68); "&gt;Procedural Modeling of Cities&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; "&gt;Search for more pages on &lt;a href="http://www.google.com/custom?cof=L:http%3A//www-cs-students.stanford.edu/%7Eamitp/header2/gameprog.gif;GL:0;BGC:%23f0f0f0;T:black;LC:%23802020;VLC:%23604040;ALC:%23ff00ff;GALT:%23808040;&amp;amp;q=%22influence+maps%22" style="color: rgb(170, 68, 68); "&gt;influence maps&lt;/a&gt;, &lt;a href="http://www.google.com/custom?cof=L:http%3A//www-cs-students.stanford.edu/%7Eamitp/header2/gameprog.gif;GL:0;BGC:%23f0f0f0;T:black;LC:%23802020;VLC:%23604040;ALC:%23ff00ff;GALT:%23808040;&amp;amp;q=isometric+games+programming+-announce" style="color: rgb(170, 68, 68); "&gt;isometric maps&lt;/a&gt;, &lt;a href="http://www.google.com/custom?cof=L:http%3A//www-cs-students.stanford.edu/%7Eamitp/header2/gameprog.gif;GL:0;BGC:%23f0f0f0;T:black;LC:%23802020;VLC:%23604040;ALC:%23ff00ff;GALT:%23808040;&amp;amp;q=%22line+of+sight%22+games" style="color: rgb(170, 68, 68); "&gt;line of sight&lt;/a&gt;.&lt;/p&gt;&lt;/div&gt;&lt;h2 id="hex" style="font-family: 'Lucida Grande', 'Lucida Sans Unicode', Tahoma, sans-serif; font-weight: bold; letter-spacing: -1px; margin-top: 1.2em; margin-right: 0px; margin-bottom: 1.2em; margin-left: 0px; font-size: 1.2em; "&gt;Hexagonal Grids&lt;/h2&gt;&lt;div class="topic" style="margin-left: 3em; margin-bottom: 2.4em; max-width: 33em; "&gt;&lt;p style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; "&gt;Many war games use hexagonal grids instead of square grids. Squares share an edge with four neighbors but also touch another four neighbors at just one point. This often complicates movement along grids because diagonal movements are hard to weight properly with integer movement values. You either have four directions or eight directions with squares, but with hexagons, you have a compromise—six directions. Hexagons don’t touch any neighbor at only a point; they have a small perimeter-to-area ratio; and they just look neat. Unfortunately, in our square pixel world of computers, hexagons are harder to use, so I’ve collected some articles that may help you turn common square-grid algorithms into hex-grid algorithms.&lt;/p&gt;&lt;ul style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; padding-left: 3em; "&gt;&lt;li class="local"&gt;&lt;a href="http://www-cs-students.stanford.edu/~amitp/game-programming/grids/" style="color: rgb(170, 68, 68); "&gt;&lt;strong&gt;Amit’s Thoughts on Grids&lt;/strong&gt;&lt;/a&gt; includes squares, hexagons, and triangles&lt;/li&gt;&lt;li added="2006-10-14"&gt;&lt;a href="http://sc.tri-bit.com/Hex_Grids" style="color: rgb(170, 68, 68); "&gt;Overview of hex grid coordinates&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.gamedev.net/reference/articles/article1800.asp" style="color: rgb(170, 68, 68); "&gt;Hexagonal coordinates explained&lt;/a&gt;, including hex/pixel coordinate conversion&lt;/li&gt;&lt;li class="local"&gt;&lt;a href="http://www-cs-students.stanford.edu/~amitp/Articles/Hexagon1.html" style="color: rgb(170, 68, 68); "&gt;Numbering Systems; Distances; Angles&lt;/a&gt;&lt;/li&gt;&lt;li class="local"&gt;&lt;a href="http://www-cs-students.stanford.edu/~amitp/Articles/Hexagon2.html" style="color: rgb(170, 68, 68); "&gt;Isometric Cube Coordinates&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.webwargaming.com/hexpart/hexpart.html" style="color: rgb(170, 68, 68); "&gt;The HexPart numbering system&lt;/a&gt; with algorithms for range, bearing, offset, and line of sight&lt;/li&gt;&lt;li added="2009-06-01"&gt;&lt;a href="http://playtechs.blogspot.com/2007/04/hex-grids.html" style="color: rgb(170, 68, 68); "&gt;Comparison of Hexagonal coordinate systems&lt;/a&gt;, including pixel to hex coordinates, and hex distances&lt;/li&gt;&lt;li class="local"&gt;&lt;a href="http://www-cs-students.stanford.edu/~amitp/Articles/GridToHex.html" style="color: rgb(170, 68, 68); "&gt;Pixel Location to Hex Coordinates&lt;/a&gt;&lt;/li&gt;&lt;li class="local"&gt;&lt;a href="http://www-cs-students.stanford.edu/~amitp/Articles/HexLOS.html" style="color: rgb(170, 68, 68); "&gt;Line of Sight and Distance&lt;/a&gt;, plus &lt;a href="http://www.sable.mcgill.ca/~clump/Hex/HGAT.html" style="color: rgb(170, 68, 68); "&gt;a Java applet demonstrating field of view&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://blog.devstone.com/aaron/archive/2004/04/18/152.aspx" style="color: rgb(170, 68, 68); "&gt;Pixel coordinate to hex coordinates&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.drking.plus.com/hexagons/misc/grid.html" style="color: rgb(170, 68, 68); "&gt;Distances in a Hexagonal Grid&lt;/a&gt;&lt;/li&gt;&lt;li added="2007-01-14" class="local"&gt;&lt;a href="http://www-cs-students.stanford.edu/~amitp/Articles/Identifying-directions-from-a-central-hex.pdf" style="color: rgb(170, 68, 68); "&gt;Identifying directions in a hex grid&lt;/a&gt; [PDF]&lt;/li&gt;&lt;li&gt;&lt;a href="http://jmz.iki.fi/blog/programming/hexagonal_maps" style="color: rgb(170, 68, 68); "&gt;Coordinate system that makes distances easy&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://cell-auto.com/neighbourhood/" style="color: rgb(170, 68, 68); "&gt;Grids used in Cellular Automata&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.sable.mcgill.ca/~clump/Hex/HGAT.html" style="color: rgb(170, 68, 68); "&gt;Computing Field of View on a Hexagonal Grid&lt;/a&gt; (source code and Java applet)&lt;/li&gt;&lt;/ul&gt;&lt;p style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; "&gt;Search for more pages on &lt;a href="http://www.google.com/custom?cof=L:http%3A//www-cs-students.stanford.edu/%7Eamitp/header2/gameprog.gif;GL:0;BGC:%23f0f0f0;T:black;LC:%23802020;VLC:%23604040;ALC:%23ff00ff;GALT:%23808040;&amp;amp;q=hexagonal+tiles+programming" style="color: rgb(170, 68, 68); "&gt;hexagons&lt;/a&gt;.&lt;/p&gt;&lt;/div&gt;&lt;h2 id="ai" style="font-family: 'Lucida Grande', 'Lucida Sans Unicode', Tahoma, sans-serif; font-weight: bold; letter-spacing: -1px; margin-top: 1.2em; margin-right: 0px; margin-bottom: 1.2em; margin-left: 0px; font-size: 1.2em; "&gt;Artificial Intelligence&lt;/h2&gt;&lt;div class="topic" style="margin-left: 3em; margin-bottom: 2.4em; max-width: 33em; "&gt;&lt;p style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; "&gt;Many times I play a game and wish that the computer opponents were written better. Sometimes the computer player is given different rules; other times it has the same rules but gets more money (or other resources) than you. The result is that the game doesn’t seem &lt;em&gt;balanced&lt;/em&gt;: it’s just too obvious that the computer is not playing well, and that the game is brain vs. brawn rather than brain vs. brain. At the same time I don’t want AI that’s &lt;em&gt;too&lt;/em&gt; good; if it were, then it’d always beat me and I’d be frustrated!&lt;/p&gt;&lt;ul style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; padding-left: 3em; "&gt;&lt;li&gt;&lt;a href="http://ai-depot.com/GameAI/Design.html" style="color: rgb(170, 68, 68); "&gt;Overview of Game AI&lt;/a&gt;&lt;/li&gt;&lt;li added="2010-01-24"&gt;&lt;sup class="new verynew" style="font-size: 0.5em; font-family: sans-serif; color: rgb(0, 0, 0); background-color: rgb(255, 255, 136); text-transform: uppercase; "&gt;(NEW!)&lt;/sup&gt; &lt;a href="http://blog.wolfire.com/2010/01/An-Introduction-to-AI-in-Games-from-Phil-Carlisle" style="color: rgb(170, 68, 68); "&gt;An introduction to AI in Games&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.aiwisdom.com/byresource_aiwisdom.html" style="color: rgb(170, 68, 68); "&gt;AI Wisdom&lt;/a&gt; [book]&lt;/li&gt;&lt;li&gt;&lt;a href="http://web.archive.org/web/http://www.lupinegames.com/articles/prac_ai.html" style="color: rgb(170, 68, 68); "&gt;Geoff Howland’s Practical Guide to AI&lt;/a&gt; and &lt;a href="http://web.archive.org/web/http://www.lupinegames.com/articles/prac_ai_2.html" style="color: rgb(170, 68, 68); "&gt;part 2&lt;/a&gt;&lt;/li&gt;&lt;li&gt;A different &lt;a href="http://www.ai-center.com/publications/nareyek-acmqueue04.pdf" style="color: rgb(170, 68, 68); "&gt;Overview of Game AI&lt;/a&gt; [PDF]&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.ai-blog.net/archives/000104.html" style="color: rgb(170, 68, 68); "&gt;Great Expectation-Formations&lt;/a&gt; - AI shouldn’t just react to the world, but it should form expectations about the world, and react to deviations from that.&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.gameai.com/cgdc03notes.html" style="color: rgb(170, 68, 68); "&gt;Moderator’s notes for AI Roundtable at CGDC 2003&lt;/a&gt;, &lt;a href="http://www.gameai.com/cgdc02notes.html" style="color: rgb(170, 68, 68); "&gt;CGDC 2002&lt;/a&gt;, &lt;a href="http://www.gameai.com/cgdc01notes.html" style="color: rgb(170, 68, 68); "&gt;CGDC 2001&lt;/a&gt;, &lt;a href="http://www.gameai.com/cgdc00notes.html" style="color: rgb(170, 68, 68); "&gt;CGDC 2000&lt;/a&gt;, &lt;a href="http://www.gameai.com/cgdc99notes.html" style="color: rgb(170, 68, 68); "&gt;CGDC 1999&lt;/a&gt;, &lt;a href="http://www.gameai.com/cgdc98notes.html" style="color: rgb(170, 68, 68); "&gt;CGDC 1998&lt;/a&gt;, &lt;a href="http://www.gameai.com/cgdc97notes.html" style="color: rgb(170, 68, 68); "&gt;CGDC 1997&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cgf-ai.com/docs/gdc2001_paper.pdf" style="color: rgb(170, 68, 68); "&gt;Terrain Reasoning for 3D Action Games&lt;/a&gt; [PDF]&lt;/li&gt;&lt;li&gt;&lt;a href="http://home.swipnet.se/dungeondweller/development/dev00055.htm" style="color: rgb(170, 68, 68); "&gt;Need-driven AI&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cgf-ai.com/docs/straatman_remco_killzone_ai.pdf" style="color: rgb(170, 68, 68); "&gt;The Procedural AI in Killzone&lt;/a&gt; [PDF] Includes line of sight, firing range, pathfinding, and tactical evaluation at run-time&lt;/li&gt;&lt;li class="local"&gt;&lt;a href="http://groups.google.com/group/comp.ai.games/browse_thread/thread/ee86366ca1373a0a/86a051e6a19493bc" style="color: rgb(170, 68, 68); "&gt;Computer Attacks&lt;/a&gt; [20+ message newsgroup discussion]&lt;/li&gt;&lt;li added="2008-05-19"&gt;&lt;a href="http://www.design.wrong.net/2008/05/18/ai-and-the-single-player-game/" style="color: rgb(170, 68, 68); "&gt;Making AI more challenging&lt;/a&gt;, in particular, by making it less predictable&lt;/li&gt;&lt;li class="local"&gt;&lt;a href="http://www-cs-students.stanford.edu/~amitp/Articles/StrategyAndTactics.html" style="color: rgb(170, 68, 68); "&gt;Strategy and Tactics&lt;/a&gt; by DreamWeaver [62k]&lt;/li&gt;&lt;li class="local"&gt;&lt;a href="http://www-cs-students.stanford.edu/~amitp/Articles/EmpireGames.html" style="color: rgb(170, 68, 68); "&gt;AI in Empire-Based Games&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.gameai.com/exai.thread.html" style="color: rgb(170, 68, 68); "&gt;Extensible AI &lt;/a&gt;[163k - newsgroup discussion]&lt;/li&gt;&lt;li class="local"&gt;&lt;a href="http://www-cs-students.stanford.edu/~amitp/Articles/HierarchalAI.html" style="color: rgb(170, 68, 68); "&gt;Hierarchical AI&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cgf-ai.com/docs/grenadehandling.pdf" style="color: rgb(170, 68, 68); "&gt;Grenade handling AI&lt;/a&gt; [PDF]&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.gameai.com/nk.paper.html" style="color: rgb(170, 68, 68); "&gt;Evolutionary Approach to AI&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.gilgameshcontrite.com/Computer_AI/pages/index.html" style="color: rgb(170, 68, 68); "&gt;The Current State of Human-Level Artificial Intelligence in Computer Simulations and Wargames&lt;/a&gt; A list of references for game AI&lt;/li&gt;&lt;/ul&gt;&lt;p style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; "&gt;Computer AI is most commonly used to implement opponents for the player. However it can also be used to implement the world (for example, all the businesses in Railroad Tycoon), assistants to the player (for example, the automatic city management in Civilization), or computer players that are not necessarily opponents (for example, non-player characters in role-playing games).&lt;/p&gt;&lt;ul style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; padding-left: 3em; "&gt;&lt;li&gt;&lt;a href="http://web.archive.org/web/http://www.lggwg.com/wolff/aicg99/dobson-forbus.html" style="color: rgb(170, 68, 68); "&gt;AI Beyond Computer Games&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.cs.northwestern.edu/~forbus/c95-gd/lectures/The_Sims_Under_the_Hood_files/v3_slide0088.htm" style="color: rgb(170, 68, 68); "&gt;Under the Hood of The Sims&lt;/a&gt; [slides]&lt;/li&gt;&lt;li added="2009-06-01"&gt;&lt;a href="http://aigamedev.com/open/interviews/stalker-alife/" style="color: rgb(170, 68, 68); "&gt;S.T.A.L.K.E.R. uses the terrain to assign goals to the NPCs nearby&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; "&gt;Everyone talks about neural networks and genetic algorithms. I’m not going to provide any references for them. Instead, I’ll point to some techniques that are not discussed nearly enough:&lt;/p&gt;&lt;ul style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; padding-left: 3em; "&gt;&lt;li&gt;&lt;a href="http://ai.eecs.umich.edu/cogarch3/Brooks/Brooks.html" style="color: rgb(170, 68, 68); "&gt;Subsumption Architecture for AI&lt;/a&gt; (Rodney Brooks)&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.gameai.com/blackandwhite.html" style="color: rgb(170, 68, 68); "&gt;AI in Black &amp;amp; White&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://reinforcementlearning.ai-depot.com/Intro.html" style="color: rgb(170, 68, 68); "&gt;Introduction to Reinforcement Learning&lt;/a&gt; (if you find this topic interesting, be sure to see &lt;a href="http://www.cs.ualberta.ca/~sutton/book/the-book.html" style="color: rgb(170, 68, 68); "&gt;the book&lt;/a&gt; by Sutton and Barto)&lt;/li&gt;&lt;/ul&gt;&lt;p style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; "&gt;In choosing a technique for AI in your games, keep it as simple as possible. If you know the answer, put the answer into the program. If you know how to compute the answer, put the algorithm for computing it into the program. Only if you don’t know the answer, and don’t even know how to compute the answer, should you resort to complex techniques that can learn how to find the answer (neural networks, simulated annealing, genetic algorithms, subsumption architecture, reinforcement learning, genetic programming). These complex techniques can come at a high price, in terms of programming time, game performance, difficulty of debugging, and lack of control.&lt;/p&gt;&lt;p style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; "&gt;Search for more pages on &lt;a href="http://www.google.com/custom?cof=L:http%3A//www-cs-students.stanford.edu/%7Eamitp/header2/gameprog.gif;GL:0;BGC:%23f0f0f0;T:black;LC:%23802020;VLC:%23604040;ALC:%23ff00ff;GALT:%23808040;&amp;amp;q=%22artificial+intelligence%22+games" style="color: rgb(170, 68, 68); "&gt;artificial intelligence&lt;/a&gt;.&lt;/p&gt;&lt;/div&gt;&lt;h2 id="oop" style="font-family: 'Lucida Grande', 'Lucida Sans Unicode', Tahoma, sans-serif; font-weight: bold; letter-spacing: -1px; margin-top: 1.2em; margin-right: 0px; margin-bottom: 1.2em; margin-left: 0px; font-size: 1.2em; "&gt;Object Oriented Programming&lt;/h2&gt;&lt;div class="topic" style="margin-left: 3em; margin-bottom: 2.4em; max-width: 33em; "&gt;&lt;p style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; "&gt;I have found that the best places to use object oriented programming are user interfaces, operating systems, and games. At the same time, it’s commonly believed that object-oriented programming is the best way to program, but there are lots of situations where other approaches work much better.&lt;/p&gt;&lt;ul style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; padding-left: 3em; "&gt;&lt;li class="local"&gt;&lt;a href="http://www-cs-students.stanford.edu/~amitp/Articles/ObjectOrientedGames.html" style="color: rgb(170, 68, 68); "&gt;Object Oriented Adventure Games&lt;/a&gt;&lt;/li&gt;&lt;li class="local"&gt;&lt;a href="http://www-cs-students.stanford.edu/~amitp/Articles/EfficientObjects.html" style="color: rgb(170, 68, 68); "&gt;Efficiency of Objects&lt;/a&gt;&lt;/li&gt;&lt;li added="2009-12-19"&gt;&lt;sup class="new verynew" style="font-size: 0.5em; font-family: sans-serif; color: rgb(0, 0, 0); background-color: rgb(255, 255, 136); text-transform: uppercase; "&gt;(NEW!)&lt;/sup&gt; &lt;a href="http://gamesfromwithin.com/data-oriented-design" style="color: rgb(170, 68, 68); "&gt;Data-oriented instead of object-oriented&lt;/a&gt;&lt;/li&gt;&lt;li class="local"&gt;&lt;a href="http://www-cs-students.stanford.edu/~amitp/Articles/MOO-Objects.html" style="color: rgb(170, 68, 68); "&gt;OOP and Games&lt;/a&gt;&lt;/li&gt;&lt;li class="local"&gt;&lt;a href="http://www-cs-students.stanford.edu/~amitp/Articles/OpenDocGames.html" style="color: rgb(170, 68, 68); "&gt;OpenDoc for Games&lt;/a&gt;&lt;/li&gt;&lt;li class="local"&gt;&lt;a href="http://www-cs-students.stanford.edu/~amitp/Articles/Design3.html" style="color: rgb(170, 68, 68); "&gt;Multiple Inheritance and RPGs&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; "&gt;Below are articles related to object oriented design but not specifically about games.&lt;/p&gt;&lt;ul style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; padding-left: 3em; "&gt;&lt;li class="local"&gt;&lt;a href="http://www-cs-students.stanford.edu/~amitp/Articles/SquaresAndRectangles.html" style="color: rgb(170, 68, 68); "&gt;Squares and Rectangles&lt;/a&gt;&lt;/li&gt;&lt;li class="local"&gt;&lt;a href="http://www-cs-students.stanford.edu/~amitp/Articles/WPSIntegration.html" style="color: rgb(170, 68, 68); "&gt;Integrating your objects with your Shell&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; "&gt;Search for more pages on &lt;a href="http://www.google.com/custom?cof=L:http%3A//www-cs-students.stanford.edu/%7Eamitp/header2/gameprog.gif;GL:0;BGC:%23f0f0f0;T:black;LC:%23802020;VLC:%23604040;ALC:%23ff00ff;GALT:%23808040;&amp;amp;q=%22object+oriented%22+games" style="color: rgb(170, 68, 68); "&gt;objects&lt;/a&gt;.&lt;/p&gt;&lt;/div&gt;&lt;h2 id="adv" style="font-family: 'Lucida Grande', 'Lucida Sans Unicode', Tahoma, sans-serif; font-weight: bold; letter-spacing: -1px; margin-top: 1.2em; margin-right: 0px; margin-bottom: 1.2em; margin-left: 0px; font-size: 1.2em; "&gt;Adventure Games&lt;/h2&gt;&lt;div class="topic" style="margin-left: 3em; margin-bottom: 2.4em; max-width: 33em; "&gt;&lt;p style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; "&gt;Although I’m not a big fan of adventure games, I’ve found that adventure game writers often have more time to work on story and game design than people working on action games. If you’re looking for story ideas or story design tips, or if you’re working on a MUD or massively multiplayer online game, take a look at these.&lt;/p&gt;&lt;ul style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; padding-left: 3em; "&gt;&lt;li&gt;&lt;a href="http://www.duke.edu/~srg3/IFdesign/raif/index.html" style="color: rgb(170, 68, 68); "&gt;Rec.Arts.Interactive-Fiction Archive&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.inform-fiction.org/" style="color: rgb(170, 68, 68); "&gt;Inform&lt;/a&gt;, a programming language for text adventure games. Very impressive! Also see &lt;a href="http://www.inform-fiction.org/I7Downloads/Documents/WhitePaper.pdf" style="color: rgb(170, 68, 68); "&gt;this whitepaper&lt;/a&gt; [PDF] and &lt;a href="http://en.wikibooks.org/wiki/Beginner%27s_Guide_to_Interactive_Fiction_with_Inform_7/Getting_Started_with_Inform_7" style="color: rgb(170, 68, 68); "&gt;this tutorial&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;&lt;a href="http://c2.com/cgi/wiki?InteractiveFictionPatterns" style="color: rgb(170, 68, 68); "&gt;Interactive Fiction design patterns&lt;/a&gt;&lt;/li&gt;&lt;li added="2009-06-01"&gt;&lt;a href="http://www.gamasutra.com/features/20060928/cole_01.shtml" style="color: rgb(170, 68, 68); "&gt;Modeling Opinions in the NPC Social Graph&lt;/a&gt;&lt;/li&gt;&lt;li class="local"&gt;&lt;a href="http://www-cs-students.stanford.edu/~amitp/Articles/NPC-Conversation.html" style="color: rgb(170, 68, 68); "&gt;NPC Conversation Techniques&lt;/a&gt;&lt;/li&gt;&lt;li added="2009-06-01"&gt;&lt;a href="http://gram.cs.mcgill.ca/papers/verbrugge-02-structure.pdf" style="color: rgb(170, 68, 68); "&gt;Narrative Flow Graphs&lt;/a&gt; [PDF] based on Petri Nets, for representing story elements&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.io.com/~sjohn/plots.htm" style="color: rgb(170, 68, 68); "&gt;Big List of Plots&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.raphkoster.com/gaming/laws.shtml" style="color: rgb(170, 68, 68); "&gt;Laws of MUDs&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://web.archive.org/web/http://www.lupinegames.com/articles/linegame.htm" style="color: rgb(170, 68, 68); "&gt;Non-linearity in games&lt;/a&gt;&lt;/li&gt;&lt;li class="local"&gt;&lt;a href="http://www-cs-students.stanford.edu/~amitp/Articles/TextGames.html" style="color: rgb(170, 68, 68); "&gt;Text vs. Graphical MUD thread&lt;/a&gt; [newsgroup posts]&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.raphkoster.com/gaming/textvgraf.shtml" style="color: rgb(170, 68, 68); "&gt;Text vs. Graphical MUDs&lt;/a&gt; (Raph Koster’s view)&lt;/li&gt;&lt;li added="2007-03-18"&gt;&lt;a href="http://www.gamasutra.com/features/20060928/cole_01.shtml" style="color: rgb(170, 68, 68); "&gt;Modeling Opinion Flow in Humans&lt;/a&gt;: use the Boids algorithm to model human opinions in social groups&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.doggysoft.co.uk/inform/write/prose.html" style="color: rgb(170, 68, 68); "&gt;Prose in Games&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.costik.com/nowords.html" style="color: rgb(170, 68, 68); "&gt;I Have No Words &amp;amp; I Must Design&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; "&gt;Search for more pages on &lt;a href="http://www.google.com/custom?cof=L:http%3A//www-cs-students.stanford.edu/%7Eamitp/header2/gameprog.gif;GL:0;BGC:%23f0f0f0;T:black;LC:%23802020;VLC:%23604040;ALC:%23ff00ff;GALT:%23808040;&amp;amp;q=%22interactive+fiction%22+games" style="color: rgb(170, 68, 68); "&gt;interactive fiction&lt;/a&gt;, &lt;a href="http://www.google.com/custom?cof=L:http%3A//www-cs-students.stanford.edu/%7Eamitp/header2/gameprog.gif;GL:0;BGC:%23f0f0f0;T:black;LC:%23802020;VLC:%23604040;ALC:%23ff00ff;GALT:%23808040;&amp;amp;q=text+%22adventure+games%22+programming+-access+-yahoo" style="color: rgb(170, 68, 68); "&gt;adventure games&lt;/a&gt;.&lt;/p&gt;&lt;/div&gt;&lt;h2 id="design" style="font-family: 'Lucida Grande', 'Lucida Sans Unicode', Tahoma, sans-serif; font-weight: bold; letter-spacing: -1px; margin-top: 1.2em; margin-right: 0px; margin-bottom: 1.2em; margin-left: 0px; font-size: 1.2em; "&gt;Game Design&lt;/h2&gt;&lt;div class="topic" style="margin-left: 3em; margin-bottom: 2.4em; max-width: 33em; "&gt;&lt;p style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; "&gt;A lot of what is hard about writing a game is getting the &lt;em&gt;design&lt;/em&gt; right. What makes a game &lt;em&gt;fun?&lt;/em&gt; Game design is an art, not a science. It’s not just the rules of the game but the way in which you interact with the game.&lt;/p&gt;&lt;ul style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; padding-left: 3em; "&gt;&lt;li added="2007-01-26"&gt;&lt;a href="http://www.gamasutra.com/features/20051026/gabler_pfv.htm" style="color: rgb(170, 68, 68); "&gt;How to Prototype a Game in Under 7 Days&lt;/a&gt; - some good advice for getting something put together quickly to see if it’ll make a good game&lt;/li&gt;&lt;li added="2006-08-24"&gt;&lt;a href="http://www.gamasutra.com/features/20060823/goetz_01.shtml" style="color: rgb(170, 68, 68); "&gt;Too Many Clicks!&lt;/a&gt; Design the UI around the things the player wants to do, not around the objects in the game.&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.gamedev.net/reference/design/features/balance/" style="color: rgb(170, 68, 68); "&gt;Game Balance&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://mu.ranter.net/theory/" style="color: rgb(170, 68, 68); "&gt;Ramblings about RPG Design&lt;/a&gt; includes topics such as balance, food, economy, time, death, weapons, storyline, and magic.&lt;/li&gt;&lt;li added="2006-10-17"&gt;&lt;a href="http://lostgarden.com/2005/06/confessions-of-horrible-game-player.html" style="color: rgb(170, 68, 68); "&gt;Confessions of a horrible game player&lt;/a&gt; - why you shouldn’t punish game players for playing your game&lt;/li&gt;&lt;li&gt;The Design of Online Economies: &lt;a href="http://trac.bookofhook.com/bookofhook/trac.cgi/wiki/DesignOfOnlineEconomies1" style="color: rgb(170, 68, 68); "&gt;Part 1 (Currency)&lt;/a&gt;, &lt;a href="http://trac.bookofhook.com/bookofhook/trac.cgi/wiki/DesignOfOnlineEconomies2" style="color: rgb(170, 68, 68); "&gt;Part 2 (NPC Merchants)&lt;/a&gt;, &lt;a href="http://trac.bookofhook.com/bookofhook/trac.cgi/wiki/DesignOfOnlineEconomies3" style="color: rgb(170, 68, 68); "&gt;Part 3 (Items)&lt;/a&gt;, and &lt;a href="http://web.archive.org/web/http://bookofhook.com/Article/GameDesign/TheDesignofOnlineEconomie-4.html" style="color: rgb(170, 68, 68); "&gt;Part 4 (Skills)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://web.archive.org/web/http://www.lupinegames.com/articles/essgames.htm" style="color: rgb(170, 68, 68); "&gt;The Essence of Computer Games&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.vancouver.wsu.edu/fac/peabody/game-book/Coverpage.html" style="color: rgb(170, 68, 68); "&gt;The Art of Computer Game Design&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.gamedev.net/reference/design/features/evolution/default.asp" style="color: rgb(170, 68, 68); "&gt;Evolutionary Design&lt;/a&gt; - why you should get something up and running before designing everything about your game&lt;/li&gt;&lt;li added="2007-03-13"&gt;&lt;a href="http://gamethink.net/For-a-new-classification-of-game.html" style="color: rgb(170, 68, 68); "&gt;Classification of game genres&lt;/a&gt;&lt;/li&gt;&lt;li added="2006-10-17"&gt;&lt;a href="http://lostgarden.com/2006/10/persistent-myths-about-game-design.html" style="color: rgb(170, 68, 68); "&gt;Persistent Myths about Game Design&lt;/a&gt;&lt;/li&gt;&lt;li added="2007-03-13"&gt;&lt;a href="http://gamethink.net/The-myth-of-replayability.html" style="color: rgb(170, 68, 68); "&gt;The Myth of Replayability&lt;/a&gt;&lt;/li&gt;&lt;li added="2007-04-29"&gt;&lt;a href="http://www.zenofdesign.com/2005/04/12/please-not-the-permadeath-debate-again/" style="color: rgb(170, 68, 68); "&gt;The “death penalty” in games&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.prospect.org/cs/articles?article=seductions_of_sim" style="color: rgb(170, 68, 68); "&gt;Urban modeling&lt;/a&gt; - models used in SimCity&lt;/li&gt;&lt;li&gt;&lt;a href="http://gamestudies.org/0102/pearce/" style="color: rgb(170, 68, 68); "&gt;Sims, BattleBots, Cellular Automata, God and Go&lt;/a&gt; - an interview with Will Wright&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.art.net/~hopkins/Don/simcity/WillWright.html" style="color: rgb(170, 68, 68); "&gt;Designing simulation games&lt;/a&gt; - they’re games, not necessarily realistic models&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.rpglibrary.org/articles/storytelling/36plots.html" style="color: rgb(170, 68, 68); "&gt;The 36 plots&lt;/a&gt; for games&lt;/li&gt;&lt;li added="2007-03-18"&gt;&lt;a href="http://lostgarden.com/2007/02/one-billion-buttons-please-should-we.html" style="color: rgb(170, 68, 68); "&gt;One Billion Buttons&lt;/a&gt;: how to gradually teach complex concepts&lt;/li&gt;&lt;li added="2008-06-16"&gt;&lt;a href="http://www.design.wrong.net/2008/05/22/positive-and-negative-feedback/" style="color: rgb(170, 68, 68); "&gt;Positive and Negative Feedback&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://terranova.blogs.com/terra_nova/2004/11/believability.html" style="color: rgb(170, 68, 68); "&gt;Believability in games&lt;/a&gt; (read the comments too)&lt;/li&gt;&lt;li&gt;&lt;a href="http://web.archive.org/web/http://www.lupinegames.com/articles/progvexp.html" style="color: rgb(170, 68, 68); "&gt;Progressive vs. Experience games&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://tleaves.com/weblog/archives/000228.html" style="color: rgb(170, 68, 68); "&gt;Realism in games&lt;/a&gt;: how much is too much?&lt;/li&gt;&lt;li added="2008-05-05"&gt;&lt;a href="http://www.shamusyoung.com/twentysidedtale/?p=984" style="color: rgb(170, 68, 68); "&gt;An example of why you don’t want too much realism in a game&lt;/a&gt;&lt;/li&gt;&lt;li added="2006-11-17"&gt;&lt;a href="http://online.wsj.com/public/article/SB116302567283617814-THAAPhbntxo2joDaooBetAHHJno_20071113.html" style="color: rgb(170, 68, 68); "&gt;The use of physics in games&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://pc.ign.com/articles/579/579495p1.html" style="color: rgb(170, 68, 68); "&gt;The Future of Game Design&lt;/a&gt;&lt;/li&gt;&lt;li class="local"&gt;&lt;a href="http://www-cs-students.stanford.edu/~amitp/Articles/AddictiveGames.html" style="color: rgb(170, 68, 68); "&gt;Addictive Games&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://lostgarden.com/2007/04/spacecute-challenge-2-extending-verbs.html" style="color: rgb(170, 68, 68); "&gt;Designing controls for a game&lt;/a&gt;, including how to combine controls to build more complex ones&lt;/li&gt;&lt;li class="local"&gt;&lt;a href="http://www-cs-students.stanford.edu/~amitp/simblob/economy.html" style="color: rgb(170, 68, 68); "&gt;Design notes for my game, SimBlob&lt;/a&gt;&lt;/li&gt;&lt;li class="local"&gt;&lt;a href="http://www-cs-students.stanford.edu/~amitp/Articles/SRE-Design.html" style="color: rgb(170, 68, 68); "&gt;Design notes for my game, Solar Realms Elite&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://home.insightbb.com/~chilliedog/Htm/ultima_7_part_2.htm" style="color: rgb(170, 68, 68); "&gt;Design documents for Ultima 7 part 2&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.duke.edu/~tlove/simcity.htm" style="color: rgb(170, 68, 68); "&gt;SimCity Essay&lt;/a&gt;&lt;/li&gt;&lt;li added="2006-10-17"&gt;&lt;a href="http://lostgarden.com/2005/08/why-you-should-share-your-game-designs.html" style="color: rgb(170, 68, 68); "&gt;Why you should share your game designs&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://web.archive.org/web/http://www.lupinegames.com/articles/focus_gameplay.html" style="color: rgb(170, 68, 68); "&gt;The Focus of Gameplay&lt;/a&gt;&lt;/li&gt;&lt;li added="2007-03-13"&gt;&lt;a href="http://gamethink.net/Provide-a-good-legible-and-clear.html" style="color: rgb(170, 68, 68); "&gt;UI for games&lt;/a&gt;: displaying information vs. immersion&lt;/li&gt;&lt;/ul&gt;&lt;p style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; "&gt;Search for more pages on &lt;a href="http://www.google.com/custom?cof=L:http%3A//www-cs-students.stanford.edu/%7Eamitp/header2/gameprog.gif;GL:0;BGC:%23f0f0f0;T:black;LC:%23802020;VLC:%23604040;ALC:%23ff00ff;GALT:%23808040;&amp;amp;q=%22game+design%22" style="color: rgb(170, 68, 68); "&gt;game design&lt;/a&gt;, &lt;a href="http://www.google.com/custom?cof=L:http%3A//www-cs-students.stanford.edu/%7Eamitp/header2/gameprog.gif;GL:0;BGC:%23f0f0f0;T:black;LC:%23802020;VLC:%23604040;ALC:%23ff00ff;GALT:%23808040;&amp;amp;q=game+%22design+document%22" style="color: rgb(170, 68, 68); "&gt;design documents&lt;/a&gt;.&lt;/p&gt;&lt;/div&gt;&lt;h2 id="languages" style="font-family: 'Lucida Grande', 'Lucida Sans Unicode', Tahoma, sans-serif; font-weight: bold; letter-spacing: -1px; margin-top: 1.2em; margin-right: 0px; margin-bottom: 1.2em; margin-left: 0px; font-size: 1.2em; "&gt;Scripting Languages&lt;/h2&gt;&lt;div class="topic" style="margin-left: 3em; margin-bottom: 2.4em; max-width: 33em; "&gt;&lt;p style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; "&gt;I usually recommend putting general rules (“find a path from here to there”) in source code and specific rules (“if sensor 9 triggers in corridor 3, make guard 18 find a path to sensor 9”) in data files. However some things fall in between and are hard to express purely as data. That’s where scripting languages come in.&lt;/p&gt;&lt;p style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; "&gt;Scripting languages give you a way to write a lot of non-speed-critical code with comparatively little effort. You can design the language to specifically deal with your game, so the amount of work you have to do is less than for a general purpose language. Also, you can write the compiler to optimize for different things (like size instead of speed), allow more features (like dynamic patching at run-time), and even user customization (for enthusiastic users!).&lt;/p&gt;&lt;ul style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; padding-left: 3em; "&gt;&lt;li&gt;&lt;a href="http://web.archive.org/web/http://bookofhook.com/Article/GameDevelopment/TheSecretLifeofGameScript.html" style="color: rgb(170, 68, 68); "&gt;The Secret Life of Game Scripting&lt;/a&gt;&lt;/li&gt;&lt;li added="2009-07-27"&gt;&lt;a href="http://eblong.com/zarf/essays/rule-based-if/" style="color: rgb(170, 68, 68); "&gt;Rule-Based Programming&lt;/a&gt; and a comparison to Object-Oriented programming for game scripting&lt;/li&gt;&lt;li&gt;&lt;a href="http://harkal.sylphis3d.com/2005/08/10/multithreaded-game-scripting-with-stackless-python/" style="color: rgb(170, 68, 68); "&gt;Game scripting with Stackless Python&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Building a scripting engine parts &lt;a href="http://www.flipcode.com/articles/scripting_issue01.shtml" style="color: rgb(170, 68, 68); "&gt;1&lt;/a&gt; &lt;a href="http://www.flipcode.com/articles/scripting_issue02.shtml" style="color: rgb(170, 68, 68); "&gt;2&lt;/a&gt; &lt;a href="http://www.flipcode.com/articles/scripting_issue03.shtml" style="color: rgb(170, 68, 68); "&gt;3&lt;/a&gt; &lt;a href="http://www.flipcode.com/articles/scripting_issue04.shtml" style="color: rgb(170, 68, 68); "&gt;4&lt;/a&gt; &lt;a href="http://www.flipcode.com/articles/scripting_issue05.shtml" style="color: rgb(170, 68, 68); "&gt;5&lt;/a&gt; &lt;a href="http://www.flipcode.com/articles/scripting_issue06.shtml" style="color: rgb(170, 68, 68); "&gt;6&lt;/a&gt; &lt;a href="http://www.flipcode.com/articles/scripting_issue07.shtml" style="color: rgb(170, 68, 68); "&gt;7&lt;/a&gt; &lt;a href="http://www.flipcode.com/articles/scripting_issue08.shtml" style="color: rgb(170, 68, 68); "&gt;8&lt;/a&gt; &lt;a href="http://www.flipcode.com/articles/scripting_issue09.shtml" style="color: rgb(170, 68, 68); "&gt;9&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.worldforge.org/project/newsletters/November2001/NPC_Scripting" style="color: rgb(170, 68, 68); "&gt;NPC Scripting&lt;/a&gt;&lt;/li&gt;&lt;li class="local"&gt;&lt;a href="http://www-cs-students.stanford.edu/~amitp/Articles/Scripting1.html" style="color: rgb(170, 68, 68); "&gt;Discussion about what language to use, how to implement&lt;/a&gt; [newsgroup discussion]&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.raphkoster.com/gaming/dikuscr.shtml" style="color: rgb(170, 68, 68); "&gt;Scripting languages in MUDs&lt;/a&gt; [newsgroup discussion]&lt;/li&gt;&lt;li&gt;&lt;a href="http://simcity.ea.com/about/inside_scoop/scripting1.php" style="color: rgb(170, 68, 68); "&gt;Scripting in SimCity 4&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.gamedev.net/reference/programming/features/modxml1/" style="color: rgb(170, 68, 68); "&gt;Using XML for scripting&lt;/a&gt; (interesting, but not what Amit would recommend—it’s so verbose)&lt;/li&gt;&lt;li class="local"&gt;&lt;a href="http://www-cs-students.stanford.edu/~amitp/Articles/Scripting2.html" style="color: rgb(170, 68, 68); "&gt;Implementation strategies for scripting languages&lt;/a&gt; [newsgroup discussion]&lt;/li&gt;&lt;li&gt;&lt;a href="http://web.archive.org/web/http://lgdc.sunsite.dk/articles/3.html" style="color: rgb(170, 68, 68); "&gt;Writing modifiable games&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://onlamp.com/pub/a/onlamp/2004/11/24/interactive_fiction.html" style="color: rgb(170, 68, 68); "&gt;Scripting languages used in Interactive Fiction&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.roaringshrimp.com/WS04-04NCombs.pdf" style="color: rgb(170, 68, 68); "&gt;Scripting vs. rules&lt;/a&gt; [PDF]&lt;/li&gt;&lt;li&gt;&lt;a href="http://harkal.sylphis3d.com/2005/08/10/multithreaded-game-scripting-with-stackless-python/" style="color: rgb(170, 68, 68); "&gt;Using Stackless Python and microthreads for games&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://archive.gamespy.com/legacy/articles/devweek_b.shtm" style="color: rgb(170, 68, 68); "&gt;A Critical Look at Programming Languages&lt;/a&gt; ; Amit can agree with the basic message but not the details, and maybe he’ll rant on this subject someday&lt;/li&gt;&lt;/ul&gt;&lt;p style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; "&gt;I think for the best results, the scripting language should be &lt;em&gt;game specific&lt;/em&gt;. I want to be able to write &lt;em&gt;scripts&lt;/em&gt;, not code. For example, a script for a play might look like this:&lt;/p&gt;&lt;div class="inverse1" style="border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: rgb(136, 136, 136); border-right-color: rgb(170, 170, 170); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(170, 170, 170); background-color: rgb(238, 238, 238); width: 35em; resize: both; overflow-x: auto; overflow-y: auto; "&gt;&lt;div class="inverse2" style="border-top-width: 1px; border-top-style: solid; border-top-color: rgb(170, 170, 170); "&gt;&lt;div class="inverse3" style="border-top-width: 1px; border-right-width: 1px; border-bottom-width: 0px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: rgb(204, 204, 204); border-right-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); padding-top: 2px; padding-right: 2px; padding-bottom: 2px; padding-left: 2px; "&gt;&lt;pre style="color: rgb(68, 68, 34); font-size: 0.9em; white-space: pre; background-color: transparent; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: rgb(136, 136, 136); border-right-color: rgb(136, 136, 136); border-bottom-color: rgb(136, 136, 136); border-left-color: rgb(136, 136, 136); padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;       Amit [to Steve]: Hello, friend!        Steve [nods to Bryan]: Welcome to CGDC.        [Amit exits left.]&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;p style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; "&gt;Note that it’s very high level: it doesn’t specify exactly how Amit speaks or how Steve nods or even the timing. For this to work, you need to have some assumptions about how people behave, and that makes the language specific to the system you are setting up. In this particular language, the use of brackets marks actions and the colon marks speech. In another language brackets might mark optional parameters and colons mark sections. The more general purpose your language, the fewer assumptions you can make, so it becomes more verbose. For example, the conversation might look like this:&lt;/p&gt;&lt;div class="inverse1" style="border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: rgb(136, 136, 136); border-right-color: rgb(170, 170, 170); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(170, 170, 170); background-color: rgb(238, 238, 238); width: 35em; resize: both; overflow-x: auto; overflow-y: auto; "&gt;&lt;div class="inverse2" style="border-top-width: 1px; border-top-style: solid; border-top-color: rgb(170, 170, 170); "&gt;&lt;div class="inverse3" style="border-top-width: 1px; border-right-width: 1px; border-bottom-width: 0px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: rgb(204, 204, 204); border-right-color: rgb(204, 204, 204); border-bottom-color: rgb(204, 204, 204); border-left-color: rgb(204, 204, 204); padding-top: 2px; padding-right: 2px; padding-bottom: 2px; padding-left: 2px; "&gt;&lt;pre style="color: rgb(68, 68, 34); font-size: 0.9em; white-space: pre; background-color: transparent; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: rgb(136, 136, 136); border-right-color: rgb(136, 136, 136); border-bottom-color: rgb(136, 136, 136); border-left-color: rgb(136, 136, 136); padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "&gt;       Amit.turns_towards(Steve);        Amit.walks_within(3);        Amit.says_to(Steve, "Hello, friend!");        Amit.waits(1);        Steve.turns_towards(Bryan);        Steve.walks_within(5);        Steve.nods_to(Bryan);        Steve.waits(1);        Steve.says_to(Bryan, "Welcome to CGDC.");        Amit.waits(3);        Amit.face_direction(DIR_LEFT);        Amit.exits();&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;p style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; "&gt;That’s a &lt;em&gt;program&lt;/em&gt;, not a &lt;em&gt;script&lt;/em&gt;. See the difference? The script is high level, and specifies &lt;em&gt;what&lt;/em&gt; you want to be done, while the program is low level, and specifies exactly &lt;em&gt;how&lt;/em&gt; to do it. It’s not a great deal harder to interpret the first syntax than the second. You already have a programming language (C, C++, Pascal, Basic, etc.). You don’t need another! (Unless your goal is simply to allow run-time flexibility, which can be done with dynamically loaded libraries, or by using an existing language like Python.)&lt;/p&gt;&lt;p style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; "&gt;Try to think differently. Your scripting language doesn’t &lt;em&gt;have&lt;/em&gt; to look just like C. Think about using an event-based structure. For example, have commands like “when X happens, do Y.” Think about having many things happen at once. Amit doesn’t have to stop just because Steve is saying something. Think about different styles of programming, like rule based, functional, imperative, logic, and object-oriented. Think about alternate rules of logic, like fuzzy logic (truth isn’t certain) or linear logic (one truth can turn into another, making the first false). Make the language take advantage of the structure of your game, and you may find it much easier to build parts of your game world.&lt;/p&gt;&lt;p style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; "&gt;Search for more pages on &lt;a href="http://www.google.com/custom?cof=L:http%3A//www-cs-students.stanford.edu/%7Eamitp/header2/gameprog.gif;GL:0;BGC:%23f0f0f0;T:black;LC:%23802020;VLC:%23604040;ALC:%23ff00ff;GALT:%23808040;&amp;amp;q=%22scripting+languages%22" style="color: rgb(170, 68, 68); "&gt;scripting languages&lt;/a&gt;.&lt;/p&gt;&lt;/div&gt;&lt;h2 id="economics" style="font-family: 'Lucida Grande', 'Lucida Sans Unicode', Tahoma, sans-serif; font-weight: bold; letter-spacing: -1px; margin-top: 1.2em; margin-right: 0px; margin-bottom: 1.2em; margin-left: 0px; font-size: 1.2em; "&gt;Economics&lt;/h2&gt;&lt;div class="topic" style="margin-left: 3em; margin-bottom: 2.4em; max-width: 33em; "&gt;&lt;p style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; "&gt;Economics is the study of human choices when it comes to managing resources (money, time, happiness, raw materials, goods, and so on). In many strategy games, economics is an important aspect of the design. Balancing the resources of your world can be a fun part of the game. Economics is also important in multi-player game dynamics: you want to reward people for making money, yet you don’t want them to have so much power that new players cannot have fun. One thing I want to explore is how location influences economics. In high school economics, businesses compete by price. Whichever business sells for less will win. But if transportation cost is a factor, then both businesses can coexist, and the player has to make interesting decisions about &lt;a href="http://www.cs.sunysb.edu/~algorith/files/voronoi-diagrams.shtml" style="color: rgb(170, 68, 68); "&gt;where to place new facilities&lt;/a&gt; to balance all the variables (availability of labor, transportation cost of raw materials, transportation cost of product, tax rates, zoning laws, etc.).&lt;/p&gt;&lt;ul style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; padding-left: 3em; "&gt;&lt;li&gt;&lt;a href="http://www.raphkoster.com/gaming/gamevworld.shtml" style="color: rgb(170, 68, 68); "&gt;Is it a game or a world?&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.raphkoster.com/gaming/economy.shtml" style="color: rgb(170, 68, 68); "&gt;Economies in a virtual world&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://ai-depot.com/Articles/46/Economics.html" style="color: rgb(170, 68, 68); "&gt;AI Economics Agents&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.io.com/~sjohn/demog.htm" style="color: rgb(170, 68, 68); "&gt;Medieval Demographics Made Easy&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.wired.com/gaming/gamingreviews/news/2004/05/63363" style="color: rgb(170, 68, 68); "&gt;Economies of Virtual Worlds&lt;/a&gt; (more about macroeconomics than microeconomics)&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.gamedev.net/reference/articles/article251.asp" style="color: rgb(170, 68, 68); "&gt;Medieval Price List&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.modelistica.com/gral_description.htm" style="color: rgb(170, 68, 68); "&gt;Economic model of TRANUS&lt;/a&gt;, a (non-game) land use and transport model&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.s.kth.se/sigra/widelands-economy-documents/transport-system.html" style="color: rgb(170, 68, 68); "&gt;Transport system in Widelands&lt;/a&gt;&lt;/li&gt;&lt;li added="2009-06-01"&gt;&lt;a href="http://www.burningsea.com/pages/page.php?pageKey=news/article&amp;amp;article_id=10253" style="color: rgb(170, 68, 68); "&gt;Economic model of Pirates of The Burning Sea&lt;/a&gt;: labor, prices, markets, upkeep, taxes, and world events&lt;/li&gt;&lt;/ul&gt;&lt;p style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; "&gt;It’s hard to come up with rules for economics in an online virtual world when the underlying costs are so different. In the physical world, “objects” take resources to build, but they typically do not use resources to keep (if you don’t use them), and you typically do not get those resources back when you throw the object away. Therefore our real world economy is based on &lt;em&gt;buying&lt;/em&gt;things. In the virtual world, the “objects” take a small amount of memory and if you destroy the object, you get the memory back. At the same time, the very&lt;em&gt;existence&lt;/em&gt; of a virtual object costs CPU time, which cannot be recovered. Therefore the virtual world economy might be based on &lt;em&gt;renting&lt;/em&gt; things. If your world’s economy reflects the underlying costs, a diamond ring may “cost” as much as a bucket of sand. Although this reflects real costs of running your server, and therefore would discourage players from overloading it, it may not make sense for your game.&lt;/p&gt;&lt;p style="margin-top: 1.25em; margin-right: 0px; margin-bottom: 1.25em; margin-left: 0px; "&gt;In addition to the economics of objects, you have to consider the economics of living in the world. In the physical world, mere &lt;em&gt;existence&lt;/em&gt; of a person has a cost; in the virtual world, existence is cheap. Since a player may not be “logged on” all the time, it’s hard to come up with fair rules for the cost of existence without penalizing either players who play a lot (your core audience) or players who can’t log on much (who are likely to leave if penalized for not being there all the time). If you &lt;em&gt;require&lt;/em&gt; someone to work for a living, the casual players may not be able to compete, and may leave.&lt;/p&gt;&lt;/div&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6459911684038758872-4543774283695975412?l=ramakrishnanalluri.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramakrishnanalluri.blogspot.com/feeds/4543774283695975412/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ramakrishnanalluri.blogspot.com/2010/03/game-programming-information-this.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6459911684038758872/posts/default/4543774283695975412'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6459911684038758872/posts/default/4543774283695975412'/><link rel='alternate' type='text/html' href='http://ramakrishnanalluri.blogspot.com/2010/03/game-programming-information-this.html' title='Game Programming information -- this article is inspired from a friend&apos;s research.'/><author><name>Ram</name><uri>http://www.blogger.com/profile/06837494716141178442</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6459911684038758872.post-3799265162094857845</id><published>2009-06-14T02:00:00.000-07:00</published><updated>2009-06-14T02:18:28.116-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Research on Game Studio&apos;s'/><title type='text'>Research on Game Studio.</title><content type='html'>RamaKrishna.Nalluri&lt;br /&gt;&lt;br /&gt;Lucas Arts http://www.lucasart.com/ for the Console Game Development&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;1. BackGround And Origin Of Company :&lt;br /&gt;&lt;br /&gt;LucasArts http://www.lucasart.com/ is a leading publisher and developer of interactive entertainment software for videogame console systems and personal computers. The company was founded in 1982 by filmmaker George Lucas to provide an interactive element to his vision of a state-of-the-art, multifaceted entertainment company.&lt;br /&gt;&lt;br /&gt;Now, working more closely than ever with sister company Industrial Light &amp;amp; Magic (ILM) since its 2005 move to the Letterman Digital Arts Center in San Francisco, LucasArts continues to advance the art of game design, while still adhering to its original design philosophy: to create games that inspire, challenge and engage players.&lt;br /&gt;&lt;br /&gt;In 1982 Lucas Film Games Formed To Investigate The Capabilities Of The Atari 2600 And 5200,Intended They Worked Together And Developed Company's First Two Games,BallBlazer and Rescue on Fractalus,both of which would release in 1984.&lt;br /&gt;&lt;br /&gt;2.Successful Titles To Date :&lt;br /&gt;&lt;br /&gt;Ballblazer (1984), Rescue on Fractalus (1984), Koronis Rift (1985), Labyrinth (1986), PHM Pegasus (1986), and Strike Fleet (1987) developed by Lucasfilm Games for publication by other companies.&lt;br /&gt;&lt;br /&gt;In 1991 Lucas Arts, in collaboration with JVC Musical Industries, launches its first video Star Wars game, StarWars, for the Nintendo Entertainment system.&lt;br /&gt;&lt;br /&gt;In 1992 Lucas Arts introduces its first CD-ROM games, including The Secret of Monkey Island, Secret Weapons of the Luftwaffe and a full-voice "talke" version of Loom.&lt;br /&gt;&lt;br /&gt;In 1993 introduced X-Wing.&lt;br /&gt;In 1994 CD-ROM "talkie" version of Sam &amp;amp; Max Hit the Road.&lt;br /&gt;In 1995 introduced Dark Forces , Full Throttle , Rebel Assault 2 , The Hidden Empire.&lt;br /&gt;In 1996 introduced After Life , Mortimer and the Riddles of the Medallion.&lt;br /&gt;In 1997 introduced Rebel HQ - a unique multiplayer game.&lt;br /&gt;Out laws - 3D action game.&lt;br /&gt;X-Wing Vs. TIE Fighter.&lt;br /&gt;Dark Forces 2.&lt;br /&gt;&lt;br /&gt;From 1998 to till date they started introducing StarWars sequels like ( Rebellion , Episode / Racer , Force Commander , Rogue Squadron 2 , Racer Revenge , An Empire Divided , Battle Front Republic Commando(Xbox , pc) , Empire at War).&lt;br /&gt;&lt;br /&gt;In 2005 and 2006 they also introduced Mercenaries(PLAYSTATION2,Xbox) ,&lt;br /&gt;In 2007 LEGO Star Wars: The Complete Saga (Xbox 360, PLAYSTATION3, Wii, Nintendo DS).&lt;br /&gt;In 2008 LEGO Indiana Jones: The Original Adventures (Xbox 360, PLAYSTATION3,&lt;br /&gt;PlayStation2, Wii, PSP (Playstation Portable), Nintendo DS, PC).&lt;br /&gt;&lt;br /&gt;3.Currenct Project :&lt;br /&gt;&lt;br /&gt;With the last Star Wars movie released in 2005, LucasArts games play a vital role in the future of the Star Wars brand , as well as the continuation of the classic Indiana Jones adventures.&lt;br /&gt;&lt;br /&gt;With franchises such as Star Wars Battlefront , LEGO Star Wars and Knights of the Old Republic.&lt;br /&gt;&lt;br /&gt;4.Target market :&lt;br /&gt;&lt;br /&gt;LucasArts releases their products through key distribution partners in more than 70 countries worldwide, including the following: Argentina, Austria, Australia, Belgium, Brazil, French ,Canada, Columbia, Eastern Europe, France, Germany, Greece, Hong Kong, India, Ireland, Israel, Italy, Japan, Korea, Malaysia, Mexico, Netherlands, New Zealand, Philippines, Portugal, Saudi Arabia, Scandinavia, Singapore, South Africa, Spain, Switzerland, Taiwan, Thailand, Turkey, United Kingdom.&lt;br /&gt;&lt;br /&gt;5.Genres :&lt;br /&gt;&lt;br /&gt;LucasArts continues to advance the art of game design.Create games that inspire,challenge and engage players.&lt;br /&gt;&lt;br /&gt;6.Platforms :&lt;br /&gt;&lt;br /&gt;Play Station 3 and Play Station 2 computer entertainment systems, PlayStationPortable system , Xbox 360 video game system from Microsoft, Windows, Wii, Nintendo DS.&lt;br /&gt;&lt;br /&gt;7.Strategic Partnerships :&lt;br /&gt;&lt;br /&gt;LucasArts forges partnerships with innovative companies such as NaturalMotion Ltd. and Pixelux Entertainment that provide technologies which further supplement the development skills of LucasArt's own internal talent.&lt;br /&gt;&lt;br /&gt;Resources from sister companies ILM and Skywalker Sound only enhance LucasArt's lineup of immersive interactive entertainment.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Electronics Arts(EA) &lt;a href="http://www.ea.com/"&gt;http://www.ea.com/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Background and origin of the company :&lt;br /&gt;&lt;br /&gt;Electronics Arts(EA) &lt;a href="http://www.ea.com/"&gt;http://www.ea.com/&lt;/a&gt; is an international developer , marketer , publisher and distributer of video games. Founded and incorporated on May 28 , 1982 by Trip Hawkins .&lt;br /&gt;&lt;br /&gt;Originally , EA was a home computing game publisher. In the late 1980s, the company began developing games in-house and supported consoles by the early 1990s.EA has a revenue $5 million in the first year and $11 million the next.Former CEO Larry Probst arrived as VP of sales in late 1984 and helped the company sustain growth into $18 million in its third full year.In December 1986 David Gardner and Mark Lewis who is in sales department moved to UK to open a European headquarters.&lt;br /&gt;&lt;br /&gt;Hawkins liked the word “Electronic”,and various employees had considered the pharases “Electronic Artists” and “Electronic Arts”.But ,Steve Hayes opposed ,saying ,''We're not the artists,they are...'' meaning that the developers whose games EA would publish were the artists.&lt;br /&gt;&lt;br /&gt;This statement from Hayes immediately tilted sentiment towards Electronic Arts and the names was unanimously endorsed.In 1999 EA approved its first M-rated game for the PC , Probst later changed his overall stance on M-rated games , and now EA has several titles that compete in the M-rated,adult game arena.In 2004,EA made a multimillion dollar donation to fund the development of game production curriculum at the University of South Calfornia's Interactive Media Division.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Successful titles to date :&lt;br /&gt;&lt;br /&gt;In 1983 - Pinball Construction Set , M.U.L.E.&lt;br /&gt;In 1984 – Archon and Archon 2 , One on One , Music Construction Set.&lt;br /&gt;In 1985 – The Bard's Tale , Mail Order Monsters , Racing Destruction Set.&lt;br /&gt;In 1986 – Starflight.&lt;br /&gt;In 1987 – Skate or Die.&lt;br /&gt;In 1989 – Lakers versus Celtics , Populous.&lt;br /&gt;In 1992 – Desert Strike:Return to the Gulf.&lt;br /&gt;In 1993 – FIFA series.&lt;br /&gt;In 1994 – Need for Speed series.&lt;br /&gt;In 1997 – Ultima Online.&lt;br /&gt;In 1999 – Command &amp;amp; Conquer series , SimCity series.&lt;br /&gt;In (1999-2008) – Medal of Honor.&lt;br /&gt;In (2000-2008) – SSX series.&lt;br /&gt;In (1999-2005) – James Bond series.&lt;br /&gt;In (2001-present) – Burnout series.&lt;br /&gt;In (2002-present) – Battlefield series.&lt;br /&gt;In (2007-present) – Rock Band series.&lt;br /&gt;In 2007 – EA Skate.&lt;br /&gt;In 2008 – Spore , Dead Space , Mirror's Edge.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Electronic Arts also published a number of non-game titles.The most popular of these was closely related to the video game industry and was actually used by several of their developers.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Current projects :&lt;br /&gt;Burnout series , Battlefield series , Rock Band series ,SimCity series , NCAA Football series.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Target market :&lt;br /&gt;&lt;br /&gt;EA has target the markets in various countries like , United Kingdom,Sweden, China, Turkey, New- York, Germany, Spain , Romania , Canada , Australia and Hyderabad(India).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Genres :&lt;br /&gt;&lt;br /&gt;EA is Interactive entertainment , its geners are Racing ,Shooting , Puzzle, RPG , Kids , Strategy , Simulation , Sports.&lt;br /&gt;&lt;br /&gt;Platforms :&lt;br /&gt;&lt;br /&gt;Wii , PC , Online , Xbox 360 , PLATSTATION3 , PLAYSTATIO2 , Nintendo DS , Mobile.&lt;br /&gt;&lt;br /&gt;Strategic partnerships :&lt;br /&gt;&lt;br /&gt;EA has Strategic partnerships with Nfl , Espn , Hasbro and The Sims.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The Figure : The Original EASN and&lt;br /&gt;EA sports logos.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;BLIZZARD ENTERTAINMENT www.blizzard.com&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Background and origin of the company :&lt;br /&gt;&lt;br /&gt;Blizzard Entertainment &lt;a href="http://www.blizzard.com/"&gt;http://www.blizzard.com/&lt;/a&gt; is an American video game developer. It is a division of Activision Blizzard , Blizzard is the creator of several successful PC games , including the Warcraft , StarCraft ,Diablo series and the MMORPG World of Warcraft. Blizzard was founded in 1991 by Michael Morhaime , Allen Adham , and Frank Pearce.In 1994 the company briefly changed its name to Chaos Studies , before finally settling on Blizzard Entertainment after it was discovered that another company with the Chaos name already existed.&lt;br /&gt;&lt;br /&gt;Blizzard launched their online gaming service Battle net in January 1997 with the release of their action-RPG Diablo.In 2004 Blizzard opened European offices in the Paris.&lt;br /&gt;&lt;br /&gt;In 2008 , Blizzard was honored at the 59th Annual Technology Emmy Awards for the creation of World of Warcraft. Mike Morhaime accepted the award.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Successful titles to date :&lt;br /&gt;&lt;br /&gt;In 1992-RPM Racing ,Battles Chess , J.R.R. Tolkien's The Lord of the Rings .&lt;br /&gt;In 1993-Rock N' Roll Racing.&lt;br /&gt;In 1994-War craft , Blackthome ,The Death AND Return of Superman .&lt;br /&gt;In 1995-War craft 2 , The Lost Vikings 2.&lt;br /&gt;In 1996-Diablo .&lt;br /&gt;In 1998-Star Craft .&lt;br /&gt;In 1999-War craft 2 .&lt;br /&gt;In 2000-Diablo 2.&lt;br /&gt;In 2001-Diablo 2-Lord of Destruction.&lt;br /&gt;In 2002-War craft 3-Reign of Chaos.&lt;br /&gt;In 2003-War craft 3-The Frozen Throne.&lt;br /&gt;In 2004-World of War craft.&lt;br /&gt;In 2008-World of War craft :Wrath of the King.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Current projects :&lt;br /&gt;&lt;br /&gt;Star Craft 2(Wings of Liberty) ,Star Craft 2(Heart of the Swarm) , Diablo 3 ,MMO project.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Target market :&lt;br /&gt;&lt;br /&gt;Blizzard has targeted its market in UK , US and the Other Western and Asian Countries ,it has $1.1 Billion Revenue in the Market.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Genres :&lt;br /&gt;&lt;br /&gt;Racing Game ,Puzzle Game ,Role-Playing Game ,Sport ,Fighting Game , Fantasy real-time strategy Game ,Expansion Pack ,Science Fiction .&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Platforms :&lt;br /&gt;&lt;br /&gt;They use Super NES , Amiga , Apple 2 ,Atari ST.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Strategic partnerships :&lt;br /&gt;&lt;br /&gt;They have Strategic partnerships with Click Entertainment , Carbine Studios ,Turpitude Design.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;2.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6459911684038758872-3799265162094857845?l=ramakrishnanalluri.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramakrishnanalluri.blogspot.com/feeds/3799265162094857845/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ramakrishnanalluri.blogspot.com/2009/06/research-on-game-studio.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6459911684038758872/posts/default/3799265162094857845'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6459911684038758872/posts/default/3799265162094857845'/><link rel='alternate' type='text/html' href='http://ramakrishnanalluri.blogspot.com/2009/06/research-on-game-studio.html' title='Research on Game Studio.'/><author><name>Ram</name><uri>http://www.blogger.com/profile/06837494716141178442</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6459911684038758872.post-3204691418191877339</id><published>2009-06-14T01:45:00.000-07:00</published><updated>2009-06-14T01:48:37.327-07:00</updated><title type='text'>Game Developer</title><content type='html'>Programme Developer for Console Games...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6459911684038758872-3204691418191877339?l=ramakrishnanalluri.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ramakrishnanalluri.blogspot.com/feeds/3204691418191877339/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ramakrishnanalluri.blogspot.com/2009/06/game-developer.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6459911684038758872/posts/default/3204691418191877339'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6459911684038758872/posts/default/3204691418191877339'/><link rel='alternate' type='text/html' href='http://ramakrishnanalluri.blogspot.com/2009/06/game-developer.html' title='Game Developer'/><author><name>Ram</name><uri>http://www.blogger.com/profile/06837494716141178442</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
