Feed fabulous-adventures-in-coding Fabulous adventures in coding

Favorite IconFabulous adventures in coding

Link https://ericlippert.com/
Feed http://ericlippert.com/feed
Updated 2024-04-26 20:15
Life, part 13
Source code for this episode is here. Just as a reminder: I am developing my C# version of Stafford’s “QLIFE” algorithm by taking Abrash’s “keep the neighbour counts around” algorithm and gradually adding optimizations. That’s much easier to understand than … Continue reading →
Life, part 12
Code for this episode can be found here. Exciting news for the client; I have added a play/pause button. I suppose I could have added that single line of code earlier, but hey, better now than later. Last time on … Continue reading →
Life, part 11
Source code for this episode is here. I’ve added a panel to the UI that moves as the UI is resized; I’ll add some controls to it in future episodes. Back in 1994 I made a photocopy of an article … Continue reading →
Life, part 10
Last time on FAIC I discussed a technique for parallelizing computation of Life grids by using SIMD instructions to handle 256 bits worth of grid state truly in parallel. Today I’m going to not present an implementation, but rather discuss … Continue reading →
Life, part 9
Code for this episode can be found here, which — unusually — is not my GitHub repo. Last time on FAIC I mentioned that there were two basic techniques for improving raw performance: keep the algorithm the same but find … Continue reading →
Life, part 8
Last time on FAIC we took a look at Scholes’ extremely concise Life algorithm, which treats a grid as an array that you can treat as a mathematical value with some unusual but entirely straightforward manipulations. We didn’t get the … Continue reading →
Life, part 7
Code for today’s episode can be found here. I’ve added drag scrolling to the user interface, so if you click and hold, you can move around the grid much the same way that you’d move around an online map site. … Continue reading →
Life, part 6
Code for this episode can be found here. The only interesting change I’ve made to the client is that if you press “P”, it pauses the simulation and runs 5000 steps of the “acorn” pattern, and then dumps the number … Continue reading →
Life, part 5
Code for this episode can be found here. I have not added any more code to the engine, but the client now has two features of great use to me; pressing space toggles whether the simulation is running or paused, … Continue reading →
Life, part 4
Code for this episode can be found here. I have not updated the Life algorithm, but I have added a new feature to the client, namely, you can now resize the form and the display box will resize along with … Continue reading →
Life, part 3
Code for this episode can be found here. All right, let’s get into it. Since I want this series to concentrate on the algorithms and not the user interface, what I will probably do is make incremental improvements to the … Continue reading →
Life, part 2
Code for this episode can be found here. There are literally fifty years of articles explaining Conway’s Game of Life, starting with the one that introduced it to me: the October 1970 issue of Scientific American. Seems like a great … Continue reading →
Life, part 1
The mathematician John Horton Conway has died, apparently due to the covid-19 epidemic, at the age of 82. I never met him but by all accounts, he was a delightful person and brilliant mathematician; his charming book on introductory game … Continue reading →
Report thy feat unto Lord British
Welcome to yet another working-from-home pandemic episode of Fun For Friday Fabulous Adventures. Over the past while I’ve gradually been looking for music, movies and games I enjoyed as a teenager and seeing how they hold up. So I am … Continue reading →
New grad vs senior dev
A student who I used to tutor in CS occasionally sent me a meme yesterday which showed “NEW GRAD vs SENIOR DEVELOPER”; the new grad is all caps yelling NO! YOU CAN’T JUST USE BRUTE FORCE HERE! WE NEED TO … Continue reading →
Bandits, victims and idiots
I don’t enjoy politics, I don’t know enough about it, and my privilege greatly insulates me from its negative effects, and so I don’t talk about it much on this blog. My intention in creating the blog lo these decades … Continue reading →
Working from home
Good Friday afternoon all and welcome to this working-from-home-and-obsessively-washing-hands edition of FAIC. I am posting today from my recently-transformed spare room which is now apparently my office. Scott Hanselman started a great twitter thread of techies showing off their home … Continue reading →
Passing awaited tasks
Here’s an interesting question I saw on StackOverflow recently; it was interesting because the answer seems obvious at first, but making a small change to the question makes the answer very different. The original question was: suppose we have an … Continue reading →
Hundred year mistakes
My manager and I got off on a tangent in our most recent one-on-one on the subject of the durability of design mistakes in programming languages. A particular favourite of mine is the worst of the operator precedence problems of … Continue reading →
Building a fake company
Well this is a first. Twitter user Plazmaz brought a scam github repository and web site to my attention; see his thread on Twitter for details. It’s a pretty obviously fake site, and there is some evidence in the metadata … Continue reading →
A Picard Easter egg
While watching the first episode of the new Star Trek series just now I noticed a nice little Easter egg: Admiral Picard (retired) apparently has the same 1982 science fiction book club edition of The Complete Robot handy on his … Continue reading →
Work and success
One last post for this decade. There has been some discussion on tech twitter lately on the subject of whether it is possible to be “successful” in the programming business without working long hours. I won’t dignify the posts which … Continue reading →
Fixing Random, bonus episode 3
You might recall that before my immensely long series on ways we could make C# a probabilistic programming language, I did a short series on how we can automatically computed the exact derivative in any direction of a real-valued function … Continue reading →
Fixing Random, bonus episode 2: pigeons and the noisy-or distribution
Source code for this episode is here. Welcome to this special bonus episode of Fixing Random, the immensely long blog series where I discuss ways to add probabilistic programming features into C#. I ran into an interesting problem at work … Continue reading →
Summer vacation 2019 part four
My friend Larry from the previous episode mentioned to me that a group of several male and female belted kingfishers had been spotted at the river; I’d never seen kingfishers at our little river before and I wanted to get … Continue reading →
Summer vacation 2019 part three
I enjoy photographing dragonflies and damselflies; this year I got some pretty reasonable shots of common blue damselflies, white-faced meadowhawks, a twelve-spotted skimmer, and my favourite, ebony jewelwings. It can be hard to get these little guys in focus, but … Continue reading →
Summer vacation 2019 part two
Today, I have a Mystery Of The Unknown for you to solve. Unlike most of the puzzlers on this blog, I don’t know the answer. UPDATE: Mystery solved! See below. On August 4th at about 20 minutes past 10 PM … Continue reading →
Summer vacation 2019 part 1
I’m back from my annual vacation where I fly south to Canada and take way too many photos. As with all my hobbies, I’m not a very good nature photographer but I do enjoy it, and this year was particularly … Continue reading →
Fixing Random, part 40 of 40
All right, let’s finish this thing off! First, I want to summarize, second I want to describe a whole lot of interesting stuff that I did not get to, and third, I want to give a selection of papers and … Continue reading →
Fixing Random, part 39
Let’s sum up the last few episodes: Suppose we have a distribution of doubles, p, and a function f from double to double. We often want to answer the question “what is the average value of f when it is given samples … Continue reading →
Fixing Random, part 38
Last time on FAIC we were attacking our final problem in computing the expected value of a function f applied to a set of samples from a distribution p. We discovered that we could sometimes do a “stretch and shift” of … Continue reading →
Fixing Random, part 37
Last time on FAIC we finally wrote a tiny handful of lines of code to correctly implement importance sampling; if we have a distribution p that we’re sampling from, and a function f that we’re running those samples through, we can compute … Continue reading →
Fixing Random, part 36
One more time! Suppose we have our nominal distribution p that possibly has “black swans” and our helper distribution q which has the same support, but no black swans. We wish to compute the expected value of f when applied to samples … Continue reading →
Fixing Random, part 35
Last time on FAIC we deduced the idea behind the “importance sampling” technique for determining the average value of a function from double to double — call it f — when it is applied to samples from a possibly-non-normalized weighted distribution of … Continue reading →
Fixing Random, part 34
Last time on FAIC we implemented a better technique for estimating the expected value of a function f applied to samples from a distribution p: Compute the total area (including negative areas) under the function x => f(x) * p.Weight(x) … Continue reading →
Fixing Random, part 33
Last time on FAIC I showed why our naïve implementation of computing the expected value can be fatally flawed: there could be a “black swan” region where the “profit” function f is different enough to make a big difference in … Continue reading →
Porting old posts, part 4
I’m continuing with my project to port over, reformat and update a decade of old blog posts. Today, a few days in mid-October 2003; this is still my second month of blogging and I am writing at what I would … Continue reading →
Fixing Random, part 32
Last time on FAIC we reviewed the meaning of “expected value”: when you get a whole bunch of samples from a distribution, and a function on those samples, what is the average value of the function’s value as the number … Continue reading →
Fixing Random, part 31
Last time in this series we saw that we could compute a continuous posterior distribution when given a continuous prior and a discrete likelihood function; I hope it is clear how that is useful, but I’d like to switch gears … Continue reading →
Applying machine learning to coding itself
We’ll get back to stochastic programming soon; I wanted to do a quick post about some updates to my earlier series on anti-unification. As I noted in the final part of that series, I spent a few months in 2018 … Continue reading →
Fixing Random, part 30
Last time on FAIC I posed and solved a problem in Bayesian reasoning involving only discrete distributions, and then proposed a variation on the problem whereby we change the prior distribution to a continuous distribution, while preserving that the likelihood … Continue reading →
Fixing Random, part 29
[It is] a spectacular vindication of the principle that each individual coin spun individually is as likely to come down heads as tails and therefore should cause no surprise that each individual time it does. Thus Guildenstern (or is it … Continue reading →
Fixing Random, part 28
Last time on FAIC we implemented a technique for sampling from a non-normalized target PDF: Find an everywhere-larger helper PDF that we can sample from. Sample from it. Accept or reject the sample via a coin flip with the ratio … Continue reading →
Fixing Random, part 27
Last time on FAIC we went through a loose, hand-wavy definition of what it means to have a “weighted” continuous distribution: our weights are now doubles, and given by a Probability Distribution Function; the probability of a sample coming from … Continue reading →
Porting old posts, part 3
I’m continuing in my efforts to move and update all my old content from my MSDN blog to ericlippert.com. Today, posts from early October of 2003. In, out, in-out, make up your mind already The late-binding code designed for OLE … Continue reading →
Fixing Random, part 26
We’ve been mostly looking at small, discrete distributions in this series, but we started this series by looking at continuous distributions. Now that we have some understanding of how to solve probability problems on simple discrete distributions and Markov processes, … Continue reading →
Fixing Random, part 25
Last time on FAIC we implemented the Markov process distribution, which is a distribution over state sequences, where the initial state and each subsequent state is random. There are lots of applications of Markov processes; a silly one that I’ve … Continue reading →
Fixing Random, part 24
[Code for this episode is here.] So far in this series we’ve very briefly looked at continuous distributions on doubles, and spent a lot of time looking at discrete distributions with small supports. Let’s take a look at a completely … Continue reading →
Fixing Random, part 23
So… I’ve got good news and bad news. The good news is: I’ve described an interface for discrete probability distributions and implemented several distributions. I’ve shown how projecting a distribution is logically equivalent to the LINQ Select operator. I’ve shown … Continue reading →
Fixing Random, part 22
[Code for this episode is here.] Last time in this series I left you with several challenges for improving our DSL for imperative probabilistic workflows. But first, a puzzle: Question One: You are walking down the street when you see … Continue reading →
123456