Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for (int i = 0; i < 10; i++) {
- int randomIndex = (int) (Math.random() * questions.size());
- getQuestion(randomIndex);
- checkInputMatch(randomIndex);
- }
- how this
- or this
- for (int i = 0; i < MAX_LINE; i++) {
- line = bufferedReader.readLine().toLowerCase(Locale.ROOT);
- arrayList.add(line);
- }
- or this
- private void addAllVideos(BufferedReader bufferedReader) throws IOException {
- String line;
- int MAX_LINE = 22;
- for (int i = 0; i < MAX_LINE; i++) {
- line = bufferedReader.readLine().toLowerCase(Locale.ROOT);
- videos.add(new Video(line, LocalDate.now()));
- }
- }
- or this
- for (int i = 0; i < sampleMorseCodeInput.length(); i++){
- letterToMorseCode(sampleMorseCodeInput, i);
- audioInitialization.pathForAudio(sampleMorseCodeInput, i);
- }
- or this
- private boolean isDraw() {
- for (Cell[] players : getGrid()) {
- for (int i = 0; i < getGrid().length; i++) {
- if (players[i] == null || players[i].getSymbol().equals(" ") || isWinner(Cell.HUMAN)) {
- return false;
- }
- }
- }
- return true;
- }
- or this
- private void runHumansTurn() {
- System.out.println("Pick a number from 1 - 9 ");
- int humanSelectedPosition = input.nextInt();
- while (isCellTaken(getCellPositioning(humanSelectedPosition)) || isRightInput(humanSelectedPosition)) {
- System.out.println("Try again ");
- humanSelectedPosition = input.nextInt();
- }
- getGrid()[(humanSelectedPosition - 1) / 3][(humanSelectedPosition - 1) % 3] = Cell.HUMAN;
- }
- or this
- private void displayGrid() {
- for (Cell[] players : getGrid()) {
- for (int index = 0; index < getGrid().length; index++) {
- String symbolText = players[index] == null ? " " : players[index].getSymbol();
- String delimiter = isLastRowIndex(index % getCols()) ? "\n" : "|";
- System.out.print(symbolText + delimiter);
- }
- }
- }
- or this
- private boolean rightToLeftDiagonalWin(Cell userCharacter) {
- for (int rows = 0; rows < ROWS; rows++) {
- Cell cell = grid[COLS - rows - 1][rows];
- if (cell != userCharacter) {
- return false;
- }
- }
- return true;
- }
- or this
- private boolean leftToRightDiagonalWin(Cell userCharacter) {
- for (int i = 0; i < ROWS; i++) {
- Cell cell = grid[i][i];
- if (cell != userCharacter) {
- return false;
- }
- }
- return true;
- }
- or this
- private boolean hasWonVertically(Cell userCharacter) {
- for (int col = 0; col < COLS; col++) {
- boolean isColWon = true;
- for (int row = 0; row < ROWS; row++) {
- Cell cellIndex = grid[row][col];
- if (cellIndex != userCharacter) {
- isColWon = false;
- break;
- }
- }
- if (isColWon) {
- return true;
- }
- }
- return false;
- }
- or this
- private int balanceCondition(int balance, int balanceLimit, String message) {
- while (balance > balanceLimit) {
- System.out.println(message);
- balance = input.nextInt();
- }
- return balance;
- }
Add Comment
Please, Sign In to add comment