Vous êtes sur la page 1sur 23

WiseTravel

CpE324 FINAL PROJECT

AKUT, PIPOS
BERDIN, CARLA
HINO, AWON
PALABRICA, NEIL PAOLO
NOVABOS, KELVIN RUEL
MARCH 28, 2014
1

Members and contribution:


AKUT- 100 airports coordinates
plot.C
BERDIN- FP.C ,PLOT.C
minPath.c
allPaths.c
HINO MAP.C
PLOT.C
PALABRICA-100 Airports and coordinates,
allPaths.c
plot.C
NOVABOS-FXNS.C
FP.C
allPaths.c

/********STATIC AIRPORTS AND THEIR


CORRESPONDING NODE NUMBER
1 Singapore Changi Airport, Singapore City,
Singapore
2 Incheon International Airport, Incheon, South
Korea
3 Amsterdam Schiphol Airport, 1118 CP Schipol,
Netherlands
4 Hong Kong International Airport, Hong Kong
5 Beijing Capital International Airport, Beijing, China
6 Munich Airport, 85356 Munchen, Germany
7 Zurich Airport, Zurich-Flughafen, Switzerland
8 Vancouver International Airport, Richmond,
Canada
9 Tokyo International Airport (Haneda), Tokyo,
Japan
10 London Heathrow Airport, Greater London,
United Kingdom
11 Los Angeles International Airport, Los Angeles,
United States
12 Auckland International Airport, Auckland, New
Zealand
13 Newark Liberty International Airport, New
Jersey, United States
14 Kuala Lumpur International Airport, Selangor,
Malaysia
15 Helsinki Airport, Vantaa, Findland
16 Ninoy Aquino International Airport, Pasay,
Philippines
17 Copenhagen Airport, Kastrup, Denmark
18 Belgorod International Airport, Belgorod, Russia
19 Shanghai Hongqiao International Airport,
Shanghai, China
20 Abu Dhabi Internation Airport, Abu Dhabi, United
Arab Emirates
21 Brisbane Airport, Brisbane, Australia
22 Cape Town International Airport, Cape Town,
Africa
23 Kulusuk Airport, Greenland
24 Taiwan Taoyuan International Airport, Taoyuan
County, Taiwan
25 Jorge Chavez International Airport, Callao, Peru
26 King Shaka International Airport, Durban, South
Africa
27 Upernavik Airport, Upernavik, Greenland
28 Nanortalik Heliport, Nanortalik, Greenland
29 Melbourne Airport, Melbourne, Australia
30 Cincinnati/Northern Kentucky International
Airport, Kentucky, United States
31 Sydney Airport, Sydney, Australia
32 Istanbul Ataturk Airport, Istanbul, Turkey
33 Orlando International Airport, Orlando, United
States
34 Petrozavodsk Airport, Besovets, Russia
35 Pulkovo International Airport, St. Petersburg,
Russia
36 Denver International Airport, Denver, United
States
37 Igarka Airport, Krasnoyarsk Krai, Russia
38 Suvarnabhumi Airport, Bangkok, Thailand
39 Barcelona El Prat Airport, Barcelona, Spain

40 San Francisco International Airport, San


Francisco, United States
41 Abbotsford International Airport, Abbotsford,
Canada
42 Guangzhou Baiyun International Airport,
Guangzhou, China
43 Grand Falls Airport, Drummond, Canada
44 Haikou Meilan International Airport, Haikou,
China
45 Jose Joaquin de Olmedo International Airport,
Guayaquil, Ecuador
46 Toronto Pearson Internation Airport,
Mississauga, Canada
47 Kamloops Airport, Kamloops, Canada
48 Hartsfield Jackson Atlanta International Airport,
Atlanta, United States
49 Moscow Domodedovo Airport, Moskovskaya
oblast, Russia
50 Vienna International Airport, Vienna, Austria
51 Athens International Airport, Athens, Greece
52 Gold Coast Airport, Gold Coast, Australia
53 Francisco de Sa Carneiro Airport, Maia, Portugal
54 Dallas/Fort Worth International Airport, Dallas,
United States
55 Bahrain International Airport, Muharraq, Bahrain
56 Oslo Airport, Gardermoen, Norway
57 Piney Pinecreek Border Airport, Minnesota,
United States
58 Halifax Stanfield International Airport, Enfield,
Canada
59 Regina International Airport, Saskatchewan,
Canada
60 Stockholm Arlanda Airport, Stockholm-Arlanda,
Sweden
61 Prague Vaclav Havel Airport, Czechoslovakia
62 Seattle Tacoma International Airport, Seattle,
United States
63 John F. Kennedy International Airport, New
York, United States
64 Baltimore Washington International Airport,
Washington, United States
65 Rajiv Gandhi International Airport, Shamshabad,
India
66 Brussels Airport, Zaventem, Belgium
67 Lisbon Portela Airport, Lisboa, Portugal
68 Doha International Airport, Doha, Qatar
69 Indira Gandhi International Airport, Palam, India
70 McCarran International Airport, Nevada, United
States
71 Minneapolis Saint Paul International Airport,
Minneapolis, United States
72 Malta International Airport, Luqa, Malta

73 Congonhas Sao Paulo Airport, Sao Paulo,


Brazil
74 Tocumen International Airport, Panama City,
Panama
75 Muscat International Airport, Muscat, Oman
76 Nice Cote dAzur International Airport, Nice,
France
77 Adelaide Airport, Adelaide, Australia
78 Simon Bolivar International Airport, Caracas,
Venezuela
79 Detroit Metropolitan Wayne County Airport,
Detroit, United States
80 George Bush Intercontinental Airport, Houston,
United States
81 Keflavik International Airport, Reykjavik, Iceland
82 Fairbanks International Airport, Alaska, United
States
83 Montreal-Pierre Elliot Trudeau International
Airport, Dorval, Canada
84 OHare International Airport, Chicago, United
States
85 Luxembourg Findel Airport, Luxembourg City,
Luxembourg
86 Raleigh-Durham International Airport, North
Carolina, United States
87 Charlotte Douglas International Airport, North
Carolina, United States
88 Logan International Airport, Boston, United
States
89 Sheremetyevo International Airport, Moscow,
Russia
90 Aeroparque Jorge Newbery, Buenos Aires,
Argentina
91 El Dorado International Airport, Bogota,
Colombia
92 Rio de Janeiro International Airport, Rio de
Janeiro, Brazil
93 Newark Liberty International Airport, New
Jersey, United STates
94 Salt Lake City International Airport, Utah, United
States
95 Dublin Airport, Dublin, Ireland
96 Ministro Pistarini International Airport, Buenos
Aires, Argentina
97 Pittsburgh International Airport, Pittsburgh,
United States
98 Benito Juarez International Airport, Mexico City,
Mexico
99 Cairo International Airport, Cairo, Egypt
100 Ben Gurion Airport, Israel
***************************************************/

fp.prj
fp.c
map.c
fxns.c
Ndist.c
minPath.c
plot.c
allPaths.c
connect.c
#ifndef FP_H
#define FP_H
#define SUCCESS 0
#define FALSE 0
#define TRUE 1
#define ORGN_NOTFOUND -1
#define DEST_NOTFOUND -2
#define DEST_INVALID -3
#define MEM_ERROR -4
#define MAX_VAL 5000
#define DIST_FACTOR 22
#define NODES 100

NODE* search_fromKey(int fromKey, NODE*


graphHead);
NODE* search_toKey(int toKey, ARC* arc);
STOP* find_minPath(NODE* graphHead, int
fromKey, int toKey);
STOP* ins_Stop(int fromKey, int dist_frominDeg,
STOP* first_Stop);
void disp_minPath(STOP* first_Stop, NODE*
graphHead);
void disp_List(NODE* graphHead);
NODE* create(int Xcor, int Ycor);
int map();
int plot(NODE **myHead,int airportP[50][2], int
airportP2[50][2]);
int Ndist(int fk,int tk, NODE* graphHead);
int allpaths(NODE* graphHead);
#endif

typedef struct dijkstra_vars


{
int processed;
int tLabel;
int inDegkey;
int dist_frominDeg;
}DIJ;
typedef struct node
{
int fromKey;
int Xcor;
int Ycor;
struct node *next;
struct arc *firstArc;
DIJ dij;
}NODE;
typedef struct stop
{
int toKey;
int dist_fromPrev;
struct stop *next;
}STOP;
typedef struct arc
{
int toKey;
int dist;
int fare;
struct arc *next;
struct arc *prev;
}ARC;
int ins_Node(int i, int Xcor, int Ycor, NODE*
graphHead);
int ins_Arc(int fromKey, int toKey, int dist, int fare,
NODE* graphHead);

/********************************
Title: FP.C
Written by: BERDIN, CARLA
NOVABOS, KELVIN
Date: 03/25/14
********************************/
#include "FP.H"
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <graphics.h>
/**

This program implements mainly the GRAPH


ADT (DIRECTED), with linked lists. The graph uses
realistic distances and airports as well.
On runtime, option 1 on the menu has a
default connected nodes(routes) for the user. If in
such cases, the user would want to start from scratch,
option 1 should be neglected, and he should
proceed to option 2.
In checking the correctness of minPath, a
sample shall be provided.
(Consider that the program solves for the
distance of nodes using the Pythagorean Theorem)
Note:

On some functions, more than 1 person


worked on it as a team.
*/
int airports[50][2]={
{467,258},
{502,136},
{287, 126},
{497, 189},
4

{485, 135},
{307, 145},
{297, 151},
{81, 139},
{519, 142},
{251, 132},
{73, 175},
{571, 320},
{148, 170},
{462, 255},
{328, 100},
{495, 218},
{309, 112},
{346, 141},
{500, 167},
{381, 204},
{373, 206},
{299, 332},
{251, 53},
{504, 199},
{397, 124},
{326, 321},
{206, 66},
{221, 79},
{541, 337},
{129, 164},
{549, 327},
{336, 170},
{130, 186},
{354, 93},
{338, 105},
{108, 160},
{442, 104},
{461, 228},
{283, 168},
{72, 164},
{385, 179},
{473, 200},
{332, 219},
{318, 281},
{124, 259},
{144, 145},
{141, 99},
{127, 174},
{360, 132},
{319, 145}
};
int airports2[50][2]={{326, 173},
{477, 277},
{258, 174},
{105, 178},
{378, 198},
{302, 107},
{114, 141},
{173, 145},
{354, 148},
{318, 107},
{313, 137},
{79, 145},
{155, 165},
{75, 151},
{419, 225},

{283, 132},
{257, 182},
{172, 277},
{418, 194},
{82, 170},
{124, 146},
{310, 182},
{175, 297},
{129, 219},
{386, 204},
{281, 146},
{532, 331},
{148, 218},
{138, 150},
{108, 185},
{271, 59},
{53, 86},
{153, 141},
{130, 155},
{288, 138},
{137, 168},
{148, 170},
{164, 156},
{365, 117},
{158, 312},
{141, 230},
{180, 290},
{279, 223},
{87, 161},
{237, 129},
{160, 320},
{343, 237},
{104, 202},
{346, 194},
{356, 188}
};
int main()
{
int dist, fromKey=1, toKey=1, i=1,
res,gd=DETECT, gm,fare,trial1,trail2;
NODE* graphHead;
NODE* tNode;
STOP* first_Stop;
STOP* first_Stop2;
STOP* tStop;
char choice;
graphHead = NULL;
while(i<=NODES)
{
if(i==1)
graphHead =
create(airports[0][0],airports[0][1] );
else
{
if(i<=51)
ins_Node(i, airports[i-1][0],
airports[i-1][1] , graphHead);
else if (i>51)
ins_Node(i, airports2[i51][0], airports2[i-51][1] , graphHead);
5

}
i++;
}
clrscr();
gotoxy(13,9);
printf(" _ _ _ __ ___ _____ ___ __ _
_ ___ _ \n");
gotoxy(13,10);
printf(" | | | || |/' _/| __|_ _| _ \\/ \\ | \\ / || __|
|\n");
gotoxy(13,11);
printf(" | 'V' || |`._`.| _| | | | v / /\\ |`\\ V /'| _||
|_\n");
gotoxy(13,12);
printf(" |_/ \\_||_||___/|___| |_| |_|_\\_||_| \\_/
|___|___|BETA\n");
gotoxy(33,13);
printf("LOADING SCREEN");
delay(1000);
printf(".");
delay(1000);
printf(".");
delay(1000);
printf(".");
gotoxy(33,13);
printf("PRESS ANY KEY. ");
getch();

while(1)
{

printf("Enter destination: ");


scanf("%i",&toKey);

}
switch(choice)
{
case 1: allpaths(graphHead); break;

case 2:
dist=Ndist(fromKey,toKey,graphHead);
res = ins_Arc(fromKey, toKey, dist, 0
,graphHead);
gotoxy(70,25);
gotoxy(33,25);
printf("%s",showResult(res));
getch();
break;
case 3: res = del_Arc(fromKey, toKey,
graphHead);
gotoxy(70,25);
printf("%s",showResult(res));
getch();
break;
case 4:

closegraph();
initgraph(&gd,&gm,"C:\\BGI");
map();
/* connect(&graphHead,airports,airports2); */
plot(&graphHead,airports,airports2);
gotoxy(1,24);
printf("\n");
printf("[1] One-Way\n");

clrscr();
initgraph(&gd,&gm,"C:\\BGI");
map();

printf("[2] Round-Trip\n");
printf("Choice: ");

plot(&graphHead,airports,airports2);
gotoxy(1,24);
printf("\n-MENU-\n");
printf("[1] Show Paths\n");
printf("[2] Add Path\n");
printf("[3] Delete Path\n");
printf("[4] Show minPath\n");
printf("[5] Quit");
gotoxy(30,25);
textcolor(3);
printf("Choice: ");
scanf("%i",&choice);

scanf("%i",&choice);
first_Stop = find_minPath(graphHead,
fromKey, toKey);
if(first_Stop==NULL)
{
printf("\nNO PATH TO DEST!\n");
}
if(choice==1)

if(choice<5 && choice!=1)


{
gotoxy(30,25);
printf("Enter origin: ");
scanf("%i",&fromKey);
gotoxy(48,25);

disp_minPath(first_Stop, graphHead);
if(choice==2)
{

NODE* newNode;
newNode = (NODE*)malloc(sizeof(NODE));

first_Stop2 = find_minPath(graphHead,
toKey, fromKey);

if(newNode)
{
newNode->fromKey = 1;
newNode->Xcor = Xcor;
newNode->Ycor = Ycor;
newNode->next = NULL;
newNode->firstArc = NULL;
}

if(first_Stop2 == NULL)
printf("\nNO PATH BACK TO ORGN!\n");
else
{
/* find tail of first route */
/* connect first and second routes */
tStop = first_Stop.
while(tStop->next!=NULL)
tStop = tStop->next;
tStop->next = first_Stop2;
disp_minPath(first_Stop,
graphHead);

return newNode;
}
NODE* search_fromKey(int fromKey, NODE* node)
{
if(node->fromKey == fromKey)
return node;
else
{

}
}
getch();
break;

node = node->next;
return search_fromKey(fromKey,

node);
}

closegraph();
initgraph(&gd,&gm,"C:\\BGI");
gotoxy(20,13);
printf("AKUT, BERDIN,
HINO,PALABRICA , NOVABOS");
gotoxy(40,14);
delay(1000);
printf(".");
delay(1000);
printf(".");
delay(1000);
printf(".");
exit(0);

case 5:

default: break;
}
}
}
/********************************
Title: FXNS.C
Written by: NOVABOS, KELVIN
Date: 03/25/14
********************************/
#include <graphics.h>
#include <stdio.h>
#include <conio.h>
#include "FP.H"
NODE* create(int Xcor, int Ycor)
{

NODE* search_toKey(int toKey, ARC* arc)


{
if(arc==NULL)
return arc;
else if(arc->toKey == toKey)
return arc;
else
>next);
}

return search_toKey(toKey, arc-

int ins_Node(int i, int Xcor, int Ycor, NODE*


graphHead)
{
NODE* newNode;
NODE* tNode;
newNode = (NODE*)malloc(sizeof(NODE));
if(newNode)
{
newNode->fromKey = i;
newNode->Xcor = Xcor;
newNode->Ycor = Ycor;
newNode->next = NULL;
newNode->firstArc = NULL;
/* searching last position */
tNode = graphHead;
while(tNode->next!=NULL)
tNode = tNode->next;

tNode->next = newNode;

if(tArc->toKey > toKey)


{
/* larger found, insert before it */
/* if multiple arcs */

return SUCCESS;
}
else

if(tArc->prev!=NULL)
{
tArc->prev->next = newArc;
newArc->prev = tArc->prev;
}

return MEM_ERROR;

int ins_Arc(int fromKey, int toKey, int dist, int fare,


NODE* graphHead)
{
NODE *tNode;
ARC* newArc;
ARC* tArc;

else
{
tNode->firstArc = newArc;
newArc->prev = NULL;

/*tempNode pointer*/
}

/*tempArc

pointer*/
int flag = 0;
done while traversing*/

/*set to 1 if an insert is
}

if(fromKey > NODES || fromKey < 1)


return ORGN_NOTFOUND;

else if(tArc->toKey == toKey)


return DEST_INVALID;

if(toKey > NODES || toKey < 1)


return DEST_NOTFOUND;

/* create new arc */


newArc = (ARC*)malloc(sizeof(ARC));

else
tArc->prev->next = newArc;
newArc->prev = tArc->prev;
newArc->next = tArc;
tArc->prev = newArc;
}

/* find its source from list */


tNode = search_fromKey(fromKey,
graphHead);
/* insert new arc observing proper
key sequence */

else if(tArc->toKey == toKey)


return DEST_INVALID;

/* if empty arc list, insert at head */


if(tNode->firstArc==NULL)
{
tNode->firstArc = newArc;
newArc->prev = NULL;
newArc->next = NULL;
}

else
/* new toKey is greatest, insert at last */
{
tArc->next = newArc;
newArc->prev = tArc;
newArc->next = NULL;
}

/*else, find proper position to


else
{

tArc = tArc->next;
if(flag<1)
{
/* insert before the last arc */
if(toKey < tArc->toKey)
{
if(tArc->prev==NULL)
tNode->firstArc = newArc;

if(newArc)
{
newArc->toKey = toKey;
newArc->dist = dist;
newArc->fare = fare;

insert*/

newArc->next = tArc;
tArc->prev = newArc;
flag = 1;
break;

}
/* start at firstArc */
tArc = tNode->firstArc;
/* traverse the arc list */
while(tArc->next!=NULL)
{

}
return SUCCESS;
}
else return MEM_ERROR;
8

{
printf("Node %i: ",tNode->fromKey);

int del_Arc(int fromKey, int toKey, NODE* graphHead


)
{
ARC* tArc;
NODE* tNode;
if(fromKey > NODES || fromKey < 1)
return ORGN_NOTFOUND;
if(toKey > NODES || toKey < 1)
return DEST_NOTFOUND;

tArc = tNode->firstArc;
while(tArc!=NULL)
{
printf("-> %i(%i) ", tArc>toKey, tArc->dist);
tArc = tArc->next;
}
tNode = tNode->next;
printf("\n");
}
}

tNode = search_fromKey(fromKey,
graphHead);
tArc = search_toKey(toKey, tNode->firstArc);
if(tArc==NULL)
return DEST_NOTFOUND;
else
{
/* delete head */
if(tArc->prev==NULL)
{
tNode->firstArc = tArc-

>next;

tArc->next->prev = NULL;
}
/*delete last */
else if(tArc->next==NULL)
tArc->prev->next=NULL;
/* delete middle */
else
{
tArc->prev->next = tArc->next;
tArc->next->prev = tArc->prev;
}
free(tArc);

/* delete success */
return SUCCESS;

STOP* find_minPath(NODE* graphHead, int


fromKey, int toKey)
{
/* DIJSKTRA's ALGO */
NODE* tNode;
NODE* tArcDest;
NODE* min_tLabel;
NODE* orgn;
NODE* dest;
ARC* tArc;
STOP* first_Stop;
first_Stop = NULL;
min_tLabel = NULL;
/* initialize dij variables */
tNode = graphHead;
while(tNode!=NULL)
{
tNode->dij.processed = FALSE;
tNode->dij.tLabel = MAX_VAL;
tNode->dij.inDegkey = 0;
tNode->dij.dist_frominDeg =
MAX_VAL;
}

tNode = tNode->next;

/* find origin */
orgn = search_fromKey(fromKey,
graphHead);
tNode = orgn;

}
void disp_List(NODE* graphHead)
{
NODE* tNode;
NODE* tNode2;
ARC* tArc;
ARC* tArc2;
tNode = graphHead;
printf("\nADJACENCY LIST: \n");
while(tNode != NULL)

/* set dij of origin */


tNode->dij.processed = TRUE;
tNode->dij.tLabel = 0;
tNode->dij.inDegkey = tNode->fromKey;
tNode->dij.dist_frominDeg = 0;
/* printf("%i %i %i\n",tNode->fromKey,
tNode->dij.processed, tNode->dij.tLabel); */
/* find dest */
dest = search_fromKey(toKey, graphHead);

return NULL;
while(dest->dij.processed!=TRUE)
{
/* process its arcs */
tArc = tNode->firstArc;
while(tArc!=NULL)
{
/* find the dest of tArc */
tArcDest =
search_fromKey(tArc->toKey, graphHead);
if(tArc->dist + tNode>dij.tLabel < tArcDest->dij.tLabel && tArcDest>dij.processed != TRUE)
{
tArcDest>dij.tLabel = tArc->dist + tNode->dij.tLabel;

/* process min_tLabel*/
tNode = min_tLabel;
tNode->dij.processed = TRUE;
min_tLabel = NULL;
}
/* make the route stack */
while(first_Stop->toKey != orgn->fromKey)
{
first_Stop = ins_Stop(tNode>fromKey, tNode->dij.dist_frominDeg, first_Stop);
tNode = search_fromKey(tNode>dij.inDegkey, graphHead);
}

if(tArc->dist <
tArcDest->dij.dist_frominDeg)

/* free all inDeg nodes */

return first_Stop;
}

tArcDest->dij.inDegkey = tNode->fromKey;
tArcDest->dij.dist_frominDeg = tArc->dist;
}
}
}

least tLabel */

STOP* ins_Stop(int fromKey, int dist_frominDeg,


STOP* first_Stop)
{
/* insert at head always */
STOP* tStop;
tStop = (STOP*)malloc(sizeof(STOP));

tArc = tArc->next;

if(first_Stop == NULL)
tStop->next = NULL;
else
{

/* choose unprocessed node with

tNode = graphHead;
while(tNode!=NULL)
{
if(tNode->dij.processed ==
FALSE && tNode->dij.tLabel < MAX_VAL)
{
if(min_tLabel ==
NULL)

tStop->next = first_Stop;
first_Stop = tStop;

tStop->toKey = fromKey;
tStop->dist_fromPrev = dist_frominDeg;
return tStop;
}

min_tLabel = tNode;
else
{
if(min_tLabel->dij.tLabel > tNode->dij.tLabel)
min_tLabel = tNode;
}
}
tNode = tNode->next;
}
if(min_tLabel==NULL)

void disp_minPath(STOP* first_Stop, NODE*


graphHead)
{
STOP* tStop;
NODE* a;
NODE* b;
int totaldist=0;
tStop = first_Stop;
gotoxy(1,25);
while(tStop!=NULL)
{
printf("%i(%i)-> ", tStop->toKey,
tStop->dist_fromPrev);
10

totaldist += tStop->dist_fromPrev;
a=search_fromKey(tStop->toKey,
graphHead);
if(tStop->next!=NULL)
{
b=search_fromKey(tStop>next->toKey, graphHead);
setcolor(15);
line(a->Xcor, a->Ycor, b>Xcor, b->Ycor);
}
tStop = tStop->next;
}
printf("END");
printf("\nTotal Dist: %i",totaldist);
printf("\nActual Dist: %i miles",
totaldist*DIST_FACTOR);
}
char* showResult(int res)
{
if(res==SUCCESS)
return "--SUCCESS\0";
if(res==ORGN_NOTFOUND)
return "--ORGN_NOTFOUND\0";
if(res==DEST_NOTFOUND)
return "--DEST_NOTFOUND\0";

if(res==DEST_INVALID)
return "--DEST_INVALID\0";

/********************************
Title: NDIST.C
Written by: NOVABOS, KELVIN
BERDIN, CARLA
Date: 03/25/14
********************************/
#include <stdio.h>
#include <conio.h>
#include <math.h>
#include "FP.H"
int Ndist(int fk,int tk, NODE* grapHead)
{
int temp,dist,tempx,tempy;
NODE* x;
NODE* y;
x = search_fromKey(fk, grapHead);
y = search_fromKey(tk, grapHead);
tempx = abs(x->Xcor - y->Xcor);
tempy = abs(x->Ycor - y->Ycor);
dist = hypot(tempx, tempy);
return dist;
}

/********************************
Title: ALLPATHS.C
Written by: PALABRICA, PAOLO
BERDIN,CARLA
NOVABOS, KELVIN
Date: 03/25/14
********************************/
#include "FP.H"
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <graphics.h>
int allpaths(NODE* graphHead)
{
int dist,first=0;
int n36[21] = {94, 64, 62, 8, 40, 70, 11, 54,
80, 57, 71, 84, 30, 48, 33, 86, 87, 13, 63, 88, 47};
int n47[6] = {46, 83, 58, 79, 82, 81};
int n68[11] = {73, 92, 90, 96, 45, 91, 78, 74,
98, 47, 44};
int n29[4] = {77, 31, 12, 16};
int n16[13] = {52, 1, 14, 38, 42, 4, 24, 19, 5,
2, 9, 29, 41};
int n41[10] = {25, 37, 69, 65, 55, 21, 20, 75,
44, 15};
int n44[9] = {43, 97, 26, 22, 99, 100, 93, 29,
7};
int n81[6] = {23, 27, 28, 95, 10, 44};
int n7[14] = {76, 39, 53, 67, 66, 3, 85, 6, 61,
50, 51, 32, 72, 15};
int n15[10] = {56, 60, 17, 35, 34, 89, 49, 18,
59, 7};
while(first!=21)
{
dist=Ndist(36,n36[first],graphHead);
ins_Arc(36,n36[first], dist, 0
,graphHead);
,graphHead);

ins_Arc(n36[first], 36, dist, 0


first++;

}
first=0;

while(first!=6)
{
dist=Ndist(47,n47[first],graphHead);
ins_Arc(47,n47[first], dist, 0 ,graphHead);
ins_Arc(n47[first], 47, dist, 0 ,graphHead);
first++;
}
first=0;
while(first!=11)
{
dist=Ndist(68,n68[first],graphHead);
ins_Arc(68,n68[first], dist, 0 ,graphHead);
ins_Arc(n68[first], 68, dist, 0 ,graphHead);
first++;
}
11

first=0;
while(first!=4)
{
dist=Ndist(29,n29[first],graphHead);
ins_Arc(29,n29[first], dist, 0 ,graphHead);
ins_Arc(n29[first],29, dist, 0 ,graphHead);
first++;
}
first=0;
while(first!=13)
{
dist=Ndist(16,n16[first],graphHead);
ins_Arc(16,n16[first], dist, 0 ,graphHead);
ins_Arc(n16[first], 16,dist, 0 ,graphHead);
first++;
}
first=0;
while(first!=10)
{
dist=Ndist(41,n41[first],graphHead);
ins_Arc(41,n41[first], dist, 0 ,graphHead);
ins_Arc(n41[first], 41,dist, 0 ,graphHead);
first++;
}
first=0;
while(first!=9)
{
dist=Ndist(44,n44[first],graphHead);
ins_Arc(44,n44[first], dist, 0 ,graphHead);
ins_Arc(n44[first],44, dist, 0 ,graphHead);
first++;
}
first=0;
while(first!=6)
{
dist=Ndist(81,n81[first],graphHead);
ins_Arc(81,n81[first], dist, 0 ,graphHead);
ins_Arc(n81[first], 81,dist, 0 ,graphHead);
first++;
}
first=0;
while(first!=14)
{
dist=Ndist(7,n7[first],graphHead);
ins_Arc(7,n7[first], dist, 0 ,graphHead);
ins_Arc(n7[first],7, dist, 0 ,graphHead);
first++;
}
first=0;
while(first!=10)
{
dist=Ndist(15,n15[first],graphHead);
ins_Arc(15,n15[first], dist, 0 ,graphHead);
ins_Arc(n15[first],15, dist, 0 ,graphHead);
first++;
}
return 0;
}

/**graphics here*/
/********************************
Title: MAP.C
Written by: HINO, AWON
Date: 03/26/14
********************************/
/**DISPLAYS THE ENTIRE WORLD MAP*/
#include <graphics.h>
int map()
{
setcolor(9);
line(136,21,141,21);
line(135, 22,135,27);
line(136,28, 136,29);
line(137,30,137,31);
line(138,32,139,33);
line(140,34,141,34);
line(142,35,143,36);
line(144,37,144,40);
line(145,41,145,41);
line(146,42,146,43);
line(147,44,147,51);
line(148,51,149,51);
line(149,50,149,50);
line(150,49,152,49);
line(153,48,158,48);
line(159,46,159,47);
line(160,44,160,45);
line(142,22,147,22);
line(148,21,149,21);
line(150,20,153,20);
line(154,19,155,19);
line(156,18,156,18);
line(156,17,160,17);
line(161,16,161,16);
line(162,15,176,15);
line(177,16,177,16);
line(178,17,187,17);
line(187,18,187,18);
line(188,19,188,20);
line(187,20,187,20);
line(183,21,186,21);
line(182,22,182,22);
line(180,23,181,23);
line(177,24,179,24);
line(175,25,176,25);
line(173,26,174,26);
line(172,27,172,27);
line(171,28,171,29);
line(170,30,170,34);
line(169,34,169,34);
line(167,35,168,35);
line(162,40,166,36);
line(161,41,161,43);
line(180,30,187,30);
line(188,29,188,28);
line(189,28,191,28);
line(192,27,193,26);
line(194,26,196,26);
line(197,25,199,23);
line(200,23,205,23);
12

line(206,22,207,21);
line(208,21,210,21);
line(211,20,214,20);
line(215,19,233,19);
line(234,18,234,17);
line(236,17,235,17);
line(237,16,247,16);
line(248,17,249,17);
line(251,19,252,19);
line(253,20,257,20);
line(258,21,269,21);
line(270,22,270,24);
line(269,24,267,26);
line(266,26,264,26);
line(250,18,250,18);
line(263,27,260,27);
line(259,28,259,31);
line(260,32,260,33);
line(260,33,258,35);
line(257,35,255,37);
line(254,38,254,39);
line(254,40,252,42);
line(252,43,255,46);
line(255,47,258,50);
line(258,51,258,53);
line(258,54,256,56);
line(256,57,255,58);
line(254,59,251,60);
line(250,60,248,62);
line(248,63,247,64);
line(246,64,244,66);
line(244,67,239,72);
line(243,69,243,69);
line(241,71,241,71);
line(239,73,238,80);
line(238,81,233,80);
line(232,80,230,82);
line(229,82,225,82);
line(180,30,181,39);
line(181,40,181,43);
line(182,44,183,47);
line(183,47,190,48);
line(191,49,192,49);
line(193,50,193,51);
line(194,51,195,51);
line(196,51,201,52);
line(202,53,203,54);
line(203,55,204,58);
line(203,59,204,62);
line(204,63,204,66);
line(204,67,206,69);
line(224,81,223,81);
line(222,81,219,78);
line(218,78,217,77);
line(217,76,216,75);
line(216,74,216,74);
line(216,73,213,70);
line(214,72,214,72);
line(212,70,211,69);
line(207,69,210,69);
rectangle(284,48,288,51);
rectangle(156,204,160,209);

rectangle(288,171,292,175);
rectangle(299,173,302,178);
rectangle(502,195,505,202);
rectangle(494,259,495,261);
rectangle(457,233,459,238);
rectangle(509,266,511,267);
rectangle(498,262,500,267);
rectangle(501,261,503,264);
rectangle(429,231,431,233);
rectangle(431,229,434,237);
rectangle(504,147,508,150);
rectangle(131,220,133,221);
rectangle(113,184,114,185);
rectangle(168,92,169,93);
rectangle(255,162,256,163);
rectangle(360,227,361,228);
rectangle(383,218,384,219);
line(128,34,128,37);
line(129,34,130,34);
line(131,34,133,36);
line(134,36,135,37);
line(136,37,136,43);
line(132,43,135,43);
line(129,38,130,38);
line(131,39,131,42);
line(118,55,134,55);
line(134,64,128,64);
line(134,55,134,64);
line(127,63,121,63);
line(121,62,119,60);
line(118,60,118,56);
line(110,50,115,50);
line(115,50,115,59);
line(114,60,114,61);
line(114,61,111,61);
line(110,60,109,60);
line(108,59,105,59);
line(104,58,104,56);
line(104,55,106,53);
line(106,53,108,53);
line(108,53,110,51);
line(155,55,155,53);
line(156,53,159,53);
line(160,53,162,55);
line(163,55,166,56);
line(166,56,168,58);
line(168,58,169,58);
line(170,59,171,62);
line(172,63,177,64);
line(178,64,182,64);
line(183,65,183,67);
line(183,68,180,71);
line(181,72,181,74);
line(181,75,179,77);
line(178,77,177,78);
line(177,79,176,82);
line(175,82,172,82);
line(172,81,170,79);
line(169,79,168,78);
line(168,77,165,74);
line(165,73,164,71);
line(163,70,158,68);
13

line(158,67,158,66);
line(157,65,150,64);
line(149,64,146,61);
line(146,61,146,60);
line(139,198,139,200);
line(140,200,145,202);
line(146,203,148,204);
line(148,203,148,201);
line(147,200,144,200);
line(143,199,143,198);
line(143,198,140,198);
line(270,57,270,60);
line(276,54,282,54);
line(282,55,283,56);
line(284,56,286,56);
line(286,57,286,59);
line(285,59,284,59);
line(284,58,282,58);
line(282,59,282,63);
line(281,64,279,64);
line(279,61,278,64);
line(278,60,271,60);
line(160,84,169,84);
line(169,85,170,86);
line(171,86,181,86);
line(160,85,160,87);
line(161,88,162,88);
line(163,88,165,90);
line(166,90,182,90);
line(182,87,182,89);
line(145,56,145,59);
line(146,56,154,56);
line(275,55,270,56);
line(503,195,503,197);
line(237,123,239,123);
line(239,124,238,133);
line(235,126,236,124);
line(234,127,233,129);
line(232,130,232,133);
line(232,133,235,134);
line(236,134,237,134);
line(240,120,242,121);
line(240,116,240,120);
line(240,116,248,116);
line(243,122,245,123);
line(245,124,245,126);
line(245,127,243,129);
line(243,129,243,135);
line(243,135,252,135);
line(252,135,252,130);
line(249,127,252,130);
line(249,127,249,117);
line(349,303,348,310);
line(348,311,349,318);
line(348,302,348,301);
line(349,300,352,299);
line(353,299,355,297);
line(355,296,358,293);
line(358,292,359,291);
line(359,291,361,291);
line(361,291,360,308);
line(359,309,359,310);

line(359,310,357,315);
line(357,316,354,319);
line(350,319,351,318);
line(352,319,353,319);
line(373,58,373,65);
line(374,58,376,56);
line(376,55,380,51);
line(380,50,384,46);
line(385,46,387,46);
line(388,46,393,44);
line(393,44,395,44);
line(395,44,395,46);
line(390,49,386,53);
line(385,53,379,59);
line(378,63,376,65);
line(376,65,374,65);
line(389,50,389,51);
line(490,282,479,282);
line(479,282,475,278);
line(477,281,477,281);
line(474,278,473,279);
line(472,279,471,278);
line(470,278,467,275);
line(467,274,465,272);
line(465,272,465,269);
line(464,268,463,268);
line(463,268,459,264);
line(459,262,457,260);
line(459,264,459,262);
line(457,260,456,251);
line(456,250,458,250);
line(459,251,459,253);
line(460,254,461,254);
line(462,253,461,250);
line(461,249,459,244);
line(459,243,459,239);
line(381,200,381,201);
line(310, 181,310,182);
line(459,243,459,239);
line(459,239,461,239);
line(462,240,462,242);
line(463,243,464,243);
line(464,243,466,245);
line(466,245,468,250);
line(468,250,468,259);
line(468,259,467,259);
line(467,262,466,260);
line(468,263,469,265);
line(472,267,470,265);
line(473,270,472,268);
line(474,271,475,271);
line(475,272,476,275);
line(476,275,480,279);
line(481,279,486,281);
line(486,281,490,281);
line(569,318,568,327);
line(567,328,565,329);
line(565,329,565,332);
line(565,332,561,336);
line(561,340,567,340);
line(567,340,569,338);
line(569,338,569,338);
14

line(569,338,569,330);
line(569,330,573,326);
line(573,326,573,320);
line(572,319,572,317);
line(572,317,569,317);
line(563,333,563,333);
line(571,329,571,329);
line(477,261,477,256);
line(478,262,479,264);
line(482,266,480,265);
line(482,267,483,269);
line(483,269,486,269);
line(487,268,489,267);
line(490,266,490,260);
line(492,257,491,259);
line(480,254,478,255);
line(481,253,482,251);
line(484,248,483,250);
line(490,249,488,248);
line(484,248,488,248);
line(520,267,520,270);
line(520,270,521,272);
line(521,272,525,272);
line(526,273,526,278);
line(526,278,532,278);
line(533,279,535,280);
line(537,278,536,280);
line(391,49,394,46);
line(378,62,379,60);
line(491,249,492,256);
line(561,337,561,340);
line(521,267,522,268);
line(523,268,524,267);
line(524,267,532,267);
line(532,267,533,268);
line(534,268,535,269);
line(535,270,537,272);
line(537,273,538,274);
line(538,277,538,274);
line(450,26,450,35);
line(451,36,452,36);
line(452,36,454,38);
line(455,38,456,39);
line(456,40,457,41);
line(458,41,459,42);
line(459,43,461,43);
line(461,43,461,42);
line(460,41,460,39);
line(461,38,461,37);
line(459,35,459,33);
line(461,37,459,35);
line(459,33,455,29);
line(455,28,454,27);
line(454,26,450,26);
line(494,211,494,213);
line(493,214,493,224);
line(492,225,492,226);
line(491,227,491,231);
line(491,231,494,231);
line(494,231,494,229);
line(495,228,498,231);
line(498,231,498,235);

line(499,236,499,237);
line(504,237,499,237);
line(504,237,504,228);
line(504,228,502,228);
line(502,228,502,230);
line(501,231,501,231);
line(499,227,499,227);
line(500,230,500,228);
line(500,226,500,220);
line(499,219,499,217);
line(498,216,498,212);
line(497,211,494,211);
line(505,146,505,146);
line(524,133,524,133);
line(504,145,505,142);
line(509,146,519,146);
line(519,146,521,144);
line(521,140,521,144);
line(521,139,523,134);
line(513,142,517,138);
line(517,137,520,134);
line(514,140,514,140);
line(518,135,518,135);
line(505,142,513,142);
line(521,134,522,133);
line(522,133,522,131);
line(522,131,519,128);
line(520,130,520,130);
line(519,128,517,128);
line(517,128,517,126);
line(518,126,523,124);
line(523,124,526,124);
line(527,125,527,134);
line(527,134,525,134);
line(527,283,528,286);
line(529,287,530,287);
line(530,287,533,290);
line(534,290,537,293);
line(537,294,538,295);
line(539,295,540,296);
line(540,297,541,298);
line(542,298,543,299);
line(543,300,548,305);
line(549,305,550,306);
line(550,306,550,309);
line(551,310,551,319);
line(550,320,550,327);
line(549,328,549,333);
line(548,334,545,335);
line(544,335,543,336);
line(544,337,544,339);
line(544,339,538,339);
line(538,339,538,338);
line(537,337,537,335);
line(536,334,533,333);
line(533,333,531,331);
line(525,285,526,294);
line(525,295,522,296);
line(524,295,521,298);
line(521,298,516,298);
line(530,331,529,331);
line(530,331,527,328);
15

line(526,329,525,329);
line(524,330,524,331);
line(524,331,518,331);
line(518,330,516,325);
line(515,324,513,324);
line(512,325,511,325);
line(510,326,506,326);
line(506,326,499,333);
line(502,331,502,331);
line(499,334,498,335);
line(498,335,489,335);
line(488,336,487,336);
line(486,337,482,337);
line(482,337,482,335);
line(482,335,484,333);
line(483,332,483,326);
line(482,325,482,322);
line(481,321,481,309);
line(481,309,483,309);
line(484,308,484,307);
line(491,307,484,307);
line(492,306,493,306);
line(494,305,496,300);
line(496,300,504,300);
line(505,299,505,295);
line(505,295,507,293);
line(508,293,510,291);
line(511,291,514,290);
line(514,290,516,288);
line(516,287,520,287);
line(520,287,520,289);
line(519,290,516,291);
line(515,291,514,292);
line(514,293,513,294);
line(514,293,513,294);
line(514,296,513,294);
line(515,296,515,297);
line(525,284,525,283);
line(525,283,526,283);
line(138,292,138,322);
line(137,323,137,325);
line(136,326,136,327);
line(135,328,135,343);
line(136,344,136,346);
line(137,347,137,348);
line(137,348,139,350);
line(139,351,142,354);
line(142,354,142,360);
line(143,361,143,364);
line(144,365,149,367);
line(149,367,151,369);
line(152,369,153,370);
line(153,370,159,368);
line(159,368,157,366);
line(157,365,156,364);
line(156,364,156,351);
line(155,350,155,349);
line(155,349,153,347);
line(153,347,153,345);
line(152,344,152,335);
line(153,334,154,331);
line(154,330,156,328);

line(156,327,159,324);
line(160,324,164,320);
line(163,322,163,322);
line(164,319,166,314);
line(166,314,171,309);
line(172,309,174,307);
line(174,306,175,303);
line(175,302,176,295);
line(182,289,176,295);
line(183,289,183,283);
line(183,283,185,281);
line(185,282,185,280);
line(186,279,187,274);
line(188,273,194,271);
line(194,271,196,269);
line(196,269,199,269);
line(199,269,201,267);
line(201,266,203,264);
line(203,263,204,260);
line(205,259,205,247);
line(205,247,202,247);
line(201,246,200,246);
line(197,243,200,246);
line(197,243,192,242);
line(191,241,191,240);
line(191,240,183,240);
line(182,239,181,239);
line(180,238,178,238);
line(178,238,174,234);
line(172,234,170,232);
line(170,231,169,230);
line(169,229,165,225);
line(165,225,165,224);
line(164,223,164,221);
line(161,221,164,221);
line(156,220,160,220);
line(155,219,155,218);
line(155,218,153,218);
line(152,217,142,217);
line(141,218,139,218);
line(139,218,139,219);
line(138,220,137,220);
line(174,234,172,234);
line(137,220,137,224);
line(136,225,136,226);
line(135,227,135,230);
line(135,230,130,235);
line(128,236,127,241);
line(126,242,126,247);
line(125,248,124,253);
line(123,254,123,267);
line(123,267,129,273);
line(126,271,126,271);
line(129,273,131,276);
line(132,276,135,279);
line(135,279,135,281);
line(135,281,137,283);
line(137,283,137,291);
line(129,235,129,235);
line(130,221,122,221);
line(122,220,121,213);
line(121,213,119,211);
16

line(119,211,117,211);
line(116,210,107,209);
line(106,209,105,208);
line(105,207,103,205);
line(102,205,101,204);
line(101,204,98,204);
line(98,204,96,202);
line(96,202,93,202);
line(92,201,89,200);
line(89,200,86,197);
line(86,196,85,195);
line(84,195,81,194);
line(81,194,81,188);
line(80,187,80,184);
line(79,183,78,180);
line(78,180,76,178);
line(76,178,73,177);
line(73,177,70,174);
line(70,174,70,160);
line(71,159,71,157);
line(72,156,72,155);
line(73,154,73,148);
line(73,148,74,148);
line(75,147,76,144);
line(76,144,78,142);
line(78,142,78,121);
line(77,120,77,117);
line(76,116,75,113);
line(75,113,72,110);
line(73,112,73,112);
line(72,109,71,108);
line(70,108,69,107);
line(69,107,69,105);
line(66,102,69,105);
line(65,102,63,100);
line(63,100,60,99);
line(59,99,56,96);
line(56,96,54,96);
line(53,97,53,98);
line(52,99,38,99);
line(38,99,38,94);
line(39,93,39,90);
line(41,90,39,90);
line(41,90,43,88);
line(43,88,43,75);
line(54,76,56,76);
line(57,75,74,76);
line(75,76,80,75);
line(81,74,81,73);
line(81,73,84,73);
line(84,73,86,75);
line(86,75,101,75);
line(102,73,104,73);
line(102,74,102,73);
line(105,72,111,72);
line(112,71,113,71);
line(114,70,131,70);
line(131,70,138,63);
line(138,63,143,63);
line(144,63,144,66);
line(144,66,147,69);
line(147,69,147,74);

line(146,75,146,77);
line(146,77,145,78);
line(145,79,143,81);
line(143,82,143,81);
line(142,83,141,88);
line(142,89,142,98);
line(146,101,150,105);
line(150,105,152,105);
line(142,98,145,101);
line(153,106,155,111);
line(155,112,155,113);
line(155,113,158,116);
line(159,115,159,103);
line(160,102,159,99);
line(160,98,160,95);
line(160,95,165,95);
line(166,94,167,94);
line(170,94,171,94);
line(171,94,171,96);
line(171,96,173,98);
line(174,98,173,98);
line(175,99,175,103);
line(175,103,177,105);
line(177,105,177,107);
line(178,108,181,108);
line(182,107,182,106);
line(183,105,183,98);
line(182,97,182,94);
line(181,93,181,92);
line(43,75,53,75);
line(185,93,183,91);
line(186,93,188,95);
line(188,95,188,97);
line(188,97,196,105);
line(196,105,197,105);
line(198,108,200,110);
line(198,106,198,108);
line(200,110,200,122);
line(199,123,197,128);
line(197,129,197,130);
line(197,130,193,130);
line(192,131,191,131);
line(190,132,187,132);
line(186,133,181,133);
line(180,132,179,132);
line(179,132,177,130);
line(176,130,174,132);
line(173,132,171,134);
line(170,134,168,136);
line(168,136,170,138);
line(170,138,175,139);
line(175,139,175,145);
line(174,146,173,146);
line(173,146,170,149);
line(170,149,169,152);
line(169,152,166,155);
line(166,155,166,156);
line(165,157,165,161);
line(164,162,164,163);
line(163,164,160,165);
line(160,165,158,167);
line(157,167,156,166);
17

line(155,167,154,167);
line(154,167,151,169);
line(152,169,151,169);
line(150,170,148,176);
line(148,176,146,178);
line(146,178,137,178);
line(137,178,134,181);
line(133,181,131,183);
line(131,183,131,191);
line(131,191,129,191);
line(128,190,126,185);
line(126,184,124,182);
line(124,182,116,182);
line(116,182,115,183);
line(112,183,111,183);
line(111,183,109,185);
line(109,185,109,186);
line(108,187,107,187);
line(106,188,106,198);
line(107,199,108,199);
line(109,200,109,201);
line(111,203,119,203);
line(120,202,120,200);
line(119,199,118,199);
line(118,196,118,199);
line(119,195,123,195);
line(123,195,126,198);
line(125,196,125,196);
line(126,198,126,204);
line(126,204,124,206);
line(124,206,124,208);
line(125,209,130,209);
line(130,209,130,214);
line(130,214,129,214);
line(128,215,128,217);
line(128,217,130,219);
line(342,266,342,302);
line(341,303,340,303);
line(340,303,337,306);
line(337,306,337,308);
line(337,308,334,311);
line(333,311,331,313);
line(331,314,327,318);
line(336,310,336,310);
line(330,316,330,316);
line(327,318,327,321);
line(327,321,319,329);
line(323,326,323,326);
line(318,329,318,329);
line(285,284,285,284);
line(317,330,317,331);
line(316,331,309,332);
line(309,332,304,333);
line(303,334,299,334);
line(298,333,298,330);
line(297,329,296,329);
line(295,328,293,323);
line(293,323,291,321);
line(291,321,289,316);
line(289,316,287,314);
line(287,314,287,311);
line(287,311,285,309);

line(285,309,285,307);
line(285,293,285,297);
line(284,306,284,298);
line(287,291,285,293);
line(287,291,287,285);
line(287,285,284,282);
line(284,282,284,276);
line(283,275,283,266);
line(284,265,284,261);
line(285,260,285,258);
line(285,258,289,254);
line(289,254,289,243);
line(289,243,287,241);
line(287,241,287,240);
line(286,239,281,237);
line(281,237,279,235);
line(279,235,277,235);
line(276,234,271,234);
line(270,233,259,233);
line(254,231,253,231);
line(258,232,255,232);
line(253,231,253,229);
line(252,228,251,228);
line(251,228,251,223);
line(250,222,250,220);
line(249,219,249,213);
line(249,213,254,208);
line(254,208,254,205);
line(251,210,251,210);
line(255,204,255,203);
line(258,200,258,198);
line(255,203,258,200);
line(258,198,260,196);
line(260,195,265,195);
line(266,194,267,194);
line(267,194,269,192);
line(270,192,269,192);
line(271,191,274,191);
line(274,191,276,189);
line(276,189,279,188);
line(279,188,281,186);
line(281,186,282,186);
line(283,185,283,183);
line(283,183,285,183);
line(286,182,289,182);
line(290,181,292,181);
line(293,180,298,180);
line(298,180,298,186);
line(299,187,299,188);
line(298,189,298,192);
line(299,187,299,188);
line(298,189,298,192);
line(299,193,311,193);
line(312,192,315,192);
line(316,191,320,191);
line(321,190,349,190);
line(349,190,351,188);
line(351,188,354,188);
line(355,189,355,189);
line(354,190,354,192);
line(354,192,352,194);
line(352,194,350,194);
18

line(349,195,349,197);
line(349,197,347,199);
line(347,199,346,202);
line(345,203,345,215);
line(346,216,347,219);
line(347,219,349,221);
line(349,222,351,224);
line(352,224,353,225);
line(353,226,356,229);
line(356,229,359,229);
line(360,233,360,234);
line(358,242,356,244);
line(359,235,358,242);
line(356,245,354,247);
line(354,247,352,252);
line(361,229,361,232);
line(352,252,350,254);
line(350,255,348,257);
line(348,258,345,261);
line(345,261,344,264);
line(344,264,342,266);
line(280,132,291,121);
line(291,121,310,121);
line(311,120,315,120);
line(316,119,316,117);
line(316,117,318,115);
line(318,115,320,115);
line(321,114,324,113);
line(325,113,327,111);
line(327,111,333,111);
line(334,110,335,110);
line(336,109,336,105);
line(335,104,335,103);
line(334,102,334,102);
line(333,103,332,103);
line(331,102,324,102);
line(324,102,324,98);
line(324,98,326,96);
line(326,96,327,89);
line(327,89,325,87);
line(325,87,324,87);
line(323,88,320,95);
line(320,96,319,97);
line(319,97,319,108);
line(318,108,317,109);
line(317,110,315,112);
line(314,112,315,112);
line(313,113,309,113);
line(308,112,306,112);
line(306,111,306,112);
line(305,110,304,110);
line(303,109,298,109);
line(297,108,294,108);
line(294,108,293,103);
line(292,102,292,99);
line(293,98,294,98);
line(295,97,299,97);
line(302,95,306,91);
line(300,96,300,95);
line(300,95,302,95);
line(306,90,308,90);
line(309,89,309,88);

line(309,88,311,86);
line(311,86,311,84);
line(311,84,313,82);
line(313,81,318,76);
line(318,76,318,72);
line(319,72,323,68);
line(323,66,325,64);
line(323,68,323,66);
line(325,64,328,64);
line(329,63,336,63);
line(337,62,337,61);
line(337,61,342,61);
line(342,62,344,64);
line(344,64,349,66);
line(350,67,352,67);
line(353,68,356,69);
line(356,69,358,71);
line(358,71,359,74);
line(359,74,359,79);
line(359,79,350,79);
line(349,80,349,82);
line(349,82,357,90);
line(357,90,363,90);
line(363,90,366,87);
line(367,87,368,86);
line(368,86,373,86);
line(373,86,376,83);
line(377,83,379,81);
line(380,81,381,80);
line(381,80,397,80);
line(398,81,398,81);
line(401,74,401,74);
line(399,80,401,75);
line(401,73,402,70);
line(401,69,401,64);
line(400,63,400,59);
line(410,60,411,61);
line(411,61,411,65);
line(412,66,413,65);
line(413,64,415,64);
line(415,64,416,67);
line(417,68,419,68);
line(420,67,420,61);
line(421,60,421,59);
line(421,59,432,59);
line(432,59,435,56);
line(435,56,438,55);
line(439,55,444,54);
line(444,54,447,51);
line(447,50,447,51);
line(448,50,453,49);
line(453,49,455,47);
line(456,47,457,46);
line(461,45,461,44);
line(465,45,466,44);
line(467,44,468,45);
line(468,45,472,45);
line(472,45,472,49);
line(471,49,470,50);
line(470,54,471,54);
line(470,50,469,53);
line(472,53,477,53);
19

line(477,53,479,51);
line(479,50,481,48);
line(461,44,464,44);
line(457,46,460,46);
line(481,47,486,47);
line(486,47,487,50);
line(487,51,488,53);
line(489,54,491,54);
line(492,53,497,53);
line(498,50,500,50);
line(501,49,509,49);
line(510,50,510,51);
line(511,52,514,53);
line(514,53,516,55);
line(516,55,536,55);
line(537,56,540,57);
line(540,57,544,57);
line(545,58,545,58);
line(546,57,548,57);
line(548,57,550,55);
line(550,55,550,53);
line(551,52,553,52);
line(556,49,561,49);
line(498,52,498,50);
line(562,50,562,51);
line(563,52,566,53);
line(566,53,568,55);
line(568,55,575,55);
line(575,55,577,57);
line(577,57,582,59);
line(582,59,583,62);
line(583,62,585,64);
line(585,64,587,64);
line(587,64,587,78);
line(587,78,584,78);
line(584,78,582,76);
line(582,76,582,73);
line(582,73,580,71);
line(580,71,579,68);
line(579,67,578,66);
line(578,66,576,68);
line(576,68,561,69);
line(561,69,556,71);
line(549,79,549,79);
line(542,89,542,89);
line(519,88,514,90);
line(514,90,511,90);
line(400,59,410,59);
line(554,51,554,50);
line(554,50,555,50);
line(556,71,552,71);
line(551,72,550,77);
line(550,77,546,81);
line(545,81,543,83);
line(543,83,543,87);
line(543,87,540,90);
line(540,90,539,93);
line(538,94,538,100);
line(537,101,534,101);
line(534,101,532,99);
line(531,99,531,91);
line(532,90,532,89);

line(532,89,534,87);
line(534,87,535,84);
line(535,83,535,83);
line(521,87,521,87);
line(536,82,535,79);
line(534,78,531,81);
line(531,81,525,81);
line(525,81,522,84);
line(522,85,519,88);
line(510,91,507,92);
line(507,92,505,94);
line(505,95,504,98);
line(504,98,506,100);
line(506,100,511,101);
line(511,101,516,101);
line(516,101,516,108);
line(515,109,515,112);
line(515,112,512,115);
line(512,115,512,118);
line(512,118,510,120);
line(510,121,500,122);
line(500,122,497,125);
line(497,129,501,133);
line(497,125,497,129);
line(501,133,504,134);
line(505,134,505,137);
line(505,137,503,137);
line(502,138,495,138);
line(494,137,492,137);
line(492,137,490,139);
line(490,139,490,148);
line(490,148,493,151);
line(506,122,500,122);
line(493,151,494,154);
line(494,155,496,157);
line(497,157,498,158);
line(498,158,498,160);
line(499,161,499,165);
line(499,165,502,168);
line(502,168,502,180);
line(501,182,501,182);
line(501,181,499,184);
line(499,184,499,187);
line(498,188,498,189);
line(497,190,496,190);
line(496,190,494,192);
line(494,193,491,196);
line(491,197,488,200);
line(488,200,485,200);
line(485,200,483,202);
line(483,202,481,202);
line(482,203,472,203);
line(471,204,472,203);
line(472,205,472,209);
line(472,209,470,209);
line(469,208,469,205);
line(468,204,464,204);
line(464,205,464,208);
line(464,208,466,210);
line(466,210,467,213);
line(467,213,472,218);
line(472,218,472,225);
20

line(471,225,468,228);
line(468,228,468,230);
line(468,230,461,230);
line(461,229,459,227);
line(458,227,454,223);
line(454,223,451,223);
line(451,223,451,221);
line(451,221,449,219);
line(449,217,447,215);
line(446,215,446,213);
line(446,213,442,209);
line(442,209,442,207);
line(441,206,440,206);
line(439,205,436,205);
line(449,219,449,217);
line(435,204,433,204);
line(433,204,428,209);
line(428,209,428,216);
line(428,216,426,218);
line(426,219,424,221);
line(424,221,424,230);
line(424,230,426,232);
line(426,232,426,235);
line(426,235,423,235);
line(423,234,419,230);
line(418,230,415,227);
line(417,230,417,230);
line(384,217,384,217);
line(415,226,414,225);
line(413,225,412,224);
line(412,223,409,220);
line(409,220,409,218);
line(408,217,407,217);
line(406,216,406,209);
line(405,208,404,205);
line(403,204,400,204);
line(399,203,393,203);
line(393,203,390,200);
line(390,200,385,200);
line(384,199,383,196);
line(382,195,380,195);
line(379,196,379,200);
line(380,201,380,202);
line(380,202,382,204);
line(383,203,387,203);
line(387,203,387,215);
line(386,216,385,216);
line(382,217,381,218);
line(381,219,374,219);
line(373,220,370,221);
line(369,221,367,222);
line(366,223,364,223);
line(363,224,363,226);
line(363,226,361,226);
line(360,225,360,224);
line(361,223,360,221);
line(359,220,359,218);
line(358,217,357,217);
line(357,217,357,193);
line(356,192,356,190);
line(355,187,355,184);
line(355,184,353,182);

line(353,182,344,182);
line(343,183,340,182);
line(340,182,336,178);
line(336,178,333,177);
line(333,176,335,171);
line(335,170,332,167);
line(333,169,333,169);
line(309,155,309,155);
line(331,168,331,170);
line(330,171,329,171);
line(329,171,327,173);
line(327,173,327,174);
line(326,175,324,175);
line(323,174,323,167);
line(323,167,318,162);
line(318,158,316,156);
line(316,156,310,156);
line(308,156,307,156);
line(306,157,306,159);
line(307,160,308,160);
line(308,160,312,164);
line(312,164,315,165);
line(315,165,317,167);
line(317,167,317,169);
line(316,170,310,170);
line(309,169,306,169);
line(305,168,303,168);
line(302,167,301,167);
line(301,167,298,164);
line(297,164,298,164);
line(296,163,290,163);
line(290,163,286,167);
line(285,167,283,169);
line(282,169,280,171);
line(280,172,279,173);
line(279,174,278,177);
line(278,177,276,179);
line(276,180,274,182);
line(274,182,272,182);
line(272,182,270,184);
line(270,184,269,187);
line(268,188,264,188);
line(263,187,257,187);
line(257,187,255,185);
line(255,185,254,176);
line(253,173,251,171);
line(253,167,253,165);
line(253,175,253,173);
line(251,171,251,169);
line(251,169,253,167);
line(253,165,255,163);
line(257,164,268,164);
line(269,165,270,165);
line(271,166,273,164);
line(275,164,273,164);
line(276,163,276,162);
line(276,162,278,160);
line(278,160,276,155);
line(276,155,274,153);
line(273,153,272,152);
line(272,151,268,147);
line(267,147,261,141);
21

line(261,141,261,140);
line(260,139,259,139);
line(259,139,259,137);
line(260,137,261,138);
line(261,138,271,138);
line(272,137,272,136);
line(273,135,274,135);
line(274,135,276,133);
line(318,162,318,158);
line(276,133,278,133);
line(278,133,279,132);
line(349,165,354,160);
line(354,154,350,150);
line(354,160,354,154);
line(349,150,348,151);
line(348,152,345,155);
line(344,155,343,150);
line(342,149,342,149);
line(341,150,340,150);
line(339,151,339,154);
line(339,154,341,156);
line(341,156,341,158);
line(341,158,337,162);
line(337,162,337,169);
line(338,170,341,170);
line(342,169,349,169);
line(349,169,349,174);
line(350,175,353,175);
line(354,174,354,170);
line(354,170,352,168);
line(351,168,349,166);
setcolor(0);
line(156,209,156,209);
line(284,51,284,51);
line(299,178,299,178);
line(288,175,288,175);
line(502,195,502,197);
line(500,263,500,264);
line(501,262,501,263);
line(431,231,431,233);
line(431,237,431,237);
line(507,147,505,147);
line(481,203,482,203);
setcolor(15);
line(4,375,635,375);
line(4,4,4,375);
line(635,4,635,375);
line(4,4,635,4);
return 0;
}
/********************************
Title: PLOT.C
Written by: PALABRICA, PAOLO
AKUT, PIPOS
BERDIN, CARLA
Date: 03/26/14
********************************/
#include <graphics.h>
#include <dos.h>

#include"fp.h"
#include<stdio.h>
int plot(NODE **myHead,int airportP[50][2], int
airportP2[50][2])
{
NODE *temp,*temp2;
int i, gd = DETECT, gm,flagger=0,fk,tk,it=1;
char num[3];
/*Airports*/
setcolor(6);
while(flagger!=50)
{
putpixel(airportP[flagger][0],airportP[flagger][
1],YELLOW);
flagger++;
}
flagger=0;
while(flagger!=50)
{
putpixel(airportP2[flagger][0],airportP2[flagge
r][1],YELLOW);
flagger++;
}
setcolor(15);
/*map numbers*/
settextstyle(2,HORIZ_DIR,4);
while(it!=101)
{
sprintf( num, "%i", it);
if(it<=50)
outtextxy(airportP[it-1][0],airportP[it1][1],num);
else
outtextxy(airportP2[it51][0],airportP2[it-51][1],num);
it++;
}
/*connect nodes*/
temp=*myHead;
setcolor(4);
while(temp!=NULL)
{
temp2=temp->firstArc;
while(temp2!=NULL)
{
fk=temp->fromKey;
tk=temp2->toKey;
if(temp->fromKey<=50)
{
if(tk!=NULL)
{
if(temp2->toKey<=50)
{
22

line(airportP[fk-1][0],airportP[fk1][1],airportP[tk-1][0],airportP[tk-1][1]);

setcolor(11);
circle(airportP[tk-1][0],airportP[tk-1][1],2);
setcolor(4);

else
{
line(airportP[fk-1][0],airportP[fk1][1],airportP2[tk-51][0],airportP2[tk-51][1]);

51][1],2);

setcolor(11);
circle(airportP2[tk-51][0],airportP2[tksetcolor(4);
}

}
}
else
{

if(tk!=NULL)
{
if(temp2->toKey<=50)
{

line(airportP2[fk-51][0],airportP2[fk51][1],airportP[tk-1][0],airportP[tk-1][1]);
setcolor(11);
circle(airportP[tk-1][0],airportP[tk-1][1],2);
setcolor(4);
}
else
{
line(airportP2[fk-51][0],airportP2[fk51][1],airportP2[tk-51][0],airportP2[tk-51][1]);
setcolor(11);
circle(airportP2[tk-51][0],airportP2[tk51][1],2);
setcolor(4);
}

}
}
temp2=temp2->next;
}
temp=temp->next;
}

/********************************
Title: MINPATH.C
Written by: BERDIN, CARLA
Date: 03/25/14
********************************/
#include <graphics.h>
#include <dos.h>
#include"fp.h"
#include<stdio.h>
int minPath(STOP **myHead,int airportP[50][2], int
airportP2[50][2])
{
STOP *temp;
int fk,tk;
temp=*myHead;
setcolor(15);
while(temp->next!=NULL)
{
fk=temp->toKey;
tk=temp->next->toKey;
if(fk<=50)
{
if(tk<=50)
line(airportP[fk1][0],airportP[fk-1][1],airportP[tk-1][0],airportP[tk-1][1]);
else
line(airportP[fk1][0],airportP[fk-1][1],airportP2[tk-51][0],airportP2[tk51][1]);
}
else
{
if(tk<=50)
line(airportP2[fk51][0],airportP2[fk-51][1],airportP[tk-1][0],airportP[tk1][1]);
else
line(airportP2[fk-51][0],airportP2[fk51][1],airportP2[tk-51][0],airportP2[tk-51][1]);
}
temp=temp->next;
delay(1000);
}
return 0;
}

return 0;
}

23

Vous aimerez peut-être aussi