How do I create an algorithm?

Get help using Construct 2

Post » Sat Aug 16, 2014 1:35 pm

Hello fellow Construct 2 users, I've recently run into a couple of problems with an app I'm trying to make. My app consists of an XY array. On my X axis, I have words. On my Y axis, I have sentences. I need to fill the elements in between with combinations of the X and Y values.

Here's an example:

Let's say that my X axis consists of the values "moose" with an index of 0, "goat" with an index of 1, and "monkey" with an index of 2.
My Y axis consists of the values "We saw a cat" with an index of 0, "You want a cat" with an index of 1, and "I own a cat" with an index of 2.
You follow?
Now what I need to do is swap out the word "cat" with all of the other X values and record them into my array.
For instance. Point (0,0) on my new array would have a value of "We saw a moose", and point (1,2) would have a value of "I own a goat."
I have to replace one word in the sentence with every element in my X axis and record the new sentences in every combination into the array.

I've tried many methods but they all involve me entering the data to every XY point by hand. Unfortunately my entire array will need to consist of about 1 million elements, seeing how my X and Y axis both have 1000 elements each. I don't have 4 months straight to sit and type in every possible combination for the values of every XY index.

Is there anyway to solve this problem?

~TylerNormal
B
3
Posts: 7
Reputation: 189

Post » Sat Aug 16, 2014 1:50 pm

Should be something like set the array to:

"We saw a"&arrayat(array.curx,0)
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sun Aug 17, 2014 10:50 am

So set all of my X's and Y's, and then use that formula to generate the X (new word) value into the Y value (sentence).

What if I'd need to replace a word in the middle of the sentence?
B
3
Posts: 7
Reputation: 189

Post » Sun Aug 17, 2014 11:15 am

Something like this:

"We saw a"&arrayat(array.curx,0)&"in the street"
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sun Aug 17, 2014 11:18 am

But you could choose not to put all those sentences in the array and just create them from a string, that way you'd only have to have an array with all the different animals..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775


Return to How do I....?

Who is online

Users browsing this forum: Google [Bot], Lordshiva1948, plinkie, sublimate and 9 guests