GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Get a count for matching adjacent values in a table.

chaosmasterrochaosmasterro Posts: 49Member, PRO
edited June 2016 in Working with GS (Mac)

I have hit a wall trying to figure out how to do this correctly. I have a table that spawns random values in a table after a given time. There are three different integer values in my table.

Example:
2131
1232
3233

Let's say I choose the "3" in Col:4 and Row:3. There are four adjacent "3"s next to each other. How do I get a value for that?
Let's say I choose the "3" in Col:1 and Row:3. There is just one "3", and I want a value for 1 to return.

(There are five "3"s in my table but I only want a count for the four adjacent ones.)

Any ideas??

Comments

  • tatiangtatiang Posts: 11,845Member, Sous Chef, PRO, Senior Sous-Chef

    Start by writing an algorithm for the process without considering GameSalad. That is, if you had those numbers written down on, say, graph paper, how would you describe a method for generating those values to someone who doesn't know anything about GameSalad? Once you have that, it's not too hard (with the help of the community here) to translate that to tables, etc.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

Sign In or Register to comment.