
Microsoft Solitaire was developed by a summer intern - yurisagalov
https://www.reddit.com/r/todayilearned/comments/3zfadv/til_that_microsoft_solitaire_was_developed_by_a/
======
kyle_u
I don't know what it is, but I love implementing Solitaire to learn new
languages and frameworks. It's always a fun exercise, and the engine gets
better with every iteration. My latest attempt is
[https://solitaire.gg](https://solitaire.gg) \- it's a Scala/Scala.js
WebGL/websocket Phaser web/native app with hundreds of games.

~~~
thomasthomas
a little off topic but is it possible to truly randomize the
80,658,175,170,943,878,571,660,636,856,403,766,975,289,505,440,883,277,824,000,000,000,000
shuffle combinations?

edit: also, when i play solitaire via an ipad app there is always a 'top
score' by someone for the hand i was dealt. i dont understand how this is
probabilistically possible

~~~
teh
Shuffling can be done in linear time, e.g. with
[https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle)
so yes.

~~~
gamegoblin
I believe user thomasthomas was referring to this problem:

[https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#P...](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#Pseudorandom_generators:_problems_involving_state_space.2C_seeding.2C_and_usage)

That is, is there enough entropy in your typical PRNG to actually generate all
of those shuffles with equal probability.

~~~
sltkr
You can easily seed your PRNG with a cryptographic entropy source which can
certainly provide enough entropy.

But in reality you don't care. You could seed the PRNG with the current system
time in nanoseconds or something, and every game you'll ever play is
different. Even if the PRNG has limited state, you'll never notice it as a
human player.

~~~
dietrichepp
I'd like to elaborate. The cryptographic PRNG has lots of entropy, and it
probably happens to be enough entropy. You need ~226 bits, and most
cryptographic PRNGs will be more than that—but not all! Information-theoretic
entropy is actually a stronger requirement, and it's why we use /dev/urandom
(which is secure and fast) instead of /dev/random (which is information-
theoretic secure, but slow).

So it might be possible that your secure PRNG still cannot generate all
permutations.

~~~
schoen
Paging tptacek to quarrel with the account of RNG entropy presented here (?)

~~~
dietrichepp
Quarrel? Here, let me clarify. A PRNG has state with a certain amount of
potential entropy, call this X. Uniformly shuffling a deck of cards requires a
certain amount of entropy, Y. If X > Y then theoretically you can generate all
possible shufflings with your PRNG, assuming it's seeded properly. If X < Y,
then you can't.

The key difference is that your PRNG could be cryptographically secure even
though X < Y. It turns out that Y ≈ 226 bits, and so it's plausible that your
cryptographically secure RNG would have X = 128 bits, for example, even though
I'd _typically_ expect a larger number.

People often conflate entropy with security. A random number source could have
high amounts of entropy and be insecure, while a random number source with
less entropy could be very secure. Or let me put it this way: entropy is
necessary but not sufficient for security.

~~~
im2w1l
It only takes 226 bits of entropy _if all shuffles should be equally likely_.
If one shuffle has probability sufficiently close to 1, and the rest are
equally likely, you could make do with less than a bit of entropy.

~~~
dietrichepp
Right, that's what "uniformly" means. Discrete uniform distribution = all
shuffles are equally likely.

------
pc86
For anyone who comes here without clicking the link, it's linking to a comment
of the intern that actually wrote it. He provides some neat context as well.
Worth the read if you don't mind being on Reddit at work.

~~~
Raphmedia
Or if you want to hide the fact that you are on reddit at work, here is the
link displayed as "code".

[http://codereddit.com/?topic=3zfadv](http://codereddit.com/?topic=3zfadv)

~~~
pc86
Blocked by the firewall as a Games website :) But hopefully it helps someone
else!

~~~
lelandbatey
Here's a (giant) png screenshot of the whole reddit thread:
[http://mirror.xwl.me/solitaire_history.png](http://mirror.xwl.me/solitaire_history.png)

Screenshot captured with phantomjs/rasterize.js and shrunk with pngquant.

~~~
cabirum
huh. 2.4 Mb for 1920x31028px color png? Nice.

------
cabirum
He mentioned "KlondGmProc" and "DefColProc" as names of message passing
routines, so google finds a single result [1] from win2ksrc.rar > klond.c, I
think that might be the actual source code.

[1]:
[http://read.pudn.com/downloads3/sourcecode/windows/248345/wi...](http://read.pudn.com/downloads3/sourcecode/windows/248345/win2k/private/windows/shell/games/sol/klond.c__.htm)

~~~
sauere
Yes. The Windows 2k source leaked a few years ago.

~~~
Someone1234
NT4 and 2K. It was supposedly only 15% of 2K's total source code, but the
majority of the NT4 source.

It is a pretty interesting read if you're interested in C programming. In
particular Microsoft's internal style and error handling.

~~~
i336_
Oh, TIL. I had no idea the WinNT source leak was nearly complete.

I vaguely recall hearing something about getting the Win2K kernel to build,
but I don't remember exactly what I read (I think it was on BetaArchive).

Then there's the Mac OS 7.x leak, which is also curious.

I need to dig my old archives up and poke at this stuff... heh

------
Diederich
I've said it before, and I'll say it again: an un-nervingly large amount of
the work I've done over the years has had this property: the long-term value
is inversely proportional to the time put into it. Learning from this
correlation remains a big priority for me.

~~~
ffn
Same here, my best projects are the ones that were banged out over at most a
week or so (then possibly supported with minor fixes over time). Still though,
every shitty cancerous hell project before that plays its part in training
your mind and preparing you for the moment when you can finally produce your
opus.

~~~
steve-howard
What if you produce your opus and a series of constant organizational changes
puts you right back in hell? Is there an end?

------
ChuckMcM
I remember playing 'spider' on my Sun system back in the day (it was a form of
solitaire) and once Don Woods (who was also working at Sun at the time) walked
past my office and said, "Oh you like that? I wrote it." To which I could only
reply he was responsible to two major time wasters in my early career :-)

~~~
i336_
That's kinda cool.

I'm curious: what was the other time waster? :P

~~~
philiplu
He created the Colossal Cave Adventure from the Crowther original back in the
70s.

[https://en.m.wikipedia.org/wiki/Don_Woods_(programmer)](https://en.m.wikipedia.org/wiki/Don_Woods_\(programmer\))

~~~
i336_
Oh, neat... that's pretty amazing, actually.

------
dice
You used to be able to underflow the score in MS Solitaire by repeatedly
dealing new hands (would subtract 52 points or so). I believe that, in Win95
at least, the score was a 16 bit signed variable so you could underflow it
with a mere 1261 deals! I wonder if the modern one is 64 bits, and if you can
still underflow it...

~~~
Houshalter
IIRC Windows did a thing where they wanted all the software they shipped to be
64 bit. That's why some of the games like pinball were removed.

~~~
bolasanibk
For pinball, there was a bug with the collision detector in the 64 bit version
they could not fix.

"Two of us tried to debug the program to figure out what was going on, but
given that this was code written several years earlier by an outside company,
and that nobody at Microsoft ever understood how the code worked (much less
still understood it), and that most of the code was completely uncommented, we
simply couldn’t figure out why the collision detector was not working. Heck,
we couldn’t even find the collision detector!"

Source:
[https://blogs.msdn.microsoft.com/oldnewthing/20121218-00/?p=...](https://blogs.msdn.microsoft.com/oldnewthing/20121218-00/?p=5803/)

~~~
dingo_bat
As a newbie dev, I'm happy to see that even experts have difficulty navigating
third-party code!

~~~
bolasanibk
Sometimes I have trouble with my own code if it is old enough. :)

~~~
SixSigma
The best one is when you read the code, say "this guy is terrible, who is it"
and then find out it was you

------
DanBC
I hope someone is archiving this folklore properly. It's a bit scary that it's
only in a Reddit thread.

(ditto for the stuff that's languishing in Google's Usenet archive.)

~~~
greglindahl
3 people have gone to the Internet Archive's Wayback machine already to save
the reddit thread.

There's this for Usenet:
[https://archive.org/details/usenethistorical](https://archive.org/details/usenethistorical)
and [https://archive.org/details/usenet](https://archive.org/details/usenet)
and
[https://archive.org/details/giganews](https://archive.org/details/giganews)

~~~
i336_
/!\\[L TIL TIL TIL TIL TIL TI]/!\

I'm saving up for a little 10TB disk array... at this rate it will be full
shortly after it arrives.

This is gonna be so awesome to go through... thanks for this!!

------
protomyth
It was probably the nicest way to teach new people how to use a mouse. I am
grateful to the author for that.

~~~
Someone
No, that was "Mousing around" for the original Macintosh. See
[https://www.youtube.com/watch?v=1pwammW5syw](https://www.youtube.com/watch?v=1pwammW5syw)
(Mac boots at around a minute in; the audio is from one of the two audio
cassettes that shipped with each Mac)

More info at [http://gizmodo.com/heres-how-a-macintosh-tutorial-taught-
peo...](http://gizmodo.com/heres-how-a-macintosh-tutorial-taught-people-to-
use-a-m-1583366354)

------
us0r
"He received no royalties for his work despite it being among the most used
Windows applications of all time."

Anyone know why he would receive a "royalty" (esp. as an intern)? I've seen
big bonuses/stock options but never a royalty.

~~~
incepted
No reason. No employee at a company ever received royalty for the code they
write for the company.

~~~
georgemcbay
Royalties are a thing in the game industry, not universal or even the norm,
but they do exist.

I mean, they do everything they can to screw employees out of them using
Hollywood-style accounting, but it is incorrect to say "No employee at a
company ever received royalty for the code they write for the company".

~~~
oxryly1
True. I've both received and been screwed out of royalties while programming
games on a salary.

------
wstrange
So a single intern single handedly caused billions of dollars in lost
productivity :-)

~~~
ThrustVectoring
Not quite. The intern is only responsible for the difference between solitaire
and the time-wasting activity it substitutes for.

I learned this when my parents tried to blame video games for why I wasn't
doing homework. They didn't want to blame books when I substituted activities.

------
albemuth
An interesting bit is that the design for the game came from Susan Kare from
NeXT [1] and had been on the original Macintosh team.

[1][https://en.wikipedia.org/wiki/Susan_Kare#After_Apple](https://en.wikipedia.org/wiki/Susan_Kare#After_Apple)

------
JDiculous
I think the most interesting part is that he now makes hard cider full time. A
reminder that there's a whole world outside of programming.

------
ChicagoDave
Best Reddit comments ever. "I'm the Girlfriend!"

------
acqq
The card deck was designed by Susan Kare:

[http://kare.com/portfolio/17_microsoft_solataire.html](http://kare.com/portfolio/17_microsoft_solataire.html)

Anybody knows if that happened only once MS decided to publish the game?

------
qnaal
the classic freecell game had the useful feature where you could play the
entire game from the numpad, the new one sucks

------
induscreep
What does "goofy message passing architecture to get polymorphism and
inheritance" mean?

~~~
cek
[https://en.wikibooks.org/wiki/Windows_Programming/Message_Lo...](https://en.wikibooks.org/wiki/Windows_Programming/Message_Loop_Architecture)

------
piokuc
I wrote a clone of Solitaire in Turbo Pascal long time ago. I still remember
the satisfaction of coming up with a recursive algo for uncovering safe tiles.
The joy of understanding recursion, that was nice, ha ha!

