Enter: Pulpsweeper: a barebones minesweeper clone made in pulp!

Hello, all! When someone says,“you can make anything as long as you can imagine it as a grid of tiles” my first thought is my favorite grid of tiles: Minesweeper! To get used to pulp and force myself to learn the ins and outs of some of its functions, I decided to implement it, and I had a lot of fun! There’s definitely A LOT of repeated code that could probably be cut down on, and due to my use of recursion to fill all zeroes the zero you clicked on is touching and any tiles that are touching any of those zeroes, I’m not super confident in this running perfectly on hardware? But my instinct is that the recursion isn’t THAT bad…

I’m attaching 3 files, the JSON of the full game with randomized minefields, the JSON of the game without randomized minefields so you can paint your own minefields in pulp if you want, and the pdx in case someone has a playdate and wants to chuck it on there to let me know how it runs. The game has an audio file that due to a glitch technically doesn’t fall in the 32 measure limit that pulp is supposed to impose, so I’m curious to see if that last note that’s outside of the 32nd measure plays on hardware.

There’s not a lot of good reusable code here, but if anyone wants to use any of the code, or any of the assets feel free, even remix your own funky not barebones minesweeper if you want.

I don’t have many plans to take this beyond where it is, other than adding difficulty options(i wrote the level generator with this in mind, so it would just be a matter of adding a menu that just changes the variable that decides how many mines to generate, and checking to make sure that variable isn’t bigger than the number of tiles on the playing field).

Sorry, that was a lot of rambling but it’s 4 am, so…

Minesweeper (1).json.zip (9.7 KB)

Minesweeper(pre-random).json.zip (6.0 KB)

Minesweeper_2022-01-22T104936.632304.zip (81.3 KB)

7 Likes

it looks great!

2 Likes

Oh man, I didn’t realize i accidentally uploaded the version with the sprites that tell you the answers, whoops

1 Like

:wink: I felt like the king of the game!

3 Likes

here are the corrected versions, lmao
Minesweeper (1).json.zip (9.7 KB)
Minesweeper_2022-01-22T104936.632304.zip (81.3 KB)

2 Likes

Hi there, I’m brand new to Pulp (and a long way to go for my playdate to arrive I’m on group 3…) but have a quick question: why did you go for items instead of world tiles?

EDIT: I think I found out myself playing around with the fake alpha tutorial found elsewhere, it is very straightforward to override the collect event and in doing so the item is never “picked” so it stays as “fake world tile”.

Thank you so much for sharing your work @zapzip2013 !

1 Like

I chose to not use world tiles because world tiles can’t have pulpscript associated with them. On top of that, I didn’t find the name function until toward the end of this project, lmao, so I wasn’t able to from pulpscript outside of a tile, query what that tile was and modify it depending on what specific tile it is. Regardless, with so many tile types and with some of them behaving differently, I’m used to object oriented programming so I like to put functions associated with a particular type of tile within that tile.

Doing it with world tiles would probably cut down on a bit of code reuse though so that may be a good option.

But yeah, the default behavior of the collect event on an item probably looks something like this


itemNameString++

say stringValue

swap defaultWorldTile

So if you overload the collect event, even with simply


on collect do

end

none of that default behavior will happen, while still allowing you to have individual pulpscript associated with each item.

1 Like

One silly bit of code you can find in the json, is, because I wasn’t aware of the name function, there was a point in the code where I essentially implemented that by doin something along the lines of

tell event.x,event.y to
     call “getName”
end
//some code using if tileString == “nameOfTile” 

and then in the tile I have an event that looks like

on getName do
     tileString = “nameOfTile”
end

Which is pretty silly and unnecessary In hindsight knowing the name function exists.