How did John von Neumann solved the fly and bicycles puzzle?
This famous puzzle goes like this: Two bicycles are traveling toward each other at the same speed until they collide; Meanwhile a fly is traveling back and forth between them, also at a constant speed. The bicycles start 20 miles apart, and travel at 10 miles per hour, and the fly travels at 15 miles per hour. How far does the fly travel in total? If you don’t know this puzzle I suggest that you stop and think a bit about it, see if you can solve it....
Would you accept to have an AI manager?
In the not so distant future, we might have AIs intelligent enough to replace managers in companies. I imagine a company having an AI agent, complete with a personalized avatar, voice, and personality. This AI would be able to perform daily video call with employees and CEOs, oversee projects progress, write emails, make suggestions, etc. I feel like this could actually happen before AI just replace all form of work. This could lead to a situation where some employees have an AI as a direct boss....
BASIC was not just a programming language
BASIC is often dismissed as an inferior language compared to its successors. Common complaints are its use of line numbers, its heavy reliance on GOTO for execution flow, and its lack of a stack for local variables. What many critics overlook is that at the time of its use (during the first wave of home computers), BASIC was not just a programming language; it was a full development environment, akin to an IDE....
Abel's theorem
The Abel-Ruffini theorem states that there is no solution to the general polynomial equation of degree five (quintic equation) that can be expressed with the common operations: (+, -, x, %), plus √ (radical of any degree). In this post I’ll try to give my quick understanding of the proof, without explicitly relying on group theory or Riemann surface. As usual on this blog, this is all hand wavy. For a proper introduction to the proof I recommend the excellent book “Abel’s Theorem in Problems and Solutions” by V....
Some command line tools I use
In this post I am going to present a few of my favorite command line tools that might be of interest to programmers who prefer to work directly from the terminal. (Note: since I didn’t want to put screenshots or html, I removed the colors from the examples. Most of those tools actually make use of ANSI escaping to colorize their outputs) ag – The Silver Searcher $ ag LookAdjust src/g_game....
Auto function binding in C
Let say you want to add some script support to a C program, like lua or maybe even something simpler where all you can do is call a function with some given arguments: #include <stdio.h> void my_func(int x, const char *s) { printf("my_func called with x=%d, s=%s\n", x, s); } int main() { // Will call my_func with 2 and "hello". script_call("my_func", 2, 'hello'"); } Since C does not support reflection, there is no way to implement the script_call function without some extra work....
The Circles of Hell of C Libraries Integration
There is spectrum on how easy it is to integrate a C (or C++ for that matter) library into a project. The issue is that the C ecosystem does not have a standard dependency manager, so each project big enough to require the use of external libraries needs to find a way to integrate them, and it is usually a significant source of problem just to get them to compile. Note that I am not even talking about how to use them....
My Solution to the Newcomb Paradox
The Newcomb paradox is stated as a fictional situation where a player enters a room with two opaque boxes, A and B. A always contains a small amount of money (let say $100), and B contains either nothing, either a larger amount of money (let say $110) 1. The player gets to pick one or both boxes and leave the room with them. The catch is that before the player enters the room, an ‘all knowing’ entity prepared the boxes and filled the box B with money only if it predicted that the player will not pick the A box....
Why I don't like C23 "auto" keyword
The next version of the C standard (C23) brings two new features that I am not enthusiastic about. One of them is the nullptr constant, the other one is the “new” auto keyword1. I will try to explain why I don’t like it. The new proposed auto keyword will work basically like in C++. You will for example be able to write: auto x = 10; auto ret = function(); Instead of:...
Python Simulation of the Blue Eyes Island Puzzle
The blue eyes island is a tricky logic puzzle that has several variations. The one I was first told was: A group of people live in an island with no contact with the outside world. Eyes color is big taboo for them and they strictly follow this rule: if anybody figures out the color of their own eyes, they will commit suicide the following night. Everybody knows the eyes color of all the other islanders, but nobody knows their own eyes color....