Code Examples
A repository of 155 code examples for BeepBeep
chess.WhiteVsBlack Class Reference

Process a database of chess games to calculate the number of white wins vs. More...

Static Public Member Functions

static void main (String[] args) throws IOException
 

Detailed Description

Process a database of chess games to calculate the number of white wins vs.

black wins. This example is a follow-up to a 2013 post by Tom Hayden, who performed the same calculation as a MapReduce job for Hadoop. The original input file, called the millionbase archive, is 1.74 GB big and contains about 2 million chess games.

The surprising finding about this example is that, while the Hadoop job reportedly takes 26 minutes to terminate, the BeepBeep pipeline takes a mere 35 seconds to compute the same result.

The program calculates the number of occurrences of each possible outcome:

  1. 1-0 (White wins)
  2. - (draw)
  3. 0-1 (Black wins)
  4. unknown (marked as a "*" in the database)

It does so with the following processor chain:

Pipeline

Running the program should produce the output:

{[Result "*"]=221.0, [Result "1-0"]=852305.0, [Result "1/2-1/2"]=690934.0, [Result "0-1"]=653728.0}
Total time: 37629 ms

Note: the example deliberately makes use of multiple syntactical shortcuts to reduce the size of the code as much as possible (at the price of some legibility).

Author
Sylvain Hallé

Definition at line 86 of file WhiteVsBlack.java.


The documentation for this class was generated from the following file: