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 2 of 2 [22 Posts] View previous topic :: View next topic
Goto page:  Previous  1, 2
Author Message
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: 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
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: 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 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: 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: 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
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 2 of 2 [22 Posts] Goto page:  Previous  1, 2
View previous topic :: View next topic
The time now is Tue Nov 21, 2017 6:05 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.4339s ][ Queries: 11 (0.4056s) ][ GZIP on - Debug on ]