<commit_before>﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class box_script : MonoBehaviour {
    public int stanje = 0;
    public int pozicija = -1;
    public int parent = -1;
    private GameController gameController;

    [SerializeField] Sprite[] images;
    Image myImage;


    private void Start () {
        stanje = 0;
        gameController = FindObjectOfType<GameController>();
        myImage = GetComponent<Image>();
        myImage.sprite = images[0];
    }

    public void onClick () {
        Debug.Log("Here");
        if (!legalMove()) {
            Debug.Log("Ilegal");
            return;
        }

        gameController.nextMoveHint(pozicija);

        gameController.prejsnjaPoteza = pozicija;

        if (gameController.firstPlayer) {
            stanje = 1;
        } else {
            stanje = 2;
        }

        myImage.sprite = images[stanje];

        gameController.cubeBoxesList[parent].GetComponent<CubeBox>().izpisiOtroke();

        
        
        if (gameController.cubeBoxesList[parent].GetComponent<CubeBox>().triVVrsto()) {
            //TODO: Kdo je zmagal
            if(!gameController.firstPlayer) {
                gameController.cubeBoxesList[parent].GetComponent<Image>().sprite = images[2];
            }
            else {
                gameController.cubeBoxesList[parent].GetComponent<Image>().sprite = images[1];
            }
            gameController.cubeBoxesList[parent].gameObject.SetActive(true);
            Debug.Log("Zmaga v majhnem");
        }

        if (gameController.konecIgre()) {
            //TODO: Kdo je zmagal
            Debug.Log("Zmaga");
        }

        gameController.firstPlayer = !gameController.firstPlayer;

    }

    bool legalMove () {
        // Prva poteza
        if (gameController.prejsnjaPoteza == -1) {
            return true;
        }
        
        return gameController.prejsnjaPoteza == parent && stanje == 0;
    }
}<commit_msg>Siplify some code<commit_after>﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class box_script : MonoBehaviour {
    public int stanje = 0;
    public int pozicija = -1;
    public int parent = -1;
    private GameController gameController;

    [SerializeField] Sprite[] images;
    Image myImage;


    private void Start () {
        stanje = 0;
        gameController = FindObjectOfType<GameController>();
        myImage = GetComponent<Image>();
        myImage.sprite = images[0];
    }

    public void onClick () {
        Debug.Log("Here");
        if (!legalMove()) {
            Debug.Log("Ilegal");
            return;
        }

        gameController.nextMoveHint(pozicija);

        gameController.prejsnjaPoteza = pozicija;

        if (gameController.firstPlayer) {
            stanje = 1;
        } else {
            stanje = 2;
        }

        myImage.sprite = images[stanje];

        gameController.cubeBoxesList[parent].GetComponent<CubeBox>().izpisiOtroke();

        
        
        if (gameController.cubeBoxesList[parent].GetComponent<CubeBox>().triVVrsto()) {
            gameController.cubeBoxesList[parent].GetComponent<Image>().sprite = images[stanje];
            gameController.cubeBoxesList[parent].gameObject.SetActive(true);
            Debug.Log("Zmaga v majhnem");
        }

        if (gameController.konecIgre()) {
            //TODO: Kdo je zmagal
            Debug.Log("Zmaga");
        }

        gameController.firstPlayer = !gameController.firstPlayer;

    }

    bool legalMove () {
        // Prva poteza
        if (gameController.prejsnjaPoteza == -1) {
            return true;
        }
        
        return gameController.prejsnjaPoteza == parent && stanje == 0;
    }
}
{'fraction_non_alphanumeric': 0.11032308904649331, 'fraction_numerical': 0.005253480430785396, 'mean_word_length': 2.0809061488673137, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 14, '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': '490376', 'n_tokens_mistral': 1145, 'n_tokens_neox': 1110, 'n_words': 200}