Random walks and polygons in tight confinement