OT Sortof: PHP


Alpha Release 3 General Discussion

Shadow Lodge

So this is on topic, you just don't know it yet.

A cookie for anyone who can figure out what this is:
$b=round(abs(($a-10.5))/2)*abs($a-9.9)/($a-9.9)

Two cookies if you can make it shorter with a single assignment statement no ifs but "? :" is Ok. I'm probably overlooking something stupid simple.

A separate cookie for someone who can tell me how to give cookies on this board :)

-- Dennis


$b=floor(($a-10.0)/2.0) ?

Are you trying to calculate stat modifiers?

Shadow Lodge

Gah! Sometimes I'm so stupid. I kept getting either 8 as -2 or 11 as +1... grrr

2 cookies for Hogarth :)

No one going to claim the third one?


0gre wrote:
A separate cookie for someone who can tell me how to give cookies on this board :)

Easy, ask Lilith and she'll give them out for You. (Helps if You are introducing someone new to the boards.) :D


hogarth wrote:
$b=floor(($a-10.0)/2.0)

Actually, $b=floor(($a-9.9)/2) would be safer.

Shadow Lodge

hogarth wrote:
Actually, $b=floor(($a-9.9)/2) would be safer.

Hmmm, why do you think so? The original formula works find.

Laithoron: Thanks!


0gre wrote:
hogarth wrote:
Actually, $b=floor(($a-9.9)/2) would be safer.
Hmmm, why do you think so? The original formula works find.

Numerical round-off could be a problem, i.e. (12.0-10.0)/2.0 may round down to 0.0, not 1.0.

Community / Forums / Archive / Pathfinder / Playtests & Prerelease Discussions / Pathfinder Roleplaying Game / Alpha Playtest Feedback / Alpha Release 3 / General Discussion / OT Sortof: PHP All Messageboards
Recent threads in General Discussion