⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 onestate.java

📁 自己编写的人工智能中野人与修道士问题的程序。
💻 JAVA
字号:
package exercise1;

class State {
	int m = 0;

	int b = 0;

	int c = 0;

	State() {

	}

	State(State x) {
		m = x.m;
		b = x.b;
		c = x.c;
	}
}

public class OneState {
	private int id = 1;

	private int layer =1;

	private int parent = 0;

	private int estimate = 65535;

	private operator operate = operator.PQ;

	protected State state = new State();

	public OneState() {

	}

	OneState(int[] x) {
		if (x.length == 3) {
			state.m = x[0];
			state.c = x[1];
			state.b = x[2];
		} else
			System.out.println("the array is unleagel!");
	}

	OneState(OneState x) {
		id = x.id;
		layer = x.layer;
		parent = x.parent;
		estimate = x.estimate;
		operate = x.operate;
		state.m = x.state.m;
		state.c=x.state.c;
		state.b=x.state.b;
	}

	public void setId(int n) {
		id = n;
	}

	public int getId() {
		return id;
	}

	public void setLayer(int n) {
		layer = n;
	}

	public int getLayer() {
		return layer;
	}

	public void setParent(int n) {
		parent = n;
	}

	public int getParent() {
		return parent;
	}

	public void setOperate(operator x) {
		operate = x;
	}
	
	public operator getOperator() {
		return operate;
	}

	public int getEstimate() {
		return estimate = layer + state.m + state.c - 2 * state.b;
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -