Last active
August 29, 2015 14:16
-
-
Save KushalP/d4bd195698faa4c7055e to your computer and use it in GitHub Desktop.
To solve a problem asked by @escmum: https://twitter.com/escmum/status/571658018766635008
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
class UserInput { | |
public static void main(String[] args) { | |
// Create a two dimensional array to hold user input. Using | |
// a boolean because we only care about there being | |
// "user input" present or not. | |
boolean[][] inputs = new boolean[18][28]; | |
// Set some values to show where user input has been triggered. | |
inputs[1][17] = true; | |
inputs[5][4] = true; | |
inputs[16][18] = true; | |
for (boolean[] row : inputs) { | |
for (boolean column : row) { | |
if (column == true) { | |
System.out.print(1); | |
} else { | |
System.out.print(0); | |
} | |
} | |
// Add a line break after printing every row. | |
System.out.println(""); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment