Fabulous adventures in coding
Link | https://ericlippert.com/ |
Feed | http://ericlippert.com/feed |
Updated | 2024-11-21 11:30 |
by ericlippert on (#188VE)
This was the maintenance room for Flood Control Dam #3. Apparently, the room has been ransacked, for most of the valuable equipment is gone. On one wall is a group of buttons colored yellow, brown and red. The only doorway … Continue reading →
|
by ericlippert on (#17SQ6)
You are south of a large lake, far too deep and wide to be crossed. Paths lead east, south and southwest. > go north You would drown. > swim in the lake Swimming isn’t allowed in the lake. > go … Continue reading →
|
by ericlippert on (#179E6)
This is a sand-filled cave whose exit is to the southwest. > dig in the sand with the shovel You seem to be digging a hole here. > again The hole is getting deeper, but that’s about it. > again … Continue reading →
|
by ericlippert on (#171T3)
You are near the top of Aragain Falls. The only path leads north. A solid rainbow spans the falls to the west. > go north Sandy beach You are on a large beach on the east shore of the river, … Continue reading →
|
by ericlippert on (#16S3H)
You are on a small, rocky beach by the Frigid River, below the falls. A rainbow crosses over the falls to the east and a narrow path continues to the southwest. > go east Can you walk on water vapor? … Continue reading →
|
by ericlippert on (#16H0M)
You are atop the west wall of a great canyon, offering a marvelous view of the mighty Frigid River below. Across the canyon, the walls of the White Cliffs join the mighty ramparts of the Flathead Mountains. To the north, … Continue reading →
|
by ericlippert on (#16DMH)
I am spending the week at FB headquarters in Menlo Park: (That’s me looking out for the thief. He’s around here somewhere.) I assume that the axe-wielding troll had already been killed and turned into mist, since the room was … Continue reading →
|
by ericlippert on (#16991)
Paths lead into the forest to the west and northwest. Also, a well-marked path extends east. > go west Forest This is a dimly lit forest, with large trees all around. > go west Behind House > enter the white … Continue reading →
|
by ericlippert on (#15RRS)
This looks like an Egyptian tomb. A stair ascends to the west. The solid-gold coffin used for the burial of Ramses II is here. > take the coffin Your load is too heavy. > drop the sword Dropped. > take … Continue reading →
|
by ericlippert on (#150VT)
This is a circular room with passages in all directions. Several have unfortunately been blocked by cave-ins. > go southeast Last time we implemented the state transition function; it takes in a zchar and a state, and produces a string … Continue reading →
|
by ericlippert on (#14RWB)
This is a small room with passages to the east, northeast and south, and a forbidding hole leading west. Bloodstains and deep scratches (perhaps made by an axe) mar the walls. A troll, brandishing a bloody axe, blocks all passages … Continue reading →
|
by ericlippert on (#140XS)
The living room opens to the east. To the west is a wooden door, above which is strange gothic lettering. The door is nailed shut. There is a trophy case here, and a large oriental rug in the center of … Continue reading →
|
by ericlippert on (#13H3Q)
You are behind the white house. Paths lead into the forest to the east and northeast. In one corner of the house is a small window which is slightly ajar. > examine the window The window is slightly ajar, but … Continue reading →
|
by ericlippert on (#139QA)
Well here’s something I never thought I’d write in Fabulous Adventures in Coding when I started this blog more than ten years ago: Today is my first day at Facebook. It still feels weird to say it. But as it … Continue reading →
|
by ericlippert on (#130VQ)
This is a path through a dimly lit forest, curving from south to east. A large tree with low branches stands by the edge of the path. On the ground is a pile of leaves. > count the leaves 69,105. … Continue reading →
|
by ericlippert on (#12S4A)
> go north You are facing the north side of a white house. There is no door here, and all the windows are boarded up. A narrow path winds north through the trees. > go north Let’s start with some … Continue reading →
|
by ericlippert on (#12HKX)
You are standing in an open field west of a white house, with a boarded front door. You could circle the house to the north or south. There is a small mailbox here. > open the mailbox Opening the small mailbox reveals … Continue reading →
|
by ericlippert on (#10NS3)
Thanks to everyone who came out to my beginner talk on using functional style in C# on Wednesday. I had a great time and we had a capacity crowd. The video will be posted in a couple of weeks; I’ll put up a … Continue reading →
|
by ericlippert on (#10EDS)
Many years ago I awoke in the dead of night in a cold sweat, with the certain knowledge that a close relative had suddenly died. […] In fact, the relative is alive and well […]. However, suppose the relative had in … Continue reading →
|
by ericlippert on (#10ASF)
Happy New Year everyone; I hope you had a pleasant and relaxing festive holiday season. I sure did. I’m starting the new year off by giving a short — an hour long or so — talk on how you can … Continue reading →
|
by ericlippert on (#X9A5)
I said last time that binary-searching the rationals (WOLOG between zero and one) for a particular fraction that is very close to a given double does not really work, because we end up with only fractions that have powers of … Continue reading →
|
by ericlippert on (#WXYD)
All right, we have an arbitrary-precision rational arithmetic type now, so we can do arithmetic on fractions with confidence. Remember the problem I set out to explore here was: a double is actually a fraction whose denominator is a large … Continue reading →
|
by ericlippert on (#WHF8)
A couple of years ago I developed my own arbitrary precision natural number and integer mathematics types, just for fun and to illustrate how it could be done. I’m going to do the same for rational numbers here, but rather … Continue reading →
|
by ericlippert on (#W73X)
Good Monday morning everyone; I hope my American readers had a lovely Thanksgiving. I sure did! Well enough chit-chat, here’s a problem I was pondering the other day. We know that doubles introduce some “representation error†when trying to represent … Continue reading →
|
by ericlippert on (#V3HZ)
In the previous exciting episode I ended on a cliffhanger; why did I put a loop around each wait? In the consumer, for example, I said: while (myQueue.IsEmpty) Monitor.Wait(myLock); It seems like I could replace that “while†with an “ifâ€. … Continue reading →
|
by ericlippert on (#TS3F)
Locks are tricky; I thought today I’d talk a bit about some of the pitfalls of locking that you might not have seen before. As you probably know, the lock statement in C# is a syntactic sugar for the use … Continue reading →
|
by ericlippert on (#SNYH)
One of the early stumbling blocks people run into when learning traditional Aristotelian logic is the idea that “a false proposition implies any propositionâ€. Let’s briefly review material implication, and then I’ll talk about what the implications of material implication … Continue reading →
|
by ericlippert on (#SBET)
UPDATE: A commenter points out that today is the 200th anniversary of the birth of George Boole; I had no idea when I scheduled this article that it would be so apropos. Happy birthday George Boole! Here’s a little-known and … Continue reading →
|
by ericlippert on (#RSA8)
A question I occasionally get is, suppose I have code like this: const double x = 200.0; const double y = 0.5; ... void M(double z) { double r = z * x * y; ... Does the compiler generate … Continue reading →
|
by ericlippert on (#R9EX)
In part one I gave a bunch of reasons to reject the proposed feature where the compiler infers additional type information about a local variable when inside the consequence of a conditional statement: if (animal is Dog) { animal.Bark(); // … Continue reading →
|
by ericlippert on (#R2GR)
I am excited to announce that Essential C# 6.0 is now available in stores! As always, Mark did the vast majority of the work. And as always, I was delighted to be asked once again to contribute to one of … Continue reading →
|
by ericlippert on (#QYK3)
In last week’s episode of FAIC I was discussing code of the form: if (animal is Dog) ((Dog)animal).Bark(); Specifically, why the cast was illegal if the variable tested was of generic parameter type. Today I want to take a bit … Continue reading →
|
by ericlippert on (#QFR5)
Here’s a question I’m asked occasionally: void M<T>(T t) where T : Animal { // This gives a compile-time error: if (t is Dog) ((Dog)t).Bark(); // But this does not: if (t is Dog) (t as Dog).Bark(); } What’s going … Continue reading →
|
by ericlippert on (#JZV8)
One of the C# oddities I noted in my recent article was that I find it odd that creating a numeric type with less-than, greater-than, and similar operators requires implementing a lot of redundant methods, methods whose values could be … Continue reading →
|
by ericlippert on (#J2SV)
I got a lot of great responses to my recent piece on features of C# I somewhat regret; thanks all for those. As promised, today on fun-for-Friday-FAIC I’ve posted some fabulous adventures in nature photography from my recent trip to … Continue reading →
|
by ericlippert on (#HRQZ)
Hey everyone, I am finally back from my many travels this summer and looking forward to doing some blogging this autumn. I’ll post some vacation photos when I have them sorted out. Until then, here’s an article that the nice … Continue reading →
|
by ericlippert on (#AV8V)
I have begun my travels but I have one more from the road. Literally! The nice people at radar asked me to write them a short article on static analysis for beginners; I was happy to oblige. (There seem to … Continue reading →
|
by ericlippert on (#AP0V)
A quick note: I’m going to be traveling for much of the rest of June and I haven’t got articles queued up, so the blog will go dark for a bit; see you in July! In the last two episodes … Continue reading →
|
by ericlippert on (#AE2J)
Last time on FAIC I reran my 2004 article on tips for coding on whiteboards for interviews. This time, a rerun from 2009 article on a similar topic. Next time, some more thoughts on this subject. Interviewing job-seeking candidates is … Continue reading →
|
by ericlippert on (#A6ER)
I got an email from a reader in India recently asking me to talk a bit about thoughts on technical interviews. Here’s a rerun of my 2004 article on that subject. (Note that this was before I was on the … Continue reading →