Newer
Older
moobreeder / Herd.java
/**
 * Moobreeder is a simple cow breeding game to illustrate the principles of
 * selective breeding to KS3 pupils.
 *
 * (c) Daniel Vedder 2018, Amano Christian School
 * Licensed under the terms of the MIT license.
 * https://git.synoikos.de/daniel/moobreeder
 */

/*
 * This is a singleton class that holds the current herd.
 */

import java.util.ArrayList;

public class Herd
{
	public static int initialSize = 4;
	private static Herd singleton;
	
	private ArrayList<Cow> herd;
	private Cow[] parents;
	private Cow[] offspring;

	private Herd()
	{
		herd = new ArrayListy<Cow>();
		parents = new Cow[] {null, null};
		offspring = new Cow[] {null, null};
		for (i = 0; i < initialSize; i++) {
			String sex = "male";
			if (i %% 2 == 0) sex = "female";
			herd.add(new Cow(sex));
		}
	}

	public static Herd getInstance()
	{
		if (singleton == null) {
			singleton = new Herd();
		}
		return singleton;
	}

	public void removeCow(int id)
	{
		//TODO
	}

	public void setParent(int id)
	{
		//TODO
	}

	public void removeParent(int id)
	{
		//TODO
	}

	public String checkBreeding()
	{
		//TODO
		return "OK";
	}

	public void breed()
	{
		//TODO
	}

	public void keepChild(int id)
	{
		//TODO
	}

	public void discardChild(int id)
	{
		//TODO
	}

	public void saveHerd(String filename)
	{
		//TODO save to binary file
	}

	public void loadHerd(String filename)
	{
		//TODO load from binary file
	}
}