Skip to content
This repository has been archived by the owner on Sep 17, 2019. It is now read-only.

[20Q Game] Fix Offline Startup Crash #75

Closed
wants to merge 1 commit into from

Conversation

Aevyz
Copy link
Contributor

@Aevyz Aevyz commented Aug 14, 2018

Here is the code that I used to temp fix this. @ninalovegood please read over this code and correct it to your standards, since many of the solutions here are very "hacky" and probably not suitable for the devel branch.

@Aevyz
Copy link
Contributor Author

Aevyz commented Aug 14, 2018

#72

@Aevyz
Copy link
Contributor Author

Aevyz commented Aug 14, 2018

How this works:

new AkiwrapperBuilder().setFilterProfanity(true).build() fails, prompt user to try again. If yes --> Retry Connection, if No --> gameFinish = true ; return to standard states

@@ -43,18 +44,39 @@
private boolean guessesAvailable = false;
private boolean gameFinished = false;
private boolean stopGame = false;
private boolean network = false;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Give this a better name

startAW();
}

private void startAW(){
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This definitely needs changing. Name needs to be changed, way the logic works needs to be changed.

private void startAW(){
startAW(false);
}
private void startAW(boolean force){
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename Force

@@ -83,6 +105,11 @@ public Output react(Interpretation input) {
String intent = getIntent (input);
Linguistics.UtteranceSentiment inputSentiment = getInference().inferSentiment(input);

if(!network){
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alter this, there's probably a cleaner way to do this


startAW();
if(!network){
return Output.say("A network connection is required to play this game, should I try and look for a connection again?");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change this string

@@ -253,7 +280,7 @@ private Output processUserGuessAnswer(String intent){

private void resetGame(){

aw = new AkiwrapperBuilder().setFilterProfanity(true).build();
startAW(true);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this really what you want to do, is it even required that we reset AW. Can you get to this state without AW being set

@Waguramu Waguramu requested a review from ninalovegood August 15, 2018 10:20
@Aevyz
Copy link
Contributor Author

Aevyz commented Sep 15, 2018

Will completely refactor everything regarding to GameStates soon, which would make this obselete.

@Aevyz Aevyz closed this Sep 15, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants