<commit_before>package pl.dom3k.picipolo.server;

import java.util.Random;

/**
 * Created by Januszek on 2016-05-10. Welcome!
 */
public class Game {
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Game game = (Game) o;
        return name.equals(game.name);

    }

    @Override
    public int hashCode() {
        return name.hashCode();
    }

    public String getName() {
        return name;
    }

    String name;
    User[] players;
    long[] points;
    Change lastChange;
    int turn;
    boolean priv;

    Game(String name,User first,boolean priv){
        this.name = name;
        players = new User[2];
        points = new long[2];
        lastChange = new Change(-2);
        players[0]=first;
        points[0]=0;
        points[1]=0;
        this.priv=priv;
        turn = -1;
    }

    Game(String name,User first,User second,boolean priv){
        this.name = name;
        players = new User[2];
        points = new long[2];
        lastChange = new Change(-1);
        players[0]=first;
        players[1]=second;
        points[0]=0;
        points[1]=0;
        this.priv=priv;
        turn = 0;
    }

    public int getUserIndex(String name)throws Exception{
        int result = -1;
        for (int i=0;i<players.length;i++){
            if (players[i]!=null&&players[i].compareName(name)) result = i;
        }
        return result;
    }

    public Change makeMove(int playerIndex ,int number,int cardNumber)throws Exception{
        if (playerIndex!=turn) return new Change(1);
        Change change = null;
        int zero = new Random().nextInt()%100;
        int one = new Random().nextInt()%100;
        long old = points[playerIndex];
        String sign = null;
        String otherSign = null;
        if (cardNumber<1){
            sign = useSign(playerIndex,number,zero,true);
            otherSign = useSign(playerIndex,number,one,false);
        }else{
            sign = useSign(playerIndex,number,one,true);
            otherSign = useSign(playerIndex,number,zero,false);
        }
        change = new Change(points[playerIndex],points[playerIndex]-old,sign,players[playerIndex].getName(),number,otherSign);
        lastChange=change;
        turn = (turn+1)%2;
        return change;
    }

    private String useSign(int playerIndex,int number, int signNumber, boolean flag)throws Exception{
        String sign = null;
        if (signNumber<35){
            sign = "+";
            if (flag) points[playerIndex]+=number;
        }else if (signNumber<65){
            sign = "-";
            if (flag) points[playerIndex]-=number;
        }else if (signNumber<80){
            sign = "*";
            if (flag) points[playerIndex]*=number;
        }else if(signNumber<95){
            sign = "/";
            if (flag) points[playerIndex]/=number;
        }else{
            sign = "=";
            if (flag) points[playerIndex]=number;
        }<commit_msg>0 condition before sign "/".<commit_after>package pl.dom3k.picipolo.server;

import java.util.Random;

/**
 * Created by Januszek on 2016-05-10. Welcome!
 */
public class Game {
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Game game = (Game) o;
        return name.equals(game.name);

    }

    @Override
    public int hashCode() {
        return name.hashCode();
    }

    public String getName() {
        return name;
    }

    String name;
    User[] players;
    long[] points;
    Change lastChange;
    int turn;
    boolean priv;

    Game(String name,User first,boolean priv){
        this.name = name;
        players = new User[2];
        points = new long[2];
        lastChange = new Change(-2);
        players[0]=first;
        points[0]=0;
        points[1]=0;
        this.priv=priv;
        turn = -1;
    }

    Game(String name,User first,User second,boolean priv){
        this.name = name;
        players = new User[2];
        points = new long[2];
        lastChange = new Change(-1);
        players[0]=first;
        players[1]=second;
        points[0]=0;
        points[1]=0;
        this.priv=priv;
        turn = 0;
    }

    public int getUserIndex(String name)throws Exception{
        int result = -1;
        for (int i=0;i<players.length;i++){
            if (players[i]!=null&&players[i].compareName(name)) result = i;
        }
        return result;
    }

    public Change makeMove(int playerIndex ,int number,int cardNumber)throws Exception{
        if (playerIndex!=turn) return new Change(1);
        Change change = null;
        int zero = new Random().nextInt()%100;
        int one = new Random().nextInt()%100;
        long old = points[playerIndex];
        String sign = null;
        String otherSign = null;
        if (cardNumber<1){
            sign = useSign(playerIndex,number,zero,true);
            otherSign = useSign(playerIndex,number,one,false);
        }else{
            sign = useSign(playerIndex,number,one,true);
            otherSign = useSign(playerIndex,number,zero,false);
        }
        change = new Change(points[playerIndex],points[playerIndex]-old,sign,players[playerIndex].getName(),number,otherSign);
        lastChange=change;
        turn = (turn+1)%2;
        return change;
    }

    private String useSign(int playerIndex,int number, int signNumber, boolean flag)throws Exception{
        String sign = null;
        if (signNumber<35){
            sign = "+";
            if (flag) points[playerIndex]+=number;
        }else if (signNumber<65){
            sign = "-";
            if (flag) points[playerIndex]-=number;
        }else if (signNumber<80){
            sign = "*";
            if (flag) points[playerIndex]*=number;
        }else if(signNumber<95&&number!=0){
            sign = "/";
            if (flag) points[playerIndex]/=number;
        }else{
            sign = "=";
            if (flag) points[playerIndex]=number;
        }
{'fraction_non_alphanumeric': 0.1284072249589491, 'fraction_numerical': 0.016091954022988506, 'mean_word_length': 2.068513853904282, 'pattern_counts': {'":': 0, '<': 15, '<?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': '116129', 'n_tokens_mistral': 1834, 'n_tokens_neox': 1792, 'n_words': 436}