Write a domino effect Using the fewest Unicode characters, write a function that accepts three parameters:


Total number of dominoes
nth affected domino
Topple direction of the affected domino (0 or L for left, 1 or R for right)


Once a domino is toppled, it must also topple the remaining dominoes in the same direction.

You should output the dominoes with | representing a standing domino and \ and / representing a domino toppled to the left and right respectively.

Examples

10, 5, 1 should return ||||//////
6, 3, 0 should return \\\|||
Ruby, 38 (46) characters



e=-&gt;n,k,r{k-=r;'\|'[r]*k+'|/'[r]*n-=k}


This function takes the direction as an integer (1 for right, 0 for left). A function that takes a string is 8 characters longer:

d=-&gt;n,k,r{n-=k;r&lt;?r??\\*k+?|*n :?|*~-k+?/*-~n}


Usage examples:

puts e[10, 5, 1] # or d[10, 5, 'r']
||||//////
puts e[10, 5, 0] # or d[10, 5, 'l']
\\\\\|||||