← 返回 coinbase 的题目列表Flappy-Bird-like Autopilot With Coins as Jump Budget
类型:online_judge
Problem: Flappy-Bird-like Autopilot With Coins as Jump Budget
You are given a simplified side-scrolling jumping game. You must implement a policy that decides whether to jump at each time step (tick).
Game Rules
The agent moves vertically:
Each tick it drops due to gravity (exact update handled by the evaluator).
If you choose jump on a tick, the agent moves upward (exact impulse handled by the evaluator).
Valid vertical range is [0, H]:
If height < 0 (hits the ground), you lose.
If height > H (hits the ceiling), you lose.
Coins exist on the map:
Touching a coin grants score (e.g., +1) (as defined by the evaluator).
Each jump consumes 1 coin (coins are your jump budget).
When you run out of coins, you can still choose not to jump; if you later crash because you cannot jump, you still lose.
Task
Implement a policy that, at every tick, decides whether to jump based on the current state, aiming to:
Avoid crashing into the ground or ceiling.
Collect as many coins / maximize score when possible.
Avoid wasting coins so you don’t lose later due to lack of jump budget.
Interface (conceptual)
The evaluator calls your policy every tick with a state (e.g., current height, vertical velocity, remaining coins, nearby coin positions, etc.; exact fields depend on the OA template). Your policy returns a boolean:
True => jump this tick (consumes 1 coin)
False => do not jump
Notes
You do not implement physics or collision; the evaluator does.
You only implement decision logic to pass hidden unit tests.
The OA UI provides an Auto-pilot visualization to replay the agent’s behavior.
Example (format illustration only)
Input: evaluator repeatedly calls policy(state)
Output: each call returns jump or no jump
This is typically an online control/policy problem rather than a classic offline LeetCode-style algorithm question.