Moderators: Magistrates, Prelates, Moderators General
import math
x = 'x'
y = 'y'
v = 'v'
a = 'a'
maxv = 'maxv'
ang = 'ang'
dt = 0.01
def target(alpha,beta):
dist = math.sqrt((alpha[x]-beta[x])**2+(alpha[y]-beta[y])**2)
if alpha[x] == beta[x]:
if alpha[y] > beta[y]:
gamma = 3.0*math.pi/2.0
else:
gamma = math.pi/2.0
else:
gamma = math.atan((alpha[y]-beta[y])/(alpha[x]-beta[x]))
if alpha[x] > beta[x]:
gamma = math.pi-gamma
return (dist,gamma)
def move(mob):
global x, y, v, a, maxv, ang, dt
mob[x] += mob[v]*dt*math.cos(mob[ang])
mob[y] += mob[v]*dt*math.sin(mob[ang])
def flee(deg):
global x, y, v, a, maxv, ang, dt
dist0 = 20.0
t = 0.0
r1 = { x: dist0, y: 0.0, v: 0.0, a: 4.0, maxv: 10.0, ang:0.0 }
r2 = { x: dist0*math.cos(2.0*math.pi/3.0), y: dist0*math.sin(2.0*math.pi/3.0), v:0.0, a:4.0, maxv: 25.0, ang:0.0 }
you = { x: 0.0, y: 0.0, v:6.0, a:0.0, maxv:6.0, ang:2.0*math.pi*deg/360.0 }
for nada in range(10000):
t += dt
move(you)
dist, gamma = target(r1,you)
if dist < r1[v]*dt:
#print 'Caught by wounded raptor at %f seconds' % t
break
r1[v] += r1[a]*dt
if r1[v] > r1[maxv]: r1[v] = r1[maxv]
r1[ang] = gamma
move(r1)
dist, gamma = target(r2,you)
if dist < r2[v]*dt:
#print 'Caught by able raptor at %f seconds' % t
break
r2[v] += r2[a]*dt
if r2[v] > r2[maxv]: r2[v] = r2[maxv]
r2[ang] = gamma
move(r2)
return t
for delta in range(18600,18700):
print delta/1000.0,flee(delta/1000.0)
xkcd wrote:zombiereagan wrote:beyond the need for a good dinosaur movie is the need for a sweet dinosaur killing video game. The first two Dino Hunter's were a good time but the 3rd one was terrible and i need my raptor hunting fix. Or rather i want to test my wits against a pack of intelligent raptors rather than just blast them with my autoaim as they appear on screen.
I've always wanted the game where you play as the dinosaurs, but only if done well. Like, where they do a good job of making you feel like you're actually a dinosaur, and not just watching one move in response to your commands. Like Oni was with martial arts, when compared to the six minutes of BloodRayne I played..
The Mighty Thesaurus wrote:Why? It does nothing to address dance music's core problem: the fact that it sucks.
Verysillyman wrote:Try "rapid". It's the new "cool".
SecondTalon wrote:A pile of shit can call itself a delicious pie, but that doesn't make it true.
Narsil wrote:There's a game coming out called ParaWorld, which is an RTS featuring dinosaurs. With frickin' laser beams attached. If that dosen't excite you you may very well be dead.
http://pc.ign.com/objects/682/682114.html
Insignificant Deification wrote:Because, sometimes, you've gotta have a taste of vulva
Jazzerus wrote:And if they are hurt, would it be possible to further hurt them in attempt to gain more distance before being eaten?
Insignificant Deification wrote:Because, sometimes, you've gotta have a taste of vulva
Tipa wrote:Someone linked this comic to another blog and it just kept wearing me down every time I read that blog, so I came up with the answers.
1) You will get 37.5m in 6.217s before you're eaten. The raptor doesn't even have time to get to his max speed.
HMBeast wrote:Am I the only one who noticed that in problem 1, a raptor's top speed is said to be 25 m/s, in problem 2, a wounded raptor is said to run at 10 m/s, while in problem 3, it's said that raptors in general run at 10 m/s.
Jazzerus wrote:Also, why are the raptors in question 3 limited to 10 m/s instead of 25 m/s as in question 1? Are they hurt too?
ArbiterOne wrote:Tell me if this is right. I tried to 'intuit' my way through this.
Since the system is symmetrical, there are two correct angles.
The angle you need to run is between the wounded raptor and a non-wounded raptor (either side). Now, my guess would be that it would be:
- Code: Select all
angle between raptors * ( speed of wounded raptor / (speed of wounded raptor + speed of non-wounded raptor) )
120 * ( 10 / (10 + 25) )
~= 34.285 degrees
or 274.285 degrees
... is there actually a canonical answer to this?
POST THE MAP so we can do question 3!
el stubbso wrote:ArbiterOne wrote:Tell me if this is right. I tried to 'intuit' my way through this.
Since the system is symmetrical, there are two correct angles.
The angle you need to run is between the wounded raptor and a non-wounded raptor (either side). Now, my guess would be that it would be:
- Code: Select all
angle between raptors * ( speed of wounded raptor / (speed of wounded raptor + speed of non-wounded raptor) )
120 * ( 10 / (10 + 25) )
~= 34.285 degrees
or 274.285 degrees
... is there actually a canonical answer to this?
POST THE MAP so we can do question 3!
isnt the answer 24 degrees or 336 degrees because: there is an angle of 60 degrees between the wounded raptor (10ms^-1) and a healthy raptor (25ms^-1), thus, logic would dictate that 10/25 = x/60 , thus x = 24 and 24 degrees is the answer. (as well as 336 degrees which is on the other side of the raptor [360-24=336])
Lujan wrote:Hello everyone,
I'm one of them "long time reader/first time poster" types. I posed the second question in the quiz as a question to some students as a joke, then decided that I should actually solve it. Looking around the internet and these boards, it seems that the problem is pretty effectively solved when you assume the raptors constantly turn to face you as you run. I decided to modify the problem such that the raptors are intelligent enough to lead you such that they move in a straight line.
I analyzed the problem two ways: assuming instant accelerations and accelerations as given in the problem. The results are summarized in a pdf (explaining the approach) and an excel sheet (with the work):
xls
The results are as follows:
If the raptors instantly accelerate to their top speeds:
The maximum possible lifetime of .54 seconds occurs when you run straight at the wounded raptor (the healthy raptors still grab you).
The minimum possible lifetime of .37 seconds occurs when you run straight at either of the healthy raptors.
If the raptors accelerate as described in the problem:
The maximum possible lifetime of 2.68 seconds occurs when you run directly between any two of the raptors (so if 0 radians points straight at a raptor, choose pi/3, pi, or 5pi/3 radians) -- the fact that one is wounded makes no difference!
The minimum possible lifetime of 1.34 seconds occurs when you run directly at any of the three raptors -- again, the fact that one is wounded makes no difference.
This is because the raptors accelerate at the same rate; the wounded one stops accelerating faster, (after 2.5 seconds as opposed to 6.25 seconds), but almost all of the action has occurred by then - the maximum possible lifetime of 2.68 seconds means that the healthy raptors continue to accelerate for all of .13 seconds. This just isn't enough to make any appreciable difference.
Anyway, I just thought I'd add my contribution to the discussion. Comments are welcome!
(Raptor.java::public class Raptor)
public boolean updatePosition(double dt, Movable target)
{
//After consulting the XKCD author, we have decided to remember only a linear velocity, and allow very speedy turns for the velociraptors. Perhaps this isn't a very good approximation, but for now, we'll allow the raptors to accellerate at the given rate until they reach max velocity.
double dx = target.getX() - this.getX();
double dy = target.getY() - this.getY();
double distance = Math.sqrt(dx * dx + dy * dy);
//start mod
double direction = Math.atan2(dy, dx);
double ax = ACCELERATION * dt * Math.cos(direction);
double ay = ACCELERATION * dt * Math.sin(direction);
double facing, speed;
//End mod
//This is the "caught" distance, which is also modified
if (distance < 3.25)
{
return true;
}
//start mod
currentXVelocity += ax;
currentYVelocity += ay;
speed = Math.sqrt(currentXVelocity*currentXVelocity+currentYVelocity*currentYVelocity);
if(speed > v){
facing = Math.atan2(currentYVelocity, currentXVelocity);
currentXVelocity = v * Math.cos(facing);
currentYVelocity = v * Math.sin(facing);
}
x += currentXVelocity * dt + ax * dt * dt; // x = x0 + v0*t + a*t^2
y += currentYVelocity * dt + ay * dt * dt; // y = y0 + v0*t + a*t^2
//end mod
return false;
}
jasonsewall wrote:You're quite close, but I disagree - while you can run 37.3m in 6.217s, the raptor reaches his maximum speed at 5.8 seconds - 25(m/s) / 4(m/s^2) = 5.8s.
Elvish Pillager wrote:There's something wrong with the "Raptors run directly towards you at whatever speed they're going" model, and here's why: Let's say a raptor is moving at a little less than 6 m/s, and it's one meter away from me. Now, I can travel two or three meters in less than a second, so the raptor's speed doesn't appreciably increase - I can set up the situation so that it won't exceed 6 m/s in that time. The interesting thing is that as long as it's moving slower than me, it can never catch me unless I run directly onto it - so I can run 180 degrees around it, in less than a second. Under the naive model, the raptor would have just switched - in under a second - from almost 6 m/s in one direction to almost 6 m/s in the other, which clearly violates its 4 m/s^2 acceleration limit.
At this point I would calculate the optimal strategy and duration of survival for the three-raptors problem, using a true maximum of 4 m/s^2 acceleration in any direction for the raptors. The reason I do not: If we assume, as we have been assuming, that both you and the raptors can be represented by a single point each, then, as long as my acceleration is the tiniest fraction greater than that of all the raptors, I can avoid them indefinitely.
I invite anyone to calculate the minimum distance a raptor with 4 m/s^2 maximum acceleration must be able to reach its prey at in order to be able to catch a human who can instantly change it speed to 6 m/s in any direction, given optimal play from both the raptor and the human. (I'd do it myself, but it's getting late here.)
Narsil wrote:There's a game coming out called ParaWorld, which is an RTS featuring dinosaurs. With frickin' laser beams attached. If that dosen't excite you you may very well be dead.
http://pc.ign.com/objects/682/682114.html
Return to Individual XKCD Comic Threads
Users browsing this forum: mscha, Soup, yappobiscuits and 17 guests