Skip to main content
replaced http://codegolf.stackexchange.com/ with https://codegolf.stackexchange.com/
Source Link

(related/inspired by: Draw a bowling formation)

(related/inspired by: Draw a bowling formation)

Tweeted twitter.com/StackCodeGolf/status/811818084054999040
Source Link
AdmBorkBork
  • 43.7k
  • 5
  • 107
  • 288

Snowman Bowling

(related/inspired by: Draw a bowling formation)

A fun pastime in the winter months here is to perform snowman bowling, using a large ball (like a basketball) and tiny snowman figures. Let's recreate this in ASCII.

Each snowman consists of the following:

(.,.) ( : ) 

Here is the alignment of the ten snowman "pins"

(.,.) (.,.) (.,.) (.,.) ( : ) ( : ) ( : ) ( : ) (.,.) (.,.) (.,.) ( : ) ( : ) ( : ) (.,.) (.,.) ( : ) ( : ) (.,.) ( : ) 

These "pins" are labeled from 1 to 10 as

7 8 9 10 4 5 6 2 3 1 

So far, so standard. However, unlike normal bowling, the snowman pins are merely flattened and not totally removed. This is done by someone needing to manually flatten the snow of any pins that were struck. A flattened snowman is represented by _____ (five underscores), with whitespace above. Here is an example with the 1 3 5 6 9 10 pins flattened (meaning only the 2 4 7 8 pins remain):

(.,.) (.,.) ( : ) ( : ) _____ _____ (.,.) ( : ) _____ _____ (.,.) ( : ) _____ _____ 

Input

  • A list of integers from 1 to 10 in any convenient format representing which pins were struck and thus need to be flattened.
  • Each number will only appear at most once, and the numbers can be in any order (sorted, unsorted, sorted descending) -- your choice, whatever makes your code golfier.
  • The input is guaranteed to have at least one integer.

Output

The resulting ASCII art representation of the snowman pins, with the correct pins flattened.

Rules

  • Leading or trailing newlines or whitespace are all optional, so long as the characters themselves line up correctly.
  • Either a full program or a function are acceptable. If a function, you can return the output rather than printing it.
  • If possible, please include a link to an online testing environment so people can try out your code!
  • Standard loopholes are forbidden.
  • This is so all usual golfing rules apply, and the shortest code (in bytes) wins.

Examples

1 3 5 6 9 10 (.,.) (.,.) ( : ) ( : ) _____ _____ (.,.) ( : ) _____ _____ (.,.) ( : ) _____ _____ 1 2 3 (.,.) (.,.) (.,.) (.,.) ( : ) ( : ) ( : ) ( : ) (.,.) (.,.) (.,.) ( : ) ( : ) ( : ) _____ _____ _____ 1 2 3 4 5 6 8 9 10 (.,.) ( : ) _____ _____ _____ _____ _____ _____ _____ _____ _____