the other side of the firewall

September 27, 2005

Rational geometry (cont’d)

I made a recent post about rational geometry, or a way to solve geometric problems with no need for trigonometric functions.

My intuition is that this new (apparently the Chinese invented it more than a thousand years ago) way of doing geometry can be very useful for machines.

I ran a very simple experiment. At the end of Chapter 1 from the referenced book, there is a simple geometric problem with the traditional solution and the rational solution.
I have implemented the solution in Java and run some measurements. The rational solution is x4 faster.
Note that the code requires Java 1.5, in order to access the new nanosecond timer.

The output is as follows:

java Geometry
3.313693059275397 computed in 200000ns
3.3136930592753853 computed in 23000ns
3.313693059275397 computed in 1046.7512ns
3.3136930592753853 computed in 250.1114ns


public class Geometry
{
public static void main(String args[])
{
long start, end;
int ITER = 5000000;

/* WARMING UP */

// traditional way
start = getTime();
double alpha = Math.acos( (float)3/4);
double beta = Math.PI - Math.PI/4 - alpha;
double d = 5 * Math.sin(alpha) / Math.sin(beta);
end = getTime();
System.out.println(d + " computed in " + (end-start) + "ns");

// rational geometry
start = getTime();
double q1 = 1400 - 525*Math.sqrt(7);
double d1 = Math.sqrt(q1);
end = getTime();
System.out.println(d1 + " computed in " + (end-start) + "ns");

/* WE ARE WARMED UP */

// traditional way
start = getTime();
for(int i=0; i {
alpha = Math.acos( (float)3/4);
// System.out.println("alpha: " + alpha);
beta = Math.PI - Math.PI/4 - alpha;
// System.out.println("beta: " + beta);
d = 5 * Math.sin(alpha) / Math.sin(beta);
}
end = getTime();
System.out.println(d + " computed in " + (end-start)/(float)ITER + "ns");

// rational geometry
start = getTime();
for(int i=0; i {
q1 = 1400 - 525*Math.sqrt(7);
d1 = Math.sqrt(q1);
}
end = getTime();
System.out.println(d1 + " computed in " + (end-start)/(float)ITER+ "ns");

}

public final static long getTime()
{
return System.nanoTime();
}

}

September 22, 2005

Virtual plague spreading like wildfire in World of Warcraft

Filed under: Games and Gaming

Virtual plague spreading like wildfire in World of Warcraft

This is one of the most interesting stories I have read.
It reminds me of a movie called The 13th Floor where a game goes beyond its purpose.

September 18, 2005

Poker software

Filed under: Games and Gaming

I have just been iniated to Texas Hold’em Poker.
To improve my game, I am looking for a decent software to run on my handheld.

Here are some possible candidates that I need to evalute:

See also a list of poker software here.






















Get free blog up and running in minutes with Blogsome | Theme designs available here