« first day (1910 days earlier)      last day (2936 days later) » 

5:00 AM
what is that green thing
 
or menus
or weapon select. Or anything
 
can you fix the background first
 
@Maltysen alien
 
i feel like I'm going to vomit
 
@Maltysen yeah that's first priority, I've been working on that
 
5:00 AM
@AshwinGupta no the trail
 
@Maltysen oh well that was more of a learning thing for me. I will remove that for real, I just had that so I could 1) see if I knew how to do it, 2) track movement before I had the sprite programmed in
 
I'm out ... bai ... ಠ_ಠ
 
no, its pretty cool
@AshwinGupta i like it
 
You wouldn't think some simple side-scrolling lines would be so damned disorienting, but wow.
 
As for the background, I am keeping the light rays, but I'm going to re-space them obviously.
 
5:02 AM
@Mego now that I have the magnitude of the velocity, but how would that help me if I don't know the direction?
 
It's the first thing I've programmed in JS/Html so yeah still learning
@Maltysen lol serious? I honestly thought it is kinda ugly.
 
@AshwinGupta yeah the trail effect is pretty nice
 
Ok ty
I'll keep it in their then
 
@Downgoat you know the direction
its tangent to the orbit
 
Tomorrow, I'm fixing the background, then it will be saturday so I'll have plenty of time
 
5:03 AM
oh
ugh, maths
 
which means its normal to your position vector
 
to hopefully program the missile hit detection, then some of the alien ai
next week I'll do menus/weapon selections. Finish the ai up
 
kepler's laws!
 
and finally I'll do in game power ups and points/health
 
@Maltysen Math is the worst ;_;
 
5:04 AM
@Downgoat kepler's laws and newton's derivations are really cool
 
speaking of Kepler, did Nasa ever find out the cause of the Kepler (Satellite) failure that caused it to go emergency mode?
 
Anonymous
@Downgoat Equation of an ellipse is x^2/a+ y^2/b = 0. Implicit differentiation, equation of tangent line is x*x_0/a + y*x_0/b = 0. Get your line, find the angle.
 
@Mego wait can't he just say that the velocity is normal to position vector?
@AshwinGupta halp what is kepler satellite?
 
Anonymous
@Maltysen Yeah he could do that too
 
@Maltysen =/ its for finding planets... uses transit method to locate exo planets
 
5:06 AM
@Downgoat do you know how to find slopes of lines and then slopes of perpendicular lines?
 
@Maltysen yeah, except I don't want to do this in a very inefficient / slow way
 
opposite reciprocal then * -1 isnt it?
For perpendicular ^
 
@Downgoat no, that's one of the fastest ways, except for going fully closed form
@AshwinGupta yup
 
Is their a better way to do it that I've missed or not learned?
 
Anonymous
You could just used the closed-form
 
5:08 AM
@Downgoat find the slope of your position vector, and then find the slope perpendicular to that, and that's the slope of your velocity vector
 
Anonymous
You have your ellipse characterized by a center (X,Y) and a pair of semi-axes (a,b) (a is semi-major, b is semi-minor)
 
@Mego he's doing restricted 3 body though, which as you said above, is very hard
 
Anonymous
Your position on that ellipse is characterized by the equation x^2/a + y^2/b = 0
 
cuz of moon
 
Anonymous
@Maltysen The closed-form solution works for discrete time, as long as you re-calculate the potentials every iteration
 
5:10 AM
oh i see what you mean.
 
Anonymous
Wait this is dumb
 
Anonymous
This can be done super easy
 
Anonymous
Place your sun at the origin of your coordinate system (0,0,0)
 
@AlexA. ...I have so many conflicting feelings about this. :P
 
5:12 AM
hahaha
I can imagine
 
Anonymous
Your planet and moon start with initial position vectors xp_0 and xm_0, and initial velocity vectors vp_0 and vm_0
 
Well wait though, don't you want 0,0,0 to be the center of gravity......
Sun isn't always the exact center is it? It's shifted a bit usually based on planetary mass?
 
@HelkaHomba Huh what? The Sixty Symbols video? I'm actually not subscribed to that one.
 
@AshwinGupta we're assuming that's negligible
restricted 3 body problem
 
@Maltysen I see...
 
Anonymous
5:13 AM
The sun, planet, and moon have masses M_s, M_p, and M_m
 
@Downgoat can you link me to ur prj really fast I wanna see something
 
@AshwinGupta vihan.org/p/SSS
 
gracias
 
0
A: Sandbox for Proposed Challenges

R. KapMolecular Geometry With all the many questions on this site, I am very surprised we don't have that many about quantum mechanics! I mean, such an amazing subject, and we really have little to none about that! Maybe only 5 which I could find by searching, and the most recent one of those is from ...

 
Anonymous
The acceleration felt by the planet is G*(M_s/xp_0^2 + M_m/(xp_0-xm_0)^2), and the acceleration felt by the moon is the same but replace xp with xm in the first part of the sum
 
Anonymous
5:16 AM
Your position at time t is x_0 + v_0*t + 1/2*a*t*t
 
@Mego that's what he's doing, except his time steps are too big so everythings inaccurate
 
Anonymous
Well make the time steps smaller
 
>_<
 
Anonymous
Rather than 1s/s, do 1ms/s
 
Anonymous
Or do 1s/s but do it in ms chunks
 
5:17 AM
that's what geobits and I have been telling him for the last 2 hours -.-
 
Anonymous
Oh
 
Anonymous
@Downgoat Listen to Geobits and Maltysen they're smart
 
@Mego yes I am
 
but he can't do that because he has his logic with his rendering
 
Anonymous
Wait what
 
Anonymous
5:18 AM
MVC your shit
 
@AshwinGupta This is cool. By the way, when you get a spacebar press, do stop the event from propagating so the page doesn't scroll down like the normal behavior is.
 
@AshwinGupta bugfix: you're checking you boundaries based on x,y not left,right,top,bottom
so your spaceship can halfway leave the screen
 
so I'd do: $y_2=v\frac{y}{\sqrt{x_1^2+y_1^2}}\\x_2=v\frac{x}{\sqrt{x_1^2+y_1^2}}$ to get the new components correct?
 
@El'endiaStarman ty, its obviously a serious WIP. I've never done JS/HTML before (or much game programming at all) and I started only a few days ago, hopefully I can make it something neat. Not original btw, total Galaga copy, Thanks for the suggestion, I noticed that too, I honestly have no clue how to fix it but I'll add it to my list and look it up l8r lol
@Maltysen yeah I'm lazy aren't I? I'll fix it tmrw
likely during class...
 
@AshwinGupta return false from your event handler
 
5:21 AM
@Maltysen meaning?
 
that stops it from propogating
 
Oh
one se
sec
 
um
I tried to return false, not working
I'll try Starman's
 
That reminds me, @CᴏɴᴏʀO'Bʀɪᴇɴ, would you mind transferring ownership of the Spacewar! KotH GitHub repository to me?
 
5:24 AM
@El'endiaStarman Lol, spacewar is probably not the best original name for a game like mines huh?
@El'endiaStarman should I just throw that in both of my event handlers (keyup and keydown)?
oops I think I did it wrong, it broke xD nvm, typoed, got it TY
@El'endiaStarman & @Maltysen fixed it TY guys. Fixed Version Here. GN now, will be back at it tomorrow
 
@Downgoat one of my moons became a planet -.-
 
nice
so I implemented what @Mego said and it doesn't work :/
let sm_axis = /*some value*/;
let v_op = Math.pow(pl.velocityX, 2) + Math.pow(pl.velocityY, 2);
let v_mag = Math.sqrt(
    f * pl.mass * (
        2 / Math.sqrt(
            Math.pow(pl.x - (pl.x + sm_axis), 2)
        ) - 1 / sm_axis
    )
);

moon.velocityX = v_mag * Math.cos(pl.velocityX / v_op);
moon.velocityY = v_mag * Math.sin(pl.velocityY / v_op);
@Maltysen do you know why the above isn't working ^
pls
 
Anonymous
5:47 AM
Well part of the problem is that you're making the moon's direction be the same as the planet's direction
 
@Downgoat did you take the normal of the vector?
ninja'd
 
oh, yeah, fixed
 
Anonymous
The other problem is that you're trying to compute a unit vector using d^2 instead of d
 
@Mego what do you mean by that?
 
^^ @Downgoat what have I been telling you for the last 2 hours?
(╯°□°)╯︵ ┻━┻
 
5:48 AM
@Maltysen I fixed that alreadu
 
@Downgoat he means's you have to take the perpendicular of the slope
so -v_op/velocityx
 
Anonymous
Math.pow(pl.x - (pl.x + sm_axis), 2)
 
Anonymous
...so Math.pow(sm_axis,2)
 
and then the lovely Math.sqrt() around that
 
@Maltysen on the last two lines?
 
5:50 AM
@Downgoat if I'm reading your code correctly
 
Anonymous
v_op needs to be Math.sqrt'd
 
>NaN
NaN
NaN
 
Anonymous
So let v_op = Math.sqrt(...)
 
dammit JavaScript
 
Math.sqrt(Math.pow(pl.x - (pl.x + sm_axis), 2) == sm_axis ??
 
Anonymous
5:52 AM
Euclidean norm is sqrt(x*x+y*y)
 
let sm_axis = (a[3].value + "00") / 1e4;
let v_op = Math.sqrt(Math.pow(pl.velocityX, 2) + Math.pow(pl.velocityY, 2));
let v_mag = Math.sqrt(
    f * pl.mass * (
        2 / Math.sqrt(Math.pow(pl.x + sm_axis, 2)) - 1 / sm_axis
    )
);
// Moon vectors components
moon.velocityX = v_mag * Math.cos(-v_op / pl.velocityX);
moon.velocityY = v_mag * Math.sin(-v_op / pl.velocityY);
 
Anonymous
You're doing r = Math.sqrt(Math.pow(pl.x + sm_axis, 2)) right now, which isn't correct
 
Anonymous
r is supposed to be the distance between the moon and the planet
 
Anonymous
So r = Math.sqrt(Math.pow(pl.x-moon.x,2) + Math.pow(pl.y-moon.y,2))
 
sm_axis is the distance from the planet to the moon so I can just use v_mag = sqrt(f * primary.mass * (1 / sm_axis)) correct?
 
Anonymous
5:55 AM
Of course, all of this is pointless, because it doesn't factor in the star's gravity for the moon's revolution
 
what is f?
 
@Maltysen grav constant
@Mego oh no
what should I do then?
 
Anonymous
@Downgoat sm_axis is the length of the semi-major axis of the moon's orbit around the planet. It's equal to r twice per rotation.
 
Anonymous
38 mins ago, by Mego
@Downgoat Listen to Geobits and Maltysen they're smart
 
Anonymous
37 mins ago, by Mego
MVC your shit
 
5:56 AM
okay, @Geobits @Maltysen what should I do to account for the star's gravity?
 
@Mego I'm not sure this would work well, but can he factor in the sun acceleration into these closed form velocties's?
@Downgoat step 1. calculate all the force vectors on the moon step 2. add them up step 3. do this very often
 
Anonymous

How to do orbital mechanics right

46 mins ago, 4 minutes total – 20 messages, 6 users, 0 stars

Bookmarked just now by Mego

 
Anonymous
@Maltysen Nope, because the orbital velocity formula I gave is the result of solving the two-body problem
 
so what is the magic equation to get: the initial velocity vector for a moon to form a circular orbit around a planet accounting for a sun?
 
you have to discretely add up everything
 
Anonymous
6:00 AM
@Downgoat It won't be circular
 
there is none
 
okay, well I just want an orbit does't have to be circular
 
@Downgoat *It's not gonna be circular relative to the sun
 
@Maltysen add up grav acceleration from all bodies?
 
@Downgoat and the sun
 
6:01 AM
yeah
 
but you have to do this really quickly, or everything will degenerate, so separate logic and rendering
 
logic is already seperate from rendering
 
1
Q: Can Gravity Guy Make It?

user81655Gravity Guy is a game where the only user input is a single key that flips the direction of gravity. Given an ASCII art level, determine if it is possible for Gravity Guy to reach the end. Rules The initial direction of gravity is down. The first column of the input will always contain only ...

 
@Maltysen okay. So I add up the total gravitational pull on the moon, now what?
 
@Downgoat now divide by mass of moon to get acceleration
btw, when adding these up DO THEM AS VECTORS
not as the magnitude of each one
 
6:04 AM
okayoh
 
then add acceleration vector to velocity vector
then add velocity vector to position vector
repeat
 
but how does this give me the initial orbit velocity to form a stable orbit around a planet
 
@Downgoat idk, shouldn't all orbits be stable?
 
no
 
@Maltysen No
 
6:07 AM
some fling the moon into interstellar space
 
What happens in real life is orbits gradually settle into a certain radius
 
how bout you allow the guy to pick
 
@Downgoat You just need to have a maximum then
 
@Maltysen this has to be idiot proof
 
make sure the initial_velocity is perpindicular to its position and give it something small
 
Anonymous
6:08 AM
@Downgoat No such thing
 
idk if that works
 
someones going to move all the sliders to max and be like "wherd my planit go"
 
Wait then
 
Anonymous
There's a way to find out if the orbit will eventually be stable
 
@Mego i.e. less than escape velocity
 
Anonymous
6:09 AM
If the velocity is too low, the object will fall into the planet (parabola). If the velocity is too high, the object will fling away (hyperpola). If it's in the right range, it will orbit the planet (ellipse or circle). It's all conic sections.
 
v_esc = (2 * G * M / r)^1/2 where G is the gravitational constant, M is the mass, r is radius
 
there's also a formula for orbital velocity, right?
 
wait
 
@Mego really?!? Can you provide me a link?
 
In astrodynamics, the characteristic energy () is a measure of the excess specific energy over that required to just barely escape from a massive body. The units are length2time−2, i.e. energy per mass. Every object in a 2-body ballistic trajectory has a constant specific orbital energy equal to the sum of its kinetic and potential energy: where is the standard gravitational parameter of the massive body with mass and is the radial distance from its center. As an object in an escape trajectory moves outward, its kinetic energy decreases as its potential energy (which is always negative...
C_3 = -GM/a where C_3 is v^2 (square of orbital velocity) and a is the semi-major axis
^ escape velocity
so v is the maximum value of the input box, G is a constant, M is the mass of the planet, and a is the orbital semi-major axis
 
6:14 AM
@Downgoat write this without looking at stable orbits first, you can worry about that later
just get moons working accurately
 
@Maltysen that's what I want to do
But I do not know how to figure out how fast the moon should go
 
2 mins ago, by Mars Ultor
C_3 = -GM/a where C_3 is v^2 (square of orbital velocity) and a is the semi-major axis
 
that gives escape velocity, how would that help me
 
@Downgoat it has to be less than that
 
2 mins ago, by Mars Ultor
so v is the maximum value of the input box, G is a constant, M is the mass of the planet, and a is the orbital semi-major axis
> maximum value
 
6:17 AM
okay
hmm
 
Anonymous
Right but a depends on the initial velocity
 
isn't escape velocity $\sqrt{\frac{2GM}{R}}$?
 
@Downgoat Yes
That's going straight up though
This is orbital escape velocity
 
Anonymous
Let me make this real easy for you
 
Anonymous
 
6:21 AM
actually
 
@Mego ...
damn greek letters...
 
v=sqrt(Gm/r)
 
Anonymous
gamma is GM. Curly-L is the angular momentum m*r*r*theta.
 
Anonymous
E is the energy of the orbit, which is equal to v*v/2 - G(M+m)/r
 
Anonymous
e is the eccentricity, which must be in [0, 1) for the orbit to be stable
 
Anonymous
6:24 AM
Solve for E, then restrict v (initial velocity) and r (initial distance) to be values such that the orbit is stable
 
Anonymous
Or, better yet, do what Maltysen said and just get the simulation working before you worry about restricting it to stable orbits
 
@Mego simulation works
 
@Downgoat v=sqrt(Gm/r) - G = gravitational constant, m = mass of planet, r = distance from center of planet
 
Anonymous
On an unrelated note:
 
Anonymous
6:30 AM
13
Q: Virtual Keyboard Text Input

MegoOn modern game consoles and other devices without traditional keyboards, trying to input text is a nightmare. Having to type with a few buttons and a joystick on a virtual keyboard is annoying, and I like to make as few movements/button presses as possible. The keyboard you will be using looks l...

 
Anonymous
^ needs more attention
 
Anonymous
The only answer so far fails to provide valid output for any inputs except the first 3
 
Hello
 
Anonymous
Huh, apparently we haven't had an MD5 challenge yet
 
Anonymous
I should write one
 
6:45 AM
Obvious:
import hashlib; print hashlib.md5(raw_input()).hexdigest()
 
@feersum I was wondering how long it would take for someone to check for duplicates in negative lookaheads instead ;)
 
was gonna do that
just I have no idea how to shorten it
 
Not a no builtins challenge (already porpised), not a "control the hexdigest" challenge (already done by Joe Z.¹ with SHA-256).
@Mego What it would be?
 
0
A: Sandbox for Proposed Challenges

MegoImplement SHA-256 code-golf hashing Given a sequence of bytes, output the SHA-256 hash value of the sequence. The SHA-256 Algorithm [todo] Restrictions The usage of builtins which compute SHA-256 hashes or otherwise trivialize the challenge is forbidden The input and output may be in any re...

 
Anonymous
@NewSandboxedPosts This bot is dumb, clearly the challenge I sandboxed is about SHA-256. MD5 has already been sandboxed and I totally looked for duplicates in the Sandbox before posting.
 
7:04 AM
Who said anything about MD5?
 
Anonymous
@Dennis <3
 
Good thing he didn't say a feed bot joke.
 
0
Q: CamelCase2snake_case() and snake_case2CamelCase()

CJ DennisWrite two functions to: convert CamelCased text to snake_case: FunctionForHTMLManipulation becomes function_for_html_manipulation convert snake_cased text to CamelCase: function_for_html_manipulation becomes FunctionForHtmlManipulation The input text will be a single suitable identifier in ma...

 
@NewMainPosts I feel like I've seen this challenge before...
 
7:24 AM
oh, 500 bronze, \o/
10
 
Anonymous
Neat!
 
@MartinBüttner Congratulations on 500 badges!
sgitw'd /o\
(SGITW means second gun in the west)
 
*SFGITW
 
7:47 AM
Damnit, I have no idea to how to do a golfy sudoku box validity checker
 
0
Q: snake_case2CamelCase()

CJ DennisWrite a function to convert snake_cased text to CamelCase: function_for_html_manipulation becomes FunctionForHtmlManipulation The input text will be a single suitable identifier in many languages. It must start with an English letter or underscore, then be followed by any number of English lette...

 
Anonymous
@NewMainPosts dupey dupe
 
It's actually cv-pls and you can get a userscript to send them to chat from main site
 
@Quill From where?
 
(Also, back in the times of zyabin101 the Hated, Katenkyo proposed this:
Mar 9 at 12:23, by Katenkyo
@zyabin101theHated would be better for this site so :)
)
 
@flawr :-)
@Quill Installed. But how it works? And how can I redirect the chat message to a specified room, like the Nineteenth Byte?
Also are there custom close vote reasons?
 
 
8:07 AM
@zyabin101 On the link? No.
 
@Quill Okay.
 
Otherwise, yes
 
8:29 AM
@MartinBüttner Heh, well what else would you do?
I was a bit worried I had misread the spec and it was supposde to be code bowling.
 
@feersum well, ask the other participants :P
 
hmm, the only other one that has code has a bunch of specific digits in it by name
 
the .{8}(.{9})* you've got is also annoying me in my solution. it looks so golfable, but so far I've only found 3 completely different solutions all at the same byte count :/
 
Maybe there is some obscure flavor that allows .{9}*
 
hm yeah, I wish, but I don't know one. and more likely than not the rest of my regex wouldn't work in it.
I haven't really used any particularly fancy .NET features, but even PCRE doesn't seem to like some of the forward references
@himarmjr ^ A bit unnecessary, don't you think? ;)
 
9:01 AM
TIL google maps in the browser can go full 3D
 
 
1 hour later…
10:18 AM
^ I feel like I've read this exact line here before.
 
11:06 AM
> Long story short we're now headed to a mine to rescue my character's old comrade who has been wrongfully exiled for treason by a malicious gang that's taken over our home town in our absence
This is why I don't RPG
 
11:22 AM
@El'endiaStarman
 
11:51 AM
Hi. For the last cops'n'robbers challenge I spent some time trying to crack posts in a certain golfing language, and thus have gotten somewhat familiar with it. Now I would like to post an answer for another challenge using the language, but isn't it unfair towards the author of the language? What is the policy for using someone else's golfing language - waiting some time so the author has a chance to post first? Not using it at all? Asking for permission? (Sending a box of chocolates?)
 
12:02 PM
@mIllIbyte Just answer
People don't create languages for themselves
Some good examples are CJam/Pyth/Golfscript - some early esolangs from PPCG IIRC, and used widely as well
 
12:14 PM
Actually, is every number except 0 considered truthy?
in C, for example?
I see.
In The Joke Java then?
so only true is truthy in Java?
 
-1
Q: How many minimum days will he take to complete N units of work

HARSHA person has to complete N units of work; the nature of work is the same. In order to get the hang of the work, he completes only one unit of work in the first day. He wishes to celebrate the completion of work, so he decides to complete one unit of work in the last day. Given that he is only ...

 
@KennyLau Yes. All other things give an error if used as a condition
 
I see
 
Same as other strongly typed languages, like C# etc. C and C++ only have numbers and booleans truthy IIRC.
 
12:30 PM
what about empty arrays?
I see
 
@MarsUltor @QPaysTaxes Thank you for the clarifications. Codegolf surely is even more fun if you can use other people's languages. I had been mislead by the wikipedia article about code golf that says: "Many code-golf websites such as Programming Puzzles & Code Golf have many users constantly creating new and unique golfing languages to win code-golf challenges." en.wikipedia.org/wiki/Code_golf#Dedicated_golfing_languages
 
I keep on forgetting we're mentioned in Wikipedia
 
That wiki page needs cleaning up :/
 
we should all put our own langs on the Wikipedia page >:D
 
... no
 
12:41 PM
of course ;P
 
Chat hivemind -- a challenge question. Are there enough languages that have some form of built-in hash function implemented, so that creating a challenge around using said built-in hash function would have enough possible entries?
 
define hash functioon
 
> Many code-golf websites such as Programming Puzzles & Code Golf have many users constantly creating new and unique golfing languages to win code-golf challenges.
^^^ only spot on the page where 'code golf' is hyphenated :/
 
@CᴏɴᴏʀO'Bʀɪᴇɴ Something like Java's .hashcode()
 
how about atob/btoa?
 
12:45 PM
@mIllIbyte They do create them to win - it's just that they also create them for the community, or at least they don't mind if the community uses it. The interpreters have to be open-source anyway.
 
@CᴏɴᴏʀO'Bʀɪᴇɴ Yeah, that would work. It might produce uninteresting results with the challenge idea I've got floating around, but it would fit.
 
Hm.
Idk if Jolf has atob/btoa.
Is it code golf?
 
It'll be code-golf, yes.
 
(There you go, Geobits - a couple more hyphens for you)
 
12:47 PM
is it code-golf or code golf?
 
code golf
:/
 
but I have to type code-golf when doing a tag
 
I have to type king-of-the-hill, too, but that doesn't make it right :P
 
:D
 
The starboard is full of 7s this morning.
 
12:52 PM
-+1 7
 
For me: 7 7 7 7 6 7 7 7 7 11
I might edit the code golf wikipedia page
flogscript isn't that well-known anymore
 
what's that?
 
what does everyone think are the 3-5 most well-known golfing languages, and 3-5 notable golfing languages?
 
@MarsUltor Java :P
Very well known.
Used for golfing.
 
Python too.
 
12:55 PM
but
They're not golfing languages - they're just used for golfing.
 
APL for sure
 
And apparently QBasic.
 
Golfscript, Pyth, CJam.
 
@CᴏɴᴏʀO'Bʀɪᴇɴ So those would be the most well known?
 
12:58 PM
They are only used in this site. In the world, they aren't well known.
 
Most people here might be biased ;)
 
@feersum Code golfing isn't well-known, either.
 
@CᴏɴᴏʀO'Bʀɪᴇɴ Relative to those, it is.
 
@Everyone go to anagol, look for the most commonly used languages created specifically for golfing
 

« first day (1910 days earlier)      last day (2936 days later) »