Skip to content

Instantly share code, notes, and snippets.

Mars is represented by a 5 x 5 grid.
You are given the initial starting point (x,y) of a rover and the direction (N,S,E,W) it is facing.
The rover receives a character array of commands.
- Implement commands that move the rover forward/backward (f,b).
- Implement commands that turn the rover left/right (l,r).
- Implement wrapping from one edge of the grid to another.
- Implement obstacle detection before each move to a new square:
If a given sequence of commands encounters an obstacle,
the rover moves up to the last possible point,
aborts the sequence and reports the obstacle.
Марс представлен сеткой 5 x 5.
Вам дается начальная точка старта (x, y) марсохода и направление север/юг/восток/запад(N, S, E, W), в котором он смотрит.
Марсоход получает символьный массив команд.
- Реализуйте команды, которые перемещают ровер вперед / назад (f, b ).
- Выполните команды, которые поворачивают ровер влево / вправо (l, r).
- Осуществить перенос от одного края сетки к другому.
- Реализуйте обнаружение препятствий перед каждым переходом на новый квадрат:
Если данная последовательность команд встречает препятствие,
марсоход движется до последней возможной точки,
прерывает последовательность и сообщает о препятствии.
Напишите программу, печатающую числа от 1 до 100.
При этом, для чисел делящихся на три, печатайте вместо них "Fizz",
для чисел делящихся на пять, печатайте "Buzz",
a для чисел делящихся и на три, и на пять, печатайте "FizzBuzz"
Пример:
1
2
Fizz
Запрограмируйте подсчет очков партии игры в боулинг.
Одна партия состоит из 10 фреймов.
В каждом фрейме у игрока есть два броска.
Если игрок сбивает все 10 кеглей первым броском,
такой бросок называется страйк (англ. strike — удар) и обозначается «Х».
Если игрок сбивает все 10 кеглей за два броска,
@dpolivaev
dpolivaev / Elevator Kata
Last active February 18, 2021 20:55 — forked from mattflo/Elevator Kata
These are some features. They can be implemented in any order you prefer.
* an elevator responds to calls containing a source floor and direction
* an elevator delivers passengers to requested floors
* an elevator doesn't respond immediately. consider options to simulate time
* elevator calls are queued not necessarily FIFO
* you may test a sequence of events happening when passengers use the elevator
* you may implement current floor monitor
* you may implement direction arrows
* you may implement doors (opening and closing)