Simulation: An Overnight Closure at MTA 42nd Street Station

Haoran Zhang
Data Mining the City
2 min readNov 13, 2019
Figure 1: A collection of animated gifs from TED-Ed Original Lessons.

Argument (Poem):

It is party time on Friday night!

WOOHOO!

But what will happen if the MTA 42nd Street Station close this night?

Figure 2: Digrams Drawn by the Author

After working hard the whole week, people would like to get a drink and party with friends. Bars around time square might be ideal choices.

However, …

What if the subway station is closed for a night?

How can people meet their friends at parties at 11 pm?

What are the changes in people’s travel patterns?

Let’s simulate them in Unity!!!

WOOHOO!

Figure 3: Diagrams Drawn by the Author
Figure 4: Diagrams Drawn by the Author
With MTA
Without MTA 11 pm
without MTA 2:30 am, after party

Pseudo-code and Unity Code:

# Cube
# Cube Spawn
# Object Pooling
# build an object pool
# recycle when no more object
------------------------------------------# cubeusing System.Collections;using System.Collections.Generic;using UnityEngine;public class cube : MonoBehaviour{public float upForce = 1f;public float sideForce = .1f;// Start is called before the first frame updatevoid Start(){float xForce = Random.Range(-sideForce, sideForce);float yForce = Random.Range(upForce / 2f, upForce);float zForce = Random.Range(-sideForce, sideForce);Vector3 force = new Vector3(xForce, yForce, zForce);GetComponent<Rigidbody>().velocity = force;}// Update is called once per framevoid Update(){}}
---------------------------------------------------------------
#Cube Spawnusing System.Collections;using System.Collections.Generic;using UnityEngine;public class CubeSpawner : MonoBehaviour{public GameObject cubePrefab;// Start is called before the first frame updatevoid FixedUpdate(){Instantiate(cubePrefab, transform.position, Quaternion.identity);}// Update is called once per framevoid Update(){}}------------------------------------------------------------------

--

--