Live data from Hacker News

Show HN: Slices – puzzle game

slices.ovh

71–80 of 80 posts

Re: Show HN: Slices – puzzle game

#71
post #50

What would be an efficient solver for this problem, and what would the running time be? Seems like a naive solver would be too slow for this, could it be restated into finding the minimal number of cuts needed to fully disconnect a planar graph?

My gut intuition says you don't need to check the entire space of possible lines, just the lines between any two dots (rotated by an trivially small degree to separate the two), because a "correct" cut should always be defined by the bounds between which some dot on the border is included or excluded in a given cut. You also don't need to check each sequence of legal cuts. Most positions can be deduced to be unwinnab…

I came up with basically this same idea independently when writing my solver (pasted in my top-level comment). It mostly works well, but it isn't obvious how to extend it to capture non-convex geometry.

E.g. cutting off 2 ears to create 3 regions vs cutting off whole head to create 2 regions.

Re: Show HN: Slices – puzzle game

#72

Fun at first, but between level 7 or something and at least level 15, it's the same problem over and over (sure, positions change a little bit, but the method is exactly same). I wonder if it changes a bit later, but even if it does, it would be cool if some of these redundant levels were removed so people don't get bored. Edit: level 17 is a little bit more interesting (albeit being the same thing) but level 18 and…

I'm at 49 now, and while I think your point is valid I don't agree that it's a problem.

Some repetition or easy levels do occur, but i solve them quite quickly so it's fine. One could even argue that interspersing easy and hard levels makes for good pacing.

I'm enjoying this game a lot!

Re: Show HN: Slices – puzzle game

#73

Earlier quoted context omitted.

My gut intuition says you don't need to check the entire space of possible lines, just the lines between any two dots (rotated by an trivially small degree to separate the two), because a "correct" cut should always be defined by the bounds between which some dot on the border is included or excluded in a given cut. You also don't need to check each sequence of legal cuts. Most positions can be deduced to be unwinnab…

I came up with basically this same idea independently when writing my solver (pasted in my top-level comment). It mostly works well, but it isn't obvious how to extend it to capture non-convex geometry. E.g. cutting off 2 ears to create 3 regions vs cutting off whole head to create 2 regions.

That's an impressive quick effort.

My second initial gut reaction says you could add a point to the graph at the local minima of a non-convex curve and use it as a way to generate additional candidate, but not require the solver to eliminate it? Could probably smoosh an extra rule inn there somehow to eliminate pieces on that particular piece, but it wouldn't generalize to all non convex curves.

Re: Show HN: Slices – puzzle game

#74
Really enjoyed the game. One feature which would be nice: extend line segments to the whole plane. Right now, only partitions created by the line segment alone are counted, so even if you begin a line ‘before’ a dot but inside an island which would partition that dot if extended, partition is not counted.

In other words: For all points on an island which are either the beginning or end of a line segment, extend the segment from that point to infinity in the other direction. Maybe show this extension while the line is being drawn.

Re: Show HN: Slices – puzzle game

#75

I was inspired to write a solver for this kind of puzzle (it's not pretty but it seems to work well): import numpy as np import z3 import matplotlib.pyplot as plt from sklearn.svm import LinearSVC from sklearn.cluster import KMeans def normalize(v): return v / np.sqrt(np.dot(v, v)) def line_normal(v): return np.array([v[1], -v[0]]) def line_segment_intersection_test(e0, e1): a, c, b, d = e0[0], e1[0], e0[1] - e0[0],…

Are you sure you can’t do this with a linear programme? Surely there is a way to encode the line choices, the partitions they create and the number of dots within those partitions as a linear programme. Might be fun to try.

Edit: Outsourced to codegolf. Had to move the question to the sandbox, as I was unsure on grading. Will update when accepted.

Re: Show HN: Slices – puzzle game

#76

I was inspired to write a solver for this kind of puzzle (it's not pretty but it seems to work well): import numpy as np import z3 import matplotlib.pyplot as plt from sklearn.svm import LinearSVC from sklearn.cluster import KMeans def normalize(v): return v / np.sqrt(np.dot(v, v)) def line_normal(v): return np.array([v[1], -v[0]]) def line_segment_intersection_test(e0, e1): a, c, b, d = e0[0], e1[0], e0[1] - e0[0],…

Are you sure you can’t do this with a linear programme? Surely there is a way to encode the line choices, the partitions they create and the number of dots within those partitions as a linear programme. Might be fun to try. Edit: Outsourced to codegolf. Had to move the question to the sandbox, as I was unsure on grading. Will update when accepted.

Well,it is a set cover problem so you can use ILP and mip is actually much faster than z3. I'm sure it's possible (though maybe not easy) to use more geometry. I don't see how to make a simple linear program though.

Re: Show HN: Slices – puzzle game

#77

Earlier quoted context omitted.

Are you sure you can’t do this with a linear programme? Surely there is a way to encode the line choices, the partitions they create and the number of dots within those partitions as a linear programme. Might be fun to try. Edit: Outsourced to codegolf. Had to move the question to the sandbox, as I was unsure on grading. Will update when accepted.

Well,it is a set cover problem so you can use ILP and mip is actually much faster than z3. I'm sure it's possible (though maybe not easy) to use more geometry. I don't see how to make a simple linear program though.

Let's see what codegolf comes up with. Link above.

Re: Show HN: Slices – puzzle game

#78

Fun at first, but between level 7 or something and at least level 15, it's the same problem over and over (sure, positions change a little bit, but the method is exactly same). I wonder if it changes a bit later, but even if it does, it would be cool if some of these redundant levels were removed so people don't get bored. Edit: level 17 is a little bit more interesting (albeit being the same thing) but level 18 and…

I'm at 49 now, and while I think your point is valid I don't agree that it's a problem. Some repetition or easy levels do occur, but i solve them quite quickly so it's fine. One could even argue that interspersing easy and hard levels makes for good pacing. I'm enjoying this game a lot!

Well, if you're level 49, you still have 40 three-moves levels to complete before going to the four-move mode, so maybe you'll sympathize with me by then ;)

Re: Show HN: Slices – puzzle game

#79

Earlier quoted context omitted.

I came up with basically this same idea independently when writing my solver (pasted in my top-level comment). It mostly works well, but it isn't obvious how to extend it to capture non-convex geometry. E.g. cutting off 2 ears to create 3 regions vs cutting off whole head to create 2 regions.

That's an impressive quick effort. My second initial gut reaction says you could add a point to the graph at the local minima of a non-convex curve and use it as a way to generate additional candidate, but not require the solver to eliminate it? Could probably smoosh an extra rule inn there somehow to eliminate pieces on that particular piece, but it wouldn't generalize to all non convex curves.

After some thought I think it works as-is if you just delete all edges between points which can't directly see each-other, as long as the visibility graphs are still connected.

The best cuts could then sometimes be edge->edge instead of always vertex->vertex. (e.g. each point at a random position in a little bump, where you want to slice off all the bumps in one go without going off at a random angle.

I'm trying to think about the topology of cuts in the plane but its hard to visualize. I guess it must be related to Voronoi and Delaunay.

Re: Show HN: Slices – puzzle game

#80

Earlier quoted context omitted.

I'm at 49 now, and while I think your point is valid I don't agree that it's a problem. Some repetition or easy levels do occur, but i solve them quite quickly so it's fine. One could even argue that interspersing easy and hard levels makes for good pacing. I'm enjoying this game a lot!

Well, if you're level 49, you still have 40 three-moves levels to complete before going to the four-move mode, so maybe you'll sympathize with me by then ;)

I did make it this far without getting impatient or bored. Currently stuck on 93. Tough one
Post reply on HN