Browse Source

printchessboard,robotorigin

content-update
OGordoo 5 years ago
parent
commit
d9a615b219
  1. 4
      subjects/printchessboard.en.md
  2. 11
      subjects/robottoorigin.en.md

4
subjects/printchessboard.en.md

@ -2,9 +2,9 @@
### Instructions
Write a program that takes a two integer as argument and displays the chess desk, where white cells `' '` and black cells `'#'`.
Write a program that takes two integers as arguments and displays the chess desk, in which white cells are represented by `' '` and black cells by `'#'`.
- If the number of arguments is different from 2, or if the argument is not a positive number, the program displays `Error` followed by a newline (`'\n'`).
- If the number of arguments is different from 2, or if the argument is not a positive number, the program displays `Error` followed by a newline (`'\n'`).
### Usage

11
subjects/robottoorigin.en.md

@ -7,7 +7,8 @@ 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
- U - up
- D - down
- R - right
- L - left
@ -17,13 +18,13 @@ If the number of arguments is not 1, output `\n`.
### Usage
```console
$> go build
$> ./main "UD"
student@ubuntu:~/[[ROOT]]/test$ go build
student@ubuntu:~/[[ROOT]]/test$ ./main "UD"
true
$> ./main "LL"
student@ubuntu:~/[[ROOT]]/test$ ./main "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 positons left from its origin. So, program should output false.
In second example, the robot moves twice to the left. It is 2 positions left from its origin, so the program outputs false.

Loading…
Cancel
Save