Interview问的问题
Question 1
Where is your player’s score, and how it defined?
Answer 1
player ‘s score defined in Player class on top of the class and we use private to protect it.
we use setter and getter to get its value and set it value.
Question 2
how you deal with ‘_’ in your trail
Answer 2
in trail class when we initialize Trail we initialize ‘_’ with null, so that when we in game class we judge trail’s char whether it’s null or not
Question 3
show me where is your game loop
Answer 3
my game loop is in game class runGame() method, i use gameOver as boolean ,it is false when defined, and in movePlayer, it return boolean value, when this game over, it will return true and this loop is end
and do you need to do any modification if you implement this new function to other class
Question 4
in your prograrm when player land in naturefeature it will move to another position but will not move by that position, if you need to write some new code to implement that player land in a new naturefeature, he should do naturefeature’s feature again