Generate pacman labyrinth

Let’s say my labyrinth it’s a bidimensional array (35x25). I need an algorithm to generate that array … can you give me some hints ?

in my array i have 0 - walkable space, 1- wall, 2- coin…and so on

There is a lot of different algorithms and tutorials around the web on this topic, google is full of results, one of them:

I don’t think any of those algorithms would generate a fun, playable game of Pac-Man @max. Are you sure you want to randomly generate the labyrinth? Or are you just asking how you could define a map somehow and then generate the play area from that in the game? If it’s the latter, you could check out ‘Zombie Pac-Man’:

The script which defines the map and then generates the level from it is here:

It sort of does what you describe. Defines a two dimensional array of IDs which correspond to a ‘tile type’ (space, wall, etc). It’s quite an old game and I would probably code it differently today, but it might be useful for you to reference. :smile: