Skip to main content
Tweeted twitter.com/#!/StackCodeGolf/status/627762150526861312
Rollback to Revision 4
Source Link
Nick B.
  • 305
  • 1
  • 11
  • action will be one of three strings: duck, jump, or nothing. You should only use duck or jump if it's necessary for avoiding the Bullet Bill. Otherwise, use nothing.
  • wait_time only applies to jump. It represents how long Mario should wait before jumping over the Bullet Bill. If action is not jump, this will be left blank.
  • The ground will always be right underneath Mario's feet.
  • Bullet Bills are only one unit tall and one unit wide. Mario will be safe if it passes one unit above his head.
  • Mario will be safe if he lands on the Bullet Bill. Hitting the side or bottom will kill him.
  • If ducking or jumping is possible, it doesn't matter whichThere will often be more than one you outputsolution. If neither is necessary,You only have to output nothingone of them.
  • Numerical input will always be integers. However, output may sometimes need to have floats/doubles.
  • action will be one of three strings: duck, jump, or nothing. You should only use duck or jump if it's necessary for avoiding the Bullet Bill. Otherwise, use nothing.
  • wait_time only applies to jump. It represents how long Mario should wait before jumping over the Bullet Bill. If action is not jump, this will be left blank.
  • The ground will always be right underneath Mario's feet.
  • Bullet Bills are only one unit tall and one unit wide. Mario will be safe if it passes one unit above his head.
  • Mario will be safe if he lands on the Bullet Bill. Hitting the side or bottom will kill him.
  • If ducking or jumping is possible, it doesn't matter which one you output. If neither is necessary, output nothing.
  • Numerical input will always be integers. However, output may sometimes need to have floats/doubles.
  • action will be one of three strings: duck, jump, or nothing.
  • wait_time only applies to jump. It represents how long Mario should wait before jumping over the Bullet Bill. If action is not jump, this will be left blank.
  • The ground will always be right underneath Mario's feet.
  • Bullet Bills are only one unit tall and one unit wide. Mario will be safe if it passes one unit above his head.
  • Mario will be safe if he lands on the Bullet Bill. Hitting the side or bottom will kill him.
  • There will often be more than one solution. You only have to output one of them.
  • Numerical input will always be integers. However, output may sometimes need to have floats/doubles.
clarification
Source Link
Nick B.
  • 305
  • 1
  • 11
  • action will be one of three strings: duck, jump, or nothing. You should only use duck or jump if it's necessary for avoiding the Bullet Bill. Otherwise, use nothing.
  • wait_time only applies to jump. It represents how long Mario should wait before jumping over the Bullet Bill. If action is not jump, this will be left blank.
  • The ground will always be right underneath Mario's feet.
  • Bullet Bills are only one unit tall and one unit wide. Mario will be safe if it passes one unit above his head.
  • Mario will be safe if he lands on the Bullet Bill. Hitting the side or bottom will kill him.
  • There will often be more thanIf ducking or jumping is possible, it doesn't matter which one solutionyou output. You only have toIf neither is necessary, output one of themnothing.
  • Numerical input will always be integers. However, output may sometimes need to have floats/doubles.
  • action will be one of three strings: duck, jump, or nothing.
  • wait_time only applies to jump. It represents how long Mario should wait before jumping over the Bullet Bill. If action is not jump, this will be left blank.
  • The ground will always be right underneath Mario's feet.
  • Bullet Bills are only one unit tall and one unit wide. Mario will be safe if it passes one unit above his head.
  • Mario will be safe if he lands on the Bullet Bill. Hitting the side or bottom will kill him.
  • There will often be more than one solution. You only have to output one of them.
  • Numerical input will always be integers. However, output may sometimes need to have floats/doubles.
  • action will be one of three strings: duck, jump, or nothing. You should only use duck or jump if it's necessary for avoiding the Bullet Bill. Otherwise, use nothing.
  • wait_time only applies to jump. It represents how long Mario should wait before jumping over the Bullet Bill. If action is not jump, this will be left blank.
  • The ground will always be right underneath Mario's feet.
  • Bullet Bills are only one unit tall and one unit wide. Mario will be safe if it passes one unit above his head.
  • Mario will be safe if he lands on the Bullet Bill. Hitting the side or bottom will kill him.
  • If ducking or jumping is possible, it doesn't matter which one you output. If neither is necessary, output nothing.
  • Numerical input will always be integers. However, output may sometimes need to have floats/doubles.
clarified integer input description
Source Link
Nick B.
  • 305
  • 1
  • 11

In 2D Mario, Bullet Bill cannons are two units tall. The Bullet Bill is fired out of the upper unit and travels in a straight line (parallel to the x axis).

Mario is two units tall when standing up and one unit tall when ducking. His jump height is three units. It takes him 0.5 seconds to reach the full height and 0.5 seconds to come back down.

Challenge

Write a program that helps Mario avoid an incoming Bullet Bill. He may have to jump, duck, or do nothing.

Input

The input will come in the format [bullet_bill_position] [direction] [speed] [mario_position].

  • bullet_bill_position consists of two space-separated integers, x and y. This represents the coordinates of the upper unit of the cannon. The bullet bill will fire from this location.
  • direction will either be left or right (string).
  • speed is the speed of the Bullet Bill in units per second.
  • mario_position consists of x and y and represents the coordinates that Mario is standing on.

Output

[action] [wait_time]

  • action will be one of three strings: duck, jump, or nothing.
  • wait_time only applies to jump. It represents how long Mario should wait before jumping over the Bullet Bill. If action is not jump, this will be left blank.

Notes

  • The ground will always be right underneath Mario's feet.
  • Bullet Bills are only one unit tall and one unit wide. Mario will be safe if it passes one unit above his head.
  • Mario will be safe if he lands on the Bullet Bill. Hitting the side or bottom will kill him.
  • There will often be more than one solution. You only have to output one of them.
  • InputNumerical input will always be integers. OutputHowever, output may sometimes need to be more precisehave floats/doubles.

Test Cases


Input: 5 1 left 2.5 0 0

Possible Output: jump 1.5

Explanation: The Bullet Bill will be at Mario's feet in 2 seconds. Mario will jump at 1.5 and touch back down at 2.5. The Bullet Bill passed safely underneath him.

Another Possible Output: jump 1

Explanation: If Mario jumps at 1, he will touch back down at 2 and land on the Bullet Bill.


Input: 0 3 right 100 5 0

Possible Output: nothing

Explanation: The Bullet Bill will pass very quickly over Mario's head. He will be safe.


Input: 0 2 right 1 5 0

Output: duck

Explanation: The Bullet Bill will go where Mario's head would've been.


Rules

  • You can write a full program or function.
  • I/O should be to stdin and stdout.

Scoring

This is . Your score is the number of bytes. The solution with the lowest score in one week will win. Good luck!

In 2D Mario, Bullet Bill cannons are two units tall. The Bullet Bill is fired out of the upper unit and travels in a straight line (parallel to the x axis).

Mario is two units tall when standing up and one unit tall when ducking. His jump height is three units. It takes him 0.5 seconds to reach the full height and 0.5 seconds to come back down.

Challenge

Write a program that helps Mario avoid an incoming Bullet Bill. He may have to jump, duck, or do nothing.

Input

The input will come in the format [bullet_bill_position] [direction] [speed] [mario_position].

  • bullet_bill_position consists of two space-separated integers, x and y. This represents the coordinates of the upper unit of the cannon. The bullet bill will fire from this location.
  • direction will either be left or right (string).
  • speed is the speed of the Bullet Bill in units per second.
  • mario_position consists of x and y and represents the coordinates that Mario is standing on.

Output

[action] [wait_time]

  • action will be one of three strings: duck, jump, or nothing.
  • wait_time only applies to jump. It represents how long Mario should wait before jumping over the Bullet Bill. If action is not jump, this will be left blank.

Notes

  • The ground will always be right underneath Mario's feet.
  • Bullet Bills are only one unit tall and one unit wide. Mario will be safe if it passes one unit above his head.
  • Mario will be safe if he lands on the Bullet Bill. Hitting the side or bottom will kill him.
  • There will often be more than one solution. You only have to output one of them.
  • Input will always be integers. Output may sometimes need to be more precise.

Test Cases


Input: 5 1 left 2.5 0 0

Possible Output: jump 1.5

Explanation: The Bullet Bill will be at Mario's feet in 2 seconds. Mario will jump at 1.5 and touch back down at 2.5. The Bullet Bill passed safely underneath him.

Another Possible Output: jump 1

Explanation: If Mario jumps at 1, he will touch back down at 2 and land on the Bullet Bill.


Input: 0 3 right 100 5 0

Possible Output: nothing

Explanation: The Bullet Bill will pass very quickly over Mario's head. He will be safe.


Input: 0 2 right 1 5 0

Output: duck

Explanation: The Bullet Bill will go where Mario's head would've been.


Rules

  • You can write a full program or function.
  • I/O should be to stdin and stdout.

Scoring

This is . Your score is the number of bytes. The solution with the lowest score in one week will win. Good luck!

In 2D Mario, Bullet Bill cannons are two units tall. The Bullet Bill is fired out of the upper unit and travels in a straight line (parallel to the x axis).

Mario is two units tall when standing up and one unit tall when ducking. His jump height is three units. It takes him 0.5 seconds to reach the full height and 0.5 seconds to come back down.

Challenge

Write a program that helps Mario avoid an incoming Bullet Bill. He may have to jump, duck, or do nothing.

Input

The input will come in the format [bullet_bill_position] [direction] [speed] [mario_position].

  • bullet_bill_position consists of two space-separated integers, x and y. This represents the coordinates of the upper unit of the cannon. The bullet bill will fire from this location.
  • direction will either be left or right (string).
  • speed is the speed of the Bullet Bill in units per second.
  • mario_position consists of x and y and represents the coordinates that Mario is standing on.

Output

[action] [wait_time]

  • action will be one of three strings: duck, jump, or nothing.
  • wait_time only applies to jump. It represents how long Mario should wait before jumping over the Bullet Bill. If action is not jump, this will be left blank.

Notes

  • The ground will always be right underneath Mario's feet.
  • Bullet Bills are only one unit tall and one unit wide. Mario will be safe if it passes one unit above his head.
  • Mario will be safe if he lands on the Bullet Bill. Hitting the side or bottom will kill him.
  • There will often be more than one solution. You only have to output one of them.
  • Numerical input will always be integers. However, output may sometimes need to have floats/doubles.

Test Cases


Input: 5 1 left 2.5 0 0

Possible Output: jump 1.5

Explanation: The Bullet Bill will be at Mario's feet in 2 seconds. Mario will jump at 1.5 and touch back down at 2.5. The Bullet Bill passed safely underneath him.

Another Possible Output: jump 1

Explanation: If Mario jumps at 1, he will touch back down at 2 and land on the Bullet Bill.


Input: 0 3 right 100 5 0

Possible Output: nothing

Explanation: The Bullet Bill will pass very quickly over Mario's head. He will be safe.


Input: 0 2 right 1 5 0

Output: duck

Explanation: The Bullet Bill will go where Mario's head would've been.


Rules

  • You can write a full program or function.
  • I/O should be to stdin and stdout.

Scoring

This is . Your score is the number of bytes. The solution with the lowest score in one week will win. Good luck!

improved formatting of test cases
Source Link
Nick B.
  • 305
  • 1
  • 11
Loading
Modified tags
Link
Downgoat
  • 29.1k
  • 6
  • 84
  • 155
Loading
Source Link
Nick B.
  • 305
  • 1
  • 11
Loading