Skip to main content
added 113 characters in body
Source Link
breadbox
  • 7.2k
  • 31
  • 44

Perl, 7674 chars

Run with perl -M5.010.

$-=rand 6;$_="-----\n|0
|0 2|\n|4";s2|
|4";s/\d/$->$&?o:$"/ge;say$_,$-&1?$":o,~~reverse

(Note that the newlines in the listing are part of the string, and not just inserted for legibility.)

If you find yourself wondering what the heck the $->$ operation does, the following reading notes may be helpful:

  • The variable $- automatically truncates its assigned value to an integer.

  • The variable $" is preset to a single space.

  • o is a bareword (representing "o").

Perl, 76 chars

Run with perl -M5.010.

$-=rand 6;$_="-----\n|0 2|\n|4";s/\d/$->$&?o:$"/ge;say$_,$-&1?$":o,~~reverse

If you find yourself wondering what the heck the $->$ operation does, the following reading notes may be helpful:

  • The variable $- automatically truncates its assigned value to an integer.

  • The variable $" is preset to a single space.

  • o is a bareword (representing "o").

Perl, 74 chars

Run with perl -M5.010.

$-=rand 6;$_="-----
|0 2|
|4";s/\d/$->$&?o:$"/ge;say$_,$-&1?$":o,~~reverse

(Note that the newlines in the listing are part of the string, and not just inserted for legibility.)

If you find yourself wondering what the heck the $->$ operation does, the following reading notes may be helpful:

  • The variable $- automatically truncates its assigned value to an integer.

  • The variable $" is preset to a single space.

  • o is a bareword (representing "o").

Source Link
breadbox
  • 7.2k
  • 31
  • 44

Perl, 76 chars

Run with perl -M5.010.

$-=rand 6;$_="-----\n|0 2|\n|4";s/\d/$->$&?o:$"/ge;say$_,$-&1?$":o,~~reverse

If you find yourself wondering what the heck the $->$ operation does, the following reading notes may be helpful:

  • The variable $- automatically truncates its assigned value to an integer.

  • The variable $" is preset to a single space.

  • o is a bareword (representing "o").