<commit_before>package com.java.laiy.controller;

import com.java.laiy.model.Board;
import com.java.laiy.model.Figure;
import com.java.laiy.model.Player;
import com.java.laiy.helpers.CoordinateHelper;
import com.java.laiy.model.exceptions.InvalidPointException;
import com.java.laiy.model.exceptions.PointOccupiedException;

public class GameController {

    private static final String GAME_NAME = "XO";

    private static final int FIRST_PLAYER = 0;

    private static final int SECOND_PLAYER = 1;

    private static final int DIAG_UP = 1;

    private static final int DIAG_DOWN = 0;

    private static final int DIAGS_FOR_CHECK = 2;

    private final String gameName;

    private final Player[] players;

    private final Board board;

    public GameController(final String gameName, final Player[] players, final Board board) {
        if (gameName == null || gameName.isEmpty()) {
            this.gameName = GAME_NAME;
        } else {
            this.gameName = gameName;
        }
        this.board = board;
        this.players = players;
    }

    public Player getWinner() {
        for ( Player playerForCheck : players) {
            if (checkRowsForWin(playerForCheck.getFigure().toString()) ||
                checkLinesForWin(playerForCheck.getFigure().toString()) ||
                checkDiagsForWin(playerForCheck.getFigure().toString())) {
                return playerForCheck;
            }
        }
        return null;
    }

    public  String getGameName() {
        return gameName;
    }

    public Player[] getPlayers() {
        return players;
    }

    public Board getBoard() {
        return board;
    }

    public void move(final int x, final int y, final Player player) throws PointOccupiedException {
        try {
            if (board.getFigure(x,y) != null) {
                throw new PointOccupiedException();
            }
            else {
                try {
                    board.setFigure(x, y, player.getFigure());
                } catch (InvalidPointException e) {
                    e.printStackTrace();
                }
            }
        } catch (InvalidPointException e) {
            e.printStackTrace();
        }<commit_msg>GameController updated by getNextTurn<commit_after>package com.java.laiy.controller;

import com.java.laiy.model.Board;
import com.java.laiy.model.Figure;
import com.java.laiy.model.Player;
import com.java.laiy.helpers.CoordinateHelper;
import com.java.laiy.model.exceptions.InvalidPointException;
import com.java.laiy.model.exceptions.PointOccupiedException;

public class GameController {

    private static final String GAME_NAME = "XO";

    private static final int FIRST_PLAYER = 0;

    private static final int SECOND_PLAYER = 1;

    private static final int DIAG_UP = 1;

    private static final int DIAG_DOWN = 0;

    private static final int DIAGS_FOR_CHECK = 2;

    private final String gameName;

    private final Player[] players;

    private final Board board;

    public GameController(final String gameName, final Player[] players, final Board board) {
        if (gameName == null || gameName.isEmpty()) {
            this.gameName = GAME_NAME;
        } else {
            this.gameName = gameName;
        }
        this.board = board;
        this.players = players;
    }

    public Player getWinner() {
        for ( Player playerForCheck : players) {
            if (checkRowsForWin(playerForCheck.getFigure().toString()) ||
                checkLinesForWin(playerForCheck.getFigure().toString()) ||
                checkDiagsForWin(playerForCheck.getFigure().toString())) {
                return playerForCheck;
            }
        }
        return null;
    }

    public  String getGameName() {
        return gameName;
    }

    public Player[] getPlayers() {
        return players;
    }

    public Board getBoard() {
        return board;
    }

    public void move(final int x, final int y, final Player player) throws PointOccupiedException {
        try {
            if (board.getFigure(x,y) != null) {
                throw new PointOccupiedException();
            }
            else {
                try {
                    board.setFigure(x, y, player.getFigure());
                } catch (InvalidPointException e) {
                    e.printStackTrace();
                }
            }
        } catch (InvalidPointException e) {
            e.printStackTrace();
        }
    }

    public boolean getNextTurn(){
        final Figure[][] figures =  getBoard().getFiguresArray();
        if (getWinner() != null){
            return false;
        }
        for (Figure[] figureArray : figures) {
            for (Figure figureValue : figureArray) {
                if (figureValue == null) {
                    return true;
                }
            }
        }
        return false;
{'fraction_non_alphanumeric': 0.09175066858671055, 'fraction_numerical': 0.002057189878625797, 'mean_word_length': 2.003088326127239, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '522417', 'n_tokens_mistral': 1359, 'n_tokens_neox': 1290, 'n_words': 332}