Skip to content

Instantly share code, notes, and snippets.

@mstine
Created December 10, 2010 04:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mstine/735806 to your computer and use it in GitHub Desktop.
Save mstine/735806 to your computer and use it in GitHub Desktop.
Solution to Lucky 13 Contest
import org.codehaus.jackson.map.ObjectMapper;
import java.util.Map;
import java.net.URL;
import java.io.*;
public class Lucky13 {
public int pay(int bet) throws Exception {
return new ObjectMapper().readValue(new BufferedReader(new InputStreamReader(new URL("http://roulette.engineyard.com/")
.openStream())).readLine(), Map.class).get("winning_number").equals("13") ? 35 * bet : 0;
}
public static void main(String[] args) throws Exception {
System.out.println("Payout: " + new Lucky13().pay(50));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment