Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

added 2629 characters in body
Source Link
Dom Hastings
  • 24.6k
  • 4
  • 58
  • 94

Perl 5 + -M5.10.0, 43 bytes, 15 changes: score 645: SAFE

17 steps total, 15 excluding code and golf.

Try it online!

Solution

I noticed that I could have saved a byte on my solution too using:

$_=$!=35;/.(.)..(.). (.)(.)/;say"2ドル1ドル3ドル4ドル"; # code

but only after posting and didn't think it was fair to adjust, a whole 15 off my score!

$_=$!=35;/.(.)..(.). (.)(.)/;say2ドル.1ドル.3ドル.4ドル; # code
$_=$!=35;/.(.)..(.). (.)(.)/;say3ドル.1ドル.3ドル.4ドル; # dode
$_=$!=35;/.(.)..(.). (.)(.)/;say3ドル.1ドル.3ドル.1ドル; # dodo
$_=$!=95;/.(.)..(.). (.)(.)/;say3ドル.1ドル.3ドル.1ドル; # nana
$_=$!=95;/.(.)..(.). (.)(.)/;say3ドル.2ドル.3ドル.1ドル; # nona
$_=$!=95;/.(.)..(.). (.)(.)/;say3ドル.2ドル.3ドル.2ドル; # nono
$_=$!=75;/.(.)..(.). (.)(.)/;say3ドル.2ドル.3ドル.2ドル; # lolo
$_=$!=75;/.(.)..(.). (.)(.)/;say3ドル.4ドル.3ドル.2ドル; # lalo
$_=$!=75;/.(.)..(.). (.)(.)/;say3ドル.4ドル.3ドル.3ドル; # lall
$_=$!=75;/.(.)..(.). (.)(.)/;say5ドル.4ドル.3ドル.3ドル; # all
$_=$!=75;/ (.)..(.). (.)(.)/;say5ドル.4ドル.3ドル.3ドル; # off
$_=$!=75;/ (.)..(.). (.)(.)/;say5ドル.4ドル.5ドル.3ドル; # of
$_=$!=75;/ (.)..(.). (.)(.)/;say5ドル.4ドル.5ドル.5ドル; # o
$_=$!=75;/ (.)..(.). (.)(.)/;say2ドル.4ドル.5ドル.5ドル; # go
$_=$!=75;/ (.)..(.). (.)(.)/;say2ドル.4ドル.4ドル.5ドル; # goo
$_=$!=75;/ (.)..(.). (.)(.)/;say2ドル.4ドル.4ドル.3ドル; # goof
$_=$!=75;/ (.)..(.). (.)(.)/;say2ドル.4ドル.1ドル.3ドル; # golf

Try it online!

I approached this by first printing out all the 2 digit error messages and looking for words that contained g, o, l and f . Once I had some target regexes I checked if any of them would match code and then refined to pick a regex that would have spaces in (at least some of) the right places. From there I worked manually (because I found it interesting!) to pick a route, although automation would have probably resulted in a better score.

Perl 5 + -M5.10.0, 43 bytes, 15 changes: score 645

Try it online!

Perl 5 + -M5.10.0, 43 bytes, 15 changes: score 645: SAFE

17 steps total, 15 excluding code and golf.

Try it online!

Solution

I noticed that I could have saved a byte on my solution too using:

$_=$!=35;/.(.)..(.). (.)(.)/;say"2ドル1ドル3ドル4ドル"; # code

but only after posting and didn't think it was fair to adjust, a whole 15 off my score!

$_=$!=35;/.(.)..(.). (.)(.)/;say2ドル.1ドル.3ドル.4ドル; # code
$_=$!=35;/.(.)..(.). (.)(.)/;say3ドル.1ドル.3ドル.4ドル; # dode
$_=$!=35;/.(.)..(.). (.)(.)/;say3ドル.1ドル.3ドル.1ドル; # dodo
$_=$!=95;/.(.)..(.). (.)(.)/;say3ドル.1ドル.3ドル.1ドル; # nana
$_=$!=95;/.(.)..(.). (.)(.)/;say3ドル.2ドル.3ドル.1ドル; # nona
$_=$!=95;/.(.)..(.). (.)(.)/;say3ドル.2ドル.3ドル.2ドル; # nono
$_=$!=75;/.(.)..(.). (.)(.)/;say3ドル.2ドル.3ドル.2ドル; # lolo
$_=$!=75;/.(.)..(.). (.)(.)/;say3ドル.4ドル.3ドル.2ドル; # lalo
$_=$!=75;/.(.)..(.). (.)(.)/;say3ドル.4ドル.3ドル.3ドル; # lall
$_=$!=75;/.(.)..(.). (.)(.)/;say5ドル.4ドル.3ドル.3ドル; # all
$_=$!=75;/ (.)..(.). (.)(.)/;say5ドル.4ドル.3ドル.3ドル; # off
$_=$!=75;/ (.)..(.). (.)(.)/;say5ドル.4ドル.5ドル.3ドル; # of
$_=$!=75;/ (.)..(.). (.)(.)/;say5ドル.4ドル.5ドル.5ドル; # o
$_=$!=75;/ (.)..(.). (.)(.)/;say2ドル.4ドル.5ドル.5ドル; # go
$_=$!=75;/ (.)..(.). (.)(.)/;say2ドル.4ドル.4ドル.5ドル; # goo
$_=$!=75;/ (.)..(.). (.)(.)/;say2ドル.4ドル.4ドル.3ドル; # goof
$_=$!=75;/ (.)..(.). (.)(.)/;say2ドル.4ドル.1ドル.3ドル; # golf

Try it online!

I approached this by first printing out all the 2 digit error messages and looking for words that contained g, o, l and f . Once I had some target regexes I checked if any of them would match code and then refined to pick a regex that would have spaces in (at least some of) the right places. From there I worked manually (because I found it interesting!) to pick a route, although automation would have probably resulted in a better score.

Source Link
Dom Hastings
  • 24.6k
  • 4
  • 58
  • 94

Perl 5 + -M5.10.0, 43 bytes, 15 changes: score 645

Yeah, I don't think this one's going to be a winner! Might be too easy anyway, as I'm pretty sure there's a shorter route than the one I ended up taking but I couldn't quite get it working!

$_=$!=35;/.(.)..(.). (.)(.)/;say2ドル.1ドル.3ドル.4ドル

Try it online!

AltStyle によって変換されたページ (->オリジナル) /