← 返回 bloomberg 的题目列表Design a Simple Game using OOD
类型:online_judge
Design a simple game using object-oriented design (OOD). The game requirements are as follows: You need to design a number guessing game where the system randomly generates a number between 1 and 100. The user needs to keep guessing the number, and after each guess, the system will tell the user if the guessed number is greater than, less than, or equal to the actual number. The game ends when the user guesses correctly. Please provide a complete class design and implement the game logic. Data size and test cases are as follows:
Input: Sequence of guessed numbers
Output: Hint returned after each guess
Example: Input: [50, 75, 85, 82] Output: ['greater', 'greater', 'smaller', 'correct']
Example
Input
50
75
85
82