<commit_before>package net.axstudio.axparty.guessword;

import java.util.Vector;

import android.content.Context;
import net.axstudio.axparty.guessword.Rule.PlayerType;

public class Game
{

	class Player
	{
		String name;
		String word;
		PlayerType type;

	}

	Game(Context context)
	{
		mContext = context;
	}

	Context mContext;
	Rule mRule;
	WordLibEntry mWords;

	Vector<Player> mPlayers = new Vector<Game.Player>();

	// Vector<Player> mMajors = new Vector<Game.Player>();
	// Vector<Player> mMinors = new Vector<Game.Player>();
	// Vector<Player> mIdiots = new Vector<Game.Player>();

	public void init(Rule rule, WordLibEntry words)
	{
		mRule = new Rule(rule.getData());
		mWords = words;

		for (int i = 0; i < mRule.getTotalPlayers(); ++i)
		{
			Player player = new Player();
			player.name = String.format(
					mContext.getString(R.string.player_name), i);
			mPlayers.add(player);

		}

	}

	public void start()
	{
		String[] w = mWords.genWord();

		Vector<Player> players = new Vector<Game.Player>(mPlayers);
		for (int i = 0; i < players.size(); ++i)
		{
			int j = (int) Math.floor(Math.random() * players.size());
			Player tmp = players.get(i);
			players.set(i, players.get(j));
			players.set(j, tmp);
		}

		// mMajors.clear();
		for (PlayerType type : PlayerType.values())
		{
			for (int i = 0; i < mRule.getNumPlayersByType(type); ++i)
			{
				Player p = players.firstElement();
				players.remove(0);
				p.type = type;
				p.word = w[type.ordinal()];
			}
		}<commit_msg>fix player default name, it's start from 1<commit_after>package net.axstudio.axparty.guessword;

import java.util.Vector;

import android.content.Context;
import net.axstudio.axparty.guessword.Rule.PlayerType;

public class Game
{

	class Player
	{
		String name;
		String word;
		PlayerType type;

	}

	Game(Context context)
	{
		mContext = context;
	}

	Context mContext;
	Rule mRule;
	WordLibEntry mWords;

	Vector<Player> mPlayers = new Vector<Game.Player>();

	// Vector<Player> mMajors = new Vector<Game.Player>();
	// Vector<Player> mMinors = new Vector<Game.Player>();
	// Vector<Player> mIdiots = new Vector<Game.Player>();

	public void init(Rule rule, WordLibEntry words)
	{
		mRule = new Rule(rule.getData());
		mWords = words;

		for (int i = 0; i < mRule.getTotalPlayers(); ++i)
		{
			Player player = new Player();
			player.name = String.format(
					mContext.getString(R.string.player_name), i+1);
			mPlayers.add(player);

		}

	}

	public void start()
	{
		String[] w = mWords.genWord();

		Vector<Player> players = new Vector<Game.Player>(mPlayers);
		for (int i = 0; i < players.size(); ++i)
		{
			int j = (int) Math.floor(Math.random() * players.size());
			Player tmp = players.get(i);
			players.set(i, players.get(j));
			players.set(j, tmp);
		}

		// mMajors.clear();
		for (PlayerType type : PlayerType.values())
		{
			for (int i = 0; i < mRule.getNumPlayersByType(type); ++i)
			{
				Player p = players.firstElement();
				players.remove(0);
				p.type = type;
				p.word = w[type.ordinal()];
			}
		}
{'fraction_non_alphanumeric': 0.15518945634266887, 'fraction_numerical': 0.0032948929159802307, 'mean_word_length': 3.47787610619469, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 23, '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': '5827009', 'n_tokens_mistral': 1244, 'n_tokens_neox': 1082, 'n_words': 249}