Question: Whilst applying the below function I have bool values converted to integers.

What am I missing?

```
import pandas as pd

def multi(x):
    if isinstance(x, (float, int)):
        return x * 10
    return x

print(pd.DataFrame(data={"a": [True, False]}).applymap(func=multi))

```

Ouput:

```
    a
0  10
1   0

```

Expected:

```
       a
0   True
1   False

```

Answer: 
After the `join` and `replace` operations, `board` will be a string like this:

```
001-012-210

```

Each row is separated by `-`.

The `111` case is testing for a row full of X's.

The `1...1...1` case is testing for a column full of X's. There are 3 dots because there is also the `-` character.

The `1..1..1` case is testing for a diagonal full of X's.
In a regular expressions alternative patterns are separated by `|` and `.` matches exactly any one character.

The board in converted to a string, that looks like this:

```
001-012-210

```

That means player `1` wins, when

* they filled a row, which means the string contains the substring `111`
* they filled a column, which means the string is either
`1xx-1xx-1xx` , `x1x-x1x-x1x` or `xx1-xx1-xx1`. In these cases there are exactly three characters between each `1`, which is matched by `1...1...1` in the regular expression.
* they filled a diagonal, which means the string is either `xx1-x1x-1xx` or `1xx-x1x-xx1`. In these cases there are either exactly two or four characters between each `1`, which are matched by either `1..1..1` or `1....1...1`.