Learn

Sunday, 3 December 2017

How Does OldBlockState Is Used In JAVA Artificial Intelligence Algorithm Progrmming


Use of OldBlockState:


The next POJO class OldBlockState is used to represent previous states of blocks as they are being moved as the rules in this example “fire.” We will later see rules that will not put a block into a state that it previously existed in:

public static class OldBlockState extends Block {

public OldBlockState(String name,
String onTopOf,

String supporting) {

super(name, onTopOf, supporting);

}

public String toString() {

return "[OldBlockState_" + this.hashCode() +" " + name + " on top of: " + onTopOf +" supporting: " + supporting+"]";


}


}


The next POJO class Goal is used to represent a goal state for the blocks that we are trying to reach:


public static class Goal {
private String supportingBlock;
private String supportedBlock;
public Goal(String supporting, String supported) {
this.supportingBlock = supporting;
this.supportedBlock = supported;
}
public String toString() {
return "[Goal_" + this.hashCode() +
" Goal: supporting block: " +
supportingBlock +
" and supported block: " +
supportedBlock +"]";
}
public void setSupportingBlock(
String supportingBlock) {
this.supportingBlock = supportingBlock;
}
public String getSupportingBlock() {
return supportingBlock;
}
public void setSupportedBlock(
String supportedBlock) {
this.supportedBlock = supportedBlock;
}
public String getSupportedBlock() {
return supportedBlock;
}
}

No comments:

Post a Comment