Skip to content
Snippets Groups Projects
Commit ee2d58f8 authored by Yann Boucher's avatar Yann Boucher
Browse files

Arbitraty neighborhood bug fixed

parent 3a8cff19
No related branches found
No related tags found
No related merge requests found
Pipeline #79594 passed
{
"data": "x = 36, y = 9\n24bo$22bobo$12b2o6b2o12b2o$11bo3bo4b2o12b2o$2o8bo5bo3b2o$2o8bo3bob2o4bobo$10bo5bo7bo$11bo3bo$12b2o!",
"height": 100,
"left": 48,
"model": "Weird Game of Life",
"title": "Weird Gosper Gun",
"top": 30,
"width": 100
}
{
"alphabet": [
{
"color": [
255,
255,
255
],
"name": "Dead"
},
{
"color": [
0,
0,
255
],
"name": "Alive"
}
],
"author": "JM",
"date": "jeu. juin 10 2021",
"desc": "Game of Life, but using a custom unorthodox neighborhood",
"neighborhood_data": {
"neighbors": [
[
0,
-2
],
[
-1,
-1
],
[
1,
-1
],
[
-2,
0
],
[
2,
0
],
[
-1,
1
],
[
1,
1
],
[
0,
2
]
]
},
"neighborhood_name": "Arbitrary",
"title": "Weird Game of Life",
"transition_data": {
},
"transition_name": "Game of Life"
}
......@@ -22,9 +22,7 @@ Neighborhood ArbitraryNeighborhoodRule::getNeighborhood(const Grid &grid, Coord
for (const auto& item : neighbors.contents)
{
CoordinateProperty coord = static_cast<CoordinateProperty&>(*item);
// n.addNeighbor(coord.c + pos, grid.get_state(coord.c.y, coord.c.x));
Coord newPos = {coord.c.y, coord.c.x};
n.addNeighbor(coord.c + pos, grid.get_state(newPos));
n.addNeighbor(coord.c + pos, grid.get_state(coord.c + pos));
}
return n;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment