« first day (1420 days earlier)      last day (3417 days later) » 

12:00 AM
the actual rules say "no more than one spell is created per gesture" (emphasis mine)
is this better?
 
@MartinBüttner yes
 
After all that work on the title (I assume trying to increase chance of "hotness"), I'm surprised you didn't have a ready-to-post reference answer. Fast answers are a big boost to the arbitrary hotness score :P
 
Why does BSWWS, CSWWS not have Stab ?
 
@Optimizer We're only considering the current/last turn (which is the right-most in my examples... clarifying)
@Geobits They are the only way to get a non-zero score in the first place.
But then I'd have to listen to Optimizer whining again that he can't get Enlightened any more. ;)
 
@MartinBüttner also, are these case insensitive ? cw for magic mirror is in small caps
 
12:09 AM
@Optimizer the case indicates whether you need to perform the gesture with both hands simultaneously
 
ok, so now its hard
 
@MartinBüttner Well any answer gives you some score. Fast answers boost it more.
 
@Geobits ah yeah sure
 
@MartinBüttner go ahead.
I was done with the program except for this double hadn thingy. I need to sleep now
so no answer.
 
12:11 AM
@MartinBüttner I've actually been working on creating a web version of a variation of Waving Hands I made a few months ago. I just uploaded it to my website (see the list of spells with Space, scroll with up and down arrow keys). Just thought you might be interested :P
 
@Doorknob冰 I was considering writing one myself ("when I've got some time...") seeing how unmaintained and outdated all the existing implementations look
 
@MartinBüttner This one's actually quite different from the original. I've still been too lazy to put the rules and instructions on the web thing
 
hehe
for now I've set up an email-triggered Ruby script that allows me to play it with my dad by email
(the script stores incoming emails and doesn't forward them to the other participant until there's one email from each of them)
 
resolving all the ambiguities and loopholes in those rules seems like a monumental task
 
@feersum yes, I agree
especially when you start with Haste and have tons of simultaneous spells
btw, you know you can edit messages in chat?
 
12:15 AM
yeah but it's too weird
 
lol why is it weird? :D
 
I mean no other chat ever has editing of posted messages
 
Thank you for using Auto-Doorknob Chat™ Editor®™ 2000©. Please come again later.
 
Skype does
 
plus the button is way too small and hard to cliuck
 
12:15 AM
up-arrow key
 
OK
I should be able to make an empty set in python by {,}
 
how old school you have to be to not know the up-arrow key thingy ?
 
12:35 AM
@PeterTaylor I've invited you to another game, I want to try out something else, if you don't mind.
actually, never mind, feel free to ignore it
I wanted to test if a two-hand gesture in a previous round can be used for two spells in the current round. but there are no spells that have a two-hand gesture before the current turn, for which casting them twice is distinguishable from casting them once.
(although I guess one could try to cast a fire and an ice elemental at the same time)
 
This sounds like Magic
 
@Rainbolt I do mention MTG in the first sentence of the spec.
 
This chatroom got a lot crabbier all of a sudden...
 
do I need to escape $ or \ characters in bash?
I'm trying to use grep to sort out the spells
 
@MartinBüttner I didn't know there was "the spec". I thought you were talking about Spellbinder.
 
12:46 AM
(and it won't work)
 
@Rainbolt I was, in the context of this challenge (which was being discussed in this chat earlier)
 
Stupid crab is keeping me from being able to move my cursor to the left side of the chat box
Fixed.
 
The edge of my pirate hat hides the first letter of every message. It's annoying, but it just fits so perfectly!
 
lol
well, I should sleep. if there's still no answer tomorrow morning, I might post one myself.
 
1:01 AM
@Martin As usual I don't get some piece of a challenge. In your second example, how could one cast Missile in the current turn?
 
SD = missile?
why is that hard
 
So missile was cast last turn right?
Is the list not a list of gestures already completed?
 
what could be cast wit the last gesture in the list
 
"Given a list of gestures for each hand, determine which spells could be cast in the current turn"
I get it I guess.
The list is a list of gestures that have already been completed, except for the last gesture which is the gesture that is being made this turn.
@feersum Ok, it definitely does not say "what could be cast with the last gesture in the list". It says "what could be cast for the current turn", which could very well be after the last gesture in the list.
 
yeah, seems like a reasonable interpretation
I edited it
 
1:13 AM
How did you know? Just basing it on the examples?
They all seem to fit now.
 
yeah my program has gotten the first several right
 
 
2 hours later…
3:24 AM
0
A: Sandbox for Proposed Challenges

Joe Z.Score a Mahjong Hand So you've built a solver for which tiles you need to complete a Mahjong hand, but you've heard that certain hands are worth more than others and sometimes a hand that scores too low can't even win. So, you decide to build a program that will score hands for you. This time,...

 
@JoeZ. Ahaha nice - I had that idea in mind too but I never did it because the spec might get complicated
You might want to be careful about edge cases though. As you probably know mahjong has a lot
 
 
2 hours later…
5:26 AM
yeah, there are a lot of edge cases
like, certain hands can count for more than one type of validity
is 7s 8s 9s 7s 8s 9s 7s 8s 9s 3s 3s 3s 4s 4s all pongs or three chows and a pong?
it depends on how the hand was played
 
I made a new chat after you posted the comment: chat.stackexchange.com/rooms/19601/…
:P
Want to discuss there? @JoeZ.
 
 
4 hours later…
9:24 AM
good morning/evening/night
 
Good morning, and in case I don't see ya, good afternoon, good evening, and good night!
 
thanks :)
 
9:46 AM
@Sp3000 heh.
@Rainbolt Just to confirm, feersum's interpretation was correct.
 
:P
 
It's been a while since I've seen that
 
same here
that pizza slice challenge looks hard
 
It's basically integration, of a sort. But the function wraps.
 
9:53 AM
hm yeah... I was thinking you could just work out how much of a peperoni you need in each slice, then start with some tangent, and work out where to cut this (or the next) peperoni and skip across peperoni-free sections. but the potential of peperonis overlapping the origin makes this a lot harder.
 
@MartinBüttner :)
 
it might indeed be easier to convert this into a polar function and give it to Mathematica to integrate
 
Well that's what I meant, it's like f(x) = length of segment intersecting pepporoni for the ray from the origin out to x
Oh right, you have Mathematica
That makes things about 20 times shorter
 
I'm not sure I can be bothered to work out the (partial) secant lengths for the rays though :D
 
Wow the formulae don't look nice at all
(The solution to (x - a)^2 + (y - b)^2 = r^2 and y = tan(theta) x I mean)
 
10:02 AM
I can imagine
 
that's the intersection of a circle and line, right?
 
maybe it's simpler if you don't do it in closed form
 
i think there's a nice geometric solution
 
get perpendicular distance from line to centre, if it's closer than the radius, work out the intersections as perpendicular offsets from the radius with simple trigonometry
 
exactly :-)
 
10:05 AM
of course, if I don't have a closed form solution I probably can't feed it to Mathematica's numerical integration :D
 
2 (r^2 - (a tan(theta) - b)^2 / (a^2 + b^2))? If I did that right. (Circle centre (a, b), radius r, line angle theta from positive x axis)
High school geometry, it's been a while
 
is that the length?
 
Yeah of the secant intersection
 
but with this form, you can't easily account for the ray ending inside the peperoni
 
Yeah not to mention you'll have problems with vertical cuts
(due to the tan)
Hm...
 
10:09 AM
yes, or the peperoni centred at the origin
 
Well... I'm not sure how to restrict to a ray yet :P
 
it's not that hard if you drop the closed form
if you work out the intersection individually as parameters along the line, you can simply clamp them to non-negative parameters
and then take the difference of the parameters
 
Oh, I see
 
to circumvent the singularities of tan, you could rotate the pizza instead
 
I think if you worked with parameters you wouldn't have that problem anyway
 
10:18 AM
how would you get from the angle to a parametric form of the line without tan though?
oh
never mind
 
(cos x, sin x)
 
yeah
that was stupid
 
So we basically want ||(a, b) - (μ cos θ, μ sin θ)|| = r^2, right?
I got something like μ = (a cos θ + b sin θ) ± sqrt((a cos θ + b sin θ)^2 - (a^2 + b^2 - r^2))
(If I did my algebra right)
 
I'll ask Mathematica
 
So I guess you're thinking max(μ1, μ2) - max(min(μ1, μ2), 0), right?
For nonnegativity
 
10:25 AM
yes, although you don't need to min/max mu1 and mu2, because you know which one is greater
{{\[Mu] ->
   a Cos[t] + b Sin[t] -
    Sqrt[-a^2 - b^2 + 2 r^4 + (a - b) (a + b) Cos[2 t] +
     2 a b Sin[2 t]]/Sqrt[2]},
 {\[Mu] ->
   a Cos[t] + b Sin[t] +
    Sqrt[-a^2 - b^2 + 2 r^4 + (a - b) (a + b) Cos[2 t] +
     2 a b Sin[2 t]]/Sqrt[2]}}
it's probably what you've got, just with some double-angle formulae applied
 
Maybe, that part can easily be redone if necessary anyway
 
yours seems golfier :D
 
:P Fine I'll check my algebra
 
for more legibility
I think in Mathematica it's golfiest to just let Mathematica solve the equation
because that's Solve[Norm[{a, b} - m {Cos@t, Sin@t}] == r^2, m]
 
Ahaha yeah that works
 
10:31 AM
LOL
 
@Optimizer?
 
can't you do any mathematical question like that then ?
(which involves solving of equation of some sorts ofcourse)
 
well, if Mathematica can solve it, but if the challenge was literally "solve this equation", then that's a standard loophole
 
Yeah I think that's going to be hard to beat. Good old Mathematica.
 
I think I could beat it by porting to CJam
function names are just too damn long in Mma
 
10:35 AM
Really? :o
 
Mma :D
mixed martial arts ?
with mixed casing
 
@Sp3000 well all I'm handing off to built-ins is the solver, and even there, computing the solutions manually isn't that much longer in CJam I think
 
I think you can do something like X = a cos θ + b sin θ; Z = sqrt(X + r^2 - a^2 - b^2);D = Z + min(Z, X) or something
I'm not sure if that's any easier in CJam
 
ummm... when you do the integration yourself... don't you still need to account the polar geometry (even when you take really small steps)?
 
this codegolf.stackexchange.com/questions/42517/sharing-pizza-fairly can lead to many difficult situations.
 
10:39 AM
because you're technically integrating over r dθ and not just dθ
 
(the configuration of pepperonis)
 
@Optimizer that's what we're discussing
 
oh!
 
Wait why r dθ?
(and I guess thankfully the secant function is continuous)
 
because that's how you integrate over an angle in polar coordinates
 
10:40 AM
also, when the question gave 1 complex example of 1 pep... and 10 people. we have to consider that we cannot simply make 10 cuts of θ angle where 10θ is the angle spanned by that pepperoni
 
@Optimizer yes, but that's not the hardest part
the hard part is that peperonis can overlap the origin
 
because the pieces towards both the end will have less area of the pepperoni
 
Hmm well I can't say I've ever integrated over polar coordinates myself...
 
haha okay
well basically what Optimizer said
 
Oh, but it's not like that though, right?
 
10:43 AM
this is hard
 
an arc traces out a bigger length if it's further away from the origin (and it's proportional to r)
 
harder than magic spell-checker
 
I thought the idea was we have a function f(θ) = sum of secant lengths of all pepperonis
 
so if you integrate over an angle, then the length element is r dθ
 
so I will first do magic spell checker then.
 
10:44 AM
Oh... I see what you mean now
Further from origin, right
That sounds more like a double integral dr dθ now
 
Hint: I didn't do too well on vector calculus and haven't done any applied maths since
 
having a limitation that the cuts are towards origin
I wonder if the OP knew that this question is tough as hell before asking (or even now)
 
:P at least it's in the doable realm
@MartinBüttner Are you going to try integrating with Mathematica before doing CJam?
 
@Sp3000 yes, but I'll write the integration myself
sorry, my wifi was completely unstable, I hope it's better now
to get back to the integral
we can't just do (m2-m1)dθ
 
10:52 AM
Ah... yes.
 
the area of a strip from m1 to m2 over an arc dθ is actually (m2²-m1²)dθ/2
 
Is it possible to just plug in "Integrate from m1 to m2 integral from 0 to 2pi r dθ dr" or something?
 
hm, with a closed form solution it might be possible... I guess I could just take the real part of the above solutions
hm, no it's not really helping
 
Oh?
How so?
 
I don't think I can get a functional from from NIntegrate (which I need, in order to invert it, so I can find the angles, where the covered area hits the next person's share)
and if I just integrate around the entire thing I just get 0 for some reason, so it doesn't seem to work anyway
 
11:07 AM
Oh... I was just thinking of binary search because I wasn't sure whether Mathematica could inverse integrals like that
 
even so
I don't even get a functional form
I think it's easiest to just do the integration yourself and print the current angle whenever you have the next slice full
 
Okay...
goes to look up polar integration
 
as I said, it's simply (m2²-m1²)dθ/2
 
I'm curious about the derivation :P
 
it's the integral from m1 to m2 of r dθ
but I guess you're interested in why you need r dθ in the first place
 
11:11 AM
... no I'm good. Now you put it that way I feel silly for not seeing that :P
 
wait
0 was actually the correct result, because I wasn't clamping the parameters to 0 yet
(that doesn't really help though, because I still don't know how to get a parameterised function from this)
or maybe I do? just replace 2Pi by a parameter?
let me try that.
 
I thought the idea was to fix one theta and find the other theta to get the right area
 
yes, that's what I mean
hm, still 0
oh I think I see the problem
I can't use NIntegrate with variable integration limits
but of course the integration limits depend on theta
 
11:26 AM
Hmm that's a problem
 
I'll try doing it manually again
oh, and there was another mistake
 
Oh?
 
I can't just take the real part of the parameters, because for complex solutions the real part is still non-zero
hm, it looks like I'm off by a factor of r^2
(the peperoni radius)
can you please double check the correct area of 4 peperoni?
I get .125664
but my integration yields a hundredth of that
 
11:41 AM
Area of 4 pepperoni?
 
yeah
that's just 4 pi 0.01, right?
 
Yeah
 
hm I don't understand why my integration is off by a factor 100 then
 
Have you tried changing the radius and does it actually scale up quadratically?
e.g. to 0.01 pepperoni radius
 
hm, it seems to be out be a different factor if I change the radius to 0.2
 
11:46 AM
Yeah if it's not a strict quadratic factor it might be something else...
What's the code like?
 
the factor is more like 25 now
(instead of 100)
but wait
no that's correct
yeah it's still the radius squared
ohhhh
I used Norm[...] = r^2... but of course, Norm takes the square root
got it
 
Ah right
Nicely done
 
now I just need to print the current angle, every time I hit another full slice
yep, it works
0
0.464
2.834
2.956
4.208
4.399
5.236
5.466
5.695
now I can just reduce the step size to get better accuracy (it will be really slow though)
215 bytes
 
:D
That's pretty good
 
0
A: Sharing pizza fairly

Martin BüttnerMathematica, 215 bytes f=(A=Pi.01Length@#2/#;l=m/.Solve[Norm[{a,b}-m{Cos@t,Sin@t}]==.1,m];B=0;k=(l/.{a->#,b->#2})&@@@#2;Print@0;((B+=If[Im@#<0,0,d(Max[#2,0]^2-Max[#,0]^2)/2])&@@@(k/.{t->#});If[B>A,Print@#;B-=A])&/@Range[0,2Pi,d=1.*^-5];)& Ungolfed: f = ( A = Pi .01 Length@#2/#; l = m /....

 
11:54 AM
takes care of all kinds of weird cases ?
 
yup
(although I don't have any to test)
 
There's no reason it shouldn't
 
what happens when two pepperoni overlap ?
 
Have you tried single pepperoni in the centre? That should be easy to test
 
do you consider the shared area as double the weight ?
 
11:55 AM
You just add the slices, it shouldn't change anything
 
there is a nice pizza puzzle which I was wondering about
 
no, the slice angles falling on overlap will be much smaller
 
@Optimizer I'm integrating over all peperoni pieces independently, so overlapping is automatically taken into account
 
you have a finite number people and you want to cut up the pizza into equal shaped and sized pieces so that at least one person gets no crust
 
@Lembik concentric rings?
 
11:56 AM
@MartinBüttner not equal shapes
 
that is not same shape
 
oh
equal shapes
 
@Lembik its impossible
 
I thought equal areas
 
a@Optimizer it is possible if you have enough people
@Optimizer not possible with 2, clearly
the question is how many people do you need to have and how can you do it?
 
11:57 AM
@Lembik see, the shapes containing the crust will have to have 1 side as an arc
so that means all shapes will have to have an arc
with that constraint, you cannot cover 100% of the pizza area
 
@Optimizer the pieces can be rotated, mirror images
 
doesn't matter
 
@Sp3000 I think this answer calls for some nice Ell-style diagrams :D... I'm not sure I can be bothered though...
 
@Optimizer do you want abet? :)
 
Sure.
 
11:59 AM
Ahaha :P
 
@MartinBüttner Ell-style ?
 
@Sp3000 have you solved it already?
 
@Optimizer check out some of Ell's answers
 
Ell is a person ?
 
not sure how to turn it into programming challenge though
 
12:00 PM
10
A: Tension on a Graph, Part II: A Rubber Band

EllPython + matplotlib, 688 from pylab import* C=cross P,M=eval("map(array,input()),"*2) P,N=[[P[0]]+L+[P[-1]]for L in P,M] W=[.5]*len(P) def T(a,c,b): I=[(H[0]**2,id(n),n)for n in N for H in[(C(n-a,b-a),C(n-b,c-b),C(n-c,a-c))]if(min(H)*max(H)>=0)*H[1]*H[2]] if I:d=max(I)[2];A=T(a,c,d);B=T(d,c,b)...

4
A: False Positives on an Integer Lattice

EllC++, 275,000,000+ We'll refer to pairs whose magnitude is accurately representable, such as (x, 0), as honest pairs and to all other pairs as dishonest pairs of magnitude m, where m is the pair's wrongly-reported magnitude. The first program in the previous post used a set of tightly related cou...

 
it's amazing, that's what it is :D
 
@Optimizer Do you want to see a solution straight away or wait a bit?
 
straight away
@MartinBüttner but, that is just a spiral unwinding . Is it related to the question ?
 
12:02 PM
@Optimizer of course it is ^^ ... have you even read the question?
@Lembik neat :)
 
@Lembik Solved what exactly?
 
@MartinBüttner I tried reading it back then. Did not understand a bit :P
@Lembik so those point touches are not considered as crusts ? :P
 
@Optimizer right
@Sp3000 I just pasted a solution to the pizza puzzle
@Optimizer there is zero area of crust
 
Oh I wasn't replying to that
 
@Lembik I see. But is that scalable ?
I think its scalable to one more level - 18 people
 
12:10 PM
It would be interesting to try to work out a complete answer to which numbers of people admit a solution
@Optimizer how do I claim my massive winnings from you?
 
@Lembik doesn't every multiple of 6? (apart from 6)
 
@MartinBüttner are those the only solutions?
 
well yeah, that's not obvious
but at least all of those do, I think
 
I agree
with both parts :)
 
Yeah, I think every multiple of 6 is straight forward.
@Lembik come to my home. I'll treat you. :P
 
12:15 PM
@MartinBüttner oh! i.imgur.com/bxtbB.png
that's surprising!
 
@Lembik how is that useful?
 
@MartinBüttner it's a completely different solution
 
but it's the same shapes, and same number, no?
 
its on same terms
 
@MartinBüttner yes. Sorry it was just interesting that they are not "pizza slices"
ok it's not that interesting :)
I give in
it just surprised me
 
12:18 PM
what will be interesting is to take the number of slices as input
 
@Optimizer how is the spellchecker going? ;)
okay, I'm going back downstairs again, in hopes that the wifi will be usable now
 
without that same hand thing, I had it done in 20 bytes other than the string
 
but that's the interesting part ;)
 
yeah >.<
so basically small c and d should be on the same index in both strings ?
 
I think there's also small w and p, but yes
or rather, if you perform C with both hands in the same turn, you can cast a spell that involves c at that time.
 
12:25 PM
now if the two hands had two different spells which had the C at the same index, I get two spells or 1 ?
(as both the C must have been used up in 1 of them)
 
you get 1 if those C are in the current turn, but 2 if they were in a previous turn
 
let me give an example.
 
compare the magic mirror example (where you can only use w once) with the final example, (where you can use c for both elementals)
 
if the input is CDPWB and CSWWS . Do I get ["Dispel Magic", "Summon Elemental"] pair too or just ["Stab", "Summon Elemental"] ?
 
the input will be CDPWB and CSWWS
 
12:33 PM
yes , sorry.
 
but you don't get Dispel Magic, because that one finished last turn and not in the current turn
 
so. the answer is... ?
Current turn is B and S ?
 
ok so which means PWPWWC and BBSPPC will have the pair ["Haste", "Time stop"], correct ?
 
you can only cast one of them, because both need the two-hand gesture in the current turn.
that's a good example though, I'll add that.
 
12:37 PM
this is so complex.
 
I think you can handle a few cases separately:
 
ok, then other than both the spells being exactly same, no case will have both the spells as pair
 
if the last turn has the same gesture on both hands, check which spells can be cast with that two-hand gesture and cast them individually. (unless it's P and P, then only output Surrender)
and in any case, look at which spells can be cast on each individual hand, and output the cartesian product
@Optimizer hm, what do you mean?
 
currently, no two different spell combination can lead up to a situation where both the spell are ending in current turn and both require double hand gestures
 
ah yes, I think that's the case
 
12:41 PM
kewl
that's pretty easy then
 
well at least form the same hand, right?
 
what do you mean ?
 
in your example, you could cast both Time stop and Haste, but due to gestures on different hands
(and you have to decide which one to pick)
 
oh, so you mean that TS and H cannot be in the same pair, but can be in other pairs
 
yes (except they're not pairs, because spells ending in two-hand gestures should be output on their own)
 
12:43 PM
so "Haste", "Stab" is not a pair ?
 
you can't stab, and haste, because Haste needs C on both hands
 
in the first turn, the second hand did Stab, while the first hand was building up for "Haste" which completed in 6th turn. No ?
 
it doesn't matter what you did in previous turns. the question only asks which spells can be completed in the current turn
 
Oh! so any spell combination has to end on the last character.
ok got it
 

« first day (1420 days earlier)      last day (3417 days later) »