Random stuff

Negative indices

xs[-1]: good, bad, ugly?


Debug statement

Print statement in Python 2 is optimized for hello world and few other programs people who study the language write.


Adjacent heptagons on hyperbolic plane

All elements returned by adjacent function from the previous post indeed correspond to the tiles adjacent to the given one. And they indeed are arranged in counter-clockwise order. So what’s the problem?


Coordinate system for heptagonal tiling of hyperbolic plane

While playing HyperRogue (which is awesome, by the way), I began to wonder how such game could be implemented. Crucial component would be discrete coordinate system for hyperbolic tiling, and it turned out that it’s not entirely trivial.


What does it mean to introduce coordinate system on a regular tiling?

I suppose there could be many valid answers to this question, but I’ll just go with one that is especially convenient for my puproses.


Rabbits make up history on demand

Operations defined in the previous post are not total. For example, we can’t go up from the root of the tree. That’s because root element has no history. Let’s pretend that this whole tree is just a subtree of a tree with the same uniform structure that spans infinitely in all directions (including up).


Navigating tree of rabbits

As stated in famous Fibonacci rabbit problem, it takes one month for young pair of rabbits to mature (reach reproductive age). Mature pair breeds, and in one month produces young pair of offsprings, while remaining reproductive itself.


Random biased coin

Suppose we pick biased coin at random, so that tails probability $\theta$ is itself uniformly distributed on $[0, 1]$. What is the distribution of number of tails if we toss this coin $n$ times?