this triggers aim to save coding time and set AI behaviors and personality traits.
parent class :
TrgCounter
examle test :
TrgCounter tc = new TrgCounter(10);
for (int i = 0; i < 50; i++) {
System.out.println(tc.trigger(true) == 1 ? "yandere" : "tsundere");
}
tsundere
tsundere
tsundere
tsundere
tsundere
tsundere
tsundere
tsundere
tsundere
yandere
yandere
yandere
yandere
yandere
yandere
yandere
yandere
yandere
yandere
tsundere
tsundere
tsundere
tsundere
tsundere
tsundere
tsundere
tsundere
tsundere
tsundere
yandere
yandere
yandere
yandere
yandere
yandere
yandere
yandere
yandere
yandere
tsundere
tsundere
tsundere
tsundere
tsundere
tsundere
tsundere
tsundere
tsundere
tsundere
yandere
parent class :
Code:
public abstract class AbsTrg {
// sub classes names should start with Trg
public abstract int trigger(Boolean trigger);
// trigger reset, implement if needed
public abstract void reset();
}
TrgCounter
Code:
public class TrgCounter extends AbsTrg {
private CountDownGate cdg;
private Boolean Mode = false;
private int score = 0;
public TrgCounter(int tolerance, Boolean mode) {
super();
this.cdg = new CountDownGate(tolerance);
Mode = mode;
}
public TrgCounter(int tolerance) {
super();
this.cdg = new CountDownGate(tolerance);
}
@Override
public int trigger(Boolean trigger) {
if (!trigger) {
return 0;
}
if (!cdg.countingDown()) {
Mode = !Mode;
cdg.reset();
score++;
if (score > 10000) {
score = 0;
}
}
return Mode ? 1 : 0;
}
public int getScore() {
// what is your [] score
return score;
}
@Override
public void reset() {
// bad girl
Mode = false;
this.cdg = new CountDownGate(10);
}
public void reset2() {
// good girl
Mode = true;
this.cdg = new CountDownGate(10);
}
public void increaseBias() {
// take it
this.cdg = new CountDownGate(cdg.getLimit() + 10);
}
public int getMode() {
return Mode ? 1 : 0;
}
}
examle test :
TrgCounter tc = new TrgCounter(10);
for (int i = 0; i < 50; i++) {
System.out.println(tc.trigger(true) == 1 ? "yandere" : "tsundere");
}
tsundere
tsundere
tsundere
tsundere
tsundere
tsundere
tsundere
tsundere
tsundere
yandere
yandere
yandere
yandere
yandere
yandere
yandere
yandere
yandere
yandere
tsundere
tsundere
tsundere
tsundere
tsundere
tsundere
tsundere
tsundere
tsundere
tsundere
yandere
yandere
yandere
yandere
yandere
yandere
yandere
yandere
yandere
yandere
tsundere
tsundere
tsundere
tsundere
tsundere
tsundere
tsundere
tsundere
tsundere
tsundere
yandere