Spelunky is © 2008, 2009 Derek Yu and Mossmouth, LLC, and is used under the [Spelunky User License v1.1b](https://spelunky.ai/LICENSE.txt). spelunky.ai is an unofficial fan project, not affiliated with or endorsed by Mossmouth. The game and its assets may not be sold.

Music by George Buzinkai and Jonathan Perry; sound effects made in SFXR. From Spelunky Classic 1.1, © 2008, 2009 Derek Yu and Mossmouth, LLC.

# Snake pit

From the spelunky.ai wiki: <https://spelunky.ai/wiki/snake-pit>. Verified against the spelunky.ai port [v0.1.10](https://github.com/851-labs/spelunky/releases/tag/v0.1.10) on 28 October 2026.

A snake pit is a special Mines level of Spelunky Classic: a shaft of rooms off the path, full of Snakes, with two Big Rubies and a free Mattock at its bottom.

![A green snake with a tan belly, slithering left](https://spelunky.ai/wiki/media/aa0fe627885261d5/sprites/sSnakeLeft/frames/0%404x.png)

| Snake pit |                                                              |
| --------- | ------------------------------------------------------------ |
| Levels    | 1–4[^1]                                                      |
| Chance    | 1 in 8 for each column of three side rooms, once a level[^2] |
| Part of   | [The Mines](https://spelunky.ai/wiki/mines)[^1]              |

The pit is a column of rooms that [level generation](https://spelunky.ai/wiki/level-generation) sets aside from [the Mines](https://spelunky.ai/wiki/mines)' path: a room open
at the bottom, then a narrow shaft dropping one or two rooms, then a bottom room with no way out but up.
[Snakes](https://spelunky.ai/wiki/snake) wait in its walls and on its floor, beside two [Big Rubies](https://spelunky.ai/wiki/big-ruby) and a
[Mattock](https://spelunky.ai/wiki/mattock) buried in a brick. A level with a pit opens with the message "I HEAR SNAKES... I HATE
SNAKES!".

## Generation

### The roll

Once the path from the entrance to the exit is laid ([the Mines' Generation](https://spelunky.ai/wiki/mines#generation) has how),
level generation looks for a column with three side rooms (rooms the path doesn't cross) one above the
other. It checks the top row's four columns from left to right, then the second row's, and each place it
finds has a 1 in 8 chance of becoming a pit. The first that comes up is the pit, and the search stops, so a
level has one at most[^3][^4].
Every level of the Mines makes the roll, level 1 included, and no other area's does[^1].

A pit that starts in the top row runs down all four rows when the bottom row's room is a side room too, and
three rows otherwise; one that starts in the second row runs to the bottom[^5]. The pit's rooms stop being side rooms, so none of them can
be a shop, [Kali's altar](https://spelunky.ai/wiki/kalis-altar) or the [Golden Idol](https://spelunky.ai/wiki/golden-idol)'s room, which only side rooms become[^6][^7].

A level with a pit opens with "I HEAR SNAKES... I HATE SNAKES!"[^8]. On a [dark level](https://spelunky.ai/wiki/dark-level), it comes after the dark
level's message[^9].

### The layout

| Room                    | What                                                                                                                                                                              |            |
| ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
| The top                 | One of the drop rooms the path uses, with an opening at the bottom                                                                                                                | [^10]      |
| The middle (one or two) | A shaft four tiles wide between solid walls, with blocks jutting from them here and there. Eight of its wall tiles, four a side, are each a Snake 1 in 10, or else a brick 1 in 2 | [^11][^12] |
| The bottom              | The shaft's foot, walled in on both sides and below: five Snakes, two Big Rubies, and the Mattock in a brick under them                                                           | [^13][^14] |

The middle and bottom rooms have one layout each. In the clip, on level 4, the player drops down the shaft to the bottom room,
collects its two Big Rubies, and the Snakes around him bite him three times[^15]. The Mattock stays buried in its brick[^16].

**Clip: Down a snake pit.** On a Mines level with a snake pit, the player drops down the pit's shaft to its bottom room, collects the two big rubies there, and the snakes around him bite him three times. ([video](https://spelunky.ai/wiki/media/aa0fe627885261d5/clips/snake-pit/descent/clip.mp4))

## Inhabitants

The pit's own Snakes are made with its rooms, before the rest of the level's monsters:

| Monster                                 | Where                                                                   | Chance                |                 |
| --------------------------------------- | ----------------------------------------------------------------------- | --------------------- | --------------- |
| [Snake](https://spelunky.ai/wiki/snake) | In the walls: eight tiles of each middle room, two of the bottom room's | 1 in 10 for each tile | [^17][^18][^12] |
| [Snake](https://spelunky.ai/wiki/snake) | On the bottom room's floor                                              | Five, always          | [^18][^19]      |

Then level generation goes over the pit's blocks as over the rest of the level's, and may put the Mines'
monsters there: [Snakes](https://spelunky.ai/wiki/snake) on top of blocks, [Bats](https://spelunky.ai/wiki/bat) and [Spiders](https://spelunky.ai/wiki/spider) under them
([the Mines' Inhabitants](https://spelunky.ai/wiki/mines#inhabitants))[^20].

## Hazards

- **The Snakes**, which bite for 1 heart each, five of them close together on the bottom room's floor[^18][^16].

## Items and shops

The bottom room always has two [Big Rubies](https://spelunky.ai/wiki/big-ruby) and a free [Mattock](https://spelunky.ai/wiki/mattock), its price 0 and not
for sale, buried in the brick in the middle of the floor, under the rubies, where a [Bomb](https://spelunky.ai/wiki/bomb) or a
Mattock already in hand can dig it out[^18][^21]. The pit's bricks hide gems and items as any brick does, and
treasure is scattered on its ledges as on the rest of the level ([the Mines' Treasure](https://spelunky.ai/wiki/mines#treasure)).
No shop is ever in the pit (above).

## Secrets

- **The free [Mattock](https://spelunky.ai/wiki/mattock)** in the floor of every pit.

## Trivia

- The code that marks the pit's rooms has an `if (true)` around it, whose `else` would have made a pit of
  two rooms, a top and a bottom; it never runs. Inside it, a test that the third room is a side room repeats
  one the loop has already made, and two variables set before it are never read[^22][^23][^24].
- The middle and bottom rooms pick their layout with `switch(rand(1,1))`, a roll with one outcome[^25][^26].
- A commented-out line beside the roll sets its chance to 1 in 1, a pit on every level[^27].

## FAQ

### What is a snake pit in Spelunky Classic?

A shaft of three or four rooms, one above the other, that level generation digs into a level of [the Mines](https://spelunky.ai/wiki/mines) beside the path. Its walls hide [Snakes](https://spelunky.ai/wiki/snake), and its bottom room holds five more, two [Big Rubies](https://spelunky.ai/wiki/big-ruby) and a free [Mattock](https://spelunky.ai/wiki/mattock). The level opens with "I HEAR SNAKES... I HATE SNAKES!".

### How often is there a snake pit in Spelunky Classic?

Level generation tries one wherever a level of the Mines has three side rooms one above the other, from the top row or the second, with a 1 in 8 chance each time, and stops at the first that comes up, so a level has one pit at most. A level with no such column has none.

### Where is the Mattock in a snake pit in Spelunky Classic?

Buried in a brick in the middle of the pit's floor, under the two Big Rubies. It's free, but the brick has to be dug or bombed out first.

### Are there snake pits outside the Mines in Spelunky Classic?

No. The roll for one is made only on the Mines' levels, 1 to 4.

## See also

- **Related:** [Snake](https://spelunky.ai/wiki/snake), [Mattock](https://spelunky.ai/wiki/mattock), [Big Ruby](https://spelunky.ai/wiki/big-ruby), [Level generation](https://spelunky.ai/wiki/level-generation)
- **Found here:** [Big Ruby](https://spelunky.ai/wiki/big-ruby), [Mattock](https://spelunky.ai/wiki/mattock), [Snake](https://spelunky.ai/wiki/snake)

## References

[^1]: [`scripts/scrLevelGen.gml:142`](https://spelunky.ai/wiki/source/scripts/scrLevelGen#L142)

[^2]: [`scripts/scrLevelGen.gml:144-148`](https://spelunky.ai/wiki/source/scripts/scrLevelGen#L144-L148)

[^3]: [`scripts/scrLevelGen.gml:138-185`](https://spelunky.ai/wiki/source/scripts/scrLevelGen#L138-L185)

[^4]: [`scripts/scrClearGlobals.gml:55`](https://spelunky.ai/wiki/source/scripts/scrClearGlobals#L55)

[^5]: [`scripts/scrLevelGen.gml:150-171`](https://spelunky.ai/wiki/source/scripts/scrLevelGen#L150-L171)

[^6]: [`scripts/scrLevelGen.gml:239-275`](https://spelunky.ai/wiki/source/scripts/scrLevelGen#L239-L275)

[^7]: [`scripts/scrRoomGen.gml:85-121`](https://spelunky.ai/wiki/source/scripts/scrRoomGen#L85-L121)

[^8]: [`objects/oPlayer1/alarm_0.gml:21-26`](https://spelunky.ai/wiki/source/objects/oPlayer1/alarm_0#L21-L26)

[^9]: [`objects/oPlayer1/alarm_1.gml:5-10`](https://spelunky.ai/wiki/source/objects/oPlayer1/alarm_1#L5-L10)

[^10]: [`scripts/scrRoomGen.gml:219-237`](https://spelunky.ai/wiki/source/scripts/scrRoomGen#L219-L237)

[^11]: [`scripts/scrRoomGen.gml:205-211`](https://spelunky.ai/wiki/source/scripts/scrRoomGen#L205-L211)

[^12]: [`scripts/scrRoomGen.gml:462-466`](https://spelunky.ai/wiki/source/scripts/scrRoomGen#L462-L466)

[^13]: [`scripts/scrRoomGen.gml:212-218`](https://spelunky.ai/wiki/source/scripts/scrRoomGen#L212-L218)

[^14]: [`scripts/scrRoomGen.gml:467-481`](https://spelunky.ai/wiki/source/scripts/scrRoomGen#L467-L481)

[^15]: Clip snake-pit/descent

[^16]: Replay `fidelity/replays/mines-seed-2-snake-pit.txt`

[^17]: [`scripts/scrRoomGen.gml:209`](https://spelunky.ai/wiki/source/scripts/scrRoomGen#L209)

[^18]: [`scripts/scrRoomGen.gml:216`](https://spelunky.ai/wiki/source/scripts/scrRoomGen#L216)

[^19]: [`scripts/scrRoomGen.gml:467-470`](https://spelunky.ai/wiki/source/scripts/scrRoomGen#L467-L470)

[^20]: [`scripts/scrEntityGen.gml:30-74`](https://spelunky.ai/wiki/source/scripts/scrEntityGen#L30-L74)

[^21]: [`scripts/scrRoomGen.gml:471-481`](https://spelunky.ai/wiki/source/scripts/scrRoomGen#L471-L481)

[^22]: [`scripts/scrLevelGen.gml:139-140`](https://spelunky.ai/wiki/source/scripts/scrLevelGen#L139-L140)

[^23]: [`scripts/scrLevelGen.gml:148-177`](https://spelunky.ai/wiki/source/scripts/scrLevelGen#L148-L177)

[^24]: Quirk 1 (docs/quirks.md)

[^25]: [`scripts/scrRoomGen.gml:207`](https://spelunky.ai/wiki/source/scripts/scrRoomGen#L207)

[^26]: [`scripts/scrRoomGen.gml:214`](https://spelunky.ai/wiki/source/scripts/scrRoomGen#L214)

[^27]: [`scripts/scrLevelGen.gml:141`](https://spelunky.ai/wiki/source/scripts/scrLevelGen#L141)

### Source code

- [`scripts/scrLevelGen.gml`](https://spelunky.ai/wiki/source/scripts/scrLevelGen)
- [`scripts/scrRoomGen.gml`](https://spelunky.ai/wiki/source/scripts/scrRoomGen)
- [`scripts/scrClearGlobals.gml`](https://spelunky.ai/wiki/source/scripts/scrClearGlobals)
- [`objects/oPlayer1/alarm_0.gml`](https://spelunky.ai/wiki/source/objects/oPlayer1/alarm_0)
- [`objects/oPlayer1/alarm_1.gml`](https://spelunky.ai/wiki/source/objects/oPlayer1/alarm_1)
