Matching patterns by tables?
biffbaxter
Member Posts: 2
What would be the best way to match a pattern by a table?
My scenario is this...think something like minecraft and tables
I have a 3x3 grid I put 3 wood across the top - 1 wood in the middle row and 1 wood in the middle row at the bottom...how would I check that as valid between the table being filled with items and another table? I presume I would assign values to the items in the table and then check them against another? If the pattern (or value) matches it returns a true value if not false, or numeric value...
Just trying to determine the best method/syntax....and ideas appreciated
My scenario is this...think something like minecraft and tables
I have a 3x3 grid I put 3 wood across the top - 1 wood in the middle row and 1 wood in the middle row at the bottom...how would I check that as valid between the table being filled with items and another table? I presume I would assign values to the items in the table and then check them against another? If the pattern (or value) matches it returns a true value if not false, or numeric value...
Just trying to determine the best method/syntax....and ideas appreciated
Comments
Have nine actors to make a 3x3 grid. (the are the same actor just placed 9 times and have two attributes called self.row and self.col
You then have a table 3x3. This is your Id table.
Go on to each actor (without unlocking it and change self.row and self col respectfully)
So then you would have your normal rules as when "stick" is true. (this means you touched stick and you want to place it on a grid)
And touch is pressed change tavlevalue(table.id,self.row,self.col) to 1
1 is equal to stick
2 is equal to stone
3 is equal to .... Ect.
Then have a new actor called control. Then have rules in place that
If tablevalue(table.id,1,1) is equal to 1
And tablevalue " " 2,1) is equal to 1
Then spawn log or what ever it equals.
If you don't want to spawn over the grid then create a new table that says transform. It's 3x3
Back on to your grid actor.
If tablevalue.transform.self.row,self.col) is equal to 1 change image to .....,
Hope that makes sense, prett complicated and I am not the best explained but it may give you a push. Or just ask more questions if you don't get it.
All the best