The Daily Click ::. Forums ::. Klik Coding Help ::. Mathematics Issue
 

Post Reply  Post Oekaki 
 

Posted By Message

MBK



Registered
  07/06/2007
Points
  1578

VIP Member
6th July, 2009 at 13:15:13 -

I'm still having trouble with my code ..

I believe the solution is one of a mathematical nature, and to be quite honest, I'm not so good at anything more complicated than multiplication. So all you Mathematicians and Number Manipulation Wizards out there, I need you!

Lets say there's 3 rows of oranges (19 oranges total), and in the first row there are 4 oranges, in the second row there are 6 oranges, and in the third row there are 9 oranges. What is the mathematical formula which will split them in such a manner? And once that is found, how can that formula become alterable so that any amount of oranges can be put in whatever row you want without spilling the oranges from one row into another? Do you see what I'm saying?

I believe that changing the number which it is spread by (or maybe even spreading by a variable ever changeable number) could have something to do with getting it to work, but I have no clue how to get it all working mathematically, let alone implementing it into the code.

I have MSN messenger, for hotmail ... But I'm probably going to need someone who's heavily into math to help me.
Do you know much about mathematics? I vaguely remember something similar to this problem in an Algebra class when I was in school, but I don't know what the term for those kind of problems is or how they were solved.


 
Click Me! http://www.create-games.com/project.asp?view=main&id=1444

http://www.mediafire.com/download.php?aoo1dnnlq5i

Blood of the Ancient One, Seen only as Shadow, Faster than Lightning, Fierce as the Greatest Dragon, Nearly Invisible, Floating in a Dream, Entered through the Demon Door, Destroyer of Evil in a Realm with a Red Sky Scarred, Who could I be ?

MBK



Registered
  07/06/2007
Points
  1578

VIP Member
6th July, 2009 at 21:34:45 -

Also take a look at my other Spread Value posts, because they mostly have to do with this problem in my code.
It's a major annoyance, as building levels for a game with the 2.5d coding will take 10x as long if it can't be fixed.
It'll also be easier to messup a level and have to restart making it from scratch because of not knowing where you messed up at.

So, yea ... anyone know of a good Math problem helper site or something?
I'm gonna be googling math sites ... hopefully I can eventually find someone who can help.

GamesterXIII has been trying really hard to help me out, and I am still trying myself, but alas to no avail, as this problem seems to have a fortress of impenetrable, impervious, stone and metal built around it, being mysteriously inscrutable to all in the land, none being capable of gaining entrance to its nearly insurmountable golden bounty of usefulness hiddin within, much resembling Fort Knox and its massive treasure contained therein.


 
Click Me! http://www.create-games.com/project.asp?view=main&id=1444

http://www.mediafire.com/download.php?aoo1dnnlq5i

Blood of the Ancient One, Seen only as Shadow, Faster than Lightning, Fierce as the Greatest Dragon, Nearly Invisible, Floating in a Dream, Entered through the Demon Door, Destroyer of Evil in a Realm with a Red Sky Scarred, Who could I be ?

OMC

What a goofball

Registered
  21/05/2007
Points
  3309

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
6th July, 2009 at 21:59:22 -

I don't understand what the question is. A mathematical formula for splitting things into rows? Wha? That's not very specific.

You mean like having three rows that add up to 19? If some rows can have 0, just do:

Row 1: Random(19)
Row 2: Random(19 - Row 1)
Row 3: 19 - Row 1 - Row 2

If you can't do 0, you may have to limit it so that it's not completely random. e.g.,

Row 1: Random(8 ) + 1
Row 2: Random(8 ) + 1
Row 3: 19 - (Row 1 + Row 2)

or something similar. You'd never get anything over 8 for the first two in the last example, but there are other ways to spread it out. You could put 17 in the first one, for instance, which would mean the other two would each have at least one. It depends on whether you want a limit on how high each one can go.

Was that the question? I don't think it was.

Edited by OMC

 

  		
  		

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1960

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
6th July, 2009 at 22:08:36 -

I think you might want to re-phrase your question. Your oranges example makes absolutely no sense at all.

 
n/a

MBK



Registered
  07/06/2007
Points
  1578

VIP Member
6th July, 2009 at 23:44:41 -

It can't be random OMC, just variable in the sense that if you put a stack of 1 wall over one platforms shadow to form a higher wall
or tower (if you'd rather think of it that way) until you add the green platform on top ...
Then if you put 2 walls in the next column (shadow and platform pairing), and 3 walls in the third column,
(walls being added in the frame editor, not during runtime), I need a way to make the wall instances line up in the columns no matter their number or order of placement.

Right now, the only way that the walls are not misplaced when stacking them (for the above example in this posting) is if you add a wall to the first column, add a wall to the second column, add a wall to the third column, add a wall offscreen (to keep the steady number balance), add a 2nd wall to the second column, add a 2nd wall to the third column, add another wall offscreen to keep first column numerically balanced with the other columns (3 walls 2 are offscreen), add 3rd wall to second column, and finally add the 3rd wall for the third column.

Is anyone getting this yet? ... and what I really need, is a way to set stacks (of any amount of walls) in any column, and still have everything line up correctly. By correctly I mean if I place 3 walls in the editor in the first column only, (but I have 3 columns) they should remain in the first column instead of getting moved over to the other columns, but I still need the x placement code at start of level because it is used throughout other sections of my code.

Hmm, I think I've just thought of a way without much math ... (if it works without ruining the code already in place that is)
Tell me if you think this would work: measure the x distance between wall placements and the platforms' shadow (the column), and if shadow is closer to wall, than the other shadow instances (columns) are, set wall to that closest shadow..... CRAP! THAT WON'T WORK!
That won't work cause it'll mis-interpret which shadow to pick to consider the distance between it and the wall instance!

This problem is insanity itself! What am I to do?

@OMC, YES, I need a variable limitation on each column.


Edited by MBK

 
Click Me! http://www.create-games.com/project.asp?view=main&id=1444

http://www.mediafire.com/download.php?aoo1dnnlq5i

Blood of the Ancient One, Seen only as Shadow, Faster than Lightning, Fierce as the Greatest Dragon, Nearly Invisible, Floating in a Dream, Entered through the Demon Door, Destroyer of Evil in a Realm with a Red Sky Scarred, Who could I be ?

OMC

What a goofball

Registered
  21/05/2007
Points
  3309

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
6th July, 2009 at 23:52:39 -

I have no clue what the problem even is. o_o You pretty much fried my brain with that explanation.

 

  		
  		

MBK



Registered
  07/06/2007
Points
  1578

VIP Member
7th July, 2009 at 00:03:39 -

Sorry ... my brain is fried too ... this is so difficult to explain!

But if I could just set position to the location of a specific instance of an object, I'd be able to avoid all this mess.
Is there some way to do that?

If there is, then that'd make life ALOT easier with all my code.
I'd be flying through it then!


 
Click Me! http://www.create-games.com/project.asp?view=main&id=1444

http://www.mediafire.com/download.php?aoo1dnnlq5i

Blood of the Ancient One, Seen only as Shadow, Faster than Lightning, Fierce as the Greatest Dragon, Nearly Invisible, Floating in a Dream, Entered through the Demon Door, Destroyer of Evil in a Realm with a Red Sky Scarred, Who could I be ?

DMT



Registered
  18/06/2009
Points
  150
7th July, 2009 at 01:50:22 -

I'm not sure, but create a hidden counter and increase it every iteration, while setting another counter to the amount of objects and then adding them? Just a thought. If you want something completely different, sorry but I can't understand your explanation...

 
I am no longer not a taco.

DMT



Registered
  18/06/2009
Points
  150
7th July, 2009 at 01:50:23 -

I'm not sure, but create a hidden counter and increase it every iteration, while setting another counter to the amount of objects and then adding them? Just a thought. If you want something completely different, sorry but I can't understand your explanation...

 
I am no longer not a taco.

Muz



Registered
  14/02/2002
Points
  6499

VIP MemberI'm on a BoatI am an April FoolHonored Admin Alumnus
8th July, 2009 at 09:21:03 -


Lets say there's 3 rows of oranges (19 oranges total), and in the first row there are 4 oranges, in the second row there are 6 oranges, and in the third row there are 9 oranges. What is the mathematical formula which will split them in such a manner?



Easy.
Oranges = 19
R1 = Oranges*4/19
R2 = Oranges*6/19
R3 = Oranges*9/19



Or....
Oranges = 19
R1 = 4
R2 = 6
R3 = Oranges - R2 - R1

 
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.

Image

MBK



Registered
  07/06/2007
Points
  1578

VIP Member
9th July, 2009 at 03:51:51 -


Originally Posted by Muz

Lets say there's 3 rows of oranges (19 oranges total), and in the first row there are 4 oranges, in the second row there are 6 oranges, and in the third row there are 9 oranges. What is the mathematical formula which will split them in such a manner?



Easy.
Oranges = 19
R1 = Oranges*4/19
R2 = Oranges*6/19
R3 = Oranges*9/19



Or....
Oranges = 19
R1 = 4
R2 = 6
R3 = Oranges - R2 - R1



That's completely ridiculous and not even a formula.
This is what your post amounts to: R1 = 4, R2 = 6, R3 = 9
That's just restating the values we already know. And it's not even funny as a joke.

-.-


Edited by MBK

 
Click Me! http://www.create-games.com/project.asp?view=main&id=1444

http://www.mediafire.com/download.php?aoo1dnnlq5i

Blood of the Ancient One, Seen only as Shadow, Faster than Lightning, Fierce as the Greatest Dragon, Nearly Invisible, Floating in a Dream, Entered through the Demon Door, Destroyer of Evil in a Realm with a Red Sky Scarred, Who could I be ?

OMC

What a goofball

Registered
  21/05/2007
Points
  3309

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
9th July, 2009 at 05:24:43 -

We're still waiting for a clear knowledge of what the question is.

 

  		
  		

MBK



Registered
  07/06/2007
Points
  1578

VIP Member
9th July, 2009 at 07:33:13 -

What I want to know, is a formula that allows for Variation in Rows, Variation in amount within each seperate row, and Variation in the total of everything ... a balancing act. If one value changes, then they all should change.

Okay, I believe this is the formula for 3 rows: Total = 3(A+B+C) But...
... What is the formula for a variable number of Rows with a variable count of Instances within each Row?
How would I write that mathematically? Is it even possible?

See, if every Instance count within each Row were the same number, then it's easy: Total = RA
But I have no clue what to write for an ever-changing amount of another ever-changing ammount.
Total = R(AV) ??? ..

I think I know the question to ask now ... maybe ..
How can the alterable value of an instance be counted for the amount of instances with that same value?


 
Click Me! http://www.create-games.com/project.asp?view=main&id=1444

http://www.mediafire.com/download.php?aoo1dnnlq5i

Blood of the Ancient One, Seen only as Shadow, Faster than Lightning, Fierce as the Greatest Dragon, Nearly Invisible, Floating in a Dream, Entered through the Demon Door, Destroyer of Evil in a Realm with a Red Sky Scarred, Who could I be ?

GamesterXIII



Registered
  04/12/2008
Points
  1110

I am an April Fool
9th July, 2009 at 07:56:45 -

"How can the alterable value of an instance be counted for the amount of instances with that same value?"

pick one of object
+ object value x = 1
+ Object Flag 0 is off
set Flag 0 on
add one to counter/value/whatever (which would be number of objects in that row)

If you need to place objects in rows based on their values (4 6 9) I believe you would have to code that manually.

You would need one more line for EACH row you plan to have.

Start of level Spread 1 into value x of oranges
Value X <= 4
set value X to 1
Value X >4 + Value X <=10
set Value X to 2
Value X >10 + Value X <=19
set Value X to 3

Are you planning on adding "oranges" at runtime?

How many are there going to be total?

It is still kind of vague as to what you are trying to do, so sorry if the answers I have given are inaccurate =s.







 
n/a

Assault Andy

Administrator
I make other people create vaporware

Registered
  29/07/2002
Points
  5686

Game of the Week WinnerVIP Member360 OwnerGOTM JUNE - 2009 - WINNER!GOTM FEB - 2010 - WINNER!	I donated an open source project
9th July, 2009 at 08:18:55 -

MBK - You need to give us an example of what you are actually trying to achieve - What do you want displayed on screen? You're assuming that the answer lies with maths but there are undoubtedly multiple ways of solving the problem. There may be a much simpler way to achieve what you want, not involving any maths, but you need to tell us what it is you actually want to do.

Looking at your first example, I just whipped this up:

http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=151997

I'm pretty sure it's what you're trying to do. And you'll notice that the solution has nothing to do with mathematical formulas or setting object ids.

 
Creator of Faerie Solitaire:
http://www.create-games.com/download.asp?id=7792
Also creator of ZDay20 and Dungeon Dash.
http://www.Jigxor.com
http://twitter.com/JigxorAndy
   

Post Reply



 



Advertisement

Worth A Click