ForumArcade ► Cheese Hunter
Cheese Hunter

¯\_(ツ)_/¯

Controls:
  • Arrow keys to move
  • Click an unvisited cell to mark or unmark it
  • Click a visited cell to teleport to it
  • Hold Enter to explore automatically
  • Hold Space to backtrack or advance to the next maze if you've found the cheese
  • Escape to return to title screen

Planned features:
  • Timed mode
  
Already addicted... >.>
  
Nice. >:]

Increased maze size and added blue bread crumbs.
  
I finished one but wait- there's more! What is this more? New maze? ohhhhhhhh coool I will spend hours here.
  
later, I already finished two
  
I think my favorite part is how when you finish it looks like a lighting strike.
  
I found that interesting as well. The maze generation is a randomized version of Prim's algorithm, which is used to construct a tree that touches every node in a graph (this tree is called a spanning tree). The lightning pattern emerges because you're exploring a subset of that tree.
  
I feel like a little white lab rat
  
Would it be possible to allow you to set markers for key points you want to reach?

Also, could you allow a click on your backtrail to re-start from there? Re-tracing a long wrong branch gets tedious.
  
There's a new version in the oven (compiler queue), but mouse events aren't working, so instead you'll be able to hold spacebar to zip back to the start, Oil's Well style.

Blake, I think the Event constructor in the TwoCans SDK is bugged:

class Event {
    field type;
    field down;
    field up;
    field button;
    field key;
    field x;
    field y;

    constructor(type, key, button, x, y, down) {
        this.down = down;
        this.up = !down;
        this.key = key;
        this.button = button;
        this.x = x;
        this.y = y;
    }
}

Missing "this.type = type;"
  
Type is indeed missing, although I found it under my couch. I'll put it back where it belongs tonight.
  
Fixed. I uploaded a new version of the SDK.
  
It looks like events accumulate infinitely now instead of being cleared after each update. I think you need to move

keyEvents = [];
mouseEvents = [];
gamepadEvents = [];
menuEvents = [];

into the infinite loop.
  
Blake, how come this don't draw me a mouse?

import Graphics2D;
import ImageResources;
import TwoCansAlpha1;

class MainScene : AbstractScene {
    field mainLayer;

    field mouseImage;

    constructor() : base() {
        this.addLayer(new SolidColorLayer(Color.LIGHT_GRAY));
        this.mainLayer = this.addLayer(new GraphicsLayer());

        imageSheet = ImageSheet.loadFromResources("twocans_everything");
        this.mouseImage = GraphicsTexture.load(imageSheet.getImage("mouse.png"));
    }

    function update(inputManager, events) {
    }

    function render() {
        this.mouseImage.draw(0, 0);
    }
}
  
Because it's all broken. Brokeeeeeeeen! But I fixed it a couple minutes ago. Redownload the new SDK.

All image sheet stuff is automatically handled by the SDK. Use Images.get(path) for getting a reference to images. Direct Graphics2D access isn't (supposed to be) available yet.
  
I won!
  
Wow, that was a nice solution path. Right along the diagonal!

Update:
  • Hold Enter to automatically explore the maze
  • Hold Space to scurry home
  • Pressing Space while on the cheese restarts with a new maze
  • Click somewhere you've been to teleport there
  • Click somewhere you haven't been to toggle its marker
  • Sick graphics
  
Actually, after doing a couple more "perfect" solves in a row I kind of figured out a trick that leveraged the fact that it's a purely randomly generated spanning tree.

Spoiler text below. Highlight to read.

The generation process will always be denser towards the origin. Branches will generally go outward. There are very few correct branches that go towards the origin. Because you're going up and to the right, all branches after a few squares, will tend to go up and to the right (it looks like lightning). This does not help the decision process when moving from the origin to the cheese. However, if you look at the cheese and search for a path to the origin, branch points will either move away from the origin or towards it. Choosing the one that tends towards the origin is correct 95% of the time and you can trace backwards through the whole maze in a matter of about 10 seconds. When you get to a point where you can see the clear path between your current point you're looking and the location of the mouse, move the mouse along the path until you forget the solution path, and then repeat the process. After a couple of tries, I could do this in about 3 passes and solve it in about 30 seconds.

Possible optimization to the generation process to negate this method:
  • in a first pass, choose about a dozen points randomly scattered through the screen.
  • create the solution path that winds through these points. Very windy. All sorts of directions.
  • Create some number of branches off this path using the existing algorithm.
  
Clever, clever...

Difficulty increased!
  
I approve.

This was the best I could do

Feature requests!
  • When encountering a dead end (or when a 3-walled dead end can be seen from the mouse's current position) that tile changes color to dark blue and the route back continues to change to dark blue until you get to the last branch.
  • More branches? It felt like there are now longer stretches of decision-free paths.
  • Night mode: you can only see within a 10 square radius.
  
Blake said:
Night mode
I was actually already planning this!
Blake said:
When encountering a dead end...
Done (in queue)!
Blake said:
...or when a 3-walled dead end can be seen...
Harder... maybe later. Would be especially useful in night mode.
Blake said:
More branches?
I've been reading through this incredible site. There's a whole zoo of maze types and generation algorithms. The first generator I used was simplified Prim's, and the current is a recursive backtracker. There are tradeoffs for every type. I could probably increase the branching of the recursive backtracker by occasionally popping the stack even if a dead end hasn't been reached yet.

I'm planning to add a menu where you choose the maze type and size - and vision radius!
  
I think I found a Cheat! IDK tho
- Highlight to read.

Pressenterandholditdown.
  
Pressenterandholditdown.

Hold Enter to automatically explore the maze

Feature. It always just takes each branch from left to right.
  
New features:
  • Title screen with maze type and size options
  • New maze type: laboratory (uses recursive subdivision algorithm)
  • Dead ends are now marked when they are in your line of sight, instead of only when you visit them
  • Can now move by holding arrow keys (nice for corridors)
  
Painted the entire large board with blue bread crumbs that for some reason turned orange when I collected the cheese.
  
Forum > Arcade > Cheese Hunter