# Is the soul a physical part of you?

### A metaphysical argument about the soul’s relation to the body.

Today we’re going to get into a small discussion about whether the soul is a part of you. Meaning; is your soul something that’s necessarily a physical part of you as a person?

To be more specific, this is an argument that was posed to posit the existence of the concept of “a soul” as an explanation for the phenomenon of human free will.

Note: If you have strong religious views on what the soul is and don’t enjoy questioning them, you may not enjoy reading this post. That being said, this post is not written to convince you of a particular point of view, but simply inform you about an interesting argument about the philosophical debate on the nature of the immaterial soul.

#### Laying the Groundwork

So before we can have this conversation, it may be useful to set a context for it. First, we have to talk about a couple of views about what people are before we can posit an argument in favor of one case or the other.

There are two prevailing views on this issue, there’s the dualist view, that a person is comprised of a body and a soul. Then there’s the physicalist view that a person is just a body.

Both of these views have interesting consequences, and the argument we’re going to discuss comes from the dualist perspective.

We need to define an important concept, the idea that a system can be deterministic. Meaning that if you reproduce an identical system multiple times, that a predictable outcome can be observed that follows specific rules. Most of physics uses determinism to predict how a system will unfold all the time. To quote google:

de·ter·min·ism (noun)

/dəˈtərməˌnizəm/

The doctrine that all events, including human action, are ultimately determined by causes external to the will. Some philosophers have taken determinism to imply that individual human beings have no free will and cannot be held morally responsible for their actions.

Let’s define another concept really quickly.

Free Will: the idea that if I am put into the exact same situation multiple times, I could make a different decision each time. There is nothing necessarily consistent about the actions of a being with free will.

So without further ado, the argument is the following.

#### There are three premises:

• Humans have free will.

• Nothing subject to determinism has free will.

• All purely physical systems are subject to determinism.

#### Conclusion: Therefore, humans are not purely physical systems.

So to explain the concept of free will we appeal to the idea of a soul, something non-physical.

## How should we evaluate this argument?

I think the first question that I asked when I heard this was “What is it about free will that proves that we’re not purely physical objects?”

Why would there be an incompatibility between the idea of having free will and the idea of things being determined?

But we’ll start our analysis with a couple of important questions.

##### Is this argument valid?

The first question we should ask is, “does our argument make sense?” Does this argument’s conclusions truly logically follow?

So I’ll save you some time and tell you that it’s conclusion does follow. Given these particular assumptions, it makes sense.

##### Are our assumptions valid?

Whether you realize it or not, this argument uses some serious assumptions, that we should be more rigorous about defining before we accept this radical conclusion.

premise one: This argument rests on the idea of free will. The idea that if we have free will we can’t just be purely physical systems. I think the strongest objection that someone could give would be that we don’t truly have free will. We might certainly believe we do; but free will isn’t something that can be observed. Perhaps the sense that we could have acted otherwise is an illusion.

premise three: “All purely physical systems are subject to determinism.” The statement asserts we can’t have free will and determinism. 3 is a pretty serious claim about empirical science.

Quantum mechanics as an example is certainly not deterministic. We can observe particles that might be found in one position $60%$ of the time; without knowing_ why_ they behave the way that they do. Determinism is not true at the level of quantum mechanics. This leads me to say that premise three might be false.

I should say that premise two can be challenged as well and I’d encourage you to think about why.

So I’ve told you the argument, I’ve told you what I think, let me know what you think~

### Souls are … weird.

If you found this interesting, you may enjoy viewing the lecture series from Yale; Death (PHIL 176) : link here.

# 3D Printed Weapons; Explained

### The History of 3D Printed Weapons in America

###### The liberator, a 3D printed handgun

What you’re looking at above is an image of one of the very first 3D printed weapons ever designed and distributed for free on the internet. To think that you could go on the internet and mass produce a gun or a rifle in your own home by printing them. This would have been unheard of even in 2012. So what’s really changed in the past couple of years?

There is a lot to understand here; so let’s start with the basics.

What is 3D printing?

3D printing is the ability to use special printers that layer plastics in order to create 3 dimensional objects. This has become a popular phenomenon in the tech community enabling a new and exciting avenue for creativity.

#### Warning: history incoming:

The earliest 3D printing technologies first became visible in the late 1980’s, at which time they were called Rapid Prototyping (RP) technologies. This is because the processes were originally conceived as a fast and more cost-effective method for creating prototypes for product development within industry. As an interesting aside, the very first patent application for RP technology was filed by a “Dr Kodama”, in Japan, in May 1980. Later, 3D Systems’ first commercial RP system, the SLA-1, was introduced in 1987 and following rigorous testing the first of these system was sold in 1988. 2007 was the year the shoots started to show through and this embryonic, open source 3D printing movement started to gain visibility.

But it wasn’t until January 2009 that the first commercially available and affordable 3D printer — in kit form and based on the RepRap concept — was offered for sale. This was the BfB RapMan 3D printer. Closely followed by Makerbot Industries in April the same year, the founders of which were heavily involved in the development of RepRap until they departed from the Open Source philosophy.

## How it works…

The most common type of 3D printing is the process called Fused Deposition Modelling (FDM), and this technology is the primary method used to makenot just the handful of working 3D printed guns that have been made, but almost all 3D printing.

###### Yoda being 3D printed in layers

The process works by slicing a digital file containing the 3D model into dozens, sometimes hundreds of (usually) 0.1 mm thick layers. The 3D printer will then use robotic precision to replicate each of these individual slices on a printing bed using melted thermoplastics, one layer printed on top of another. The result, hopefully, will be a complete physical copy of the digital file. Depending on the size of the part, the type of material being used and the model of 3D printer, this process can take several hours.

How did 3D weapons come to exist?

Our story begins where most violence happens, Little rock, Arkansas. In the Summer of 2012 Ben Denio and Cody Wilson sought to create a political and legal vehicle for demonstrating and promoting the subversive potential of /publicly-available 3D Printing technologies. They called this venture “Defense Distributed”. On July 27th, 2012 they launched the Wiki Weapon Project- the effort to create and release the files for the world’s first printable handgun.

In August a month later, Indiegogo.com removed DD’s inaugural fundraising campaign from its website, citing a terms of service violation. This removal prompted a backlash in the tech community, and the Bitcoin community helped fund the Wiki Weapon. By September 2012, DD had raised enough money to start prototyping and experimentation, when industry player Stratasys (a popular manufacturer of 3D printers) scandalously revoked its lease with the company and quickly repossessed its printer. This repossession, one of the first of its kind, made world news, and the Wiki Weapon found even more support. Research and development continued. . .

#### This, is the liberator.

These components are the brainchild of Defense Distributed’s vision of open sourced weapons available for the /public.

When the liberator was published, it did so as an open source software package, containing cad (computer-aided design) and .stl files that would allow you to print the individually designed components from your own home and reproduce the pistol.

This was interesting. This should be protected by both the First Amendment, since it involves expression of written information, and the Second (I’m thinking about the 2008 Heller decision) — It seems like it should be.

### Except that it wasn’t. #Justice

A letter was sent from the federal government addressed to Wilson and Defense Distributed, It was signed by Glenn Smith, chief of enforcement for the State Department’s Bureau of Political-Military Affairs, Office of Defense Trade Control Compliance.

Smith warned Wilson that the technical specs he made /publicly available may be “ITAR-controlled technical data” released “without the required prior authorization” from the State Department. ITAR stands for International Traffic in Arms Regulations, which are the U.S. government’s set of rules controlling the import and export of munitions.

In other words, by releasing CAD files allowing anyone with access to a 3D printer to make a somewhat fragile plastic pistol, Wilson may have become an illegal arms trafficker. The State Department didn’t say for sure that this information (some might call it speech) fell under its jurisdiction. But while regulators pondered the question-and four months later, at press time, they were still pondering-they demanded that Wilson “treat the above technical data as ITAR-controlled,” meaning that “all such data should be removed from /public access immediately.”

So what we’re essentially seeing is that sharing code that can create guns is considered the same thing as exporting guns? That’s weird.

Waiting on the issue for a bit, Defense distributed decided they were going to take matters into their own hands and sue the federal government for the right to distribute files online pursuant to their constitutional right to free speech.

### In a very interesting (but completely unsurprising) ruling; the courts ruled against Defense Distributed.

You can read the original court documents relating to the appeal here.

“Ordinarily, of course, the protection of constitutional rights would be the highest /public interest at issue in a case. That is not necessarily true here, however, because the State Department has asserted a very strong /public interest in national defense and national security. Indeed, the State Department’s stated interest in preventing foreign nationals — including all manner of enemies of this country — from obtaining technical data on how to produce weapons and weapon parts is not merely tangentially related to national defense and national security; it lies squarely within that interest.” — Defense distributed V. Department of State¹

However it should be noted that there was not consensus as it was a 2–1 decision. Here is a statement from 5th Circuit, District Judge Edith Jones.

“In sum, it is not at all clear that the State Department has any concern for the First Amendment rights of the American /public and press. Indeed, the State Department turns freedom of speech on its head by asserting, “The possibility that an Internet site could also be used to distribute the technical data domestically does not alter the analysis….” The Government bears the burden to show that its regulation is narrowly tailored to suit a compelling interest. It is not the /public’s burden to prove their right to discuss lawful, non-classified, non-restricted technical data.” — Defense distributed V. Department of State²

#### Where are we now?

If you’re interested, the liberator’s original source files can still be found on torrent sites.

Also, Defense Distributed has an interesting Instagram page so if you’re interested you can see the research and development that they do. Edit: They have since removed the instagram page; here’s their twitter though.

##### Here are some questions I don’t have the answers to yet but am curious about learning. Jump into the comments if you’re interested.
• DD was not allowed to publish the liberator files due to the fear that foreign nationals might be able to obtain them, making DD an illegal arms trafficker. What would happen if the software in question continued to be leaked unto torrent sites due to being “hacked” by strangers that DD had no control over? Would they still be responsible for the files being shared on the internet?

• Should the GNU GPL be revised in order to remove liability for any harm caused by GPL licensed source files that are open sourced weapons?

I hope this was interesting for you, it certainly was interesting to write and learn about, so as always thank you for reading ~

# How Should We Model Reality?

### Does machine learning justify changing our need for a glass box?

Take a look at this paper. It’s titled, “Deep learning and the Schrödinger equation”. It’s implications are really interesting; first let’s take a look at the paper’s claim.

“We have trained a deep (convolutional) neural network to predict the ground-state energy of an electron in four classes of confining two-dimensional electrostatic potentials. On randomly generated potentials, for which there is no analytic form for either the potential or the ground-state energy, the neural network model was able to predict the ground-state energy to within chemical accuracy, with a median absolute error of 1.49 mHa. We also investigate the performance of the model in predicting other quantities such as the kinetic energy and the first excited-state energy of random potentials. While we demonstrated this approach on a simple, tractable problem, the transferability and excellent performance of the resulting model suggests further applications of deep neural networks to problems of electronic structure.

So what does this mean in laymen’s terms? It basically means that we can give a computer a lot of different examples of any given problem we want it to solve and can get answers for questions about that problem that are really accurate.

Let’s say you were looking at some physical phenomenon you wanted to understand. (Let’s use something like the probability of finding a tennis ball that you dropped in a hole in the ground.)

Now in general if you drop a tennis ball in a big hole in the ground it usually falls towards the center where the hole is the deepest. So it’s unlikely that it will get caught on the outer fringes, but still possible.

So you might get some sort of curve of changing probability that looks like this, where x=0 is the center of the hole and the further out you go, the lower the probability gets.

###### ratchet probability example of how likely you are to find a tennis ball.

Now imagine instead of a tennis ball, you’re looking at an electron, and instead of gravity acting on the tennis ball, it’s now electric potentials that create coulomb forces on that electron that force it into a certain position.

This situation I’ve just described is called the quantum well; something you’ll see a lot in an introductory quantum mechanics course. The usefulness of the quantum well example is that you usually earn how to model it using the **Schrödinger equation**. $$i\hbar {\frac {\partial }{\partial t}}\Psi (\mathbf {r} ,t)=\left[{\frac {-\hbar ^{2}}{2\mu }}\nabla ^{2}+V(\mathbf {r} ,t)\right]\Psi (\mathbf {r} ,t)$$

You can read more about the Schrödinger equation here, but for our purposes what you should know is that it gets very complicated very quickly. The second you start trying to use it to model two tennis balls, things become very very difficult to solve, especially because we only have the probabilities!

### The glass box

When we manipulate equations that we believe accurately model the real world, every valid manipulation of that model is something that we also believe to be “true”, and we continue to manipulate this equation until we arrive at a statement of interest to the question we’re asking. These models are sometimes called a “glass box”. This is because the process we are inspecting is one that we believe that we understand because the model we’re using works for that particular problem.

In the context of this paper something called a Convolutional Neural Network is used. It works by looking at thousands of input-output examples of the thing you want to model, and creates an approximation of the raw numerical operations that are applied to your input in order to “fake” knowing whatever the function actually is. This process of creating a numerical model that doesn’t have to know anything about the function it’s approximating is called a “black box”. We know what we put into the box and we know what comes out, and that’s it. Because we don’t really know what the model looks like other than the numbers, we usually just test it to see how accurate it is and then use it for problems where we don’t have a glass box yet.

This concept of neural networks was actually invented in the 1950’s, but it’s only recently that this method of machine learning has exploded in popularity for solving complex problems. This paper is interesting because it enables us to use computers as black boxes to solve problems that were once thought to only be solved with glass boxes. Now we don’t need to understand a problem in order to be able to use an approximation of the answer. And before you say it, this has nothing to do with the hidden variables theory, which isn’t what we’re talking about. (That’s a question that Einstein)

Now we don’t need to understand a problem in order to be able to use an approximation of the answer.

### Which models are better?

Well just looking at it heuristically we get exact accuracy with glass boxes but they can take a long time to develop and accurately research.

On the other hand we can get black boxes that can give us a 0.1% margin of error and provide us with models for a lot of different problems a LOT faster because all we have to do is collect some data and then train a machine learning algorithm.

That brings up a more important question for us then, what’s more important? Is numerical accuracy all that matters? What is a model supposed to do for us?

I think the answer is that the model we choose in general entirely depends on the problem. Up until recently we’ve never really had the option to use anything other than a pure math, glass box solution to model any given situation to the best of our ability.

It is important to state though that this does have it’s limits. The predictions of these machine learning models are based solely upon our experimental data. So if there are unusual qualities we don’t know about, we won’t be able to notice until we hit edge cases.

For example, the ultraviolet catastrophe was a fault in the Rayleigh-Jeans law that was only uncovered because we could use test the model on much smaller wavelengths that we hadn’t used in experiment to see what it would predict. Only then did we find that it was unrealistic and needed to be revised.

So how should we model reality? Do we need to understand how a particular phenomenon works in order to make meaningful use of our predictions? Or can we ignore it and go on to use machine learning to speed up research and engineering at the cost of understanding.

The Engineer in my says who cares, but the physicist in me cares quite a lot and believes that there shouldn’t be a black box in our understanding of fundamental aspects of reality like schrodinger evolution.

Sources

# The Email disclaimer, Explained.

### This blog post was written only for its intended recipients.

The opinions expressed in this blog and those providing comments are theirs alone, and do not reflect the opinions of David Awad or any employee thereof. David Awad is not responsible for the accuracy of any of the information supplied. If you choose to do stupid things after reading this blog, that constitutes a “you-problem” for which the author takes o responsibility.

## A disclaimer that’s what.

You probably have seen something like this before. The idea of this concept is a poor attempt to shield an entity from any form of legal repercussions as a consequence of emails as well as create consequences if that information ends up being sent to the wrong person.

### What is an email disclaimer?

Let’s start from the ground up with a simple definition.

dis·claim·er

disˈklāmər/

noun

a statement that denies something, especially responsibility.

e.g. “the novel carries the usual disclaimer about the characters bearing no relation to living persons”, “a disclaimer of responsibility”

synonyms:denial, refusal, rejection

legal — an act of repudiating another’s claim or renouncing one’s own.

So when used in the context of an email, I suppose the intention here is to avoid being liable to some sort of consequences that could come from the contents of the email.

### History of disclaimers:

For the younger readers, you may find it interesting that letters were written up and sent in an envelope.

After that; archaic machines were forged to transmit bits of information over telephone lines in order to send a document to a unique identifying address. You may never have seen one, but this machine was called a fax. They made it really easy for you to simply type in a number in order to send a document to someone by simply knowing the right numbers to use.

Shockingly, this led to a lot of people sending documents to the wrong locations.

In addition, faxes were often sent to people at hotels, where the fax would be received by a business center and delivered to a hotel room. This led to concerns that the information in the fax might be misdelivered or read by persons for whom it was not intended.

THAT is how this whole message disclaimer business began. It really makes sense in this context.

Enter the world of the email. Lawyers were sending messages that could contain “legally privileged information” and wanted some sort of similar protection despite it no longer being necessary.

e·mail — ˈēmāl/
noun
messages distributed by electronic means from one computer user to one or more recipients via a network.

However, rather than putting the disclaimer at the beginning of an email, by virtue of reasoning I cannot understand, by nearly universal practice the disclaimer is placed at the end of the e-mail. Thus, the unintended recipient would read the entire e-mail, only to discover the frightening language informing him or her of their wrongdoing.

### Why do people use them now?

An email disclaimer could provide you a few things.

• potentially refuse responsibility.

• is virtually free to add on to an email.

• does virtually no harm outside of looking a bit silly.

So it makes sense why they’ve started to see widespread use; but does it actually make sense?

So here is an example email disclaimer I received once, take a look and we’ll break it down.

This e-mail is intended for the addressee shown. It contains information that is confidential and protected from disclosure. Any review, dissemination or use of this transmission or its contents by persons or unauthorized employees of the intended organisations is strictly prohibited. If you are not the intended recipient please delete this message and notify the sender immediately.

The contents of this email do not necessarily represent the views or policies of REDACTED, its employees or students.

### Warning: You are about to attend this /publication’s fiiiiiirst,

8765309 Let’s do the timewarp again avenue, LN, 01924

## It’s Roastin’ time. Grab your popcorn™ now.

Let’s start with the obvious. You receive an email, and proceed to read it, you get to the bottom of the email and notice this disclaimer. It begins with the following:

“This e-mail is intended for the addressee shown.”

##### duh.

But let’s say this email was actually intended for someone else, how the heck would you know? It was sent to me; the addressee shown. How does one actually know if they were the intended recipient when an email is sent to them, the recipient! Are you a mind reader? Would proof need to be shown to a court room that you knew you weren’t the intended recipient at the time of unintended receipt?

“If you are not the intended recipient please delete this message and notify the sender immediately.”

And what if I dont?

### Oh no! I’ve read it exactly like I shouldn’t have because the disclaimer is at the bottom of the email despite being something that should obviously be read beforehand! What do I do?

First of all, this is my blog post, I’ll be asking the questions here. Second, keep your voice down, I’m right here; there’s no need to be so loud. Third I am not a lawyer, so take this advice with a grain of salt. No this disclaimer of me talking to you isn’t like those other disclaimers from before.

So on the one hand, if I am not the recipient, I am told that I cannot act on information in the message. On the other hand, I am instructed to take particular actions in that case.

“It contains information that is confidential and protected from disclosure.”

##### Protected by what?! COME ON!!

Being that there is no statute or law given to provide some context as to why, and it’s only “prohibited” and doesn’t explain the nature of the consequences I can’t say that I’m scared.

Also, If the mail system always adds a disclaimer saying that the message doesn’t represent official policy… how do you state official policy by email?

#### It is just Wasting space.

Imagine going back and forth for just a few emails.

A message posted to a mailing list that contained exactly five lines of real content.

1: greeting
2: blank
3: a quick question, followed by a thank you
4: blank
5: <author’s name>
6: blank
7–23: LEGAL NONSENSE


This is a huge waste of space, and feels really stupid if you’ve received something like this. The signal to noise ratio is terrible!

### So ultimately does this actually do anything?

Well, according to The Economist¹, these types of agreements are not legally enforceable.

“In the United States, several courts have ruled that email disclaimers may have a legal effect when intentionally included in an email, generally before the text of the email or in the body of the email. However, no court appears to have ruled on the effectiveness of boilerplate email disclaimers appearing below the signature line in every email².”

To cite an actual case that this author happens to find hilarious, let’s take a look at Romero v. Romero³ which pushed the limits of what can be, “disclaimed.”

One family court case spilled over into an email that stated “pay-back is really a b**” and that the recipients “still have a gigantic debt to pay to me, which will be paid no matter what.” Romero v. Romero, 2011 Cal. App. Unpub. LEXIS 8706 (Cal. App. 4th Dist. Nov. 14, 2011)³. The e-mail concluded with, “Your most determined, unstoppable, and visceral enemy.”

Below that, the email included the following boilerplate disclaimer:

“DISCLAIMER: Not one word herein should be construed by anyone as meaning violent or threatening intentions, and instead the entire contents is to be taken by the strict literary meaning. There have not been, and will be any elucidated threats of violence or intent, either expressed or implied, within the entirety of this document.”

Unsurprisingly, the recipient of the e-mail sought a protective order. The sender claimed his emails were protected by his First Amendment right of free speech and that the “disclaimer” prevented the emails from being used as the basis for a protective order. The court explained to the sender that his documented threat and harassment of the recipient would not be ignored “by simply putting a disclaimer on it.”

## “L O L, Nah son.” — California District Court.

#### Suppose we ignore my previous citations and take these disclaimers at face value.

It may be a little paranoid to be using these from a legal perspective anyway. An incredible amount of trust is already given to the internet and the different servers that move your emails across the globe. Yes, we can fight this with PGP encryption and other techniques, but it can only get us so far if a determined third party were to obtain our data.

Consider for a moment sending an overnight mail package: Have you ever read the delivery contract? (I already know you haven’t read the EULA for half of the websites you were on today, let alone one for this site) Most likely, it gives the carrier the absolute right to open the package for almost any reason. How good is the security of that package along the way? Who might be opening your package and reading the contents?

In actual fact, the likelihood of a particular email message being intercepted by a truly interested party is relatively low. That being said you, as either a lawyer, or as a representative of an interested party in this particular communication, have an obligation to take reasonable steps to protect the confidentiality of theoretical client information.

So, in summation, Email disclaimers are unnecessary.

###### The following parody email disclaimer has been left as an exercise for the reader.

Disclaimer: This email is intended for the use of the individual addressee(s) named above and may contain information that is confidential, privileged or unsuitable for overly sensitive persons with low self-esteem, no sense of humour or irrational religious beliefs. If you are not the intended recipient, any dissemination, distribution or copying of this email is not authorised (either explicitly or implicitly) and constitutes an irritating social faux pas. Unless the word absquatulation has been used in its correct context somewhere other than in this warning, it does not have any legal or grammatical use and may be ignored. No animals were harmed in the transmission of this email, although the yorkshire terrier next door is living on borrowed time, let me tell you. Those of you with an overwhelming fear of the unknown will be gratified to learn that there is no hidden message revealed by reading this warning backwards, so just ignore that Alert Notice from Microsoft: However, by pouring a complete circle of salt around yourself and your computer you can ensure that no harm befalls you and your pets. If you have received this email in error, please add some nutmeg and egg whites and place it in a warm oven for 40 minutes. Whisk briefly and let it stand for 2 hours before icing.

# How to play Monopoly Like a Programmer

### An in depth tour of the game using simple stats, an intro to MongoDB atlas, and 100,000 trips to old Park Place.

Most of my friends know I’m a big fan of monopoly. I had been saying for a while that there must be an optimal way to play this game that can be modeled by simulating multiple monopoly games.

One question that’s worth answering is what spaces are landed on the most?

So we’re going to play monopoly like a programmer would. We’ll run a simulation of 100,000 games to model what spaces a single player is most likely to land on. Based on that we’ll know which spaces are the most valuable to purchase.

For the record this is a hideous brute force approach to the problem and there are much more interesting monopoly simulations you can do using markov chains; unfortunately I am not Hannah Fry and cannot simply do these things in a blog post.

Since it’s a good set of sample data, I’ll show you how to store this data in MongoDB Atlas to make it easy for you when you need real database storage in the future. If you’ve never used MongoDB before, all you need to know is that it’s an Open Source Database that doesn’t use a formal mechanism in order to store data, you simply give mongo the objects and data you want to store and it handles the rest for you.

MongoDB Atlas is a database as a service created by the experts who design and engineer MongoDB. It provides all of the features of MongoDB, while removing most of the operational overhead. With MongoDB Atlas you can deliver your applications quickly, and focus on what matters most to you and your customers. ~ They’ll host a database for you, and do it really well.

Without further ado; Let’s get to work!

## Running our Simulation

Here is my code for running our bare-bones monopoly simulation. (you can find the source here)

# models a single monopoly player's Tour around the board multiple Times
from random import shuffle, randint
# simulate 10^5 games
games  = 10**5
# average number of turns per game
finish = 35
# create array of all squares on the board
squares = [0]*40
# track the number of games so far
games_finished = 0

while games_finished < games:
# set of community chest cards
master_chest = [0,40,40,40,40,10,40,40,40,40,40,40,40,40,40,40]
chest = [i for i in master_chest]
shuffle(chest)
# set of chance cards
master_chance = [0,24,11,'U','R',40,40,'B',10,40,40,5,39,40,40,40]
chance = [i for i in master_chance]
shuffle(chance)
doubles  = 0
position = 0
turns = 0
while turns < finish:
d1, d2   = randint(1, 6), randint(1, 6)
diceroll = d1 + d2
# increment number of doubles
if d1 == d2: doubles += 1
else: doubles = 0
# go to jail
if doubles >= 3: position = 10
else:
position = (position + diceroll) % 40
# Chance Card
if position in [7,22,33]:
chance_card = chance.pop(0)
if len(chance) == 0: # chance deck is spent
chance = [i for i in master_chance]
shuffle(chance)
if chance_card != 40:
if isinstance(chance_card, int):
position = chance_card
elif chance_card == 'U': # utilities
while position not in [12,28]:
position = (position + 1)%40
elif chance_card == 'R': # railroad
while position not in [5,15,25,35]:
position = (position + 1)%40
elif chance_card == 'B': # back 3 spaces
position = position - 3
# Community Chest
elif position in [2,17]:
chest_card = chest.pop(0)
if len(chest) == 0:
chest = [i for i in master_chest]
shuffle(chest)
if chest_card != 40: position = chest_card
# Go to jail
if position == 30: position = 10
squares.insert(position, (squares.pop(position)+1))
turns += 1
games_finished += 1
print(squares)
# a player lands on a space (finish_order * games) times



• It doesn’t track money which can affect the number of turns, but is independent of the dice rolls themselves.

• It assumes that the average monopoly game takes about 35 turns before a game ends.

• It assumes that the “Go To Jail” space is not one that can be landed on, but results in landing on the “Jail” space.

• This code makes no distinction between “just visiting” jail and “being in” jail. For our purposes the two are functionally the same, as we don’t get anything out of someone being in jail.

total number of turns = (turns per game \times number of games played)

So after running our simulator for 100,000 games what are our stats?

Take a look at this spreadsheet; we’ve listed the name of each numbered space on the board along with our calculated information. The frequency percentage has been calculated as the number of times landed on a space divided by the total number of turns in the simulation.

First Half of the Monopoly Statistics

Second Half of the Monopoly Statistics

## Storing our data in MongoDB

Now for showing off your fancy new data to your friends just in case they don’t believe your conclusions, we’ll store the data in MongoDB Atlas. (Arguably they should learn your conclusions the hard way, but let’s use MongoDB anyway; it’s a great tool for serious data storage and replication and the knowledge will come in handy in the future!)

The process of connecting to the Atlas hosted database is fortunately really simple.

There’s two components to this, we create our database in Atlas, and then simply connect to it from another computer or application to store our information.

#### Making our database in Atlas

Start by making an account on http://mongodb.com/atlas.

Once you’ve done that, you should get a screen that looks like this with no clusters.

screenshot taken from the actual mongodb blog :)

Go ahead and make your cluster with whatever number instances you want, you can set this up with the lowest tier settings with additional options for more complex setups, but for now we’ll stick with the small stuff.

Note: make a note of the admin username and password as you’ll need them to connect in the future.

Setting up the mongo cluster

Once you have your cluster, click the connect button on the top right, and configure your whitelist entry to allow connections from anywhere. Hit confirm and we should be all set!

Note: Even though your database is hosted in the cloud, allowing access from anywhere is incredibly dangerous and you should use more strict rules in production.

Our VERY DANGEROUS security whitelist

#### Connecting for that sweet, sweet data transfer

Note: If you don’t have mongo installed already, you should definitely do a quick brew install mongo to get it. If you don’t have OSX or brew just check out this page on how to install mongo.

So you’ve hopefully just installed the Mongo Client. You should be able to run the mongo application from the command line. mongo is the client program that’s going to do the talking to our actual database, which is hosted for us on the Atlas platform.

Hit the connect button again and take a look through the page; you should see a segment titled; “Connect with the Mongo Shell.”

Copy the sample connection command that is templated out for you.

copy that command; it’s gold!

mongo “mongodb://cluster01-shard-00–00-vvmfr.mongodb.net:27017,cluster01-shard-00–01-vvmfr.mongodb.net:27017,cluster01-shard-00–02-vvmfr.mongodb.net:27017/admin?replicaSet=Cluster01-shard-0” — ssl — username admin — password <YOUR_PASSWORD_HERE>

MongoDB shell version v3.4.1

2017-01-23T16:16:31.737-0500 I NETWORK  [main] Starting new replica set monitor for Cluster01-shard-0/cluster01-shard-00-00-vvmfr.mongodb.net:27017,cluster01-shard-00-01-vvmfr.mongodb.net:27017,cluster01-shard-00-02-vvmfr.mongodb.net:27017

MongoDB server version: 3.4.1

Cluster01-shard-0:PRIMARY>


#### Using the database

If you can see something like the screen above, you now have access to your database cluster!

So let’s do some of the basics! (you can read about more of the mongo shell and what it can do here)

We’ll go on with the basics, at the first mongoDB prompt, you can create a database right from the start, we’ll call ours monopoly.

Cluster01-shard-0:PRIMARY> use monopoly

switched to db monopoly

Cluster01-shard-0:PRIMARY>

Now we can create a table of properties and start doing operations!

We’ll insert a few objects into our hosted collection in Atlas and then list them back out to make sure things went smoothly.

Cluster01-shard-0:PRIMARY> db.spaces.insert({'GO':95251})

WriteResult({ "nInserted" : 1 })
Cluster01-shard-0:PRIMARY> db.spaces.insert({'Mediterranean Avenue':68130})

WriteResult({ "nInserted" : 1 })

Cluster01-shard-0:PRIMARY> db.spaces.find()

{ "_id" : ObjectId("5886d25f482270f08c4e44a1"), "GO" : 95251 }

{ "_id" : ObjectId("5886d2d8482270f08c4e44a2"), "Mediterranean Avenue" : 68130 }

Cluster01-shard-0:PRIMARY>


You’ll find that this paradigm of choosing a db, selecting a collection and inserting documents into that collection, remains consistent throughout all of the mongo drivers for all of the different programming languages.

And now you’re all set to do anything with your Mongo powered Monopoly Database. Now please enjoy this completely unaltered photo of a walrus wearing a party hat.

“The Walrus in Question”

#### So what did we learn here?

• Interestingly, the space that ends up being landed on the most is Jail. What that means for monopoly or capitalism is beyond the scope of this blog, but it is an interesting fact nonetheless.

• The space that collects rent that is landed on the most is New York Avenue! The other orange properties seem to be solid investments probabilistically as well.

• The dark blue properties like Park Place, (or Park Lane in the UK!) are never worth it.

Lastly, the MongoDB Atlas platform has some fantastic features and is incredibly flexible; definitely take a look at mongodb.com if you’re interested in open source database software.

This post was originally inspired by Hannah Fry. Her latest book, The Indisputable Existence of Santa Claus uses mathematics in a lot of unique and interesting ways. If you found this post interesting; she takes an entirely different approach to the monopoly problem and many others!