FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Forum index » Science and Technology » Math » Recreational
Please help me!
Post new topic   Reply to topic Page 1 of 2 [22 Posts] View previous topic :: View next topic
Goto page:  1, 2 Next
Author Message
Bill McCray
science forum beginner


Joined: 18 May 2005
Posts: 44

PostPosted: Wed May 25, 2005 8:01 pm    Post subject: Re: Game formulas Reply with quote

On Wed, 25 May 2005 09:42:31 -0400, Mickey
<REMOVETHISTEXT.portillas@hotmail.com> wrote:

Quote:
Bill,

Wow, that was some post, thank you. Looking back now I should have
specified the problem more like this:

Given a monster type range and player dexterity range and using one
index from each range with four percentages A,B,C,D:

If the monster type index is equal to the minimum and the player
dexterity index is equal to the minimum, then the monster has A/100
chance of striking the player.

If the monster type index is equal to the maximum and the player
dexterity index is equal to the minimum, then the monster has B/100
chance of striking the player.

If the monster type index is equal to the minimum and the player
dexterity index is equal to the maximum, then the monster has C/100
chance of striking the player.

If the monster type index is equal to the maximum and the player
dexterity index is equal to the maximum, then the monster has D/100
chance of striking the player.

Ultimately in my program I can only input the player dexterity and the
monster type to find the percentage of striking the player. Your posted
solution is using the ranges and not specific values and that of course
was the fault of my previous post.

I don't think you have asked for anything here that is different from
your previous post. Take whatever four specific values you want your
dexterity formula to match, substitute in the formulas I derived in my
last post, and compute a, b, c, and d. Your dexterity formula is than

aP + bM + cPM + d

This resulting formula will match your four specified conditions
exactly and will give dexterity values for points between those four
specified condition that vary linear with P for a fixed M and vary
linearly with M for a fixed P.

In case you didn't understand, Pmax and Pmin are the maximum and
minimum values for the P range (respectively) and Mmax and Mmin are
the maximum and minimum values for the M range (respectively).

Quote:
You must be a math professor, your posts have been clear and very
well written. Thank you.

And thank you for that comment. No, I'm not a math professor. I'm an
electrical engineer by schooling and a logic designer and programmer
by experience. I did well in my math classes in school and have
always enjoyed the subject, which is why I follow this newsgroup.
However, I admit that there are a lot of posts here that are well over
my head.

I try to tailor my writing to my perception of the experience level of
my audience, preferring to err on the side of giving too much detail
rather than not enough.

As for the "well written", I decided somewhere in my public-school
years that, since English is my only native language, I should try to
learn to use it properly. For example, I have formulate Bill's Rule
of Homophones: Just because two words sound alike when spoken does
not make them acceptable substitutes for each other in writing. I
know the difference between "its" and "it's", and I try to be careful
to use the correct one in each instance. I'm not perfect (oh, the
shame), but I do try. Also, I proofread each post I write, sometimes
more than once, before sending it off.

I call myself a "programmar programmer".

Bill

Swap first and last parts of username and ISP for address.
Back to top
Mickey
science forum beginner


Joined: 18 May 2005
Posts: 14

PostPosted: Wed May 25, 2005 11:42 am    Post subject: Re: Game formulas Reply with quote

Bill,

Wow, that was some post, thank you. Looking back now I should have
specified the problem more like this:

Given a monster type range and player dexterity range and using one
index from each range with four percentages A,B,C,D:

If the monster type index is equal to the minimum and the player
dexterity index is equal to the minimum, then the monster has A/100
chance of striking the player.

If the monster type index is equal to the maximum and the player
dexterity index is equal to the minimum, then the monster has B/100
chance of striking the player.

If the monster type index is equal to the minimum and the player
dexterity index is equal to the maximum, then the monster has C/100
chance of striking the player.

If the monster type index is equal to the maximum and the player
dexterity index is equal to the maximum, then the monster has D/100
chance of striking the player.

Ultimately in my program I can only input the player dexterity and the
monster type to find the percentage of striking the player. Your posted
solution is using the ranges and not specific values and that of course
was the fault of my previous post. You must be a math professor, your
posts have been clear and very well written. Thank you.


-Mickey


Bill McCray wrote:
Quote:
On Tue, 24 May 2005 14:37:02 -0400, Mickey
REMOVETHISTEXT.portillas@hotmail.com> wrote:


Bill McCray wrote:

On Mon, 23 May 2005 19:02:54 -0400, Mickey
REMOVETHISTEXT.portillas@hotmail.com> wrote:



Bill,

I need something more flexible than your previous solution. I need to be
able to tweak the game play by changing the percentages. Something more
along the lines of the following. I welcome everyones input.


Given a monster type range, a player dexterity range and four
percentages A,B,C,D.

If the monster type index is equal to the minimum and the player
dexterity index is equal to the minimum, then the monster has A/100
chance of striking the player.

If the monster type index is equal to the maximum and the player
dexterity index is equal to the minimum, then the monster has B/100
chance of striking the player.

If the monster type index is equal to the minimum and the player
dexterity index is equal to the maximum, then the monster has C/100
chance of striking the player.

If the monster type index is equal to the maximum and the player
dexterity index is equal to the maximum, then the monster has D/100
chance of striking the player.



-Mickey


aP + bM + cPM + d

a(Pmin) + b(Mmin) + c(Pmin)(Mmin) + d = A/100
a(Pmin) + b(Mmax) + c(Pmin)(Mmax) + d = B/100
a(Pmax) + b(Mmin) + c(Pmax)(Mmin) + d = C/100
a(Pmax) + b(Mmax) + c(Pmax)(Mmax) + d = D/100

Solve for a, b, c, and d.

Bill

Bill,

The problem I have is that every time I want to tweak the results I have
to solve for a, b, c, d, which with my math skills, takes a while. Is it
possible to derive a single formula where I can input the dexterity,
monster index and attributes to compute the result? It may not be
possible, but I though I would ask. I spent all day yesterday solving
for a,b,c,d for one result! I am currently having great difficulty
solving for a, b, c, d for the following attributes:

m=1, p=10, result=25
m=1, p=100, result=0
m=28, p=10, result=100
m=28, p=100, result=50


Thank you.

-Mickey


Yeah. As I said above, just solve the four equations for a, b, c, and
d.

It's one of the powers of algebra that you can solve the four
equations once for all sets of values you might want to substitute for
the variables. Rather than substitute for the variables and then
solve the equations, solve the equations before you substitute for the
variables.

1: a(Pmin) + b(Mmin) + c(Pmin)(Mmin) + d = A/100
2: a(Pmin) + b(Mmax) + c(Pmin)(Mmax) + d = B/100
3: a(Pmax) + b(Mmin) + c(Pmax)(Mmin) + d = C/100
4: a(Pmax) + b(Mmax) + c(Pmax)(Mmax) + d = D/100

[#2 - #1]
5: b(Mmax - Mmin) + c(Pmin)(Mmax - Mmin) = (B - A)/100
[#4 - #3]
6: b(Mmax - Mmin) + c(Pmax)(Mmax - Mmin) = (D - C)/100

[#6 - #5]
7: c(Pmax - Pmin)(Mmax - Mmin) = (D - C - B + A)/100

[solve 7 for c]
8: c = (D - C - B + A)/100(Pmax - Pmin)(Mmax - Mmin)

Let's name the denominator E

E = 100(Pmax - Pmin)(Mmax - Mmin)

so c = (D - C - B + A)/E

[substitute for c in 6 and solve for b]
9: b(Mmax - Mmin) + c(Pmax)(Mmax - Mmin) = (D - C)/100

b(Mmax - Mmin) = (D - C)/100 - c(Pmax)(Mmax - Mmin)

100b(Mmax - Mmin) = (D - C) - 100c(Pmax)(Mmax - Mmin)

100b(Mmax - Mmin) = (D - C) - 100(D - C - B + A)(Pmax)(Mmax - Mmin)/E

b = (D - C)/100(Mmax - Mmin) - (D - C - B + A)(Pmax)/E

b = (D - C)(Pmax - Pmin)/E - (D - C - B + A)(Pmax)/E

b = [(D - C)(Pmax - Pmin) - (D - C - B + A)(Pmax)]/E

b = [(D - C)(Pmax - Pmin) - (D - C)(Pmax) + (B - A)(Pmax)]/E

b = [(D - C)(- Pmin) + (B - A)(Pmax)]/E

b = [(B - A)(Pmax) - (D - C)(Pmin)]/E

[#3 - #1]
10: a(Pmax - Pmin) + c(Mmin)(Pmax - Pmin) = (C - A)/100

[Substitute for c in 10 and solve for a]
10: a(Pmax - Pmin) = (C - A)/100 - c(Mmin)(Pmax - Pmin)

a = (C - A)/100(Pmax - Pmin) - c(Mmin)

a = (C - A)(Mmax - Mmin)/E - (D - C - B + A)(Mmin)/E

a = [(C - A)(Mmax - Mmin) - (D - C - B + A)(Mmin)]/E

a = [(C - A)(Mmax - Mmin) - (D - B)(Mmin) + (C - A)(Mmin)]/E

a = [(C - A)(Mmax) - (D - B)(Mmin)]/E

[Substitute for a, b, and c in #1, solve for d]

d = A/100 - a(Pmin) - b(Mmin) - c(Pmin)(Mmin)

d = A(Pmax - Pmin)(Mmax - Mmin)/E
- (Pmin)[(C - A)(Mmax) - (D - B)(Mmin)]/E
- (Mmin)[(B - A)(Pmax) - (D - C)(Pmin)]/E
- (Pmin)(Mmin)(D - C - B + A)/E

dE = A[(Pmax)(Mmax) - (Pmin)(Mmax) - (Pmax)(Mmin) + (Pmin)(Mmin)]
- (C - A)(Pmin)(Mmax) + (D - B)(Pmin)(Mmin)
- (B - A)(Pmax)(Mmin) + (D - C)(Pmin)(Mmin)
- (Pmin)(Mmin)(D - C - B + A)

dE = A[(Pmax)(Mmax) - (Pmin)(Mmax) - (Pmax)(Mmin) + (Pmin)(Mmin)
+ (Pmin)(Mmax) + (Pmax)(Mmin) - (Pmin)(Mmin)] +
B[-(Pmin)(Mmin) - (Pmax)(Mmin) + (Pmin)(Mmin)] +
C[-(Pmin)(Mmax) - (Pmin)(Mmin) + (Pmin)(Mmin)] +
D[(Pmin)(Mmin) + (Pmin)(Mmin) - (Pmin)(Mmin)]

dE = A(Pmax)(Mmax) - B(Pmax)(Mmin) - C(Pmin)(Mmax) + D(Pmin)(Mmin)

d = [A(Pmax)(Mmax) - B(Pmax)(Mmin) - C(Pmin)(Mmax) + D(Pmin)(Mmin)]/E

So assuming I haven't made any mistakes (unlikely, of course):

E = 100(Pmax - Pmin)(Mmax - Mmin)
a = [(C - A)(Mmax) - (D - B)(Mmin)]/E
b = [(B - A)(Pmax) - (D - C)(Pmin)]/E
c = (D - C - B + A)/E
d = [A(Pmax)(Mmax) - B(Pmax)(Mmin) - C(Pmin)(Mmax) + D(Pmin)(Mmin)]/E

To test the result, substitute back into the four original equations:

1:

Does a(Pmin) + b(Mmin) + c(Pmin)(Mmin) + d = A/100?

a(Pmin) + b(Mmin) + c(Pmin)(Mmin) + d
=
(Pmin)[(C - A)(Mmax) - (D - B)(Mmin)]/E +
(Mmin)[(B - A)(Pmax) - (D - C)(Pmin)]/E +
(Pmin)(Mmin)(D - C - B + A)/E +
[A(Pmax)(Mmax) - B(Pmax)(Mmin) - C(Pmin)(Mmax) + D(Pmin)(Mmin)]/E
=
{A[-(Pmin)(Mmax) - (Mmin)(Pmax) + (Pmin)(Mmin) + (Pmax)(Mmax)] +
B[(Pmin)(Mmin) + (Mmin)(Pmax) - (Pmin)(Mmin) - (Pmax)(Mmin)] +
C[(Pmin)(Mmax) + (Pmin)(Mmin) - (Pmin)(Mmin) - (Pmin)(Mmax)] +
D[-(Pmin)(Mmin) - (Pmin)(Mmin) + (Pmin)(Mmin) + (Pmin)(Mmin)]}/E
=
{A[-(Pmin)(Mmax) - (Mmin)(Pmax) + (Pmin)(Mmin) + (Pmax)(Mmax)] +
B[(Pmin)(Mmin) + (Mmin)(Pmax) - (Pmin)(Mmin) - (Pmax)(Mmin)] +
C[(Pmin)(Mmax) + (Pmin)(Mmin) - (Pmin)(Mmin) - (Pmin)(Mmax)] +
D[-(Pmin)(Mmin) - (Pmin)(Mmin) + (Pmin)(Mmin) + (Pmin)(Mmin)]}/E
=
A(Pmax - Pmin)(Mmax - Mmin)/E
=
A(Pmax - Pmin)(Mmax - Mmin)/100(Pmax - Pmin)(Mmax - Mmin)
=
A/100

Yes, it does.

2:

Does a(Pmin) + b(Mmax) + c(Pmin)(Mmax) + d = B/100

a(Pmin) + b(Mmax) + c(Pmin)(Mmax) + d
=
(Pmin)[(C - A)(Mmax) - (D - B)(Mmin)]/E +
(Mmax)[(B - A)(Pmax) - (D - C)(Pmin)]/E +
(Pmin)(Mmax)(D - C - B + A)/E +
[A(Pmax)(Mmax) - B(Pmax)(Mmin) - C(Pmin)(Mmax) + D(Pmin)(Mmin)]/E
=
{A[-(Pmin)(Mmax) - (Pmax)(Mmax) + (Pmin)(Mmax) + (Pmax)(Mmax)] +
B[(Pmin)(Mmin) + (Pmax)(Mmax) - (Pmin)(Mmax) - (Pmax)(Mmin)] +
C[(Pmin)(Mmax) + (Pmin)(Mmax) - (Pmin)(Mmax) - (Pmin)(Mmax)] +
D[-(Pmin)(Mmin) - (Pmin)(Mmax) + (Pmin)(Mmax) + (Pmin)(Mmin)]}/E
=
B[(Pmax)(Mmax) - (Pmax)(Mmin) - (Pmin)(Mmax) + (Pmin)(Mmin)]/E
=
B(Pmax - Pmin)(Mmax - Mmin)/100(Pmax - Pmin)(Mmax - Mmin)
=
B/100

Yes, this does, too. WOW!

3:
Does a(Pmax) + b(Mmin) + c(Pmax)(Mmin) + d = C/100?

a(Pmax) + b(Mmin) + c(Pmax)(Mmin) + d
=
{(Pmax)[(C - A)(Mmax) - (D - B)(Mmin)] +
(Mmin)[(B - A)(Pmax) - (D - C)(Pmin)] +
(Pmax)(Mmin)(D - C - B + A) +
[A(Pmax)(Mmax) - B(Pmax)(Mmin) - C(Pmin)(Mmax) + D(Pmin)(Mmin)]}/E
=
{A[-(Pmax)(Mmax) - (Pmax)(Mmin) + (Pmax)(Mmin) + (Pmax)(Mmax)] +
B[(Pmax)(Mmin) + (Pmax)(Mmin) - (Pmax)(Mmin) - (Pmax)(Mmin)] +
C[(Pmax)(Mmax) + (Pmin)(Mmin) - (Pmax)(Mmin) - (Pmin)(Mmax)] +
D[-(Pmax)(Mmin) - (Pmin)(Mmin) + (Pmax)(Mmin) + (Pmin)(Mmin)]}/E
=
C[(Pmax)(Mmax) + (Pmin)(Mmin) - (Pmax)(Mmin) - (Pmin)(Mmax)]/E
=
C(Pmax - Pmin)(Mmax - Mmin)/100(Pmax - Pmin)(Mmax - Mmin)
=
C/100

Three for three. I'm amazed.

4:

Does a(Pmax) + b(Mmax) + c(Pmax)(Mmax) + d = D/100?

a(Pmax) + b(Mmax) + c(Pmax)(Mmax) + d
=
{(Pmax)[(C - A)(Mmax) - (D - B)(Mmin)] +
(Mmax)[(B - A)(Pmax) - (D - C)(Pmin)] +
(Pmax)(Mmax)(D - C - B + A) +
[A(Pmax)(Mmax) - B(Pmax)(Mmin) - C(Pmin)(Mmax) + D(Pmin)(Mmin)]}/E
=
{A[-(Pmax)(Mmax) - (Pmax)(Mmax) + (Pmax)(Mmax) + (Pmax)(Mmax)] +
B[(Pmax)(Mmin) + (Pmax)(Mmax) - (Pmax)(Mmax) - (Pmax)(Mmin)] +
C[(Pmax)(Mmax) + (Pmin)(Mmax) - (Pmax)(Mmax) - (Pmin)(Mmax)] +
D[-(Pmax)(Mmin) - (Pmin)(Mmax) + (Pmax)(Mmax) + (Pmin)(Mmin)]}/E
=
D(Pmax - Pmin)(Mmax - Mmin)/100(Pmax - Pmin)(Mmax - Mmin)
=
D/100

Whoopie! It checks out.

So the result is:

E = 100(Pmax - Pmin)(Mmax - Mmin)
a = [(C - A)(Mmax) - (D - B)(Mmin)]/E
b = [(B - A)(Pmax) - (D - C)(Pmin)]/E
c = (D - C - B + A)/E
d = [A(Pmax)(Mmax) - B(Pmax)(Mmin) - C(Pmin)(Mmax) + D(Pmin)(Mmin)]/E

Note that Pmax cannot equal Pmin and Mmax cannot equal Mmin.

How much was it that you offered for the solution?

Bill

Swap first and last parts of username and ISP for address.
Back to top
Bill McCray
science forum beginner


Joined: 18 May 2005
Posts: 44

PostPosted: Tue May 24, 2005 9:22 pm    Post subject: Re: Game formulas Reply with quote

On Tue, 24 May 2005 14:37:02 -0400, Mickey
<REMOVETHISTEXT.portillas@hotmail.com> wrote:

Quote:

Bill McCray wrote:
On Mon, 23 May 2005 19:02:54 -0400, Mickey
REMOVETHISTEXT.portillas@hotmail.com> wrote:


Bill,

I need something more flexible than your previous solution. I need to be
able to tweak the game play by changing the percentages. Something more
along the lines of the following. I welcome everyones input.


Given a monster type range, a player dexterity range and four
percentages A,B,C,D.

If the monster type index is equal to the minimum and the player
dexterity index is equal to the minimum, then the monster has A/100
chance of striking the player.

If the monster type index is equal to the maximum and the player
dexterity index is equal to the minimum, then the monster has B/100
chance of striking the player.

If the monster type index is equal to the minimum and the player
dexterity index is equal to the maximum, then the monster has C/100
chance of striking the player.

If the monster type index is equal to the maximum and the player
dexterity index is equal to the maximum, then the monster has D/100
chance of striking the player.



-Mickey


aP + bM + cPM + d

a(Pmin) + b(Mmin) + c(Pmin)(Mmin) + d = A/100
a(Pmin) + b(Mmax) + c(Pmin)(Mmax) + d = B/100
a(Pmax) + b(Mmin) + c(Pmax)(Mmin) + d = C/100
a(Pmax) + b(Mmax) + c(Pmax)(Mmax) + d = D/100

Solve for a, b, c, and d.

Bill

Bill,

The problem I have is that every time I want to tweak the results I have
to solve for a, b, c, d, which with my math skills, takes a while. Is it
possible to derive a single formula where I can input the dexterity,
monster index and attributes to compute the result? It may not be
possible, but I though I would ask. I spent all day yesterday solving
for a,b,c,d for one result! I am currently having great difficulty
solving for a, b, c, d for the following attributes:

m=1, p=10, result=25
m=1, p=100, result=0
m=28, p=10, result=100
m=28, p=100, result=50


Thank you.

-Mickey

Yeah. As I said above, just solve the four equations for a, b, c, and
d.

It's one of the powers of algebra that you can solve the four
equations once for all sets of values you might want to substitute for
the variables. Rather than substitute for the variables and then
solve the equations, solve the equations before you substitute for the
variables.

1: a(Pmin) + b(Mmin) + c(Pmin)(Mmin) + d = A/100
2: a(Pmin) + b(Mmax) + c(Pmin)(Mmax) + d = B/100
3: a(Pmax) + b(Mmin) + c(Pmax)(Mmin) + d = C/100
4: a(Pmax) + b(Mmax) + c(Pmax)(Mmax) + d = D/100

[#2 - #1]
5: b(Mmax - Mmin) + c(Pmin)(Mmax - Mmin) = (B - A)/100
[#4 - #3]
6: b(Mmax - Mmin) + c(Pmax)(Mmax - Mmin) = (D - C)/100

[#6 - #5]
7: c(Pmax - Pmin)(Mmax - Mmin) = (D - C - B + A)/100

[solve 7 for c]
8: c = (D - C - B + A)/100(Pmax - Pmin)(Mmax - Mmin)

Let's name the denominator E

E = 100(Pmax - Pmin)(Mmax - Mmin)

so c = (D - C - B + A)/E

[substitute for c in 6 and solve for b]
9: b(Mmax - Mmin) + c(Pmax)(Mmax - Mmin) = (D - C)/100

b(Mmax - Mmin) = (D - C)/100 - c(Pmax)(Mmax - Mmin)

100b(Mmax - Mmin) = (D - C) - 100c(Pmax)(Mmax - Mmin)

100b(Mmax - Mmin) = (D - C) - 100(D - C - B + A)(Pmax)(Mmax - Mmin)/E

b = (D - C)/100(Mmax - Mmin) - (D - C - B + A)(Pmax)/E

b = (D - C)(Pmax - Pmin)/E - (D - C - B + A)(Pmax)/E

b = [(D - C)(Pmax - Pmin) - (D - C - B + A)(Pmax)]/E

b = [(D - C)(Pmax - Pmin) - (D - C)(Pmax) + (B - A)(Pmax)]/E

b = [(D - C)(- Pmin) + (B - A)(Pmax)]/E

b = [(B - A)(Pmax) - (D - C)(Pmin)]/E

[#3 - #1]
10: a(Pmax - Pmin) + c(Mmin)(Pmax - Pmin) = (C - A)/100

[Substitute for c in 10 and solve for a]
10: a(Pmax - Pmin) = (C - A)/100 - c(Mmin)(Pmax - Pmin)

a = (C - A)/100(Pmax - Pmin) - c(Mmin)

a = (C - A)(Mmax - Mmin)/E - (D - C - B + A)(Mmin)/E

a = [(C - A)(Mmax - Mmin) - (D - C - B + A)(Mmin)]/E

a = [(C - A)(Mmax - Mmin) - (D - B)(Mmin) + (C - A)(Mmin)]/E

a = [(C - A)(Mmax) - (D - B)(Mmin)]/E

[Substitute for a, b, and c in #1, solve for d]

d = A/100 - a(Pmin) - b(Mmin) - c(Pmin)(Mmin)

d = A(Pmax - Pmin)(Mmax - Mmin)/E
- (Pmin)[(C - A)(Mmax) - (D - B)(Mmin)]/E
- (Mmin)[(B - A)(Pmax) - (D - C)(Pmin)]/E
- (Pmin)(Mmin)(D - C - B + A)/E

dE = A[(Pmax)(Mmax) - (Pmin)(Mmax) - (Pmax)(Mmin) + (Pmin)(Mmin)]
- (C - A)(Pmin)(Mmax) + (D - B)(Pmin)(Mmin)
- (B - A)(Pmax)(Mmin) + (D - C)(Pmin)(Mmin)
- (Pmin)(Mmin)(D - C - B + A)

dE = A[(Pmax)(Mmax) - (Pmin)(Mmax) - (Pmax)(Mmin) + (Pmin)(Mmin)
+ (Pmin)(Mmax) + (Pmax)(Mmin) - (Pmin)(Mmin)] +
B[-(Pmin)(Mmin) - (Pmax)(Mmin) + (Pmin)(Mmin)] +
C[-(Pmin)(Mmax) - (Pmin)(Mmin) + (Pmin)(Mmin)] +
D[(Pmin)(Mmin) + (Pmin)(Mmin) - (Pmin)(Mmin)]

dE = A(Pmax)(Mmax) - B(Pmax)(Mmin) - C(Pmin)(Mmax) + D(Pmin)(Mmin)

d = [A(Pmax)(Mmax) - B(Pmax)(Mmin) - C(Pmin)(Mmax) + D(Pmin)(Mmin)]/E

So assuming I haven't made any mistakes (unlikely, of course):

E = 100(Pmax - Pmin)(Mmax - Mmin)
a = [(C - A)(Mmax) - (D - B)(Mmin)]/E
b = [(B - A)(Pmax) - (D - C)(Pmin)]/E
c = (D - C - B + A)/E
d = [A(Pmax)(Mmax) - B(Pmax)(Mmin) - C(Pmin)(Mmax) + D(Pmin)(Mmin)]/E

To test the result, substitute back into the four original equations:

1:

Does a(Pmin) + b(Mmin) + c(Pmin)(Mmin) + d = A/100?

a(Pmin) + b(Mmin) + c(Pmin)(Mmin) + d
=
(Pmin)[(C - A)(Mmax) - (D - B)(Mmin)]/E +
(Mmin)[(B - A)(Pmax) - (D - C)(Pmin)]/E +
(Pmin)(Mmin)(D - C - B + A)/E +
[A(Pmax)(Mmax) - B(Pmax)(Mmin) - C(Pmin)(Mmax) + D(Pmin)(Mmin)]/E
=
{A[-(Pmin)(Mmax) - (Mmin)(Pmax) + (Pmin)(Mmin) + (Pmax)(Mmax)] +
B[(Pmin)(Mmin) + (Mmin)(Pmax) - (Pmin)(Mmin) - (Pmax)(Mmin)] +
C[(Pmin)(Mmax) + (Pmin)(Mmin) - (Pmin)(Mmin) - (Pmin)(Mmax)] +
D[-(Pmin)(Mmin) - (Pmin)(Mmin) + (Pmin)(Mmin) + (Pmin)(Mmin)]}/E
=
{A[-(Pmin)(Mmax) - (Mmin)(Pmax) + (Pmin)(Mmin) + (Pmax)(Mmax)] +
B[(Pmin)(Mmin) + (Mmin)(Pmax) - (Pmin)(Mmin) - (Pmax)(Mmin)] +
C[(Pmin)(Mmax) + (Pmin)(Mmin) - (Pmin)(Mmin) - (Pmin)(Mmax)] +
D[-(Pmin)(Mmin) - (Pmin)(Mmin) + (Pmin)(Mmin) + (Pmin)(Mmin)]}/E
=
A(Pmax - Pmin)(Mmax - Mmin)/E
=
A(Pmax - Pmin)(Mmax - Mmin)/100(Pmax - Pmin)(Mmax - Mmin)
=
A/100

Yes, it does.

2:

Does a(Pmin) + b(Mmax) + c(Pmin)(Mmax) + d = B/100

a(Pmin) + b(Mmax) + c(Pmin)(Mmax) + d
=
(Pmin)[(C - A)(Mmax) - (D - B)(Mmin)]/E +
(Mmax)[(B - A)(Pmax) - (D - C)(Pmin)]/E +
(Pmin)(Mmax)(D - C - B + A)/E +
[A(Pmax)(Mmax) - B(Pmax)(Mmin) - C(Pmin)(Mmax) + D(Pmin)(Mmin)]/E
=
{A[-(Pmin)(Mmax) - (Pmax)(Mmax) + (Pmin)(Mmax) + (Pmax)(Mmax)] +
B[(Pmin)(Mmin) + (Pmax)(Mmax) - (Pmin)(Mmax) - (Pmax)(Mmin)] +
C[(Pmin)(Mmax) + (Pmin)(Mmax) - (Pmin)(Mmax) - (Pmin)(Mmax)] +
D[-(Pmin)(Mmin) - (Pmin)(Mmax) + (Pmin)(Mmax) + (Pmin)(Mmin)]}/E
=
B[(Pmax)(Mmax) - (Pmax)(Mmin) - (Pmin)(Mmax) + (Pmin)(Mmin)]/E
=
B(Pmax - Pmin)(Mmax - Mmin)/100(Pmax - Pmin)(Mmax - Mmin)
=
B/100

Yes, this does, too. WOW!

3:
Does a(Pmax) + b(Mmin) + c(Pmax)(Mmin) + d = C/100?

a(Pmax) + b(Mmin) + c(Pmax)(Mmin) + d
=
{(Pmax)[(C - A)(Mmax) - (D - B)(Mmin)] +
(Mmin)[(B - A)(Pmax) - (D - C)(Pmin)] +
(Pmax)(Mmin)(D - C - B + A) +
[A(Pmax)(Mmax) - B(Pmax)(Mmin) - C(Pmin)(Mmax) + D(Pmin)(Mmin)]}/E
=
{A[-(Pmax)(Mmax) - (Pmax)(Mmin) + (Pmax)(Mmin) + (Pmax)(Mmax)] +
B[(Pmax)(Mmin) + (Pmax)(Mmin) - (Pmax)(Mmin) - (Pmax)(Mmin)] +
C[(Pmax)(Mmax) + (Pmin)(Mmin) - (Pmax)(Mmin) - (Pmin)(Mmax)] +
D[-(Pmax)(Mmin) - (Pmin)(Mmin) + (Pmax)(Mmin) + (Pmin)(Mmin)]}/E
=
C[(Pmax)(Mmax) + (Pmin)(Mmin) - (Pmax)(Mmin) - (Pmin)(Mmax)]/E
=
C(Pmax - Pmin)(Mmax - Mmin)/100(Pmax - Pmin)(Mmax - Mmin)
=
C/100

Three for three. I'm amazed.

4:

Does a(Pmax) + b(Mmax) + c(Pmax)(Mmax) + d = D/100?

a(Pmax) + b(Mmax) + c(Pmax)(Mmax) + d
=
{(Pmax)[(C - A)(Mmax) - (D - B)(Mmin)] +
(Mmax)[(B - A)(Pmax) - (D - C)(Pmin)] +
(Pmax)(Mmax)(D - C - B + A) +
[A(Pmax)(Mmax) - B(Pmax)(Mmin) - C(Pmin)(Mmax) + D(Pmin)(Mmin)]}/E
=
{A[-(Pmax)(Mmax) - (Pmax)(Mmax) + (Pmax)(Mmax) + (Pmax)(Mmax)] +
B[(Pmax)(Mmin) + (Pmax)(Mmax) - (Pmax)(Mmax) - (Pmax)(Mmin)] +
C[(Pmax)(Mmax) + (Pmin)(Mmax) - (Pmax)(Mmax) - (Pmin)(Mmax)] +
D[-(Pmax)(Mmin) - (Pmin)(Mmax) + (Pmax)(Mmax) + (Pmin)(Mmin)]}/E
=
D(Pmax - Pmin)(Mmax - Mmin)/100(Pmax - Pmin)(Mmax - Mmin)
=
D/100

Whoopie! It checks out.

So the result is:

E = 100(Pmax - Pmin)(Mmax - Mmin)
a = [(C - A)(Mmax) - (D - B)(Mmin)]/E
b = [(B - A)(Pmax) - (D - C)(Pmin)]/E
c = (D - C - B + A)/E
d = [A(Pmax)(Mmax) - B(Pmax)(Mmin) - C(Pmin)(Mmax) + D(Pmin)(Mmin)]/E

Note that Pmax cannot equal Pmin and Mmax cannot equal Mmin.

How much was it that you offered for the solution?

Bill

Swap first and last parts of username and ISP for address.
Back to top
Mickey
science forum beginner


Joined: 18 May 2005
Posts: 14

PostPosted: Tue May 24, 2005 4:37 pm    Post subject: Re: Game formulas Reply with quote

Bill,

The problem I have is that every time I want to tweak the results I have
to solve for a, b, c, d, which with my math skills, takes a while. Is it
possible to derive a single formula where I can input the dexterity,
monster index and attributes to compute the result? It may not be
possible, but I though I would ask. I spent all day yesterday solving
for a,b,c,d for one result! I am currently having great difficulty
solving for a, b, c, d for the following attributes:

m=1, p=10, result=25
m=1, p=100, result=0
m=28, p=10, result=100
m=28, p=100, result=50


Thank you.

-Mickey




Bill McCray wrote:
Quote:
On Mon, 23 May 2005 19:02:54 -0400, Mickey
REMOVETHISTEXT.portillas@hotmail.com> wrote:


Bill,

I need something more flexible than your previous solution. I need to be
able to tweak the game play by changing the percentages. Something more
along the lines of the following. I welcome everyones input.


Given a monster type range, a player dexterity range and four
percentages A,B,C,D.

If the monster type index is equal to the minimum and the player
dexterity index is equal to the minimum, then the monster has A/100
chance of striking the player.

If the monster type index is equal to the maximum and the player
dexterity index is equal to the minimum, then the monster has B/100
chance of striking the player.

If the monster type index is equal to the minimum and the player
dexterity index is equal to the maximum, then the monster has C/100
chance of striking the player.

If the monster type index is equal to the maximum and the player
dexterity index is equal to the maximum, then the monster has D/100
chance of striking the player.



-Mickey


aP + bM + cPM + d

a(Pmin) + b(Mmin) + c(Pmin)(Mmin) + d = A/100
a(Pmin) + b(Mmax) + c(Pmin)(Mmax) + d = B/100
a(Pmax) + b(Mmin) + c(Pmax)(Mmin) + d = C/100
a(Pmax) + b(Mmax) + c(Pmax)(Mmax) + d = D/100

Solve for a, b, c, and d.

Bill

Swap first and last parts of username and ISP for address.
Back to top
Bill McCray
science forum beginner


Joined: 18 May 2005
Posts: 44

PostPosted: Tue May 24, 2005 12:02 am    Post subject: Re: Game formulas Reply with quote

On Mon, 23 May 2005 19:02:54 -0400, Mickey
<REMOVETHISTEXT.portillas@hotmail.com> wrote:

Quote:

Bill,

I need something more flexible than your previous solution. I need to be
able to tweak the game play by changing the percentages. Something more
along the lines of the following. I welcome everyones input.


Given a monster type range, a player dexterity range and four
percentages A,B,C,D.

If the monster type index is equal to the minimum and the player
dexterity index is equal to the minimum, then the monster has A/100
chance of striking the player.

If the monster type index is equal to the maximum and the player
dexterity index is equal to the minimum, then the monster has B/100
chance of striking the player.

If the monster type index is equal to the minimum and the player
dexterity index is equal to the maximum, then the monster has C/100
chance of striking the player.

If the monster type index is equal to the maximum and the player
dexterity index is equal to the maximum, then the monster has D/100
chance of striking the player.



-Mickey

aP + bM + cPM + d

a(Pmin) + b(Mmin) + c(Pmin)(Mmin) + d = A/100
a(Pmin) + b(Mmax) + c(Pmin)(Mmax) + d = B/100
a(Pmax) + b(Mmin) + c(Pmax)(Mmin) + d = C/100
a(Pmax) + b(Mmax) + c(Pmax)(Mmax) + d = D/100

Solve for a, b, c, and d.

Bill

Swap first and last parts of username and ISP for address.
Back to top
Mickey
science forum beginner


Joined: 18 May 2005
Posts: 14

PostPosted: Mon May 23, 2005 9:02 pm    Post subject: Game formulas Reply with quote

Bill,

I need something more flexible than your previous solution. I need to be
able to tweak the game play by changing the percentages. Something more
along the lines of the following. I welcome everyones input.


Given a monster type range, a player dexterity range and four
percentages A,B,C,D.

If the monster type index is equal to the minimum and the player
dexterity index is equal to the minimum, then the monster has A/100
chance of striking the player.

If the monster type index is equal to the maximum and the player
dexterity index is equal to the minimum, then the monster has B/100
chance of striking the player.

If the monster type index is equal to the minimum and the player
dexterity index is equal to the maximum, then the monster has C/100
chance of striking the player.

If the monster type index is equal to the maximum and the player
dexterity index is equal to the maximum, then the monster has D/100
chance of striking the player.



-Mickey
Back to top
Mickey
science forum beginner


Joined: 18 May 2005
Posts: 14

PostPosted: Thu May 19, 2005 5:15 pm    Post subject: Re: thanks to all Reply with quote

correction, I meant in solving for d :)



Mickey wrote:
Quote:
I had noticed the player - dexterity swap error and also the error I had
in the calculation for c. I now see where I went wrong in calculating b,
forget to multiply by 10. Thanks very much Bill, your breakdown of
everything made it clear. Thanks to everyone who replied.


-Mickey



Bill McCray wrote:

On Thu, 19 May 2005 11:11:47 -0400, Mickey
REMOVETHISTEXT.portillas@hotmail.com> wrote:


Bill,

I tried the following, but my results are skewed by -5. Where did I
go wrong?

If the monster type is equal to 1 and the player dexterity is equal
to 10, then the monster has a 50% chance of striking the player.

If the monster type is equal to 28 and the player dexterity is equal
to 10, then the monster has a 100% chance of striking the player.

If the monster type is equal to 1 and the player dexterity is equal
to 100, then the monster has a 0% chance of striking the player.

If the monster type is equal to 28 and the player dexterity is equal
to 100, then the monster has a 50% chance of striking the player.


aP + bM + cPM + d



First thing is that you've put the player's dexterity in the monster
variable and the monster type in the player's variable, so let's
change the formula to aM + bP + cPM + d to match what you have below.


a + 10b + 10c + d = 50
28a + 10b + 280c + d = 100
a + 100b + 100c + d = 0
28a + 100b + 2800c + d = 50

27a + 270c = 50
27a + 2600c = 50

2330c = 0
c = 0

27a = 50
a = 50/27



Okay so far.


50/27 + 10b + d = 50
50/27 + 100b + d = 0

-90b = 50
b = -5/9

50/27 - 15/27 + d = 50



Here you should be substituting a and b into

a + 10b + d = 50

which you give you

50/27 - 150/27 + d = 50

Solving this for d gives

d - 100/27 = 50
d = 50 + 100/27
d = (1350 + 100)/27
d = 1450/27


35/27 + d = 50
d = 1350/27 - 35/27
d = 1315/27

(50/27)P - (15/27)M + 1315/27 =
(50P - 15M + 1315)/27 =



(50M - 15P + 1450)/27



-Mickey



Bill

Swap first and last parts of username and ISP for address.
Back to top
Mickey
science forum beginner


Joined: 18 May 2005
Posts: 14

PostPosted: Thu May 19, 2005 5:13 pm    Post subject: thanks to all Reply with quote

I had noticed the player - dexterity swap error and also the error I had
in the calculation for c. I now see where I went wrong in calculating b,
forget to multiply by 10. Thanks very much Bill, your breakdown of
everything made it clear. Thanks to everyone who replied.


-Mickey



Bill McCray wrote:
Quote:
On Thu, 19 May 2005 11:11:47 -0400, Mickey
REMOVETHISTEXT.portillas@hotmail.com> wrote:


Bill,

I tried the following, but my results are skewed by -5. Where did I go
wrong?

If the monster type is equal to 1 and the player dexterity is equal to
10, then the monster has a 50% chance of striking the player.

If the monster type is equal to 28 and the player dexterity is equal to
10, then the monster has a 100% chance of striking the player.

If the monster type is equal to 1 and the player dexterity is equal to
100, then the monster has a 0% chance of striking the player.

If the monster type is equal to 28 and the player dexterity is equal to
100, then the monster has a 50% chance of striking the player.


aP + bM + cPM + d


First thing is that you've put the player's dexterity in the monster
variable and the monster type in the player's variable, so let's
change the formula to aM + bP + cPM + d to match what you have below.


a + 10b + 10c + d = 50
28a + 10b + 280c + d = 100
a + 100b + 100c + d = 0
28a + 100b + 2800c + d = 50

27a + 270c = 50
27a + 2600c = 50

2330c = 0
c = 0

27a = 50
a = 50/27


Okay so far.


50/27 + 10b + d = 50
50/27 + 100b + d = 0

-90b = 50
b = -5/9

50/27 - 15/27 + d = 50


Here you should be substituting a and b into

a + 10b + d = 50

which you give you

50/27 - 150/27 + d = 50

Solving this for d gives

d - 100/27 = 50
d = 50 + 100/27
d = (1350 + 100)/27
d = 1450/27


35/27 + d = 50
d = 1350/27 - 35/27
d = 1315/27

(50/27)P - (15/27)M + 1315/27 =
(50P - 15M + 1315)/27 =


(50M - 15P + 1450)/27



-Mickey


Bill

Swap first and last parts of username and ISP for address.
Back to top
Bill McCray
science forum beginner


Joined: 18 May 2005
Posts: 44

PostPosted: Thu May 19, 2005 4:54 pm    Post subject: Re: Please help me! Reply with quote

On Thu, 19 May 2005 11:11:47 -0400, Mickey
<REMOVETHISTEXT.portillas@hotmail.com> wrote:

Quote:

Bill,

I tried the following, but my results are skewed by -5. Where did I go
wrong?

If the monster type is equal to 1 and the player dexterity is equal to
10, then the monster has a 50% chance of striking the player.

If the monster type is equal to 28 and the player dexterity is equal to
10, then the monster has a 100% chance of striking the player.

If the monster type is equal to 1 and the player dexterity is equal to
100, then the monster has a 0% chance of striking the player.

If the monster type is equal to 28 and the player dexterity is equal to
100, then the monster has a 50% chance of striking the player.


aP + bM + cPM + d

First thing is that you've put the player's dexterity in the monster
variable and the monster type in the player's variable, so let's
change the formula to aM + bP + cPM + d to match what you have below.

Quote:
a + 10b + 10c + d = 50
28a + 10b + 280c + d = 100
a + 100b + 100c + d = 0
28a + 100b + 2800c + d = 50

27a + 270c = 50
27a + 2600c = 50

2330c = 0
c = 0

27a = 50
a = 50/27

Okay so far.

Quote:
50/27 + 10b + d = 50
50/27 + 100b + d = 0

-90b = 50
b = -5/9

50/27 - 15/27 + d = 50

Here you should be substituting a and b into

a + 10b + d = 50

which you give you

50/27 - 150/27 + d = 50

Solving this for d gives

d - 100/27 = 50
d = 50 + 100/27
d = (1350 + 100)/27
d = 1450/27

Quote:
35/27 + d = 50
d = 1350/27 - 35/27
d = 1315/27

(50/27)P - (15/27)M + 1315/27 =
(50P - 15M + 1315)/27 =

(50M - 15P + 1450)/27

Quote:


-Mickey

Bill

Swap first and last parts of username and ISP for address.
Back to top
John Bailey
science forum addict


Joined: 05 May 2005
Posts: 72

PostPosted: Thu May 19, 2005 4:39 pm    Post subject: Re: Please help me! Reply with quote

On Wed, 18 May 2005 18:43:39 -0400, Mickey > wrote:

Quote:
In my game I have 28 different monster types. I have arranged them so
that monster number one is the weakest and monster 28 is the most
powerful. The player begins with a dexterity attribute of 10 and can
obtain a maximum of 100. I need a formula that determines whether or not
a player strikes a monster when they attack one. I would like the
formula to work with the following rules:

If the player dexterity is equal to 10 and the monster type is equal to
1, then the chances of striking the monster should be 50%

If player dexterity is equal to 100 and monster type is equal to 1, then
the chances of striking the monster should be 100%

If player dexterity is equal to 10 and monster type is equal to 28, then
the chances of striking the monster should be 0%

If player dexterity is equal to 100 and monster type is equal to 28,
then the chances of striking the monster should be 50%

Not trying to be a WA, but I sought an answer that did not require 4
simultaneous equations. I think it allows reuse of the relations in
other situations.

If we invent two intermediate variables, call them q and r.

We can write a payoff equation directly from knowing the payoffs at
the four points you gave:

P = 0(1-q)(1-r)+50(1-q)r+50q(1-r)+100qr

Now make q= (d-10)/90 and r=(m-1)/27 where d is the dexterity of the
player and m is the strength of the monster. This just converts the
dexterity and strength values to values between 0 and 1.

Thats it!
Checking these results:
q has value 0 if d=10, q has value 1 if d=100
r has value 0 if m=1, r has value 1 if m=28

P has value 100 if both q and r are 1 (m=28,d=100)
P has value 50 if only 1 of q and r are 1, the other 0
P has value 0 if both q and r are 0 (m=1,d=10)

Obviously some algebra might reduce the number of terms in the
equation, but for a computer program, these steps may be as logical
and simple as anything.

The visualization concept that supports this view is treating the
Payoff as the payoff surface for a 2 player, zero sum game.
To see it go to http://tinyurl.com/96x6j



John Bailey
http://home.rochester.rr.com/jbxroads/mailto.html
Back to top
Mickey
science forum beginner


Joined: 18 May 2005
Posts: 14

PostPosted: Thu May 19, 2005 1:36 pm    Post subject: Re: Please help me! Reply with quote

I found one error, but it doesn't fix the result...

27a + 2600c = 50

2330c = 0

should be:

27a + 2700c = 50

2430c = 0


-Mickey
Back to top
Mickey
science forum beginner


Joined: 18 May 2005
Posts: 14

PostPosted: Thu May 19, 2005 1:11 pm    Post subject: Re: Please help me! Reply with quote

Bill,

I tried the following, but my results are skewed by -5. Where did I go
wrong?

If the monster type is equal to 1 and the player dexterity is equal to
10, then the monster has a 50% chance of striking the player.

If the monster type is equal to 28 and the player dexterity is equal to
10, then the monster has a 100% chance of striking the player.

If the monster type is equal to 1 and the player dexterity is equal to
100, then the monster has a 0% chance of striking the player.

If the monster type is equal to 28 and the player dexterity is equal to
100, then the monster has a 50% chance of striking the player.


aP + bM + cPM + d

a + 10b + 10c + d = 50
28a + 10b + 280c + d = 100
a + 100b + 100c + d = 0
28a + 100b + 2800c + d = 50

27a + 270c = 50
27a + 2600c = 50

2330c = 0
c = 0

27a = 50
a = 50/27

50/27 + 10b + d = 50
50/27 + 100b + d = 0

-90b = 50
b = -5/9

50/27 - 15/27 + d = 50
35/27 + d = 50
d = 1350/27 - 35/27
d = 1315/27

(50/27)P - (15/27)M + 1315/27 =
(50P - 15M + 1315)/27 =


-Mickey
Back to top
T Rig
science forum beginner


Joined: 06 May 2005
Posts: 13

PostPosted: Thu May 19, 2005 4:20 am    Post subject: Re: Please help me! Reply with quote

I recently implemented a parabolic curve fit including 3x3 matrix
elimination so I'll try a curve fit:

Level 10

Quote:
C = 50 - ((50*Monster) / 2Cool ...with a little error near monster type 1 .


For an x,y of 1,50 , 14,25 , 28,0 that's

y = 50.90551 - 1.65062*x - 0.00687*x^2 .


Level 100

Quote:
C = 100 - ((50*Monster) / 2Cool ...with a little error near monster type 1 .


For an x,y of 1,100 , 14,75 , 28,50 that's

y = 100.90551 - 1.650662*x - 0.00687*x^2 .
Back to top
Mike1
science forum Guru


Joined: 11 May 2005
Posts: 543

PostPosted: Thu May 19, 2005 12:16 am    Post subject: Re: Please help me! Reply with quote

In article <pJSdnfUt7MmHWBbfRVn-jg@speakeasy.net>,
REMOVETHISTEXT.portillas@hotmail.com says...
Quote:

Thank you very much, Bill, that is exactly what I was looking for and it
works GREAT! Could you please help me derive a similar formula for the
monster hitting the player?

Thanks again, I appreciate your help.

-Mickey

....(with snipping)..
Since you've given four data points, I included a term with the
product of the Play and Monster values. It turns out to vanish. The
percent value is given by:

Strike% = aP + bM + cPM + d

c = 0
a = 5/9
b = -50/27
d = 1250/27

....and you may want to add a check to ensure that Strike%
doesn't fall below zero if the player drops below 10.For
example:

% = Max(0,Strike%)

Mike
Back to top
Bill McCray
science forum beginner


Joined: 18 May 2005
Posts: 44

PostPosted: Wed May 18, 2005 10:34 pm    Post subject: Re: Please help me! Reply with quote

On Wed, 18 May 2005 18:43:39 -0400, Mickey
<REMOVETHISTEXT.portillas@hotmail.com> wrote:

Quote:

Thank you very much, Bill, that is exactly what I was looking for and it
works GREAT!

I'm happy that I could help.

Quote:
Could you please help me derive a similar formula for the monster hitting
the player?

You'll have to specify the attributes you want in it.

Quote:
Thanks again, I appreciate your help.

-Mickey

Bill McCray wrote:
On Wed, 18 May 2005 16:22:40 -0400, Mickey
REMOVETHISTEXT.portillas@hotmail.com> wrote:


I am creating a simple adventure game and I need help with some math
formulas. I would truly appreciate any help.

In my game I have 28 different monster types. I have arranged them so
that monster number one is the weakest and monster 28 is the most
powerful. The player begins with a dexterity attribute of 10 and can
obtain a maximum of 100. I need a formula that determines whether or not
a player strikes a monster when they attack one. I would like the
formula to work with the following rules:

If the player dexterity is equal to 10 and the monster type is equal to
1, then the chances of striking the monster should be 50%

If player dexterity is equal to 100 and monster type is equal to 1, then
the chances of striking the monster should be 100%

If player dexterity is equal to 10 and monster type is equal to 28, then
the chances of striking the monster should be 0%

If player dexterity is equal to 100 and monster type is equal to 28,
then the chances of striking the monster should be 50%

Using the above data, I also need a formula to fairly determine whether
or not a monster strikes the player when they attack him.


Since you've given four data points, I included a term with the
product of the Play and Monster values. It turns out to vanish. The
percent value is given by:

aP + bM + cPM + d

10a + b + 10c + d = 50
100a + b + 100c + d = 100
10a + 28b + 280c + d = 0
100a + 28b + 2800c + d = 50

90a + 90c = 50
90a + 2520c = 50

2430c = 0
c = 0

90a = 50
a = 5/9

50/9 + b + d = 50
50/9 + 28b + d = 0

-27b = 50
b = -50/27

150/27 - 50/27 + d = 50
100/27 + d = 50
d = 1350/27 - 100/27
d = 1250/27

(15/27)P - (50/27)M + 1250/27 =
(15P - 50M + 1250)/27 =

Checking:

P 10 100
15P 150 1500
M 1 28
50M 50 1400

P= 10, M= 1 (150 - 50 + 1250)/27 = 1350/27 = 50
P=100, M= 1 (1500 - 50 + 1250)/27 = 2700/27 = 100
P= 10, M=28 (150 - 1400 + 1250)/27 = 0/27 = 0
P=100, M=28 (1500 - 1400 + 1250)/27 = 1350/27 = 50

Bill

Swap first and last parts of username and ISP for address.

Swap first and last parts of username and ISP for address.
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 2 [22 Posts] Goto page:  1, 2 Next
View previous topic :: View next topic
The time now is Fri Nov 24, 2017 9:17 am | All times are GMT
Forum index » Science and Technology » Math » Recreational
Jump to:  


Copyright © 2004-2005 DeniX Solutions SRL
Other DeniX Solutions sites: Electronics forum |  Medicine forum |  Unix/Linux blog |  Unix/Linux documentation |  Unix/Linux forums  |  send newsletters
 


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1172s ][ Queries: 11 (0.0812s) ][ GZIP on - Debug on ]