You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
xpetit 46f4ddc49e
Simplify prompt, execution of Go programs, fix typos
4 years ago
..
README.md Simplify prompt, execution of Go programs, fix typos 4 years ago

README.md

robottoorigin

Instructions

There is a robot at position (0, 0) at 2D map.

Write a program, that outputs true if robot ends up at the origin (0, 0) after a sequence of moves, otherwise false. \n should be in the end of line.

Sequence of moves is a string, which characters state for movement direction:

  • U - up
  • D - down
  • R - right
  • L - left

If the number of arguments is not 1, output nothing.

Usage

$ go run . "UD"
true
$ go run . "LL"
false

In first case, the robot moves up and the down. So, it returned back to its origin position.

In second example, the robot moves twice to the left. It is 2 positions left from its origin, so the program outputs false.