Skip to content

Instantly share code, notes, and snippets.

View gonaumov's full-sized avatar
💭
a status

George Naumov gonaumov

💭
a status
View GitHub Profile
package tictactoe;
import java.util.Scanner;
public class TikTakToeGame {
private final char[][] state = {
{'_', '_', '_'},
{'_', '_', '_'},
{'_', '_', '_'}
};
package tictactoe;
public enum Messages {
ASK_COORDINATES("Enter the coordinates: "),
ERROR_ONLY_NUMBERS("You should enter numbers!"),
ERROR_INCORRECT_RANGE("Coordinates should be from 1 to 3!"),
ERROR_OCCUPIED_CELL("This cell is occupied! Choose another one!"),
NOT_FINISHED("Game not finished"),
DRAW("Draw"),
WINNER_X("X wins"),
package tictactoe;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
TikTakToeGame game = new TikTakToeGame();
System.out.println(game.getState());
System.out.print(Messages.ASK_COORDINATES.message);
package tictactoe;
import java.util.Scanner;
public class TikTakToeGame {
private char[][] state;
private int column;
private int row;
public TikTakToeGame(char[][] initialState) {
package tictactoe;
public enum Messages {
ASK("Enter cells: "),
ASK_COORDINATES("Enter the coordinates: "),
ERROR_ONLY_NUMBERS("You should enter numbers!"),
ERROR_INCORRECT_RANGE("Coordinates should be from 1 to 3!"),
ERROR_OCCUPIED_CELL("This cell is occupied! Choose another one!"),
NOT_FINISHED("Game not finished"),
DRAW("Draw"),
package tictactoe;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in).useDelimiter("");
char[][] state = new char[3][3];
int i = 0;
int j = 0;
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int sum = 0;
int num;
boolean barrier = false;
while (!barrier) {
num = scanner.nextInt();
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int externalSize = scanner.nextInt();
int internalSize = scanner.nextInt();
int[][] matrix = new int[externalSize][internalSize];
for (int i = 0; i < matrix.length; i++) {
for (int j = 0; j < matrix[i].length; j++) {
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int max = 0;
while (scanner.hasNextInt()) {
int input = scanner.nextInt();
if (input % 4 == 0 && input > max) {
max = input;
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int shape = scanner.nextInt();
String message;
switch (shape) {
case 1:
message = "You have chosen a square";