Last active
July 26, 2016 03:51
-
-
Save zachpendleton/6919727ef748dab7120c6ca700fb210c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
process.stdin.setEncoding("UTF-8"); | |
process.stdin.on("data", function(data) { | |
var gameState = JSON.parse(data); | |
if (gameState["winner"]) return; | |
var rowCount = gameState['board'].length; | |
var columnCount = gameState['board'][0].length; | |
process.stdout.write(Math.floor(Math.random() * columnCount).toString() + "\n"); | |
process.stdin.resume(); | |
}); | |
process.stdin.resume(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment