Answered step by step
Verified Expert Solution
Question
1 Approved Answer
2 0 4 8 is a tiny video game that was super hype some years ago. You had to fuse two equal numbers to create
is a tiny video game that was super hype some years ago. You had to fuse two equal numbers to create its double. So and became and became and so on
Fibonacci was a famous mathematician who made the superhype Fibonacci sequence you may have heard about: Un Un Un The first number of the sequence are
Lets combine these two hype things to create a supersuperhype game!
bonacci plays on a x square. Each square is either empty or contains a number of the Fibonacci sequence.
You are given an initial board situation a D array of integers and a pushing direction up left, down, or right Then, you must compute the board contents after the push and return an updated D array of integers.
The value of integers in the array is guaranteed to be less than and are all Fibonacci numbers. The value means the square is empty.
Rule
Numbers move as far as possible in the pushing direction.
push downward
Rule
When two consecutive numbers in the Fibonacci sequence are pushed one on another, they fuse into the next number.
push rightward
Rule
Fusing orders are resolved in the backward direction of the push.
A fused number can not be fused once again in the same turn.
rightward rightward
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started