Money is a way to reallocate goods or services. It is neither the only way nor the best one.

Moreover, because of the potential it expresses, it has secondary effects. For instance psychological safety or power.

On the other hand, money is a way to reallocate goods or services because we believe it is. Money is meaningful as long as there is a shortage of it.

Economy is about handling the shortage of money.

It is OK

This text is inspired by the reading the book “A guide to good life” by William Irvine (thanks, Karolos!). It is a book on Stoicism. First, I will start with my conclusion after reading the first 100 pages and then I will continue with a short critical summary of what I read on the book. I may write more after reading the rest of the book.

I have the feeling that a big part of what is described in the book so far, could be derived from “It is OK”. It is what it is. No need to feel good or bad for everything. Not everything has to be done (in order to/because) we feel good or bad. We can do things because of what we think. Not necessary to attach feelings to everything.


  • I lost a game of tennis.
    It is OK.
  • I feel sad about losing a game of tennis.
    It is OK.
  • I feel sad about feeling sad about losing a game of tennis.
    It is OK.

As an exercise to the writer, we can replace the game of tennis above and the meta-thoughts/feelings it induces with other more relevant to our situation. I think it is OK if I don’t solve it now.

If we don’t act based on feelings (it is OK, though, to do so, if we wish) that leaves a gap. How do we decide what to do and what to feel? Well, I believe that pondering this question in its various forms can take a lifetime. I don’t have the aspiration to squeeze an answer here. Nor do I have an answer that can I can generalize beyond my current mindset/values.


Now, back on the book more concretely. First, in three paragraphs what I think I read.

The observation of hedonic adaptation, the fact that we get used to our current situation, seems to be key driver in what is described in the book. In short, to be happy, imagine things could be worse. Since things could be worse, you will be happy with what you have. Example: On material possessions, imagine you don’t have them. This thought will make you appreciate them more and also prepare you in case you lose them. On people, similarly.

Did something bad happen? Well, it happened. For this we use fatalism and we just readjust our hedonic baseline. Anyway, we should have prepared for this by thinking of bad scenarios as described before.

What about trying to achieve something? Well, try hard enough and evaluate only based on criteria that are totally on your control. Since you can’t control external circumstances, you shouldn’t worry about those. Did you try your best to win the tennis game? That’s OK, no matter the result. Did you try to guess the winning numbers in a lottery hard enough? It is OK, no matter the result.

I am not sure whether Stoicism is close to what I oversimplified above, or if I do justice to the book, but I respectfully disagree at least partially with what I read. While I do find a useful exercise to think of the absence of something that I have, I believe it shouldn’t be the feeling that you will miss it what drives the appreciation. Rather, since I have it, there must be a reason I want it in first place. If, indeed, there is a reason, then that is the source of joy. If there is no reason, I don’t need it.

If something bad happens, I think it is OK to feel bad for a while. That gives us motivation to avoid bad situations. Eventually, though, we need to also do other things apart from feeling.

As for striving for something, there is a reason we want it. We can enjoy the journey of achieving that. Especially, if its journey is the reason (which is indeed the reason for the things that last). If we try hard and don’t achieve it, I think it is OK to use in our evaluation external criteria, even if they include things beyond our control. We don’t live in a deterministic environment. By embracing a criterion that includes externalities, we make ourselves vulnerable to conditions beyond our control, but at least we are adopting an evaluation function that is closer to what really matters to us.

Finally, two independent thoughts on developing a philosophy. First, Like most philosophies, they are mostly for relatively affluent people. If you don’t have food or shelter, hard to adhere to any philosophy. Second, I have a personal test for each philosophy on how to live. It should provide a negative answer on why, under normal circumstances, I shouldn’t be taking drugs for the rest of my life that make me happy. The reason for this requirement is that I believe it is OK to feel happy or unhappy or whatever for a transient period of time, as long as you can ground it on reasonable causes (e.g. being with my daughter or my dog died).


Doing can be thought as finding the fixed point of a process. That is, for a given input, after successive applications of the process, the output is trivially produced from the input to the point that input and output are the same modulo trivial isomorphisms. Then, we can say that something is done.

Example 1: Find my keys.

Example 2: Calculate a Nash equilibrium.

Example 3: Model the behavior of different participants in a market.

Example 4: Sort a list of numbers.

Example 5: Devise a sorting algorithm under some constrains.

Hypothesis: Every relevant non recursive process can be wrapped trivially in a recursive process that terminates when we have found its fixed point.

Corollary 0: A solved problem is solved if subsequent solutions of the same problem require at most the same time as the best solution so far. Otherwise, we either solve a different problem, we don’t have access to the previous solution, or we didn’t solve the problem at hand.

Corollary 1: Sometimes there is a much faster analytical approach compared to the naive successive recursive calls.

Corollary 2: Memoization can greatly accelerate the process for future similar problems. It may even reach a similar time to an analytical approach at the limit and depending on what we measure. Memoization can also be called experience.

Corollary 3: If we go deeply enough, we need the support of a sufficiently large stack, or introspection for possible tail optimization.

Corollary 4: If a subsequent recursive application of the process deals with a harder problem, the initial process may never converge to a solution.

Corollary 5: Even if we have perfectly modelled the process, the computation of a fixed point may be practically intractable. In that case, we can hope that either the specific instance we are dealing with is easy, or that an approximation is sufficient.

Changing rear brake cable on a bike

What you need:

  • Rear brake cable
  • Rear brake cable housing (the exterior part)
  • Insulation tape
  • Good cable cutters
  • Ferrule
  • Cable ties
  • Bar tape (you can also reuse your current one)
  • Scissors


Remove carefully your current bar tape. Cut/remove the insulation tape that holds the brake cable on the handle bar. Cut the ferrule of the brake cable at the rear end. Press the lever for the brake. Find the cable brake and pull it. Cut the existing cable ties and remove the old cable housing. Now, we have finished removing the old cable and housing.

To install the new one, first pass in the rear cable into the place where you removed the previous one. Put on the housing cable and attach it (but not firmly) on the bike. Have the brake cable go through it, while keeping a considerable amount (say 30 cm) not pushed in. Cut the housing at where it seems appropriate +1 cm. Push now all the cable in. It is possible that the cable will be stuck at the end because cutting the housing compressed it towards the end and there is not enough space. With the cable now almost there, cut the unnecessary last 1 cm. Since the cable is already inside, the housing is not compressed now. Push the rest of the cable through. Connect it to the brake. Make sure that the cable allows easily stirring. Attach firmly the housing. Make sure that the brake works as expected. Cut the unnecessary extra cable at the end. Put on a ferrule. But back on the bar tape. Reconfigure your rear brakes.

Enjoy smoother braking.

Playing chess in Zurich

I have been playing chess in Zurich for about 2 years now. At the beginning, with my limited German knowledge, I found it somewhat confusing to navigate how to join a local club and what are the opportunities/typical events for someone to play chess in Zurich. Therefore, I will summarise what information I have collected over these two years on this post. In case you spot an omission, feel free to comment and I will try to address it. The post assumes no experience with local chess clubs.

I will separate the events to two categories:

  • team events
  • individual tournaments

Team events

On team events, players form a group of a specified number of players. Then, they decide who plays on board 1, on board 2, etc. We call that a team. Then, they meet the opposing team and play a match. Each player plays only one game for the match on the corresponding board. A player who wins gains 1 point, draws 0.5, and loss 0. The team score is the sum of the points that the players collect. The team with the higher score wins.

Below are the different team events that happen in Zurich.

Company tournament (FMM)

Time control: 90 minutes for the first 36 moves, 30 minutes rest of the game.
Team size: 5-6 players (depending on the league)
Rounds: 5-6 (depending on the league)
Duration: October – March
Time: 18:30
Match day: Weekday (depending on the hosting company)
Rating (Elo): Unrated (but there are individual prizes at the end).

The company tournament (FMM) is a tournament with 3 different leagues. To participate, you need to be affiliated with a company that already participates in FMM or enrol your company. You can find a list of participating companies. If you are lucky and your company already participates, seek internally the organisers and tell them you want to play. There is always a joy when a someone shows interest.

If you are interested enough, but your company does not participate yet, and you can add your company to the list. To help you on doing so, you will find many people who can guide you. Since you are reading this post, I could also try and help.

Zürcher Mannschafts-Meisterschaft (ZMM)

Time control: 60 minutes + 30 seconds per move.
Team size: 5-6 players (depending on the league)
Rounds: 4-5 (depending on the league)
Duration: October – March
Time: 19:30
Match day: Weekday (depending on the hosting club)
Rating: Unrated.

On this tournament, you play against other teams from the canton of Zurich. To participate, you need to be a member on a local chess club. See later on this post on how you can join one.

You can find the results and the schedule of the current season chess-results. The site of chess-results is used for all kinds of tournaments, so it may also be useful for discovering past tournaments that may re-occur in the future.

Schweizerischen Gruppenmeisterschaft (SGM)

Time control: 90 minutes for the first 40 moves, 30 minutes for the rest of the games + 30 seconds per move starting from the first move, if on Saturday. Otherwise, 90 minutes + 30 seconds per move starting from the first move.
Team size: 4 – 8 (depending on the league)
Rounds: 6 – 7 (depending on the league)
Duration: October – March
Match day: Saturday or weekday. The choice depends on the club/team.
Time: 14:00 if Saturday, 19:30 if weekday.
Rating: Swiss. Also FIDE in higher leagues.

The tournament is organized by the Swiss chess federation. The participating teams are from all over Switzerland. In the lower leagues, they try to minimize the distances that someone has to cover in order to play, so teams from the same region are usually grouped together.

It has the longest time controls from the tournaments I have participated, and it is my favourite combined with the fact that the games happen on Saturday afternoon.

Schweizerischen Mannschaftsmeisterschaft (SMM)

Time control: 90 minutes + 30 seconds per move starting from the first move.
Team size: 4 – 8 (depending on the league)
Rounds: 6 – 9 (depending on the league)
Duration: April – September
Match day: Depends. Weekday on lower leagues. Saturday on higher ones.
Time: 14:00 if Saturday, 19:30 if weekday.
Rating: Swiss. Also FIDE in higher leagues.

This is the “sister” league to SGM. Once SGM finishes, SMM starts, and the other way around. You can think of it as the summer edition of the Swiss club league. There are two separated tournaments, because of mostly historical reasons. They used to be to Swiss federation about chess that got merged.

Individual tournaments

There are also individual tournaments where the pairings only depend on the players and not on their affiliation with a team. Taking the chronologically, as they happen within the year

Zürcher Stadtmeisterschaft (ZSM)

Time control: 75 minutes + 30 seconds per move starting from the first move.
Rounds: 7
Duration: April – May
Time: 18:45
Match day: Wednesday
Rating: Swiss.

The city championship happens every April/May close to Bahnhof Enge (Kirchgemeindehaus Enge). There is a game every Wednesday, for 7 weeks. There are 4 categories, split by national rating. You can find more details on the Zurich’s chess federation website and the corresponding subpages.

Zürcher Osteropen

Time control: 90 minutes for the first 40 moves, 30 minutes for the rest of the games + 30 seconds per move starting from the first move.
Rounds: 7
Duration: During Eastern. (19 April 2019 – 22 April 2019)
Rating: Swiss/FIDE.

There are two sections. Open, where even GMs play and under 1820 category, where only players under that rating can play. It is a relatively new tournament, that started in 2018. The prizes, though, are quite generous. You can find more details on the tournament’s site.

Reti Amateur Open

Time control: 90 minutes + 30 seconds per move starting from the first move.
Rounds: 5
Duration: Friday – Sunday in the middle of November. (16 – 18 November 2018)
Rating: Swiss
Restrictions: Rating under 2250.

It is the only individual tournament that I know in Zurich, which happens within 3 days (Friday-Saturday-Sunday) and has long time control. This is great for people who don’t have time to dedicate to chess during holidays. In the last two years that I have participated, it was a great experience to me since I had many opportunities to play with much higher rated players than me (and lose). It is great because, afterwards, during the analysis of the games with the opponent, I feel I am learning a lot.

You can find more information on the tournament website.

Zürcher Weihnachtsopen

Time control: 90 minutes + 30 seconds per move starting from the first move.
Rounds: 7
Duration: 26 December – 30 December.
Rating: Swiss/FIDE

Maybe the largest open chess event that happens in Zurich. It has two sections. In the Master section (from 2000 Elo) you will find many titled players. The other section is for players up to 2050 Elo. The prizes in the Master section reach 3000 francs for the first place, while the for the up to 2050 section, the first place gains 1000 francs.

You can find more details on the website, and if you are quick enough, you can still register for the tournament this year.

Local clubs

For the group events, you need to join a team. FMM is a special case and that depends on your company. For all other team events you need to join a local club. A local club membership usually also includes a membership to the Swiss Chess Foundation. This allows you to have an ELO which is useful for the individual tournaments, since the pairings are always based on Swiss system. It is also useful, because otherwise you usually need to pay an extra fee to participate in the tournament.

Joining a local club apart from allowing to play in these tournaments, it also provides an atmosphere conductive to becoming a better chess player, by meeting other people interested in chess and potentially developing some new friendships.

You can find a list of local chess clubs on the site of Zurich chess association. Given that there are quite a few clubs, there are a few different strategies that you follow to select a club to become a member:

  • Close to your neighbourhood.
  • Playing on weekdays that you are free.
  • You know someone there.

So far, all the people I have met from various chess clubs have been very nice. Don’t hesitate to join a club even if you don’t currently know anyone there.

In case you want some specific recommendations:

  • Letzi is the club I am member. I am very happy and I would recommend it. Altstetten is also flat, so it is easily reachable by bike.
  • SG Zurich is the most historical club in the world, created in 1809.
  • ASK Reti is associated with ASVZ. Therefore, if you already member of ASVZ, you can attend events at ASK Reti.

Concluding thoughts

Chess is fun. You get the opportunity to meet other people and get a small break from everyday life. If you are not sure about joining a club, try going to one for a couple of times, meet some people there and then decide. It is also a great opportunity to practice some German, but not necessary if you feel too shy about it.

Why having a bike beats the stock market

About 4 years ago, I wasn’t fully convinced whether I should buy a good but more expensive bike. Now, I can back that decision with data on why it was a good investment and how it beats the stock market. I will break it down in parts: how I use it, how much it costs, and collateral benefits. I may follow up this post with some basic maintenance tips.

You can skip the background story, if you only care about the essence of this post. I have listed the important “lessons learnt” in following sections . The background story only mentions my path towards buying a good bike. The reasons why someone else may do it, will differ. The only reason I list them here, is that this is a personal blog and I would like to have my story written so I can read it again after some years, before I forget the details.


How I use the bike

I go almost everywhere by bike (unless I walk). Specifically:

  • Commuting. Going to work is ~5 km. I make it in about 15 – 18 minutes each way. Going by public transport is about 30 minutes each way. That means that, each month, I cover about 200 km and save about 8 – 10 hours of commuting.
  • Excursions. This was applicable in spring/summer which adds about 1000 km per year due to a couple of trips.
  • Other. I may have to run some errands, go somewhere due to a hobby (mostly chess)/visit friends/go out/etc. They usually add up to another 100 km per month.

I use a bike no matter the weather. I always wear helmet and always have a backpack with waterproof clothes in case it rains. Then:

  • Warm weather without rain. Fingerless gloves.
  • Rain. I am covered everywhere by something waterpoof: jacket, pants, overshoes, helmet cap, gloves, cover for the backpack. In the backpack, I also put a spare set of clothes in case I somehow get wet (almost never happens) or too sweaty (more frequent). I also keep a second set of clothes in the office in case I forget to renew my clothes supply.
    It important to note here that all surfaces have to be covered, otherwise they get wet. That does not only apply to our body, but also to our shoes or head.
  • Cold weather. Winter gloves. A long piece of cloth that covers my neck, ears and part of my face.
  • Snow. See cold weather + rain. I also wear ski goggles. It looks funny but it is very effective. Otherwise because the snow falls slowly, it goes in my eyes and I cannot see very clearly. Plus, it covers another part of my face, so I don’t feel cold.
  • Haze. Same as snow.

How much I saved

This is going to be a direct comparison with the money saved by not taking the public transportation. I calculate the yearly ticket for public transportation as 782 francs per year. After 4 years, I have saved about 3000 francs.

How much I earned

Someone could argue there are also benefits that cannot be quantified. Some of them also result in cost savings, but that’s not what is important. At the end of the day, those benefits make you happier.

It is also proven through research, that exercise boosts our happiness levels. My experience agrees with that. When I had to take the bus/train/tram I was feeling that something is wrong and was missing from my everyday life. I remember vividly that when I had a dislocated shoulder and I couldn’t use my bike for about 1 month, I wasn’t feeling that happy (and it wasn’t just because of the dislocated shoulder).

Biking also has given me the opportunity to participate to some social activities (well, bike with friends) or meet new people that I wouldn’t have otherwise.

How much it cost

I keep a spreadsheet with all the costs since I bought the bike. There, I include everything related to the bike, including:

  • accessories (example: bike lights, batteries)
  • clothes (example: waterproof clothes, bike shoes)
  • spare or upgraded parts (example: chains, tires, cogs, brakes, lube, grease, cranksets)
  • tools (example: bike stand, bike toolset, chain wear indicator, pump)
  • service (2 times before I start doing it myself)

The bike cost 1500 francs. The cost of accessories/clothes/spare parts/tools (including a bike stand)/service (2 times before I start doing it myself) amounts so far to another 1500 francs.

Buying a bike is a good investment

After four years, I have replaced almost all moving parts with new ones (everything that touches the chain has been replaced), and upgraded some of them (rear brake, chainrings). I have also collected tools, clothes and accessories. I believe all of those together are at least worth the initial price of the bike. I could even argue it is worth even more since just today I replaced the chain and the jokey wheels and it feels like new. Nevertheless, this is beyond the point.

I have broken even on the cost of bike and its extras. To simplify things, let’s cross out a few terms. We assume that the expenses on the bike (see above) negate the expenses on public transportation. They also cover the cost of the bike. So let’s also cross that out. Let’s assume that the value of the bike when I bought it is the same as now (due to replacement/upgrade of parts + all the tools/clothes/accessories I have collected).

In short, 4 years ago, I put a amount of money into something, spent another a, and got back 3a (the money I saved from the transportation tickets = 2a + bike itself is another a).

Solving the equation:

2 * a * (1 + x)**4 = 3a

We find that this corresponds to a compound interest rate of about 10% per year during these four years. That beats by a great margin the stock market (7%) or bond market (5%) and it is a much safer investment (depending on your home location).

Unfortunately, this extrapolation is kind of misleading since the cost savings of a bike are of linear nature in reality. That should not, though, retract from the point of this section, that from a purely financial point of view, it makes sense to invest money in buying a good bike.


Background story

Buying cheap bikes

When I moved to Switzerland, after a few months, I bought my first second hand bike. It cost around 100 francs. It survived for a few months. When something broke down, I learnt that asking for repair would cost about 50 francs. I decided to buy a second second-hand bike instead, and use the first one as spare parts. That didn’t really happen, since the second bike was quite different and the parts didn’t match. Neither did I have the tools or knowledge to do that. So I bought a third, and eventually a fourth one after the third one was stolen. Despite having bought 4 bikes within 2 years, it was still cheaper than a yearly pass for the public transport (around 500 – 600 francs per year for people under 25 years old). Biking for two years daily was with no signs of slow down was enough to convince myself that this is something I really like.

Buying a good bike

A couple of months after graduation, I started working. There, I met a co-worker who was interested in buying a good bike. He started asking around what kind of bike would fit his needs. His needs were very close to mine. Some of those were:

  • Convenient for commuting.
  • Fast on a road.
  • Can go off road (mountains, gravel, etc).
  • Can cover large distances.
  • Not very heavy.
  • Good brakes.

That’s how I learnt about cyclocross bikes. There are in-between road and mountain bikes.

Back then, I knew nothing about bikes and I was too lazy to research it. Reading without trying it through experience was not feeling very compelling to me. So, to bootstrap my entrance to the higher-end world of bikes, I decided to trust my co-worker and buy exactly the same bike.

The decision was not easy. The cost was a multiple of the cost of the yearly pass for public transport. I remember when I was a kid, I could not understand why someone would buy an expensive bicycle when with the same amount of money they could buy a motorbike.

On the other hand, I knew that I would not have to buy a new bike for a long time, I would enjoy the better bike more, and also, buying a better bike gives you a good excuse of buying good replacement parts. Later on, I also learnt how to maintain the bike myself.

On servicing the bike

I knew almost nothing about how to service a bike. I learnt most of the things through youtube. I highly recommend the gcn youtube channel. Usually, I search for gcn + bike part I want to service.

The other important aspect of servicing a bike yourself is having the necessary parts and tools at hand. Usually, I am able to work on the bike on weekends only and ordering some parts may take a week for their delivery. It is useful to have some tools already at hand (I find useful to have a bike tool set), emergency supplies (inner tube), and anticipate needs before the next time you need to service your bike. This is not as hard as it sounds since most things on a bike can wait for a week (tires, chain, cogs, brakes, etc). For some things, I know I am going to use them regularly, so I just keep a stock of them (lube, screws, ferrules, grease, kitchen roll, …).

There are also great communities online that help people who work on their bikes. My personal favourite is r/bikewrench.

If you are not into fixing things manually, give it a try. It is fun, and makes you appreciate the elegance and simplicity of the design of a bike. With so few moving parts, it achieves great flexibility. I wish one day I will be able to design my code as elegantly, as a bike is designed.


Studying in Zurich under strict budget

This post is for ETH students who have strict budget constrains.

Before going into the details, two meta-comments.

First, I never felt comfortable sharing these details. Nevertheless, my past self (almost 7 years ago) would find it useful.

Second, if you can work on the side (even 1 day/week — especially in CS), that may be enough to give you more room in your budget.

Temporary place

Youth hostel / AirBnB / friends.

This is needed until you find a more permanent place of stay, and sometimes that may take a while (2-3 weeks until you move to your permanent place).

If you see a listing about a room in an apartment that is not rented for a while, you may contact the owner and ask if you can stay for few days by paying pro rata. This is useful if at some point (usually weekend) the Youth hostel is fully booked. I never tried the AirBnB/friends solutions because they were not available.

Food: If you can’t cook at the temporary place, you can take the precooked chicken. You can clean your hands with wet wipes afterwards.

Permanent place

Try student housing.

Alternatively: Find two more people. The goal is to find an apartment in a building that is going to be renovated/demolished after ~6 months. You can find an apartment that can host 3 people with a price around 1000 francs. This is usually too expensive for 1 student, and too bothersome for a family to move out again after few months.

Using you have good chances of getting accepted for the apartment.


Go to a German supermarket (Aldi, Lidl) once per week. Budget around 50 francs. Look at the price per kilo and not per item.Avoid food that costs more than 10 francs/kilo. Pasta/rice/chicken/pizza/Paella/toast/sausages can be cheap. Buy fish cans with different sauces that you can use it on pasta/rice so you don’t get bored of eating the same thing. Don’t eat at Mensa. Eat at home or take food from home with you.


On Saturday mornings on Helvetiaplatz you may find second hand clothes very cheap. Once, I bought a pair of jeans that were only 2 francs. Otherwise, try Brockenhaus.


Buy a second hand bike. Put in your backpack extra clothes. Have waterproof jacker, pants, gloves, shoe covers. Don’t repair your bike once it is broken. Buy a second one around 100 francs after 4-5 months, if the first one is broken. Use the materials from the first one as replacement for the second one. Even without that, it is cheaper than public transportation (amortized).

Alternatively, if you don’t like biking in the rain, get a Halbtax and a Gleis-7 card. Check the weather prediction every morning. It rains about twice per week in Zurich. If you return after 19.00 by train, you will have to pay only the 1-hour ticket to go to ETH.

Moving out/in

Initially, buy cheap furniture for all people together. Share transportation costs. When you move to your second apartment, rent a big car. Do the cleaning yourself carefully. It takes at least a day. One more day for the move.

Going out

Go to parks, friends places’. Invite friends. Spend time at ETH.

Health insurance

Get an exception if you have a health insurance in your home country. Otherwise, find the cheap insurance for students. Go to the dentist/do checkups in your home country.

Airplane tickets

Book well in advance for Christmas. It may be more convenient to have your roundtrip flights starting from Zurich, but usually it is cheaper the other way around.


Get the cheapest option. Call home through internet. If your parents do not use a chatting app, you can always buy credits on Hangouts/Skype.


Check if someone from a neighbouring apartment wants to share their connection. Refer your friends/other students and get a referral from someone.


Some costs are not recurring (e.g. clothes, bike, moving out, airplane tickets). Budget for those.

Make money

Try an internship or a part time job even at ETH — ask your advisor. Check the regulations. You can work during summer/exam period as much as you want. During the semester, 2 days per week.


Check the guide from ETH. Ask other students. Focus on your studies. You are not alone.

Heroes or enemies?

The one-armed woman said, “There was a movie called Maple recently. I don’t know if you’ve seen it. At the end, an adult and a child stand in front of the grave of a Red Guard who had died during the faction civil wars. The child asks the adult, ‘Are they heroes?’ The adult says no. The child asks, ‘Are they enemies?’ The adult again says no. The child asks, ‘Then who are they?’ The adult says, ‘History.’”

From the book “The three body problem”

Learn about chess endgames from stockfish

Stockfish has a very well documented codebase. Someone can learn a lot about chess even by just looking at the comments. As an example, here is what stockfish does in certain end games from the perspective of the strong side. For the weak side, the opposing plan is true. As a note for the rules that follow, they may not characterize all possible positions. If not, then the position has to be evaluated by looking more closely to its specifics.

Plenty of material vs King

– Just push the lone king towards the side and keep the distance of the two kings short.

King + Knight + Bishop vs King

– Similar as above. The difference is that the right corner is the corner with the same color as the bishop.

King + Pawn vs King

– It is evaluated based on some magic tables.

King + Rook vs King + Pawn

– If stronger’s side’s King is in front of the pawn, then this is a win.
– Similarly, if the weaker’s side’s King is too far from the pawn, it is also a win for the strong side.
– The position is a draw if the pawn is advanced and protected by the opposing king.

King + Rook vs King + Bishop

– Draw.

King + Rook vs King + Knight

– Draw, unless King and Kight are too far away.

King + Queen vs King + Pawn

– This is usually a win for the side with the Queen.
– The exception is when the Pawn is on the 7th rank, protected by the King, on the Rook or Bishop files, and the strong’s side King is far away from the pawn.

King + Queen vs King + Rook

– This is a win for the stronger side.
– The strong side wants the two kings closer and the enemy King driven to the edges.

King + 2 Knights vs King

– Draw.

King + Bishop + Pawns vs King

– This is in general a win for the strong side.
– Exception is when the pawns are in the same Rook file, where the promoting square is of different color compared to the Bishop and the enemy King can arrive there in time.

King + Bishop + Pawns vs King + Pawn

– Similar as above.
– Exception is when the pawns of the strong side are on a Knight’s file, there is an enemy’s pawn on the 7th rank and the bishop cannot attack it or if there is only one pawn from the strong side in that file. Then, there is a draw as long as the weak’s side King is within two squares from the blocking pawn, on the back two ranks, and the strong side’s King is farther away.

King + Queen vs King + Rook + Pawns

The weak is the one with King + Rook + Pawns.

– It returns a draw if the pawns form a “fortress” on the third rank and they defend the rook, and the king is at most up to rank 2, and the enemy king is farther away (rank 4 or beyond).

King + Rook + Pawn vs King + Rook

– Draw if the pawn is not too far advanced (5th rank), the defending king protects the queening square, and the attacking king is away. The draw is achieved through the third-rank defense.

– Draw if the pawn is on the 6th rank, by checking from behind the enemy King.

– Draw if the pawn is on the 6th rank or higher, the defending King controls the queening square, the defending rook is on the first rank and either the tempo is on the defending’s side or the distance between the two kings is at least two squares.

– Draw if the pawn is on A7, attacking Rook on A8, defending Rook behind the pawn, and defending King on H7 or G7. Symmetrically for a pawn on H7.

– Draw if the defending king is blocking the pawn and the attacking king is too far away.

– Win if the attacking king is closer to the pawn compared to the defending king. The pawn should not be on a rook’s file, though, and it should be close to be promoted.

King + Rook + Pawn vs King + Bishop

The only rule here concerns a possible pawn on a Rook file, which under some conditions can be a draw.

King + Rook + 2 Pawns vs King + Rook + 1 Pawn

Draw if the stronger side has no passed pawns and the defending king is actively placed.

King + Pawns vs King

Draw only if the pawns are on a Rook’s file and the defending king is in front of them.

King + Bishop + Pawn vs King + Bishop

– Draw if the defending King is in front of the Pawn and he can’t be kicked out.

– Draw if bishops are of opposite color and one of the following is true: (a) pawn is on rank 5 or earlier (b) the defending king is in front of the pawn or (c) the defending bishop attacks one square in front of the pawn and it is at least three squares farther away from the pawn.

King + Bishop + 2 Pawns vs King + Bishop

To have a forced draw, we need opposite color bishops. Then:

– Draw if the pawns are on the same file and the defending king is in front of the pawns.
– Draw if the pawns are on adjacents files, the defending king is in front of them, and the defending bishop controls the squares in front of them.

King + Bishop + Pawn vs King + Knight

– Draw easily if the defending King is in front of the Pawn, in a square that the attacking Bishop cannot go.

King + Knight + Pawn vs King

– Draw if a Rook pawn is on the 7th rank and the defending King is blocking it.

King + Knight + Pawn vs King + Bishop

– Win only if the Knight can prevent the Bishop from taking the Pawn.

King + Pawn vs King + Pawn

– Draw chances if the weaker side could achieve a draw even without its pawn.
– Exception is when the strong’s side Pawn is too advanced and the pawn is not on the Rook’s rank. Then, if the weaker side could have drawn even without its pawn, then it could have winning chances with its pawn.

Married functions

On Gödel Escher Bach, on page 137 there are two “married” functions defined:

for n >= 1:
F(n) = n – M(F(n – 1))
M(n) = n – F(M(n – 1))

for n = 0:
F(0) = 1, M(0) = 0

I wondered whether it is easy to define three function that increase their value every time n is increased by three, using only addition, subtracting and recursive calls to the previous value of the functions. It turns out it is not too hard to find some.

for n >= 1
F(n) = n – M(n – 1) – N(F(n – 1) + M(n – 1) + N(n – 1) – 2)
M(n) = F(n – 1)
N(n) = M(n – 1)

for n = 0:
F(0) = 1, M(0) = 0, N(0) = 0