# Talk:Traproom
I was reading through Sporkhack code and stumbled across this new special room

+mktraproom()
+{
+    struct mkroom *sroom;
+    struct rm *lev;
+    int area, ttyp, ntraps;
+    int idx = (level_difficulty() + ((long)u.ubirthday))&nbsp;% 9;
+
+    if(!(sroom = pick_room(TRUE))) return;
+
+    sroom-&gt;rtype = TRAPROOM;
+    if (!rn2(10)) idx = rn2(10); /* occasionally give anything if called twice on same level */
+
+    area = ((sroom-&gt;hx - sroom-&gt;lx + 1) * (sroom-&gt;hy - sroom-&gt;ly + 1));
+    ntraps = rn2(area/3) + (area/4);
+
+    while (ntraps-- &gt; 0) {
+	switch (idx) {
+	default: ttyp = LANDMINE; break;
+	case 0:  ttyp = ROLLING_BOULDER_TRAP; ntraps--; break;
+	case 1:  ttyp = rn2(2)&nbsp;? PIT&nbsp;: SPIKED_PIT; break;
+	case 2:  ttyp = WEB; break;
+	case 3:  ttyp = rn2(3)&nbsp;? ROCKTRAP&nbsp;: COLLAPSE_TRAP; break;
+	case 4:  ttyp = FIRE_TRAP; break;
+	case 5:  ttyp = rn2(5)&nbsp;? TRAPDOOR&nbsp;: HOLE; break;
+	case 6:  ttyp = STATUE_TRAP; break;
+	case 7:  ttyp = rn2(2)&nbsp;? DART_TRAP&nbsp;: ARROW_TRAP; break;
+	}
+	mktrap(ttyp, 0, sroom, NULL);
+    }
+
+}

Generation:

case 10:
+					if (u_depth &gt; 4 &amp;&amp; !rn2(24)) { mkroom(TRAPROOM); break; }

--Ozymandias (talk) 01:51, 24 July 2013 (UTC) if someone could write this article, that would be great.