Great game, I love it! I hope the author is collecting juicy analytics. They would be useful if they ever want to bundle 100 levels in order of difficulty and release this as a Steam game (which I would absolutely buy!)
I don’t think the gates should animate up into the air. It breaks the visual logic of 2D for no benefit. It’s subconsciously confusing to see a gate I place in one cell move to occupy pixels in the cell “above” it.
I look forward to future days introducing new mechanics as well. Can I suggest a few, based on dynamics?
- Food! The horse moves on every turn towards an attractor. Have a hay bale / giant sugar cube in one corner fall off the back of a truck / helicopter :) Horses start out dumb and move directly towards the goal before backtracking. Smarter horses path find the shortest route to the goal.
- Goals! Now that the horse is moving, get the horse into a static horse box / cattle pen cell by strategically placing fences so that the path it takes towards the food involves walking onto the goal square.
- Floods! Water encroaches from the edges on a turn by turn basis. Not only do you have to contain the horse, you also have to hold back the flood.
'analytics' and 'surveillance' are not the same thing
trying to understand player behavior in the context of a board or video game (though there is some overlap!) is not the same as trying to understand user behavior in the context of social media or purchasing behavior - the data of both of which derive their value from being sold to THIRD PARTIES as a commodity.
being able to tune a fun little video game is not the same thing at all
Collecting analytics like this is effectively the same as play-testing physical board games in-development. People play a game, information is gathered, and the game is tuned in response to that. If zero information were ever gathered, games could not be balanced or tuned for other things like unforeseen problems.
Please, show me a piece of software, or game, that is perfect the first time it is made.
So long as personal information is not collected, consent is not morally necessary.
If I collect information on how often a coin-op Street Fighter II game is played in an arcade, while collecting no personal information, consent is not needed.
You are not entitled to play the game, which is hosted on their server which requires bandwidth and other resources. In the same way that you are free to make demands about how software runs on your machine, the author is free to make demands about the use of their software.
If the data gathered is only on gameplay, and not something that can be used as PII like IP addresses or device information, then it should be fine. Gathering things like the score and time spent completing the level, isn't a problem. This could be used to rank the levels, without gathering any user information.
There are games that let you opt-out, hell even ones that ask you when you first open the game. There are bad apples, but there are plenty of good ones too.
If it asks you then it's neither opt-in nor opt-out. Then it depends on how it asks you. If it's a simple yes/no, it's fine. If it's typical tech bullshit where your options are a big "I want to make the world a better place and save the whales by sending my data" or a tiny button in the corner labeled "maybe later" that takes you to another screen saying "please confirm you want to opt out of data collection and kill a bunch of kittens" then not so good.
You could just package an arbitrary 100 levels, let the player play them in any order, then give rewards for 10, 20, 30, 40, etc. levels completed/mastered.
There is definitely a turn-based minigame here - get the most "distance" travelled by the horse, every turn the horse moves one block towards it's closest escape and you can drop walls to cause it to find a new path - in this one you actually lose when the horse can't get out but the goal is to get the horse to move as many blocks as possible using your limited number of walls (or apples which can attract it).
That reminds me of Paquerette Down the Bunburrows [1] which is a very fun pathfinding game where the bunnies will pathfind to try to run away from you. It's not exactly what you described, but it is very fun and surprisingly deep and challenging.
I was initially expecting the horse to move after each turn. As it is, this is a logic game, similar to what I'd expect to see in the NYT Games app. Quite entertaining, but something that you could look at and reason about to solve.
But, you absolutely could make this a turn based game where the horse is trying to escape and you (playing as the farmer), work to fence it in as it meanders towards a gate.
> I don’t think the gates should animate up into the air. It breaks the visual logic of 2D for no benefit. It’s subconsciously confusing to see a gate I place in one cell move to occupy pixels in the cell “above” it.
I interpreted it as standard "top-down" RPG graphics, where the Y axis always doubles as the Z axis. As such, I didn't find it visually confusing - but it did made playing on mobile annoying, because you often end up targeting the wrong field.
> I don’t think the gates should animate up into the air.
I think it should go up, otherwise it doesn't look like a wall. It would look like something the horse can step on and run over. For the water it makes sense to be flat flat and that the horse doesn't want to touch it: it is water-shy.
+1 to this. It's also visually confusing, the gate looks like it's covering two cells.
Great game! Feature request: add a button that shows my submitted solution. I'd like to be able to compare it with the optimal solution (so it'd be nice if a single tap could toggle between my submission and the optimal).
Sometimes simple things are best. I really like the game as-is.
This is a rather simple game to program. IMO, if you can program, take a few weekends to make your own game based on your ideas. If you can't program, your ideas will lead you to a wonderful learning project.
I would have responded earlier, but I wanted to actually implement something you suggested: different walls. Alternative wall sprites, which don't occlude other tiles so much, are now live and can be adjusted in the settings.
Re: analytics, the only serious plans I had were to use the daily level histograms to adjust difficulty. The idea of taking some levels and releasing them as a standalone game is tempting, but I wonder if doing this type of puzzle over and over again might get tedious? That's one of the reasons I thought it would work better as a daily game. Let's see how it's doing in a few months.
I love the mechanic ideas. I think there are two big constraints on what kind of cool new features/gimmicks can be implemented though. First: if this is going to be a daily game, the new mechanics have to be intuitive enough to where somebody could figure them out their first time playing. I like the idea of cherries being misleading, and it's a fun troll-ish idea for a single player game, but it would be a mean trick if it were someone's first daily. (Then again, there's someone who's first Wordle game was probably MYRRH.) The other constraint is I have a solver that can guarantee the optimal solution is actually optimal. Some game mechanics might make this a lot harder, or even impossible.
Another thing to try could be to rank people in realtime instead of the one-off submission approach. I do this in https://spaceword.org (create tight crosswords using 21 letters), and I think it's quite motivating to see how you compare to others as you improve your solution. On the other hand, its a bit more taxing on the server, and then you also could not show the optimal solution.
I would prefer not being distracted by that, and not having information on possible solutions before submitting. Trying to find the best solution with added hints like that is a different game. So it should be opt-in.
Cool game! One minor feature request. It would be helpful to have some way to move the entire block of placed tiles around at once to give myself more room in a particular direction.
> I don’t think the gates should animate up into the air. It breaks the visual logic of 2D for no benefit.
I also feel it would make more sense either for everything to be 2.5D or pure top down. Having appear / disappear animation is nice feedback to user though.
Other thing is that maybe the hitbox should change when the wall comes up. Now to remove it you need to press the grid, essentially the root of the wall. Unintuitive to me.
Thanks for the game, looking forward to when there is multiple horses or sheep to enclose.
IMO, the game is great to keep simple, but I’d like to play more levels than just daily, so could see people paying for the ability to play more, like NYT games, and could be part of a suite of game if curated daily by expert vs social curation. The blocks are small though for a small phone with big fingers.
I also wonder if making it GPL and submitting to various *NIX distros would be best. Then it may need to be standalone with random maps created by ML or similar.
I found the optimal solution for day 8 by hand, that was fun!
My algorithm, by hand, was as such:
1. Start with the smallest possible valid solution (1)
2. Expand slowly, and each "step" (like, moving a wall or two around to "obvious" spaces) must be a valid solution (this brings you to 40-60 score, depending on your choices, on day 8). Continue to step 3 once you can't see anything obvious.
3. Look at possible places where you could expand, but need 1 more block. You'll find one eventually.
4. See if you can spare any walls anywhere, using diagonals for example. If so, place the solution from 3 and go to 3 (repeat). If not, go to 5.
5. Count or estimate the squares gained by doing your improvement from 3. See if you can reduce your score by less than that, pessimizing your solution, to gain 1 wall. Once you've found one, go to 3.
That got me to the optimal score within 15 mins or so.
This is nice, I enjoyed it. Was a couple points off the optimal score for day 8 but when I clicked "Show optimal" I couldn't then go back to see mine to compare. Either way, stretched the brain a bit.
Only nit: fix the walls. They take up one and a half spaces so are confusing, and they're sci-fi steel with flashing red lights. Turn them into one-square-only fences. You use fences to enclose horses, not raptor walls from Jurassic Park.
This is my feedback too. Turn “show optimal” into a toggle that persists on the page and toggles between yours and the optimal.
And same about the walls. Especially on mobile it’s hard enough to tap the right square, and having a wall poking up from the square below just makes things worse.
I am curious on how you would algorithmically find the optimal solution for this kind of problem for much bigger grids.
I wanted to do some seed finding in Factorio for the same exact problem using the generated map images, but never found a good solution that was fast enough.
The site uses Answer Set Programming with the Clingo engine to compute the optimal solutions for smaller grids. Maximizing grids like this is probably NP-hard.
Note that traditional SAT and SMT solvers are quite inefficient at computing flood-fills.
The ASP specifications it uses to compute optimal solutions are surprisingly short and readable, and look like:
#const budget=11.
horse(4,4).
cell(0,0).
boundary(0,0).
cell(0,1).
boundary(0,1).
% ...truncated for brevity...
cell(3,1).
water(3,1).
% ...
% Adjacent cells (4-way connectivity)
adj(R,C, R+1,C) :- cell(R,C), cell(R+1,C).
adj(R,C, R-1,C) :- cell(R,C), cell(R-1,C).
adj(R,C, R,C+1) :- cell(R,C), cell(R,C+1).
adj(R,C, R,C-1) :- cell(R,C), cell(R,C-1).
% Walkable = not water
walkable(R,C) :- cell(R,C), not water(R,C).
% Choice: place wall on any walkable cell except horse and cherries
{ wall(R,C) } :- walkable(R,C), not horse(R,C), not cherry(R,C).
% Budget constraint (native counting - no bit-blasting!)
:- #count { R,C : wall(R,C) } > budget.
% Reachability from horse (z = enclosed/reachable cells)
z(R,C) :- horse(R,C).
z(R2,C2) :- z(R1,C1), adj(R1,C1, R2,C2), walkable(R2,C2), not wall( R2,C2).
% Horse cannot reach boundary (would escape)
:- z(R,C), boundary(R,C).
% Maximize enclosed area (cherries worth +3 bonus = 4 total)
#maximize { 4,R,C : z(R,C), cherry(R,C) ; 1,R,C : z(R,C), not cherry( R,C) }.
% Only output wall positions
#show wall/2.
Im over 35 years of age. I have 15+ years of programming experience. And I generally consider myself as someone who has good breadth of tech in general. Yet, this is the first time in my life I've heard of ASP. And gosh. I was completely blown away by this as I read more about it and went through some examples (https://github.com/domoritz/clingo-wasm/blob/main/examples/e...)
Therefore, like a good little llm bitch that I have become recently, I straight away went to chatgpt/sonnet/gemini and asked them to compile me a list of more such "whatever this is known as". And holy cow!! This is a whole new world.
My ask to HN community: any good book recommendations related to "such stuff"? Not those research kinds as I don't have enough brain cells for it. But, a little easier and practical ones?
Things I don't like include that it's more dense, doesn't use clingo examples (mostly math-style examples so you kind of have to translate them in your head), and while the proofs of how grounding works are interesting, the explanations are kind of short and don't always have the intuition I want.
I still think this is the authoritative reference.
The "how to build your own ASP system" paper is a good breakdown of how to integrate ASP into other projects:
The pre-machine-learning formulations of AI focused on symbolic reasoning through the dual problems of search and logic. Many problems can be reduced to enumerating legal steps, and SAT/SMT/ASP and related systems can churn through those in a highly optimized and genetic manner.
> algorithmically find the optimal solution for this kind of problem for much bigger grids.
Great, now I've been double nerd-sniped - once for the thing itself and another for 'What would an optimiser for this look like? Graph cuts? SAT/SMT? [AC]SP?'
I'd bet it's NP-hard. The standard reduction to a flow problem only tells you if a cut exists (by min-cut max-flow duality), but here we want the cut of size at most N that maximizes enclosed area.
The Leetcode version of this is "find articulation points", which is just a DFS, but it's less general than what is presented here.
I think it's NP hard, maybe from Sparsest Cut. But you could probably find the min-cut and then iterate by adding capacity on edges in the min cut until you find a cut of the right size. (if the desired cut-size is close to the min cut size at least).
It's NP-hard from Minimum s–t Cut with at least k Vertices. That's the edge version, but since the grid graph is 4-regular(-ish), the problem is trivially convertible to the vertex version.
That conclusion may be too hasty. If min cut with k vertices is NP-hard on arbitrary graphs, that doesn't automatically mean that that applies to a 2D grid too.
Is NP hardness proven for just planar graphs? Those are closer to the 2D grid, but still slightly more general. All I could find was a reduction to densest k subgraphs, but Wikipedia tells me that whether that problem is NP hard for planar graphs is an open question.
To be clear, I would be very surprised if the problem turns out to be _not_ NP hard, but there is no trivial equivalence to min cut in general graphs to show that it is.
I agree, that is a good point. Although it is (induced) subgraphs of 2D grids, which gets you a bit closer to the planar case (albeit with bounded degree).
It might be polytime on planar graphs, but that would be surprising.
Constraint programming seems to be a fitting approach. Input would be number of walls, and the location of lakes.
The decision variables would be the positions of walls.
In order to encode the horse being enclosed, additional variables for whether horse can reach a given square can be given. Finally, constraints for reachability and that edges cannot be reached should ensure correctness.
it was very easy to support the portal mechanism when the entire problem is mapped as a network flow optimization. i could just simply add the portal coordinates together with the neighbors.
I don't believe this works in general. If you have a set of tiles that connect to neither the horse nor to an exit, they can still keep each other reachable in this formulation.
Yes, this is the major challenge with solving them with SAT. You can make your solver check and reject these horseless pockets (incrementally rejecting solutions with new clauses), which might be the easiest method, since you might need iteration for maximizing anyways (bare SAT doesn't do "maximize"). To correctly track the flood-fill flow from the horse, you generally need a constraint like reachable(x,y,t) = reachable(nx,ny,t-1) ^ walkable(x,y), and reachable(x,y,0)=is_horse_cell, which adds N^2 additional variables to each cell.
You can more precisely track flows and do maximization with ILP, but that often loses conflict-driven clause learning advantages.
Good point. I don't think the puzzles do this and if they would, I would run a pre-solve pass over the puzzle first to flood fill such horseless pockets up with water, no?
It's not quite that easy. For the simplest example, look at https://enclose.horse/play/dlctud, where the naive solution will waste two walls to fence in the large area. Obviously, you can construct puzzles that have lots of these "bait" areas.
Like the other comment suggested, running a loop where you keep adding constraints that eliminate invalid solutions will probably work for any puzzle that a human would want to solve.
However, I think that you do not need 'time' based variables in the form of
reachable(x,y,t) = reachable(nx,ny,t-1)
Enforcing connectivity through single-commodity flows is IMO better to enforce flood fill (also introduces additional variables but is typically easier to solve with CP heuristics):
that gives away too much information, instead i'd go with something that tells you that you've found the best solution. you'll still be able to know whether or not to keep going, but you get no information that makes finding the ideal solution easier.
There is a level editor with the ability to show the optimal result for a custom level. In theory, one could recreate any official level and reveal the best solution that way. However, I haven't tried this to verify any intentional roadblocks by the developer.
on disk, so basically I'm trying to save the image of a solution and reuse it if the same quiz is required. So instead of recomputing the result just return the same image.
I think Cloudflare r2 has a generous free tier. You can also technically store images in redis I think. anyways, thank you for making this, really cool!
curious question from a non-programmer - are you checking against the exact same image (i.e. hashed), or is there an easy way of trying to match an image to a very similar one you've seen before?
Not OP, so I don't know what their website does, but there is a technique called "locality-sensitive hashing" that gives the same hash for similar items instead of exactly the same ones
I imagine you went searching for domain names and came up with this? I resisted clicking on this top story all day because I thought "how good could that be? "enclose horse" what is that?" Yet, the experience was genuine-slow-forming-smile-of-understanding. This is really good.
Cool game, but I don't like how you get only one chance. Even returning to the page, you can't try again to beat your previous score. No replayability value at all.
The one shot per day provides a reason to sink your teeth into one board.
I love Wordle but I found it unplayable when I used that Wordle archive site to play infinite games since there was no reason to think deeply about the 10th+ round I was playing in one sitting.
It shows you what the exit routes are, what your score will be, and you can move the gates around as long as you want, so the means of finding the maximum area are entirely within your grasp.
But you have no idea what the optimal solution is, are you 1,10,50 away from it. Would be nice to have some indicator of how close you are before you submit, though I guess that's intentional.
I believe that’s the point. I had the optimal solution for some time but was convinced there was something better. Eventually I submitted, and seeing the perfect score was more thrilling after convincing myself I was an idiot.
I seriously don't get the idea behind daily challenges unless you want to keep users hooked to extract some value from them, but that doesn't seem to be the case here, as there are no ads.
That's fine. So these kind of games aren't for you, then. Remember crosswords in newspapers? Yeah, think of it like that. You don't get hooked until you cannot let go, you get a limited chunk served each day. Same with Wordle.
I remember buying a magazine full of crosswords and similar puzzles when I was in the mood.
And when there were sites with unlimited Wordle, I played a few in a row.
On the internet, unlike with newspapers, you're not limited to how many levels/games you can make per day. Making it once per day doesn't make any sense whatsoever. It's condescending to the users and feels like a power trip.
> It's condescending to the users and feels like a power trip.
condescending (adjective): having or showing an attitude of patronizing superiority.
I don't really see how a once-a-day puzzle is condescending, unless it's a "You can't be trusted to regulate yourself so I'll do it for you" type thing. Adding a dictionary definition like above, however, probably is condescending :)
But I like the one-a-day format because, as other comments have said, you can spend an entire day with just one puzzle feeling important (relative to things that are important).
You can freely make levels and browse other people's levels. The complaining about power trips seems as uncharitable a perspective as you could possibly conceive of, not to mention a bit theatric.
> you want to keep users hooked to extract some value from them
Ironically, that's what I initially liked about the daily puzzles like Wordle: they forcibly prevented you from sinking too much time into them. It was sort of like, "hey here's something cool, and I'm going to make sure it's a positive addition to your life by preventing you from succumbing to your own addictive impulses". You could call that condescending or infantilizing, but to me it's just part of the look and feel of a thing. Especially if the author isn't charging money, they get to use whatever tools are at their disposal to craft the users' experience of it. Wordle Over And Over Again is a different game than Wordle Once Daily. (And WOAOA done properly would probably have a progression of difficulties, or themes, or something, whereas WOD makes more sense with pure randomness.)
I assume that "all the different levels" might not exist yet. The author is probably creating them a bit in advance, and will keep going as long as they're motivated. Having a regular schedule for new releases helps, and doing it daily seems as sensible as any other schedule.
IMO they should have a (second) pop-up that warns you that you only get one submit. Not sure if it should let you know if you've made an optimal solution or not, but since it's not timed there's no cost in slowing people down. I've seen similar daily puzzles where you get to see the leaderboard and then can go back and optimize further. Yes, it says it at the beginning, but it's still easy to forget.
Yes but it would be nice to see the targets, so you know how far off from an optimal solution you are. I know I'd spend more time looking for better solves if I knew the current one can be improved
Nice game! Out of curiosity, are the daily levels built by hand or algorithmically? Is there some way to measure their difficulty computationally, other than just trying to do it yourself or seeing how many people get a perfect score? I'm also working on a grid-based browser game and both those questions have come up for me, I'm keen to see how other people tackle it.
All the daily levels are built by hand. I struggled to come up with a good random level generator. You can see my feeble attempts in the Edit page (via the hamburger menu) by giving the dice button a few sad clicks.
I did originally try to measure the difficulty computationally by running the solver and timing it, but it didn't really line up with what humans would find difficult. Now I'm just eyeballing it.
lots of fun! the fact that the walls spill over the square boundaries is very annoying though, i would love to have an option to just make a wall a filled in square without the 3d effect.
This is a very cool and enjoyable game. I'd be really interested in knowing what framework/library was used to make it. I inspected the source and can see the game is done on canvas, but can't work out more than that.
Looks like some people have discovered the first "accidental" game mechanic: The horse can walk over cherry fields, but the player cannot place walls on them - so if a level designer places cherries strategically, they can create unblockable paths.
Right now, this is only used for troll levels, but I wonder if you could also use it for some actual puzzles.
My 10 year old loves this game. He started playing it Wednesday or Thursday of last week and basically all of his screen time. Both trying to optimize and the level design scratch an itch that few games do
I think this problem is called the maximum-weight closure and can be solved as max flow. You want to find a cut between source (horse) so they were no out-going edges not in the cut (escape routes).
Ton of fun! Was interesting to see how my strategy evolved as well. I started out trying to make a large pen, but quickly realized that wouldn't work, so I made a small pen and then started moving it out. This allowed me to see individual optimizations and try alternatives. Even at the end, about to hit submit, I wasn't sure my solution was optimal, but ended up with the optimal sizse-86 solution for today's challenge. Will try again tomorrow!
Usability, i'd like either a 'save/restore state' button, or a 'restore current best'. Right now, experimenting after finding a solution seems like a punishment if I can't recall exactly what I did to hit my rolling 'best'. Good game though!
This is surprisingly similar to a subset of the ARC II puzzles.
The collected answered could probably be used to teach an AI to approach this type of problem thereby gaining some of the cognitive biases that humans have, which is exactly what you want in some cases: An AI that generates human like solutions to hard problems .
just vibe-coded an optimizer for this game that takes in the screenshot of the grid and the number of walls as input, and spits out the optimal wall configuration (supports cherries too!)
algorithm:
1. infer grid dimensions
2. color histogram analysis to designate grasses, water, cherries and horse
3. apply mixed-integer linear programming to determine optimized wall placements
I love this! Would you consider adding a settle to toggle the animations off? When I'm staring at it to figure it out the animations are a bit distracting!
A very fun game - it took quite a bit of fiddling to get an optimal solution using an LLM. Interesting as I haven't tried using them for 'unique' algo problems much. And then the day 9 puzzle broke my original solver (I had bounded areas that were unreachable to the horse so didn't actually score). Will be interesting to see whether the solver works on day 10.
It would be interesting to be able to change the wall budget for each puzzle to add some variation (with a max limit).
Does each day's challenge come out at a certain time in your local timezone? I have a friend who is seeing day 9 when I can only see day 8. I'd request having new daily maps come out at a consistent global time for the purpose of competing with friends who live in different timezones.
I expected the horse to move one tile for each block you placed. I had an elaborate plan to lure it towards one exit and then close it at the last minute... Nope!
I remember a game I played on my phone ~15 years ago called "Greedy Spiders". The spiders would move greedily towards something every move, but you could cut strings in their web so they would have to start a new route. So you would kinda have to lure them into going one direction while slowly chipping away at the web, until you could completely cut them off or force them to have to take a longer detour giving you more time to cut more of the web. Quite challenging after a while.
Nice puzzle! But I'd like a button to go back to your most optimal solution so far: it's tedious to try other options but then have to convert it back to your better solution again...
I didn't realize level 1 gave me 11 (eleven) walls at first. I thought it stood for II = roman 2. Maybe use a font that makes the difference between 1 and I clearer.
I don’t think the gates should animate up into the air. It breaks the visual logic of 2D for no benefit. It’s subconsciously confusing to see a gate I place in one cell move to occupy pixels in the cell “above” it.
I look forward to future days introducing new mechanics as well. Can I suggest a few, based on dynamics?
- Food! The horse moves on every turn towards an attractor. Have a hay bale / giant sugar cube in one corner fall off the back of a truck / helicopter :) Horses start out dumb and move directly towards the goal before backtracking. Smarter horses path find the shortest route to the goal.
- Goals! Now that the horse is moving, get the horse into a static horse box / cattle pen cell by strategically placing fences so that the path it takes towards the food involves walking onto the goal square.
- Floods! Water encroaches from the edges on a turn by turn basis. Not only do you have to contain the horse, you also have to hold back the flood.
reply