Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Challenges

Post History

71%
+3 −0
Challenges 8 coexisting queens

JavaScript, 48 bytes _=>[..."41506372"].map(x=>1e8/9+10**x|0).join` ` Try it online! The string "41506372" encodes the position of the queen in each row. 1e8/9 gives 11111111.1111......

posted 1y ago by m90‭

Answer
#1: Initial revision by user avatar m90‭ · 2022-09-29T15:04:11Z (over 1 year ago)
# JavaScript, 48 bytes

<!-- language-all: lang-javascript -->

    _=>[..."41506372"].map(x=>1e8/9+10**x|0).join`
    `

[Try it online!][TIO-l8n6ksz2]

[TIO-l8n6ksz2]: https://tio.run/##y0osSyxOLsosKNEts/ifnJ9XnJ@TqpeTn66h8T/e1i5aT09PycTQ1MDM2NxIKVYvN7FAo8LWzjDVQt9S29BAS6uixkBTLys/My@BK@G/poam5n8A "JavaScript (V8) – Try It Online"

The string `"41506372"` encodes the position of the queen in each row.

 `1e8/9` gives 11111111.1111..., and adding 10<sup>x</sup> changes a digit from 1 to 2 at position `x`.

The bitwise operation is a short way to cause a conversion to integer, removing the fractional part, and finally, `join` inserts line feeds in between the numbers.