TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: Boxes

52 pointsby sidbatraalmost 11 years ago

20 comments

ronaldxalmost 11 years ago
Current thoughts on strategy:<p>You shouldn&#x27;t care how you are affecting your opponent&#x27;s board (you are affecting it randomly). So just play for your own board.<p>On an empty board:<p><pre><code> The centre square is the most valuable, crossing 4 lines The diagonals are also valuable, crossing 3 lines All the other squares are equally not-valuable, crossing 2 lines. However - the squares change their value (a lot) depending on what your opponent plays. </code></pre> A good strategy is therefore to wait and see what your opponent plays, then greedily collect the lines that they nearly fill in by random chance.<p>To acheive this... fill the valuable squares: centre and diagonals, while your opponent fills other places randomly. I guess they are doing the same.<p>Once you&#x27;re done with the diagonals: fill the line which is most close to completed. This does not require too much thought - once you start filling a line, it&#x27;s nearly always right to keep filling it.<p>You can break ties between lines, where necessary, by looking at which crossing lines are nearly filled.<p>Although the robot has the advantage of seeing what the player plays, I believe the first move outweighs this advantage (especially on the larger boards?)
评论 #7789936 未加载
评论 #7786867 未加载
Cogitoalmost 11 years ago
This was quite interesting, but it&#x27;s so annoying to see multiple 1 line comments from new accounts, and accounts that have very little history. Even more annoying, the older &quot;spammy&quot; accounts all seem to be linked to accredible, the site hosting the game. Over half the contributions on this page are from those accounts; <i>niveshi</i>, <i>lateguy</i>, <i>aheppenstall</i>, <i>ambitionvc</i>, <i>amarsaurabh</i>, <i>rachana318</i>.<p>Apart from all that, this looks like it would be fun to turn into a pure javascript clone. The network connection seems completely unnecessary, and it would be fun to create competing AIs.
评论 #7790650 未加载
hypersoaralmost 11 years ago
Neat! This was fun to think about.<p>Given the complete lack of relationship between the two matrices, the fact that you&#x27;re playing against a computer seems immaterial. You make a move, and then a random square is filled in. You lose if you don&#x27;t achieve the win condition in some number of turns (I wanna say around n^2&#x2F;2).<p>That said, here&#x27;s a greedy algorithm I&#x27;ve arrived at, similar (but not identical to) ronaldx&#x27;s:<p>For an unfilled point p on an unfinished line, define its value, v(p). There are a bunch of ways to do this, but one that I&#x27;ve thought of is: the number of x&#x27;s on all unfinished lines through that point.<p>1. Fill in the center square<p>2. Choose an unfinished line with a maximal number of x&#x27;s such that the sum of the values of all its unfilled points is &#x2F;maximal&#x2F;<p>3. Fill in a point p on that line with v(p) &#x2F;minimal&#x2F;<p>4. Goto: step 2<p>Reasoning for step 1: The center space opens up the most options, lying on more lines than any other point.<p>Reasoning for step 2: You want to pick a line to fill in. Moreover, you want the filling in of its points to benefit your efforts elsewhere as much as possible.<p>Reasoning for step 3: Now that you&#x27;ve picked a line, you&#x27;re going to fill in all its points. You pick the points in ascending order of value to give the robot as much time as possible to fill in the best points for you.
Glyptodonalmost 11 years ago
There should be an option to let the computer play first.
squidpiealmost 11 years ago
This is a good time, but it would be nice to see what the robot is doing, having their game board visible but no numbers showing would nice.
swangalmost 11 years ago
There is a bug in the game where if your search page 503s I lose a turn (computer takes a square, the square I clicked isn&#x27;t acknowledged).
waterfowlalmost 11 years ago
Was having fun but I think HN just killed it. Alas!
评论 #7786333 未加载
评论 #7786339 未加载
carbalmost 11 years ago
Why would you disable the context menu? For something so simple, this application&#x27;s front-end seems incredibly over-complicated.
farnsworthalmost 11 years ago
Fun! But why is the AI done server-side? So slow!
评论 #7787106 未加载
ahassanalmost 11 years ago
I&#x27;m kinda confused about how to win. Do I choose a number and if the computer also chooses that number, we both get X&#x27;s?
Oculusalmost 11 years ago
I think it&#x27;d be nice to see the NPC board even if it&#x27;s just a grid of blank squares.
rachana318almost 11 years ago
@lateguy - am one of the developers. try figuring it out ;)
评论 #7786606 未加载
DanBCalmost 11 years ago
Is &quot;the robot&quot; just &quot;other humans&quot;?
评论 #7787017 未加载
nikunjkalmost 11 years ago
Exciting game. Please build a mobile version of this!
aheppenstallalmost 11 years ago
Really like it - what algorithm are you using for the robot?
评论 #7785980 未加载
ambitionvcalmost 11 years ago
Really cool!
niveshialmost 11 years ago
This is awesome
ckarthikvalmost 11 years ago
Good stuff, addictive!
lateguyalmost 11 years ago
I beated till 3 levels, really cool. What algo you are using?
amarsaurabhalmost 11 years ago
I liked the game. Super cool stuff. Pretty addictive. I could cross level 4.