Sure, here’s the translation: Java文字游戏逻辑

huangapple 未分类评论48阅读模式
英文:

java word game logic

问题

if长度大于3{
   if在单词库中{
        if以前一个单词的最后两个字母开头{
           currentPlayerPoints+=1;
           message="答对了,你得到了一分";
        }else{
           currentPlayerLives-=0;
           message="你没有匹配上单词";
        }
    }else{
        message="你的单词不在数据库中";
        currentPlayerLives-=0;
    }
}else{
    message="你的单词至少应该有3个字母";
    currentPlayerLives-=0;
}
英文:

Hi I have to create a game for two players where one player guesses the word starting on random char , min 3 letters long and should be in word base, the second player word should meet last 2 conditions plus should start on two last letters of the word provided by first player. Both players start with 3 lives. Example:
random word:e
firstPlayer:echo
secondPlayer:hollow

Do you think that using multiple nested if statements will be fine? How to add random char at first attempt?

if(longer than 3){
   if(in word base){
        if(starting with 2 letters from previous last letters){
           currentPlayerPoints+=1;
           message="Thats right you got a point";
        }else{
           currentPlayerLives-=0;
           message="you didnt match the word";
        }
    }else{
        message="your word is not in database";
        currentPlayerLives-=0;
    }
}else{
    message="your word should be longer at least 3 letters long";
    currentPlayerLives-=0;
}

huangapple
  • 本文由 发表于 2020年5月4日 00:51:31
  • 转载请务必保留本文链接:https://java.coder-hub.com/61578264.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定