TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Sudoku Solver in 140 bytes

123 点作者 itamarb超过 13 年前

10 条评论

po超过 13 年前
For those of you who haven't heard of code golf, you should check out <a href="http://140byt.es/" rel="nofollow">http://140byt.es/</a> The point is more to learn more about the language than to make something practical so come at it in a lighthearted way. In this case, the problem is actually pretty damn hard.<p>140 Bytes is Jed Schmidt's side project where people compete to make useful functions as small as possible. Jed is kind of a Javascript powerhouse and also happens to be a really nice guy.<p><a href="https://github.com/jed" rel="nofollow">https://github.com/jed</a><p><a href="https://github.com/jed/140bytes/wiki/Byte-saving-techniques" rel="nofollow">https://github.com/jed/140bytes/wiki/Byte-saving-techniques</a><p><i>Edited to add..</i> As a curiosity, Jed might have the most-forked gist on github: <a href="https://gist.github.com/962807" rel="nofollow">https://gist.github.com/962807</a>
评论 #3047473 未加载
swannodette超过 13 年前
Here's one half the size in k:<p><pre><code> p,:3/:_(p:9\:!81)%3 s:{*(,x)(,/{@[x;y;:;]'&#38;21=x[&#38;|/p[;y]=p]?!10}')/&#38;~x} </code></pre> <a href="http://thesweeheng.wordpress.com/2008/11/30/more-sudoku-solvers-in-k-and-q/" rel="nofollow">http://thesweeheng.wordpress.com/2008/11/30/more-sudoku-solv...</a>
评论 #3047818 未加载
0x12超过 13 年前
That's really neat, a sudoku solver that fits in a tweet.<p>The license is even nicer, that's a real gem, and I think it ought to be submitted for formal approval as an open source license.
评论 #3047414 未加载
ashishgandhi超过 13 年前
A fork for 139 byes: <a href="https://gist.github.com/1247640" rel="nofollow">https://gist.github.com/1247640</a><p>And I had never heard of "DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE". (<a href="http://en.wikipedia.org/wiki/WTFPL" rel="nofollow">http://en.wikipedia.org/wiki/WTFPL</a>)
评论 #3047717 未加载
todsul超过 13 年前
This won't work for anything but the most basic puzzles. Brute force just constitutes basic gameplay. To solve a moderately advanced Sudoku puzzle you need to compare potential candidates in groups. Then it gets even more advanced with a handful of trial and error techniques.
评论 #3048309 未加载
HankMcCoy超过 13 年前
Could someone help with the syntax on line 24:<p>g&#38;&#38;R(a)<p>I simply don't understand it as a statement and I don't get in the context of the for-loop
评论 #3050074 未加载
评论 #3050061 未加载
thmzlt超过 13 年前
4clojure has a code golf league for its exercise: <a href="http://4clojure.com/" rel="nofollow">http://4clojure.com/</a>
whatgoodisaroad超过 13 年前
I want to see a minimal solution in APL.
HankMcCoy超过 13 年前
I have to admit, I have never seen<p>.) for-loops used this way<p>.) an OR-operator in a for loop<p>.) +a as a shortcut for a.toString()<p>.) syntax like g&#38;&#38;R(a) (line 24)<p>.) syntax like a[j^i==j] (line 29)<p>Where can I learn/read about advanced stuff like this, searching for this information on google is very hard, as I lack the correct terms ...
评论 #3050258 未加载
veyron超过 13 年前
What's the minimal `J` solution?