Re: ideas for grid scanning system?

2016-01-01 Thread AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector


  


Re: ideas for grid scanning system?

Oops, made a mistake in my example. Should have but in a way to keep track of previously scanned tiles, so:def gridcheck():
# based on an implementation by Eric S. Raymond

x = 5
y = 5

tile_id = grid[y][x]

test = grid[:]

connected = [[x,y]]

edge = [(x, y)]

while edge:
newedge = []
for (x, y) in edge:
for (s, t) in ((x+1, y), (x-1, y), (x, y+1), (x, y-1)):
try:
p = test[t][s]
except IndexError:
pass
else:
if p == tile_id:
test[t][s] = 99
connected.append([s,t])
newedge.append((s, t))
edge = newedge

return connectedI've taken a bit of time looking over your code and I think I can offer a solution, haven't played with BGT before so appologies if it implodes, heh. void examine(int a, int b) {
int target=board[a][b];
int temp_board=board;
vector new;
new.x=a;
new.y=b;
remove.insert_last(new);
processed.insert_last(new);
while(remove.length()>0) {
int[] new_remove;
for(int c=0; c<remove.length(); c++) {
vector new;
new.x=remove[c].x;
new.y=remove[c].y;

if(new.x-1>0) {
if(temp_board[new.x-1][new.y]==target) {
vector temp;
temp.x=new.x-1;
temp.y=new.y;
new_remove.insert_last(temp);
processed.insert_last(temp);
temp_board[new.x-1][new.y] = 99;
}//if
}//if

if(new.x+1<board.length()-1) {
if(temp_board[new.x+1][new.y]==target) {
vector temp;
temp.x=new.x+1;
temp.y=new.y;
new_remove.insert_last(temp);
processed.insert_last(temp);
temp_board[new.x+1][new.y] = 99;
}//if
}//if

if(new.y-1>0) {
if(temp_board[new.x][new.y-1]==target) {
vector temp;
temp.x=new.x;
temp.y=new.y-1;
new_remove.insert_last(temp);
processed.insert_last(temp);
temp_board[new.x][new.y-1] = 99;
}//if
}//if 

if(new.y+1<board.length()-1) {
if(temp_board[new.x][new.y+1]==target) {
vector temp;
temp.x=new.x+1;
temp.y=new.y;
new_remove.insert_last(temp);
processed.insert_last(temp);
temp_board[new.x][new.y+1] = 99;
}//if
}//if 

}//for
remove = new_remove;
}//while
}//examineThis creates a copy of the board array and iterates over it, it creates a new array called "new_remove" every cycle of the while loop, it checks adjacent tiles to the current tile, then adds any that match to new_remove to check their adjacent tiles next cycle, marks them off on the copy of board, and adds them to processed to deliver the final results. At the end of the for loop new_remove replaces remove to check the new list of tiles, and new_remove is recreated/emptied for the next cycle, i'm not sure what the BGT syntax is for clearing or copying arrays so don't know if thats correct.

URL: http://forum.audiogames.net/viewtopic.php?pid=245082#p245082





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: ideas for grid scanning system?

2016-01-01 Thread AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector


  


Re: ideas for grid scanning system?

Oops, made a mistake in my example. Should have put in a way to keep track of previously scanned tiles, so:def gridcheck():
# based on an implementation by Eric S. Raymond

x = 5
y = 5

tile_id = grid[y][x]

test = grid[:]

connected = [[x,y]]

edge = [(x, y)]

while edge:
newedge = []
for (x, y) in edge:
for (s, t) in ((x+1, y), (x-1, y), (x, y+1), (x, y-1)):
try:
p = test[t][s]
except IndexError:
pass
else:
if p == tile_id:
test[t][s] = 99
connected.append([s,t])
newedge.append((s, t))
edge = newedge

return connectedI've taken a bit of time looking over your code and I think I can offer a solution, haven't played with BGT before so appologies if it implodes, heh. void examine(int a, int b) {
int target=board[a][b];
int temp_board=board;
vector[] remove;
vector[] tmp;
processed = tmp;
vector new;
new.x=a;
new.y=b;
remove.insert_last(new);
processed.insert_last(new);
while(remove.length()>0) {
vector[] new_remove;
for(int c=0; c<remove.length(); c++) {
vector new;
new.x=remove[c].x;
new.y=remove[c].y;

if(new.x-1>0) {
if(temp_board[new.x-1][new.y]==target) {
vector temp;
temp.x=new.x-1;
temp.y=new.y;
new_remove.insert_last(temp);
processed.insert_last(temp);
temp_board[new.x-1][new.y] = 99;
}//if
}//if

if(new.x+1<board.length()-1) {
if(temp_board[new.x+1][new.y]==target) {
vector temp;
temp.x=new.x+1;
temp.y=new.y;
new_remove.insert_last(temp);
processed.insert_last(temp);
temp_board[new.x+1][new.y] = 99;
}//if
}//if

if(new.y-1>0) {
if(temp_board[new.x][new.y-1]==target) {
vector temp;
temp.x=new.x;
temp.y=new.y-1;
new_remove.insert_last(temp);
processed.insert_last(temp);
temp_board[new.x][new.y-1] = 99;
}//if
}//if 

if(new.y+1<board.length()-1) {
if(temp_board[new.x][new.y+1]==target) {
vector temp;
temp.x=new.x;
temp.y=new.y+1;
new_remove.insert_last(temp);
processed.insert_last(temp);
temp_board[new.x][new.y+1] = 99;
}//if
}//if 

}//for
remove = new_remove;
}//while
}//examineThis creates a copy of the board array and iterates over it, it creates a new array called "new_remove" every cycle of the while loop, it checks adjacent tiles to the current tile, then adds any that match to new_remove to check their adjacent tiles next cycle, marks them off on the copy of board, and adds them to processed to deliver the final results. At the end of the for loop new_remove replaces remove to check the new list of tiles, and new_remove is recreated/emptied for the next cycle, i'm not sure what the BGT syntax is for clearing or copying arrays so don't know if thats correct.

URL: http://forum.audiogames.net/viewtopic.php?pid=245082#p245082





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

ideas for grid scanning system?

2016-01-01 Thread AudioGames . net Forum — Developers room : gamedude via Audiogames-reflector


  


ideas for grid scanning system?

So, I'm sort of stumped on this one. Imagine you have a grid. Any particular grid will do. It could be a 3 by 3, a 7 by 7, or a 10 by 10. I recommend it being quite a large sized board. Anyways, you have a particular point of focus on this board. Let's say you have a 10 by 10 board. Your point of focus is the coordinate (4, 6). Let's imagine that this useless, pointless (no pun intended) space has a classification of orange. I'm trying to create a function that will check the surrounding coordinates in order to check whether or not they are also classified as orange. If so, then the surrounding coordinates for those coordinates should be checked, and so on. The end goal is to retrieve a list of all of the coordinates that are connected to (4, 6) that are also orange. I hope I make sense. My example may have just confused someone I'm sure. To make a long explanation short, I am aiming for a Bubble Shooter type system. Any thoughts? All attempts that I have made towards accomplishing this goal have ended quite badly. So, when all else fails...P.S. Here's what I have so far in the form of an example:https://dl.dropboxusercontent.com/u/561 … 20Copy.bgt

URL: http://forum.audiogames.net/viewtopic.php?pid=244786#p244786





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: ideas for grid scanning system?

2016-01-01 Thread AudioGames . net Forum — Developers room : gamedude via Audiogames-reflector


  


Re: ideas for grid scanning system?

So, anyone want to take a look at this? I've attempted to implament one of the flood fills found on the helpful Wikipedia page, but I'm still not getting the right results. I have a link to a simple example below:https://dl.dropboxusercontent.com/u/561 … 20Copy.bgtthe examine function is where the trouble is to save time. I appreciate all of the help.

URL: http://forum.audiogames.net/viewtopic.php?pid=244924#p244924





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: ideas for grid scanning system?

2016-01-01 Thread AudioGames . net Forum — Developers room : gamedude via Audiogames-reflector


  


Re: ideas for grid scanning system?

Well, I completely redesigned how I want to go about this situation. I updated the link above for anyone who wants to take a look. It still doesn't work, but it looks like it could turn out to be a lot less time consuming...

URL: http://forum.audiogames.net/viewtopic.php?pid=245073#p245073





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: ideas for grid scanning system?

2016-01-01 Thread AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector


  


Re: ideas for grid scanning system?

Oops, made a mistake in my example. Should have put in a way to keep track of previously scanned tiles, so:def gridcheck():
# based on an implementation by Eric S. Raymond

x = 5
y = 5

tile_id = grid[y][x]

test = grid[:]

connected = [[x,y]]

edge = [(x, y)]

while edge:
newedge = []
for (x, y) in edge:
for (s, t) in ((x+1, y), (x-1, y), (x, y+1), (x, y-1)):
try:
p = test[t][s]
except IndexError:
pass
else:
if p == tile_id:
test[t][s] = 99
connected.append([s,t])
newedge.append((s, t))
edge = newedge

return connectedI've taken a bit of time looking over your code and I think I can offer a solution, haven't played with BGT before so appologies if it implodes, heh. void examine(int a, int b) {
int target=board[a][b];
int temp_board=board;
vector[] remove;
vector[] tmp;
processed = tmp;
vector new;
new.x=a;
new.y=b;
remove.insert_last(new);
processed.insert_last(new);
temp_board[a][b] = 99;
while(remove.length()>0) {
vector[] new_remove;
for(int c=0; c<remove.length(); c++) {
vector new;
new.x=remove[c].x;
new.y=remove[c].y;

if(new.x-1>0) {
if(temp_board[new.x-1][new.y]==target) {
vector temp;
temp.x=new.x-1;
temp.y=new.y;
new_remove.insert_last(temp);
processed.insert_last(temp);
temp_board[new.x-1][new.y] = 99;
}//if
}//if

if(new.x+1<board.length()-1) {
if(temp_board[new.x+1][new.y]==target) {
vector temp;
temp.x=new.x+1;
temp.y=new.y;
new_remove.insert_last(temp);
processed.insert_last(temp);
temp_board[new.x+1][new.y] = 99;
}//if
}//if

if(new.y-1>0) {
if(temp_board[new.x][new.y-1]==target) {
vector temp;
temp.x=new.x;
temp.y=new.y-1;
new_remove.insert_last(temp);
processed.insert_last(temp);
temp_board[new.x][new.y-1] = 99;
}//if
}//if 

if(new.y+1<board.length()-1) {
if(temp_board[new.x][new.y+1]==target) {
vector temp;
temp.x=new.x;
temp.y=new.y+1;
new_remove.insert_last(temp);
processed.insert_last(temp);
temp_board[new.x][new.y+1] = 99;
}//if
}//if 

}//for
remove = new_remove;
}//while
}//examineThis creates a copy of the board array and iterates over it, it creates a new array called "new_remove" every cycle of the while loop, it checks adjacent tiles to the current tile, then adds any that match to new_remove to check their adjacent tiles next cycle, marks them off on the copy of board, and adds them to processed to deliver the final results. At the end of the for loop new_remove replaces remove to check the new list of tiles, and new_remove is recreated/emptied for the next cycle, i'm not sure what the BGT syntax is for clearing or copying arrays so don't know if thats correct.

URL: http://forum.audiogames.net/viewtopic.php?pid=245082#p245082





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: ideas for grid scanning system?

2016-01-01 Thread AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector


  


Re: ideas for grid scanning system?

Oops, made a mistake in my example. Should have but in a way to keep track of previously scanned tiles, so:def gridcheck():
# based on an implementation by Eric S. Raymond

x = 5
y = 5

tile_id = grid[y][x]

test = grid[:]

connected = [[x,y]]

edge = [(x, y)]

while edge:
newedge = []
for (x, y) in edge:
for (s, t) in ((x+1, y), (x-1, y), (x, y+1), (x, y-1)):
try:
p = test[t][s]
except IndexError:
pass
else:
if p == tile_id:
test[t][s] = 99
connected.append([s,t])
newedge.append((s, t))
edge = newedge

return connectedI've taken a bit of time looking over your code and I think I can offer a solution, haven't played with BGT before so appologies if it implodes, heh. void examine(int a, int b) {
int target=board[a][b];
int temp_board=board;
vector[] remove;
vector[] processed;
vector new;
new.x=a;
new.y=b;
remove.insert_last(new);
processed.insert_last(new);
while(remove.length()>0) {
vector[] new_remove;
for(int c=0; c<remove.length(); c++) {
vector new;
new.x=remove[c].x;
new.y=remove[c].y;

if(new.x-1>0) {
if(temp_board[new.x-1][new.y]==target) {
vector temp;
temp.x=new.x-1;
temp.y=new.y;
new_remove.insert_last(temp);
processed.insert_last(temp);
temp_board[new.x-1][new.y] = 99;
}//if
}//if

if(new.x+1<board.length()-1) {
if(temp_board[new.x+1][new.y]==target) {
vector temp;
temp.x=new.x+1;
temp.y=new.y;
new_remove.insert_last(temp);
processed.insert_last(temp);
temp_board[new.x+1][new.y] = 99;
}//if
}//if

if(new.y-1>0) {
if(temp_board[new.x][new.y-1]==target) {
vector temp;
temp.x=new.x;
temp.y=new.y-1;
new_remove.insert_last(temp);
processed.insert_last(temp);
temp_board[new.x][new.y-1] = 99;
}//if
}//if 

if(new.y+1<board.length()-1) {
if(temp_board[new.x][new.y+1]==target) {
vector temp;
temp.x=new.x+1;
temp.y=new.y;
new_remove.insert_last(temp);
processed.insert_last(temp);
temp_board[new.x][new.y+1] = 99;
}//if
}//if 

}//for
remove = new_remove;
}//while
}//examineThis creates a copy of the board array and iterates over it, it creates a new array called "new_remove" every cycle of the while loop, it checks adjacent tiles to the current tile, then adds any that match to new_remove to check their adjacent tiles next cycle, marks them off on the copy of board, and adds them to processed to deliver the final results. At the end of the for loop new_remove replaces remove to check the new list of tiles, and new_remove is recreated/emptied for the next cycle, i'm not sure what the BGT syntax is for clearing or copying arrays so don't know if thats correct.

URL: http://forum.audiogames.net/viewtopic.php?pid=245082#p245082





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: ideas for grid scanning system?

2016-01-01 Thread AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector


  


Re: ideas for grid scanning system?

Oops, made a mistake in my example. Should have but in a way to keep track of previously scanned tiles, so:def gridcheck():
# based on an implementation by Eric S. Raymond

x = 5
y = 5

tile_id = grid[y][x]

test = grid[:]

connected = [[x,y]]

edge = [(x, y)]

while edge:
newedge = []
for (x, y) in edge:
for (s, t) in ((x+1, y), (x-1, y), (x, y+1), (x, y-1)):
try:
p = test[t][s]
except IndexError:
pass
else:
if p == tile_id:
test[t][s] = 99
connected.append([s,t])
newedge.append((s, t))
edge = newedge

return connectedI've taken a bit of time looking over your code and I think I can offer a solution, haven't played with BGT before so appologies if it implodes, heh. void examine(int a, int b) {
int target=board[a][b];
int temp_board=board;
vector[] remove;
vector[] tmp;
processed = tmp;
vector new;
new.x=a;
new.y=b;
remove.insert_last(new);
processed.insert_last(new);
while(remove.length()>0) {
vector[] new_remove;
for(int c=0; c<remove.length(); c++) {
vector new;
new.x=remove[c].x;
new.y=remove[c].y;

if(new.x-1>0) {
if(temp_board[new.x-1][new.y]==target) {
vector temp;
temp.x=new.x-1;
temp.y=new.y;
new_remove.insert_last(temp);
processed.insert_last(temp);
temp_board[new.x-1][new.y] = 99;
}//if
}//if

if(new.x+1<board.length()-1) {
if(temp_board[new.x+1][new.y]==target) {
vector temp;
temp.x=new.x+1;
temp.y=new.y;
new_remove.insert_last(temp);
processed.insert_last(temp);
temp_board[new.x+1][new.y] = 99;
}//if
}//if

if(new.y-1>0) {
if(temp_board[new.x][new.y-1]==target) {
vector temp;
temp.x=new.x;
temp.y=new.y-1;
new_remove.insert_last(temp);
processed.insert_last(temp);
temp_board[new.x][new.y-1] = 99;
}//if
}//if 

if(new.y+1<board.length()-1) {
if(temp_board[new.x][new.y+1]==target) {
vector temp;
temp.x=new.x+1;
temp.y=new.y;
new_remove.insert_last(temp);
processed.insert_last(temp);
temp_board[new.x][new.y+1] = 99;
}//if
}//if 

}//for
remove = new_remove;
}//while
}//examineThis creates a copy of the board array and iterates over it, it creates a new array called "new_remove" every cycle of the while loop, it checks adjacent tiles to the current tile, then adds any that match to new_remove to check their adjacent tiles next cycle, marks them off on the copy of board, and adds them to processed to deliver the final results. At the end of the for loop new_remove replaces remove to check the new list of tiles, and new_remove is recreated/emptied for the next cycle, i'm not sure what the BGT syntax is for clearing or copying arrays so don't know if thats correct.

URL: http://forum.audiogames.net/viewtopic.php?pid=245082#p245082





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: ideas for grid scanning system?

2015-12-31 Thread AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector


  


Re: ideas for grid scanning system?

What your looking for is similar to a Flood Fill Algorithm, which coincidentally i've been working on recently for a project. So here's an example in python:def gridcheck(self, grid, start_x, start_y):
# based on an implementation by Eric S. Raymond

x = start_x
y = start_y

tile_id = grid[y][x]

connected = [[x,y]]

edge = [(x, y)]

while edge:
newedge = []
for (x, y) in edge:
for (s, t) in ((x+1, y), (x-1, y), (x, y+1), (x, y-1)):
try:
p = grid[t][s]
except IndexError:
pass
else:
if p == tile_id:
connected.append([s,t])
newedge.append((s, t))
edge = newedge

return connectedThis function takes the Grid and the starting x and y positions, then should return a list containing the coordinates of all tiles that match the starting tile, if any.

URL: http://forum.audiogames.net/viewtopic.php?pid=244816#p244816





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: ideas for grid scanning system?

2015-12-31 Thread AudioGames . net Forum — Developers room : gamedude via Audiogames-reflector


  


Re: ideas for grid scanning system?

So, anyone want to take a look at this? I've attempted to implament one of the flood fills found on the helpful Wikipedia page, but I'm still not getting the right results. I have a link to a simple example below:https://dl.dropboxusercontent.com/u/561 … 20Copy.bgtthe examine function is where the trouble is to save time. I appreciate all of the help.

URL: http://forum.audiogames.net/viewtopic.php?pid=244924#p244924





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: ideas for grid scanning system?

2015-12-31 Thread AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector


  


Re: ideas for grid scanning system?

I was kinda assuming you'd need to use recursion. Actually, I remember doing something like--APRONE! Isn't this kinda like how Goblins work in Castaways?Umm. I'm just going to think with my fingers for a minute.def fill(base, x, y, flags=None) :
value=base[x][y]
if(flags is None) : flags=[[False]*len(base[x])]*len(base)
flags[x][y]=True
v=base[x][y]
lx=len(base) # should have done this earlier. Oops.
ly=len(base[x])
for i in xrange(3) :
if(x-1+i<0 or x-1+i>=lx) : continue
for j in xrange(3) :
if(y-1+j<0 or y-1+j>=ly or flags[x-1+i][y-1+j]) continue
if(base[x-1+i][y-1+j]==v) : flags=fill(base, x-1+i, y-1+j, flags)
# j
# i
return flags
# functionExcept that could make the stack explode if the array is particularly large. I have no idea what algorithm the Windows API uses, but I know it's quite old, and I have to imagine that stack size has only increased with time.Still... the above is the first thing I'd try. I totally shouldn't. 

URL: http://forum.audiogames.net/viewtopic.php?pid=244935#p244935





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

ideas for grid scanning system?

2015-12-30 Thread AudioGames . net Forum — Developers room : gamedude via Audiogames-reflector


  


ideas for grid scanning system?

So, I'm sort of stumped on this one. Imagine you have a grid. Any particular grid will do. It could be a 3 by 3, a 7 by 7, or a 10 by 10. I recommend it being quite a large sized board. Anyways, you have a particular point of focus on this board. Let's say you have a 10 by 10 board. Your point of focus is the coordinate (4, 6). Let's imagine that this useless, pointless (no pun intended) space has a classification of orange. I'm trying to create a function that will check the surrounding coordinates in order to check whether or not they are also classified as orange. If so, then the surrounding coordinates for those coordinates should be checked, and so on. The end goal is to retrieve a list of all of the coordinates that are connected to (4, 6) that are also orange. I hope I make sense. My example may have just confused someone I'm sure. To make a long explanation short, I am aiming for a Bubble Shooter type system. Any thoughts? All attempts that I have 
 made towards accomplishing this goal have ended quite badly. So, when all else fails...

URL: http://forum.audiogames.net/viewtopic.php?pid=244786#p244786





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: ideas for grid scanning system?

2015-12-30 Thread AudioGames . net Forum — Developers room : sneak via Audiogames-reflector


  


Re: ideas for grid scanning system?

are you asking how to identify connecting coords after supplying those coords? Or are you asking to search for a specific id in a coord system and then identify all of the connecting coords with the same id

URL: http://forum.audiogames.net/viewtopic.php?pid=244796#p244796





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: ideas for grid scanning system?

2015-12-30 Thread AudioGames . net Forum — Developers room : sneak via Audiogames-reflector


  


Re: ideas for grid scanning system?

Well here I'll try and write something up in suto code cause I'll be typing fast and I am sure I'll mess up the syntax or something along the waygim a sec

URL: http://forum.audiogames.net/viewtopic.php?pid=244799#p244799





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: ideas for grid scanning system?

2015-12-30 Thread AudioGames . net Forum — Developers room : sneak via Audiogames-reflector


  


Re: ideas for grid scanning system?

Having a hard time concentrating enough to fully flesh out this idea, but basicly you're wanting to create an alternative forloop manually. Here's what I have so far, let me know if it helps or not. idk. Assuming your grid is held in a 2d arrayint[][] grid;void main(){grid.resize(10);for(int x=0; x<10; x++){grid[x].resize(10);}}void checkGrid(int x, int y){int uX=x+1;int dX=x-1int uY=y+1;int dY=y-1;int result=grid[x][y];if(grid[uX][y]==result){}if(grid[dX][y]==result){}if(grid[x]uY]==result){}if(grid[x][dY]==result){}}}int checkSquares(int x, int y){int uX=x+1;int dX=x-1int uY=y+1;int dY=y-1;int result=grid[x][y];if(grid[uX][y]==result){return grid[uX][y];}if(grid[dX][y]==result){return grid[dX][y];<
 br />}if(grid[x]uY]==result){return grid[x][uY];}if(grid[x][dY]==result){return grid[x][dY];}}}It needs a lot more work to get it working, but hopefully it is enough to help you think in another direction. GF is wanting to watch house with me, so sorry. If you haven't figured it out by the time I get some more time I'll pick it back up and post it here.

URL: http://forum.audiogames.net/viewtopic.php?pid=244805#p244805





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: ideas for grid scanning system?

2015-12-30 Thread AudioGames . net Forum — Developers room : gamedude via Audiogames-reflector


  


Re: ideas for grid scanning system?

Starting from a coordinate, i'm looking for a way to identify all of the coordinates that are connecting to it that have the same id. Each coordinate in the grid is assigned an id. Some of them could be the same. I'm looking for a way to identify if, given a coordinate, there are surrounding coordenates with the same id, and, if possible, surrounding coordinates to those surrounding coordinates, and so on.

URL: http://forum.audiogames.net/viewtopic.php?pid=244798#p244798





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: ideas for grid scanning system?

2015-12-30 Thread AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector


  


Re: ideas for grid scanning system?

What your looking for is similar to a Flood Fill Algorithm, which coincidentally i've been working on recently for a project. So here's an example in python:def gridcheck(self, grid, start_x, start_y):
# based on an implementation by Eric S. Raymond

x = start_x
y = start_y

tile_id = grid[y][x]

connected = [[x,y]]

edge = [(x, y)]

while edge:
newedge = []
for (x, y) in edge:
for (s, t) in ((x+1, y), (x-1, y), (x, y+1), (x, y-1)):
try:
p = grid[t][s]
except IndexError:
pass
else:
if p == tile_id:
connected.append([t,s])
newedge.append((s, t))
edge = newedge

return connectedThis function takes the Grid and the starting x and y positions, then should return a list containing the coordinates of all tiles that match the starting tile, if any.

URL: http://forum.audiogames.net/viewtopic.php?pid=244816#p244816





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector