| |||||||||||
PyWeek - The difference between two anglesGiven you're at angle X, and you want to be at angle Y, which way do you turn? At first, it looks like you can just subtract them, but that doesn't work - it breaks down at the edges (i.e. you're at 1 and you want to go to 359). Happily, the kind folks on #pyweek were willing to help me out. For future reference, the answer is: Make a vector facing angle X and a vector facing angle Y. Take the cross product and look at the sign of the Z term (assuming X and Y are in the X-Y plane!) - this tells you which way to turn. I got that working and have thus uploaded a screenshot of 10 cops and 1 robber (i.e. you). Happily those white dots on the field are their waypoints, and they're chasing them and not you. So far....! — atiaxi on 2006/09/06 01:03 of Team Zankar |
Last Challenge
September 2008 [entries, ratings] Previous March 2008 [entries, ratings] September 2007 [entries, ratings] April 2007 [entries, ratings] > September 2006 [entries, ratings] March 2006 [entries, ratings] (June 2006) August 2005 [entries, ratings] Not logged in Login | ||||||||||