Professional Documents
Culture Documents
project
Concept .................................................................................................. 3
Implemented Data structures ................................................................ 3
Project Data Structures Code ................................................................. 4
▪ Graph.h ............................................................................................. 4
▪ Graph.cpp.......................................................................................... 9
Game GUI ............................................................................................. 14
Concept
Find your way is a game where the player will be given a path to walk
through. Each way or (node) will either make them lose points or gain.
Depending on a particular algorithm the fastest way to get to the end
point with best score is the best target they can reach.
adjList[src].push_back(make_pair(dest, weight));
edges_number++;
}
}
void Graph::addNode(int n) {
adjList.resize(adjList.size() + n);
nodes_number++;
}
int Graph::nodes_count()
{
return nodes_number;
}
void Graph::printGraph()
{
for (int i = 0; i < nodes_number; i++)
{
for (Pair v : adjList[i]) {
cout << "(" << i << ", " << v.first << ", " << v.second << ") " << endl;
}
}
cout << "nodes count is : " << nodes_number << " edges count is : " << edges_number;
}
dist[start] = 0;
return dist[end];
srand(s);
int offset = -10; //changed it form 10
int range = 40; //40
void Graph::searchWeight(int n)
{
bool flag = false;
for (int i = 0; i < adjList.size(); i++)
{
for (auto j = adjList[i].begin(); j != adjList[i].end(); j++)
{
if (j->second == n)
{
cout << "\nThis weight was found between node " << i << " And " << j->first << '\n';
flag = true;
}
}
}
if (flag == false)
{
cout << "\nThis weight was not found in the graph\n";
}
}
bool Graph::empty()
{
return (nodes_number==0);
}
▪ Graph.cpp
#include "Graph.h"
adjList[src].push_back(make_pair(dest, weight));
edges_number++;
}
}
void Graph::addNode(int n) {
adjList.resize(adjList.size() + n);
nodes_number++;
}
int Graph::nodes_count()
{
return nodes_number;
}
void Graph::printGraph()
{
for (int i = 0; i < nodes_number; i++)
{
for (Pair v : adjList[i]) {
cout << "(" << i << ", " << v.first << ", " << v.second << ") " << endl;
}
}
cout << "nodes count is : " << nodes_number << " edges count is : " << edges_number;
}
dist[start] = 0;
return dist[end];
srand(s);
int offset = -10; //changed it form 10
int range = 40; //40
}
}
if (flag == false)
{
cout << "\nThis weight was not found in the graph\n";
}
}
bool Graph::empty()
{
return (nodes_number==0);
}
Game GUI