Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Pattern detection

Author
Message
george++
AGK Tool Maker
16
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 24th Jun 2018 16:20 Edited at: 24th Jun 2018 17:23
Hi, I am not sure if the title of topic describes my issue, but what I am looking for is:
Is there any efficient method to detect pattern in a table where cell values can be 0 or not?
For examble, I am looking for an algorithm to detect if there is any cell with non zero value between a source and a destination
janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 24th Jun 2018 17:08 Edited at: 24th Jun 2018 17:14
Not sure if I understand your problem, but wont two simple for loops over x and y(it a table) which counts the empty cells do the job for you ?
If the count equals the the maximum amount of cells you are set.
Whats about the source and a destination values ?
george++
AGK Tool Maker
16
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 24th Jun 2018 17:26
If the table (2 rows x 9 cols) goes like that:

0 x 0 0 0 0 x 0 0
0 0 0 0 0 0 0 0 0

Where x stands for non empty cell
Column 1 is the source (counting from zero) destination cell is Column 6
Phaelax
DBPro Master
20
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 25th Jun 2018 13:32
So what would the pattern be in that example?
Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
george++
AGK Tool Maker
16
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 25th Jun 2018 15:50
You are right, there is no pattern in this example. I can detect if another 'x' lies between the source and the destination with a simple loop, but since this loop (among others) needs to be executed within the main game loop, I am afraid that the execution speed will slow down. So I am wondering if there is an algorithm (pattern detection?) in order to gain better performance from loops.
Rich Dersheimer
AGK Developer
14
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 25th Jun 2018 16:30
Are you searching for specific patterns?

Are you looking at the data in words of six characters?

If you are looking at six character groupings, you can isolate each group of six with a mid(x,6), and then check if it does not equal "000000". This might be a little quicker, but unless you have a LOT of data to sift through, AppGameKit is still pretty fast at brute force searches on each and every character in a string.

Login to post a reply

Server time is: 2024-03-29 08:11:57
Your offset time is: 2024-03-29 08:11:57