Aim
If you are given a sequence such as (A, G, M, _, _, C, D, _, G)
your aim is to push all non empty elements to one side to get (A, G, M, C, D, G, _, _, _)
. You must preserve the order of the non-empty elements.
Rules
- You are free to choose the sequence type. (strings, numbers, containers etc). You must also choose a Nil/None/Null character or element that will fit your sequence type. eg; spaces or underscores inside a string.
- User should be able to input the push direction (left or right) and the sequence. Input values and format are up to you to choose. eg; Your code handles sequences that are numbers with
7
as the null character. You setR
for right,L
for left. So user inputsR, 1577462722727777
. The result is7777777715462222
- Rearranged sequence should be displayed or written to a file.
- Your code should not exceed 128 bytes.
Points
- +(10 / bytes) golfing points
- +1 for Moses-Mode. Push half the elements to the left, and half to the right. If odd number of items are present, you may choose the direction of the final element. eg;
(A, G, M, _, _, _, C, D, G)
You may use use this calculator to round your points to the hundredth decimal place.