<commit_before>package player;

import game.Answer;
import game.Question;

public class SinglePlayerAI implements Player {

	@Override
	public Answer PerformTurn(Question question) {
		// TODO Auto-generated method stub
		return null;
	}
	
	public void setID(int id){
		
	}
	
	public String getName()
	{
		return "Single player AI";
	}

}<commit_msg>Added example of object storing/loading to single player AI<commit_after>package player;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.Arrays;

import game.Answer;
import game.Question;

public class SinglePlayerAI implements Player {

	public int[] testCache = new int[100];
	private static final String filename = "testCache.bin";
	
	@Override
	public Answer PerformTurn(Question question) {
		// TODO Auto-generated method stub
		return null;
	}
	
	@Override
	public void reset(int id){
		
	}
	
	public static void main(String[] args) {
		java.util.Random rand = new java.util.Random();
		SinglePlayerAI ai = new SinglePlayerAI();
		ai.loadArray();
		ai.testCache[rand.nextInt(ai.testCache.length)] = rand.nextInt();
		
		System.out.println(Arrays.toString(ai.testCache));
		
		ai.finalize();
	}
	
	public void loadArray()
	{
		try {
			FileInputStream fis = new FileInputStream(filename);
			ObjectInputStream ois = new ObjectInputStream(fis);
			testCache = (int[]) ois.readObject();
			ois.close();
			fis.close();
		} catch (Exception e) {
			System.out.println("WARNING! cache not loaded");
			testCache = new int[100];
		}
	}
	
	@Override
	public void finalize(){
		//Save lookup table to persistent medium
		try {
			FileOutputStream fos = new FileOutputStream(filename);
			ObjectOutputStream oos = new ObjectOutputStream(fos);
			oos.writeObject(testCache);
			oos.close();
			fos.close();
		} catch (IOException e) {
			System.out.println("WARNING! cache not stored");
		}
	}
	
	@Override
	public String getName()
	{
		return "Single player AI";
	}

}
{'fraction_non_alphanumeric': 0.111328125, 'fraction_numerical': 0.0029296875, 'mean_word_length': 4.059259259259259, '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': '1185535', 'n_tokens_mistral': 697, 'n_tokens_neox': 618, 'n_words': 173}