46
\$\begingroup\$

Introduction

The Atari ST was a rather popular personal computer from the mid 80's to early 90's era, powered by a Motorola 68000 microprocessor. On this machine, the default behavior of the operating system for uncaught CPU exceptions was to display a row of bombs on the screen, as shown in the following picture:

row of bombs

Source: https://commons.wikimedia.org/wiki/File:Row_of_bombs.png
NB: Depending on the OS version, the bomb graphics may vary slightly. But let's take this one as reference.

The number of bombs depends on the exception vector, the most common ones being:

  • ($008) Bus Error : 2 bombs
  • ($00c) Address Error : 3 bombs
  • ($010) Illegal Instruction : 4 bombs

Goal

Your goal is to write a program or function that prints or outputs an ASCII art of such Atari ST bombs.

Input

An integer representing the number of bombs to display. Your code must support the most common values: 2, 3 and 4. Supporting less and/or more bombs is fine, but it is neither required nor subject to a bonus.

Output

The original bomb consists of a 16x16 pixel tile, represented here in both ASCII and binary:

....##..........    0000110000000000
.#.#..#.........    0101001000000000
.......#........    0000000100000000
#..#....#.......    1001000010000000
..#...#####.....    0010001111100000
......#####.....    0000001111100000
....#########...    0000111111111000
...###########..    0001111111111100
...###########..    0001111111111100
..#############.    0011111111111110
..########.####.    0011111111011110
...#######.###..    0001111111011100
...######.####..    0001111110111100
....#########...    0000111111111000
.....#######....    0000011111110000
.......###......    0000000111000000

In this challenge, each ASCII bomb must be stretched to twice its original width for a better rendering. Therefore, it will consist of 16 rows of 32 characters, using ## for 'ON' pixels and two spaces for 'OFF' pixels. All bomb tiles must be put side by side. Leading spaces are forbidden. Trailing spaces are also forbidden, except the ones that are actually part of the bomb tile (i.e. the 31st and 32nd columns) which must be present. You may include no more than one leading line-break and no more than one trailing line-break.

Example

Below is the reference output for two bombs, where mandatory line-breaks are marked as \n and tolerated extra line-breaks are marked as (\n):

(\n)
        ####                            ####                    \n
  ##  ##    ##                    ##  ##    ##                  \n
              ##                              ##                \n
##    ##        ##              ##    ##        ##              \n
    ##      ##########              ##      ##########          \n
            ##########                      ##########          \n
        ##################              ##################      \n
      ######################          ######################    \n
      ######################          ######################    \n
    ##########################      ##########################  \n
    ################  ########      ################  ########  \n
      ##############  ######          ##############  ######    \n
      ############  ########          ############  ########    \n
        ##################              ##################      \n
          ##############                  ##############        \n
              ######                          ######            (\n)

(Of course, other line-break formats such as \r or \r\n may be used just as well.)

Rules

This is code-golf, so the shortest answer in bytes wins. Standard loopholes are forbidden.

| improve this question | | | | |
\$\endgroup\$
  • \$\begingroup\$ I notice you've excluded non-ASCII-art forms, so an Atari ST machine-code function that crashes with the right number of bombs doesn't count. (The bomb isn't in the font, but the Atari ST has fun/easter-egg glyphs in its native character set, including characters 28–31 that are 4 pieces that form the image of J. R. "Bob" Dobbs from the satirical Church of the SubGenius. I remember writing a program that spammed those 4 glyphs at random screen positions, as a very early exercise in using text-drawing system calls :) \$\endgroup\$ – Peter Cordes Oct 5 '16 at 2:32
  • 1
    \$\begingroup\$ @PeterCordes - That's right, it must be ASCII. However, you'd be allowed to read the bomb graphics from the ST ROM since there's no rule that prevents you from doing it. (Just mention the TOS version this is supposed to work on.) \$\endgroup\$ – Arnauld Oct 5 '16 at 11:48
  • 1
    \$\begingroup\$ Oh WOW, that brings back memories. My first computer was an Atari ST. I remember those bombs with dread. \$\endgroup\$ – Rod Oct 6 '16 at 15:27
  • \$\begingroup\$ Aside: "The number of bombs depends on the exception vector" - say what?! Any reason why they couldn't output the actual code/error? (Never had an ST, I'm from the Amiga camp... "Guru Meditation" and all that.) \$\endgroup\$ – MrWhite Oct 6 '16 at 21:02

31 Answers 31

1
2
0
\$\begingroup\$

Excel VBA, 557 412 321 Bytes

Anonymous VBE immediate window function that takes input from range [A1] and outputs to the VBE immediate window

[B:B]="=REPT(""#"",2*ROW())":[C:C]="=REPT("" "",2*ROW())":a=[C4&B9&C3]:b=[C3&B11&C2]:For Each s In Array([C4&B2&C10],["  ##  ##    ##"&C9],[C7&B1&C8],[B1&C2&B1&C4&B1&C7],[C2&B1&C3&B5&C5],[C6&B5&C5],a,b,b,[C2&B13&C1],[C2&B8&C1&B4&C1],[C3&B7&C1&B3&C2],[C3&B6&C1&B4&C2],a,[C5&B7&C4],[C7&B3&C6]):For i=1To[A1]:?s;:Next:?:Next

Sample Input / Output

[A1]=4
[B:B]="=REPT(""#"",2*ROW())":[C:C]="=REPT("" "",2*ROW())":a=[C4&B9&C3]:b=[C3&B11&C2]:For Each s In Array([C4&B2&C10],["  ##  ##    ##"&C9],[C7&B1&C8],[B1&C2&B1&C4&B1&C7],[C2&B1&C3&B5&C5],[C6&B5&C5],a,b,b,[C2&B13&C1],[C2&B8&C1&B4&C1],[C3&B7&C1&B3&C2],[C3&B6&C1&B4&C2],a,[C5&B7&C4],[C7&B3&C6]):For i=1To[A1]:?s;:Next:?:Next
        ####                            ####                            ####                            ####                    
  ##  ##    ##                    ##  ##    ##                    ##  ##    ##                    ##  ##    ##                  
              ##                              ##                              ##                              ##                
##    ##        ##              ##    ##        ##              ##    ##        ##              ##    ##        ##              
    ##      ##########              ##      ##########              ##      ##########              ##      ##########          
            ##########                      ##########                      ##########                      ##########          
        ##################              ##################              ##################              ##################      
      ######################          ######################          ######################          ######################    
      ######################          ######################          ######################          ######################    
    ##########################      ##########################      ##########################      ##########################  
    ################  ########      ################  ########      ################  ########      ################  ########  
      ##############  ######          ##############  ######          ##############  ######          ##############  ######    
      ############  ########          ############  ########          ############  ########          ############  ########    
        ##################              ##################              ##################              ##################      
          ##############                  ##############                  ##############                  ##############        
              ######                          ######                          ######                          ######            

Alternate Solutions

Cell Based Solution, 412 Bytes

x="=REPT(""":y=""",2*ROW())":[B:B]=x&"#"&y:[C:C]=x&" "&y:?[REPT(C4&B2&C10,A1)]:?[REPT("  ##  ##    ##"&C9,A1)]:?[REPT(C7&B1&C8,A1)]:?[REPT(B1&C2&B1&C4&B1&C7,A1)]:?[REPT(C2&B1&C3&B5&C5,A1)]:?[REPT(C6&B5&C5,A1)]:a=[REPT(C4&B9&C3,A1)]:?a:b=[REPT(C3&B11&C2,A1)]:?b:?b:?[REPT(C2&B13&C1,A1)]:?[REPT(C2&B8&C1&B4&C1,A1)]:?[REPT(C3&B7&C1&B3&C2,A1)]:?[REPT(C3&B6&C1&B4&C2,A1)]:?a:?[REPT(C5&B7&C4,A1)]:?[REPT(C7&B3&C6,A1)]

Array-ASCII Solution, 557 Bytes

f=Space(14):w=Space(12):For Each s In Array("        ####"&Space(20),"  ##  ##    ##"&Space(18),f &"##"&Space(16),"##    ##        ##"&f,"    ##      ##########          ",w &"##########          ","        ##################      ","      ######################    ","      ######################    ","    ##########################  ","    ################  ########  ","      ##############  ######    ","      ############  ########    ","        ##################      ","          ##############        ",f &"######"&w):For i=1To[A1]:?s;:Next:?:Next
| improve this answer | | | | |
\$\endgroup\$
1
2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.