-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdebugging_helpers.cpp
54 lines (47 loc) · 912 Bytes
/
debugging_helpers.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/**
debugging_helpers.cpp
Purpose: helper functions for debugging when working
with grids of floats and chars.
*/
#include <vector>
#include "debugging_helpers.h"
using namespace std;
/**
Displays a grid of beliefs. Does not return.
@param grid - a two dimensional grid (vector of
vectors of floats) which will usually
represent a robot's beliefs.
*/
void show_grid(vector < vector <float> > grid) {
int i, j;
float p;
vector<float> row;
for (i = 0; i < grid.size(); i++)
{
row = grid[i];
for (j=0; j< row.size(); j++)
{
p = row[j];
cout << p << ' ';
}
cout << endl;
}
}
/**
Displays a grid map of the world
*/
void show_grid(vector < vector <char> > map) {
int i, j;
char p;
vector<char> row;
for (i = 0; i < map.size(); i++)
{
row = map[i];
for (j=0; j< row.size(); j++)
{
p = row[j];
cout << p << ' ';
}
cout << endl;
}
}