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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

A game based on the Havel-Hakimi algorithm

88 点作者 jnotarstefano大约 11 年前

13 条评论

DaCapoo大约 11 年前
I have not looked over the Havel-Hakimi algorithm yet, but here&#x27;s the best way I&#x27;ve found to solve these (with 100% success rate so far)<p>1. Pick the node with the highest degree 2. Make all the connections for that node until it has a value of zero by connecting it with the highest-value node that it isn&#x27;t already connected to<p>For example, in this scenario: <a href="http://i.imgur.com/O8MlWzz.png" rel="nofollow">http:&#x2F;&#x2F;i.imgur.com&#x2F;O8MlWzz.png</a><p>The way that I see it is that since the highest-degree node needs to make X number of connections, ensure it can make all of those connections before worrying about anything else. In this case, that means start by connecting the 4 to the next highest value node - the 3, then the 2, then the other 2, then the 1.<p>This leaves the following situation: <a href="http://i.imgur.com/9vZjafr.png" rel="nofollow">http:&#x2F;&#x2F;i.imgur.com&#x2F;9vZjafr.png</a><p>It&#x27;s kind of easy to see where it goes from there. Sure this is a simple example, but as I said it&#x27;s worked 100% of the time I&#x27;ve tried it.
评论 #7459839 未加载
评论 #7461113 未加载
评论 #7461176 未加载
NoodleIncident大约 11 年前
This is nice! I got stuck and gave up when there got to be nodes with 6s on them, but that&#x27;s just because I&#x27;m in class.<p>Given that the only reason to select an edge right now is to delete it, perhaps the delete action could be mapped to a click, rather than a click plus a backspace. Also, a reset level button would be nice.
ajanuary大约 11 年前
A greedy algorithm seems to be successful with the graphs in this game. Pick the node with the highest degree, connect it to the other nodes with the highest degrees, repeat.
评论 #7458702 未加载
评论 #7458710 未加载
评论 #7458612 未加载
rbonvall大约 11 年前
It reminds me of the &#x27;bridges&#x27; game from Simon Tatham&#x27;s Portable Puzzle Collection. It has the additional restriction that edges cannot cross each other.<p><a href="http://www.chiark.greenend.org.uk/~sgtatham/puzzles/" rel="nofollow">http:&#x2F;&#x2F;www.chiark.greenend.org.uk&#x2F;~sgtatham&#x2F;puzzles&#x2F;</a><p>(Say goodbye to your productivity if you like puzzles).
评论 #7461671 未加载
评论 #7461061 未加载
kaitai大约 11 年前
If you want to reach people in the wide wide world, explain what a degree sequence is in the first paragraph! This is your chance for a bit of mathevangelism!
sitkack大约 11 年前
Crazy I just came across a game with the same exact mechanic in the last week. Can&#x27;t find it again though.
评论 #7460591 未加载
csense大约 11 年前
This should keep a completed level on the screen until you click to advance.<p>Also, deleting links needs some work: I think the hit detection is too small. Also, a mouse-only way to delete would be nice -- how about right clicking? Double clicking would be another possibility (and I assume more touch friendly).
NaNaN大约 11 年前
Fun. I gave up when the number got to 9, because the cluster got messy. :(
kaahne大约 11 年前
Pretty fun game. I thought that greedy algorithm would not work with this problem, so I wrote a basic genetic algorithm to find a solution, refining it as I went.<p>Bit of overkill, but fun game overall !
tn13大约 11 年前
Within 3 minutes of playing this game I was able to see what Havel-Hakimi algorithm is.
btkostner大约 11 年前
Congrats. You just showed maths far better than any of my high school classes.
devilshaircut大约 11 年前
Pretty fun game. Clever way to scout internships as well. Hah!
spot大约 11 年前
needs an animation for when you complete a graph.<p>reward my success!