Code:
|
Code:
PersistantQuestion persistantQuestion = new PersistantQuestion();
persistantQuestion.addPath("yes",new DrawRnd("I love you", "do you love me?","please do you love me","you love me don't you ?"));
persistantQuestion.addPath("no",new DrawRnd("you're annoying", "I'm leaving","good bye","you love me don't you ?"));
persistantQuestion.activate();
for (int i = 0; i < 10; i++) {
System.out.println(persistantQuestion.process(""));
}
persistantQuestion.activate();
System.out.println(persistantQuestion.process(""));
System.out.println("answering no:");
System.out.println(persistantQuestion.process("no"));
persistantQuestion.activate();
for (int i = 0; i < 10; i++) {
System.out.println(persistantQuestion.process(""));
}
}
output:
you love me don't you ?
I love you
do you love me?
please do you love me
i see
do you love me?
answering no:
okay
I'm leaving
good bye
you're annoying
you love me don't you ?
i see
Process finished with exit code 0
Last edited by Moti Barski on Fri Jun 09, 2023 5:22 pm; edited 3 times in total (Reason for editing : code buff)