# Sorting out the maths in some game code.

#### JonnyMe

I completely edit my last post in this should be more simple to understand and maybe figure out. I found out that "x" decreases as "a" increase. But the "x" value in both equations should equal each other.

ax = b

65x = 134
77x = 157

Last edited:

#### mr fantastic

MHF Hall of Fame
I completely edit my last post in this should be more simple to understand and maybe figure out. I found out that "x" decreases as "a" increase. But the "x" value in both equations should equal each other.

ax = b

65x = 134
77x = 157
What you have posted is meaningless. If you hope to get help, post the whole question.

#### JonnyMe

What you have posted is meaningless. If you hope to get help, post the whole question.
Don't call someone else work meaning less, if it is unsolvable then say so.

x needs to equal something, this is not homework a problem this is part of a game code that I would like to figure out. I would have figured it out myself but I am not exactly fresh on my freshman algebra or whatever this falls under.

65 = 134
77 = 157

65 x (something) = 134
77 x (something = 157
A x (something) = C

#### mr fantastic

MHF Hall of Fame
Don't call someone else work meaning less, if it is unsolvable then say so. Mr F says: It is in your own interests, not mine, that you make what you post meaningful. Otherwise, you will simply find that no-one bothers to reply and you will be left wondering why.

x needs to equal something, this is not homework a problem this is part of a game code that I would like to figure out. I would have figured it out myself but I am not exactly fresh on my freshman algebra or whatever this falls under.

65 = 134
77 = 157

65 x (something) = 134 Mr F says: (something) = 134/65.
77 x (something = 157 Mr F says: (something) = 157/77.
A x (something) = C Mr F says: (something) = C/A.
..

#### JonnyMe

" 10) Do not beg for answers. If your question is unanswered do not make a post begging for someone to reply back, it is totally useless. Other members can see the question."
Very very vague interpretation of bumping.

No one bothers to reply because no one knows the answer you got is wrong also.

It has to be solvable its part of the game's code so there must be very complex.

Here is it is to the simplest level I can put it:

A x B = C
D x B = E

B = B

A = 65
B = unknowable
C = 134
D = 77
E = 157

#### undefined

MHF Hall of Honor
" 10) Do not beg for answers. If your question is unanswered do not make a post begging for someone to reply back, it is totally useless. Other members can see the question."
Very very vague interpretation of bumping.

No one bothers to reply because no one knows the answer you got is wrong also.

It has to be solvable its part of the game's code so there must be very complex.

Here is it is to the simplest level I can put it:

A x B = C
D x B = E

B = B

A = 65
B = unknowable
C = 134
D = 77
E = 157
mr fantastic is giving you valid feedback, and your questions really don't make sense.

If what you say is true, then

$$\displaystyle \frac{134}{65} = \frac{157}{77}$$

which we know is not true, so you're looking for a B that does not exist.

There must be something wrong with the way you're coding the game, or the way you are conceptualizing.

• mr fantastic

#### JonnyMe

mr fantastic is giving you valid feedback, and your questions really don't make sense.

If what you say is true, then

$$\displaystyle \frac{134}{65} = \frac{157}{77}$$

which we know is not true, so you're looking for a B that does not exist.

There must be something wrong with the way you're coding the game, or the way you are conceptualizing.
mr fantastic's math is correct but does not work with the equation, the game is completed already and been working its not mine, I really got to show you guys what I am trying to get out of this.

#### undefined

MHF Hall of Honor
mr fantastic's math is correct but does not work with the equation, the game is completed already and been working its not mine, I really got to show you guys what I am trying to get out of this.
Care to share any lines of code? I can read most languages... I assume it's not assembler.

#### JonnyMe

Care to share any lines of code? I can read most languages... I assume it's not assembler.
Great I can't find my 77-77 carbine. So I got to do different numbers now.

Here is where its from and I don't have access to the game's code, but as far as I know this feature in it is working correctly. So shooting with a 65-65 carbine (damage will always be the same since the damage range on the carbine is the same number) your spray shot will always do 134 damage no mater what. Same thing with the 153 carbine.

So now.

A x B = C
D x B = E

B = B

A = 65
B = unknowable
C = 134
D = 153
E = 313

#### undefined

MHF Hall of Honor
Great I can't find my 77-77 carbine. So I got to do different numbers now.

Here is where its from and I don't have access to the game's code, but as far as I know this feature in it is working correctly. So shooting with a 65-65 carbine (damage will always be the same since the damage range on the carbine is the same number) your spray shot will always do 134 damage no mater what. Same thing with the 153 carbine.

So now.

A x B = C
D x B = E

B = B

A = 65
B = unknowable
C = 134
D = 153
E = 313
Okay this is what I gather.

You have a function f(x) that maps the carbine number (whatever it's called) to the damage it does.

So f(65) = 134
f(77) = 157
f(153) = 313

You are looking for an expression for f(x) that allows you to calculate damage given arbitrary carbine number x.

This is a problem of curve fitting. The more data points you have, the better.

As we already discussed, f(x) cannot be of the form f(x) = kx for some constant real k.

A quick inspection also reveals that f(x) cannot be linear, of the form f(x) = ax + b.

We can find a quadratic polynomial to fit the data, but it would be better if you could provide more data points. That way, if we fit three points using a quadratic curve and any additional points happen to be on the curve, we will have some confidence we found the right curve.

So far these are the data points.

(65, 134)
(77, 157)
(153, 313)

We don't even know if the program uses a polynomial f(x). For all we know, it could based on an arbitrary table of values. But curve fitting seems to be the best solution for what you want, unless you can get access to the game's source code.