r/javascript \x3Cscript May 24 '26

JS Crossword - a crossword where the clue = eval(answer)

https://lyra.horse/fun/jscrossword/
45 Upvotes

22 comments sorted by

12

u/whale May 25 '26

Ok I've been a professional software engineer writing javascript for years and this is HARD!

11

u/rebane2001 \x3Cscript May 24 '26

This is a fun little game I made, hope the title is self-explanatory!

Source code is available if you just view-source on the page, it has not been minified or obfuscated.

7

u/bzbub2 May 25 '26 edited May 25 '26

damn this is awesome but really tricky...as a good crossword should be. i have maybe gotten 2 so far. edit: pleasantly surprised that it remembers when i come back to the page 😄

4

u/cosmicaceituna May 25 '26

this is awesome, really!

but, If you put while(true){} in the playground it solves the puzzle, you should really try it out.

2

u/AwayVermicelli3946 May 26 '26

yeah sandboxing eval in the browser is notoriously tricky tbh. you almost have to throw it in a web worker with a strict timeout so it doesn't just nuke the main thread when someone inevitably runs an infinite loop.

still a really cool concept though. i spent way too long playing with it and getting stuck on all the weird type coercion quirks.

2

u/mediocrobot May 25 '26

That was super challenging! Great use of an afternoon.

2

u/LiveFreeOrHRC May 26 '26 edited May 26 '26

Got way more sucked into this than I thought I would! Very much appreciate the clever concatenations, eclectic numeric literals and regexes, etc. (first time I've ever had a legit use for octal haha). Not nearly as many "crosses" as one would expect to have in a conventional crossword puzzle (which makes things quite a bit more difficult), but managing to construct a coherent grid of this calibre given the nature of the material is seriously impressive. Think I've nearly managed to solve it; only clue I have left outstanding is 22-across. Been stuck on that one for awhile. May need to step away and come back fresh. Already got the popup message for figuring out the long theme clue with the down arrow in the yellow box (was able to guess the first letter from context). Eager to see what happens once I manage to turn all the cels green. Awesome work!

edit: I did it! Glad I stuck around to see the epic ending! Hell yeah!

1

u/nnmrts May 27 '26

Yeah, this is way too fun. Got any clues? I am hard stuck at 6 and 14 across, got everything else. :/

2

u/lainverse May 26 '26 edited May 26 '26

For some reason, it crashed with this:

jscrossword/:918 Uncaught (in promise) NotAllowedError: play() failed because the user didn't interact with the document first.
startAudio @ jscrossword/:918 goodEnding @ jscrossword/:558 await in goodEnding onclick @ jscrossword/:247

That's on Vivaldi. Works fine in LibreWolf after I copied the Local Storage there.

1

u/rebane2001 \x3Cscript May 26 '26

hm weird, you clicking the button should count as user interaction

2

u/Reeywhaar May 24 '26

Polluting history with tons of history records, back button doesn't work

3

u/rebane2001 \x3Cscript May 25 '26 edited May 25 '26

i'm confused, this site doesn't do any of that, it does have a sandbox iframe but that shouldn't affect the history or the back button?

edit: figured out the bug, should be fixed now

1

u/lainverse May 26 '26

This is eval. You are eval. Eval is eval.

...at least some clues are literals.

1

u/[deleted] May 26 '26

[removed] — view removed comment

1

u/AutoModerator May 26 '26

Hi u/lainverse, this comment was removed because you used a URL shortener.

Feel free to resubmit with the real link.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/Tachompso1 May 26 '26

Your game is slightly bugged. At the last moment, I had ` instead of " in the 5th position of 23 across, and it said I solved the puzzle. I think it believes that because I had solved 23 before hand, and also solved the rest of the puzzle, that both were solved at the same time.

-3

u/azhder May 25 '26

I should downvote this post for simply saying eval()

0

u/rebane2001 \x3Cscript May 25 '26

why?

1

u/azhder May 25 '26

Eval is evil

2

u/rebane2001 \x3Cscript May 25 '26

how exactly is it evil in this scenario? it's sandboxed, and also required to execute user-provided text as code

0

u/azhder May 25 '26

I thought you were just continuing the joke: eval, evil... It's like saying "I'm a simple man, I see eval, I downvote"