# How can someone find their Morphy number?

The Morphy number is a measure of how closely a chess player is connected to Paul Morphy (1837–1884) by way of playing chess games. It's analogous to the Erdős Number for mathematicians.

People who played a chess game with Morphy have a Morphy number of 1. Players who did not play Morphy but played someone with a Morphy number of 1 have a Morphy number of 2. People who played someone with a Morphy number of n have a Morphy number of n+1.

In my case, in the early 1980s, I played Jonathan Penrose in a simultaneous exhibition, the cosmic significance of which was unknown to me at the time. Penrose is one of the few living MN3 players, having played Savielly Tartakower in 1950, who played James Mortimer in 1907, who played Paul Morphy himself "hundreds of times" from 1853. So that gives me MN4. A bit lucky: if I hadn't got that connection to Penrose, I might be hard-pressed to find my number.

Jonathan’s brother is the celebrated physicist, Roger Penrose.

So how does someone go about finding their Morphy number more systematically? Has anyone data-mined chess games databases from this perspective? Have any results been published? What are the paths implied in the Wikipedia article linked above from the MN1 to MN2 to ... to MN5 players listed there? And what's the expected MN for an active player today?

Has anyone else here managed to figure out their MN?

• please play me so I can have MN5. begin. e4. (whatever move you make i'll resign. just make a move please.) – BCLC Mar 4 at 10:47
• @BCLC I am honoured but I think it should be a proper game of chess :-) – Laska Mar 4 at 12:47
• Come on. Please just comment back e5 or something. – BCLC Mar 4 at 14:24
• (part1) This is a half request and half implicit comment about how this number seems, at least ostensibly, kinda weird? i mean, erdos, bacon and erdos-bacon make sense because you actually do work. i mean, not just anyone can act or do maths. morphy number is like all you have to do is play? – BCLC Mar 4 at 14:36
• (part2) anyone can just show up, move and then resign. i think it would make sense if you win (or at least draw) against someone with morphy number (and then MN1 means win or draw against morphy) or make it to X number of moves without losing or something. myb add that it has to be in a FIDE or whatever tournament. but seriously just playing? i don't really see the value in this kind of number. – BCLC Mar 4 at 14:38

You'd have to find a list of players Morphy has played. Then, you'd research as many players who played each of those players. This can all be done by searching by player in a large database. Eventually you'd have a large tree, and the problem comes down to an optimal search algorithm.

You'd search "branches" with a more likely chance of giving you a small Morphy number. This means looking at players who have played more games over their career. For example, if some player A was one of Morphy's opponents who played the most games, you'd look at him first. Then, find one of Player A's opponents (call him B) who played the most games in his lifetime, and look at him first. If doing this recursively with B never leads to you (or gives a poor Morphy number), go on to C: the opponent of player A who played the second most games. If eventually you find all of Player A's opponents don't lead to you, meaning Player A isn't connected to you, go on to the opponent of Morphy who had the second most games.

But it's still a massive job to search. Even if you find a link to yourself, you need to prove/justify that it's the smallest link. Perhaps you could organize all these players into a tree and write a program to efficiently search it.

I never heard of the 'Morphy number' until I read your post. I found that my Morphy number is 5. Here is how I did it.

I started with Wikipedia

After looking at the list I realized that my best bet was the simul where I played John Donaldson. I still regret not pushing the pawn after preparing it so well...

I looked at other American players John would have played and found that he played Reshevsky at Lone Pine 1981.

Per Wikipedia Reshevksy's number is 3.

I had a similar problem not long ago, though not chess related. If I were to pattern this solution off of that one, I would consider storing Morphy in an SQL table along with all of his opponents, along with all of their opponents, and so on, in a parent/child relationship. So you would have one table with two columns (id and parent_id). id would be the child of parent_id and any id could be a parent_id, child id or both. So if Morphy is `parent_id=1` and he played ids 2-10, you might have

``````parent_id  |  id
1          |  2
1          |  3
1          |  4

etc.

2          |  25
2          |  28

etc.
``````

The last row would be you. Perhaps you are `id=1,100,000`

``````1,000,000  |  1,100,000
``````

Say this table is call chess_players, you could then recursively query this table to get your id and all of your ancestor parent_ids. Something like this

``````with recursive cte (id, name, parent_id) as
(
select     id,
parent_id
from       chess_players
where      parent_id = 1 and id=1100000 -- Morphy is the parent and you are the child
union all
select     p.id,
p.parent_id
from       chess_players p
inner join cte
on p.parent_id = cte.id
)
select * from cte;
``````

You will then see all of the parent_ids of your id number all the way up to Morphy's parent_id of 1. I suppose this is your Morphy count and you could use this technique for anyone in your chess_players table.

I'm thinking you could probably scrape a database like chessgames.com to populate your table.

As far as an algorithmic answer goes, if you can get a set of games into a pandas dataframe (Python), the following code should get you the Morphy numbers, unless I've messed up somewhere:

``````def get_distances(games,
starting_player = 'James Morphy',
max_depth = 100,
white_col_name = 'white'
black_col_name = 'black')
player_nums = {starting_player:0}
games_left = pd.DataFrame(index = games.index)
games_left[['white','black']] = games[[white_col_name, black_col_name]]
for current_depth in range(max_depth):
known_players = set(player_nums.keys())
numbered_white = games_left.white.isin(known_players)
numbered_black = games_left.black.isin(known_players)
new_white = games_left.loc[numbered_black & (~numbered_white)]
new_black = games_left.loc[numbered_white & (~numbered_black)]
new_players = set(new_white.white).union(set(new_black.black))
if not new_players:
return {'player_nums': player_nums,
'result': 'Ran out of connections'}
for player in new_players:
player_nums[player] = current_depth+1
games_left = games_left.loc[~(numbered_white | numbered_black)]
if games_left.shape[0] == 0:
return {'player_nums': player_nums,
'result': 'Analyzed all games'}
return {'player_nums': player_nums,
'result':  'Reached maximum depth'}
``````

This gets the Morphy number for everyone. Getting just yours is "almost as hard" (for some definition of "almost as hard") as getting all the Morphy numbers. This gets the numbers for a fixed data set. If you want to update the numbers as more games are played, you can just keep rerunning the program, but there's probably some tweaks you can make to make updating more efficient. Also, there have been comments suggesting people think that calculating the Morphy number would have an exponential complexity with respect to the depth number, but as long as the number of games is fixed, this algorithm has polynomial complexity with respect to the number of games.

Pseudocode to iteratively compute morphy number.

assume you have a database with a table plays of two columns x and y where a row indicates two indeviduals who have played one another.

``````_morphy = {}
def Morphy(name):

if name == 'Morphy':
return 0

if name in _morphy:
return _morphy[name]

_morphy[name] = math.inf
score = math.inf
results = execute(select x, y from plays where x=name or y=name)
for x, y in results:
if x == name:
score = min(score, Morphy(y) + 1)
elif y == name:
score = min(score, Morphy(x) + 1)

_morphy[name] = score
return score

print(Morphy('Jar Jar Binks'))
``````

This may not help if you do not have games in the ChessBase database (or even enough games), but ChessBase recently released a feature called "WinChain", which TRIES to find your "number" to any player, including Morphy. Nevertheless, I found that it still does not work particularly well for going back that far, but you still might be interested.

Here is an article called "Three Steps to Morphy" discussing the feature.

And here is a link to the page specifically for the Morphy number.

I could not get my Morphy number since my chain was still too long, but I was only four steps from Kasparov, Karpov and Carlsen, and 5 from Fischer.

Morphy numbers are something new to me.

It is the degrees of detachment little world marvel for chess players.

I was looking Gligoric and discovered he had a Morphy number of 3.

So Morphy (1837-1884) has a Morphy number zero.

Any individual who played him has a Morphy number of 1.

Any individual who played a Morphy number 1 has a Morphy number 2, etc.

I played John Littlewood in a simul.

John Littlewood had played Botvinnik who has an MN of 3.

That gives me an MN of 5.

Anand, Kramnik, and Gelfand additionally have MNs of 5.

Little world I have just 5 degrees of partition from Morphy who was conceived in 1837.

For me, it was a combination of Wikipedia, WinChain, USCF, and my own knowledge. I worked from both ends.

I started by assuming that getting a link to high-rated players was probably the way to go - if you follow the chain up, eventually you get to famous players with known Morphy numbers, or at least players who have many games in large databases. To that end, I used the USCF website to find my top opponents (using the "Show Game Statistics" link on the Member Detail page, which organizes opponents by rating.) The choice seemed easy: I've only played one IM in my life. I then looked at his top opponents, followed by their top opponents. At that point I lucked out and found a name from the Wikipedia page - Borislav Ivkov, listed as having a rather low Morphy number of 3. So that gave me a Morphy number of 6. I double-checked some other paths, but nothing beat that link.

Of course, I wasn't satisfied with just playing Morphy. I had to beat him. So, I used the USCF website to find the top players I'd beaten, and the top players they beat. This time I used a shortcut: I knew that a particular player that I had once beaten had scored a win against that IM I played. When I checked the Game Statistics, I found that she had also beaten a second IM. I then used the WinChain tool mentioned in another answer to try to link those two IMs to some players with low Morphy numbers (there were too many false positives if I tried to chain them directly to Morphy.) I also found a somewhat recent game using the USCF Game Statistics pages that wasn't in the database that WinChain uses, which shortened the path by one. Surprisingly, the win path ended up with no names in common with the ones that formed my original Morphy number path. I ended up beating Morphy in 7 steps by going through Arnold Denker.

Based on this experience, my tips are:

• First, try to find a link from yourself to a professional-level player. Use your own knowledge of who you played, and the website of wherever it is you play your games - USCF, FIDE, etc., to find who you played and who your opponents played. High rated players tend to play other high rated players a lot, so looking at your higher rated opponents first is often the best way to go.

• Once you get to someone rated high enough to be in databases, use WinChain. But remember that it only finds wins. Try swapping the names; sometimes that gives a shorter path, since a loss from one perspective is a win from another. And remember that WinChain won't find everything; you may still have to look elsewhere for more direct links.

• When using WinChain, instead of just searching for Morphy (which might result in a chain that's too long for it to find, or a false positive from some 1800s simul) search for several other players with known Morphy numbers, like Ivkov or Keres.

• Don't give up. Keep looking until you find that connection.

There is no magical way of finding it, of course, you just have to know the history of the people that you have played and then you can deduce your Morphy number. Of course, it is highly likely that the chain never reaches Morphy.