Created
December 10, 2010 04:55
-
-
Save mstine/735806 to your computer and use it in GitHub Desktop.
Solution to Lucky 13 Contest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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