Pfft. To do a dN just treat each rolled dice as one digit of a base-6 number and roll dice based on how many digits base-6 N has. If you end up with a greater value, just reroll! It's perfect!
Some of the best coders have a touch of OCD. I know when something doesn't compile, even if it isn't correct in what it's spewing out, I will sit there for hours getting it to work. This annoys me when it's say 4:30.
not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
Yeah... I got stuck a couple hours yesterday trying to figure out why a UnhandledExceptionHandler in a service wasn't logging everything it should to the event log. I had to make myself stop because I wasting time on a tangential issue and not fixing the bug I had introduced that was causing the exception in the first place(Since I already knew why the exception was happening that wasn't triggering my OCD tendencies).
Yep, it's a pet peeve of mine because everyone just uses "OCD" as a term and incorrectly too usually.
I have OCPD tendencies too not surprisingly which are probably helpful in my work! And also why I sometimes sit working on a side project for hours until 4am etc.
IN THE ZOOOOONE MANNNN.
OCD is just a pain in the ass. It sucks having an inner dialogue that you have to constantly ignore or risk losing jobs and friends.
OCPD is what people usually mean when they say OCD. The two are actually quite distinct conditions, although the comorbidity rate is not insignificant.
(OCPD is the one closer to being more of a boon than a bane.)
I both love and hate reading about personality disorders. It's always really interesting. I have so many of them (have had some tests done by actual psychiatrists for the craziest one, not just reading symptoms myself and checking a list). They are the things that make me so socially awkward and stressed out most of the time, yet totally awesome in the right situations.
First off, rounding is not how you test for equal floating point values, you check the difference is within a small range (an epsilon).
x = 0 at 90 and 270 degrees, not just 90.
Possibly more issues dunno that was just looking quick.
I know. Thats why I noted that I had not gotten to some special cases because TDD hasn't gotten me to that point yet. I'll try working with an epsilon for my tests to see how that works out.
There's something deeper, but I can't seem to find it. 6 degrees is just over 0.1 radians - which is just far too large for rounding error using doubles.
Yeah. I am taking a look at it again now. Thus far nothing really sticks out.
First off, rounding is not how you test for equal floating point values, you check the difference is within a small range (an epsilon).
x = 0 at 90 and 270 degrees, not just 90.
Possibly more issues dunno that was just looking quick.
I know. Thats why I noted that I had not gotten to some special cases because TDD hasn't gotten me to that point yet. I'll try working with an epsilon for my tests to see how that works out.
There's something deeper, but I can't seem to find it. 6 degrees is just over 0.1 radians - which is just far too large for rounding error using doubles.
Yeah. I am taking a look at it again now. Thus far nothing really sticks out.
There are some calculations we don't even have in your code, let alone the step by step values. Can you provide for 225 case?
First off, rounding is not how you test for equal floating point values, you check the difference is within a small range (an epsilon).
x = 0 at 90 and 270 degrees, not just 90.
Possibly more issues dunno that was just looking quick.
I know. Thats why I noted that I had not gotten to some special cases because TDD hasn't gotten me to that point yet. I'll try working with an epsilon for my tests to see how that works out.
There's something deeper, but I can't seem to find it. 6 degrees is just over 0.1 radians - which is just far too large for rounding error using doubles.
Yeah. I am taking a look at it again now. Thus far nothing really sticks out.
There's something deeper, but I can't seem to find it. 6 degrees is just over 0.1 radians - which is just far too large for rounding error using doubles.
MPI is a silly goose when it comes to file reading and load balancing the file contents. Makes it even worse when the code is going to be run on anything from real clusters to workstations.
Wait... that actually works for most of your tests?
You're calculating (for θ = y/x in 0...pi) angle = tan(θ) (which is simply sin(θ) / cos(θ)) and then x = cos(angle), y = sin(angle)
But this is x = cos(sin(y/x) / cos(y/x) which I don't think is what you want...
You want atan2 which, given an x,y vector returns the angle to get it
I use Math.Atan(y / x) which gives me the angle in radians (assuming I handle some special cases). Ill see what Math.Atan2 does, might remove those special cases.
Here it is as of now.
public static UnitVector FromComponent(double x, double y) {
if (x == 0 && y > 0)
return FromAngle(Angle.FromDegrees(90));
if (x == 0 && y < 0)
return FromAngle(Angle.FromDegrees(270));
if (x < 0)
return FromAngle(Angle.FromRadians(Math.PI + Math.Atan(y / x)));
return FromAngle(Angle.FromRadians(Math.Atan(y / x)));
}
This makes all my tests pass as of right now but if I can remove those pesky cases that would make me a billion times happier.
Edit: Just tried it and Atan2 takes care of the special cases. Its now
I take it MPI is a clustering thing. It sounds familiar.
MPI is the classic interface for communication of large clusters see http://en.wikipedia.org/wiki/Message_Passing_Interface.
Personally I can't wait to see what exaByte clusters use for communication since straight MPI won't cut it.
I would really like to develop something using clustering someday, I think that'd be fun, and potentially aggravating.
MPI is really a C API so it is really annoying when you want to transmit anything that isn't a flat array. For a fun project I would use google protocol buffers as the message passing interface as you can serialize full classes.
What Phyphor is basically saying is that atan2 is what you are trying to write in FromComponent.
But letting you handle things yourself using atan, you are closer to the mark.
You'll get a divide by zero error in a special case, QUICK WHICH IS IT?
You wont get a divide by zero with doubles, the result is Infinity. I am using Math.Atan2 as it takes care of the mess I had previously using Math.Atan.
"Programming you don't have to be insane but it... hell fuck shit why isn't this compiling!"
My equivalent to that is coming back to that beautiful, glorious idea from 5 days ago that makes bytecode spit rainbows, taking one look, thinking for 30 seconds and saying "Why the fuck did I spend 3 hours on that when I could have simply done X?"...but at the time....IT FELT SO RIGHT.
What Phyphor is basically saying is that atan2 is what you are trying to write in FromComponent.
But letting you handle things yourself using atan, you are closer to the mark.
You'll get a divide by zero error in a special case, QUICK WHICH IS IT?
You wont get a divide by zero with doubles, the result is Infinity. I am using Math.Atan2 as it takes care of the mess I had previously using Math.Atan.
Oh hey cool, you're using C# right?
edit: Hrm, looking further it seems like atan has been handling that correctly for a long time in other languages too. Why am I remembering having to handle that differently?
Maybe I had a broken standard library. Or my memory fails me.
I think this may be related to DJGPP game I did yeeeeeears ago involving trig. (BOMB clone )
Thinking about it, I believe it is because I converted things to fixed point integer math to replace all my floating point calculations and was using SIN tables and shit, so NEVERMIND.
I think this may be related to DJGPP game I did yeeeeeears ago involving trig. (BOMB clone )
Thinking about it, I believe it is because I converted things to fixed point integer math to replace all my floating point calculations and was using SIN tables and shit, so NEVERMIND.
I would really like to develop something using clustering someday, I think that'd be fun, and potentially aggravating.
MPI is really a CFortran API so it is really annoying when you want to transmit anything that isn't a flat array. For a fun project I would use google protocol buffers as the message passing interface as you can serialize full classes.
Fixed that for you.
And short of custom binary serialization where we're not even unpacking the message and using bitmasks to decode the contents, GPB is the fastest I've used.
I think this may be related to DJGPP game I did yeeeeeears ago involving trig. (BOMB clone )
Thinking about it, I believe it is because I converted things to fixed point integer math to replace all my floating point calculations and was using SIN tables and shit, so NEVERMIND.
Posts
Phyphor, ladies and gentlemen!
True OCD I can tell you doesn't really help all that much.
Nintendo ID: Incindium
PSN: IncindiumX
Edit: :rotate:
I have OCPD tendencies too not surprisingly which are probably helpful in my work! And also why I sometimes sit working on a side project for hours until 4am etc.
IN THE ZOOOOONE MANNNN.
OCD is just a pain in the ass. It sucks having an inner dialogue that you have to constantly ignore or risk losing jobs and friends.
(OCPD is the one closer to being more of a boon than a bane.)
My other issues though, man, good times! Well, maybe.
I know. Thats why I noted that I had not gotten to some special cases because TDD hasn't gotten me to that point yet. I'll try working with an epsilon for my tests to see how that works out.
Yeah. I am taking a look at it again now. Thus far nothing really sticks out.
There are some calculations we don't even have in your code, let alone the step by step values. Can you provide for 225 case?
Why are you using hyperbolic tangent?
Hahahahahaaha. Good catch.
Also Phyphor, I will be recruiting you to test the security/breakability of a future game.
Good question. This has been fixed and now things work as expected.
You're calculating (for θ = y/x in 0...pi) angle = tan(θ) (which is simply sin(θ) / cos(θ)) and then x = cos(angle), y = sin(angle)
But this is x = cos(sin(y/x) / cos(y/x) which I don't think is what you want...
You want atan2 which, given an x,y vector returns the angle to get it
Haha
Oh man
10 Points for Gryphyphor!
I use Math.Atan(y / x) which gives me the angle in radians (assuming I handle some special cases). Ill see what Math.Atan2 does, might remove those special cases.
Here it is as of now.
This makes all my tests pass as of right now but if I can remove those pesky cases that would make me a billion times happier.
Edit: Just tried it and Atan2 takes care of the special cases. Its now
MPI is the classic interface for communication of large clusters see http://en.wikipedia.org/wiki/Message_Passing_Interface.
Personally I can't wait to see what exaByte clusters use for communication since straight MPI won't cut it.
MPI is really a C API so it is really annoying when you want to transmit anything that isn't a flat array. For a fun project I would use google protocol buffers as the message passing interface as you can serialize full classes.
But letting you handle things yourself using atan, you are closer to the mark.
You'll get a divide by zero error in a special case, QUICK WHICH IS IT?
You wont get a divide by zero with doubles, the result is Infinity. I am using Math.Atan2 as it takes care of the mess I had previously using Math.Atan.
My equivalent to that is coming back to that beautiful, glorious idea from 5 days ago that makes bytecode spit rainbows, taking one look, thinking for 30 seconds and saying "Why the fuck did I spend 3 hours on that when I could have simply done X?"...but at the time....IT FELT SO RIGHT.
Oh hey cool, you're using C# right?
edit: Hrm, looking further it seems like atan has been handling that correctly for a long time in other languages too. Why am I remembering having to handle that differently?
Maybe I had a broken standard library. Or my memory fails me.
Thinking about it, I believe it is because I converted things to fixed point integer math to replace all my floating point calculations and was using SIN tables and shit, so NEVERMIND.
Sin tables, eh?
30 degrees => Missionary mapping?
Fixed that for you.
And short of custom binary serialization where we're not even unpacking the message and using bitmasks to decode the contents, GPB is the fastest I've used.
Oh wow.
This kind of stuff is fascinating to me. I think it would be so cool to have a whole new technology stack based on something other than UNIX.