Newer
Older
hanabi-networking / src / MainTest.java
import java.io.File;
import java.io.FileReader;
import java.io.IOException;

import org.json.JSONException;
import org.json.JSONObject;
import org.json.JSONTokener;

import card.Card;
import player.BasePlayer;

public class MainTest {
	private static class Opts {
		String playerFile;

		Opts(String[] args) {
			// TODO dummy
			// TODO error handling here, ctor is assumed to never fail
			playerFile = "test.json";
		}
	}

	public static void main(String[] args) {
		Opts opts = new Opts(args);
		JSONTokener jt = null;
		try {
			FileReader fr = new FileReader(new File(opts.playerFile));
			jt = new JSONTokener(fr);
		} catch (JSONException | IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		JSONObject o = new JSONObject(jt);

		BasePlayer p = new BasePlayer(o);

		System.out.println(p.toJson().toString(4));
	}

}