Shawn Driscoll's Tech Blog

Stuff That Happened in the Past

Friday, January 10, 2014

Lessons From '70s Star Trek Arrays

Star Trek: The Mainframe Game was based on two-dimensional arrays. One for mapping sectors. And one for mapping quadrants. These were the short and long-range sensor scans that were routinely performed. These 2D arrays were stored as DIM S(8,8) and DIM Q(8,8) in the HP-2000F computer which ran its own version of BASIC.

Now fast-forward 40 years.

Star Trek: The Python Game is now in the works. And arrays have been poo-poo'd on over the years, but that doesn't matter. Arrays are a non-issue for Python. Its format may look different is all, as it uses [ ][ ] for its indexing.

Here is some Python code to get started with:

It seems pretty straight forward, as it initializes a ten by ten array with zeros. Then assigns an integer value of 807 to a location in the array. The program refers to the array as "grid". This is the output from the Python code:

And there you have it. The makings of an old-school 2D array using Python.


  1. Since I'm new to python, this postwas very handy for me. It looks very much like Turbo Pascal to me which i did over 15 years ago in high school. I wonder how do we do arrays with numpy and how can we increase the speed of execution with other packages.

    1. I have forgotten Turbo Pascal. I don't remember what version of Pascal I used in 1984 actually. It was a UNIX form or another I believe? I haven't played with NumPy much yet. I don't know enough about vectors. I haven't noticed much slowness in Python. It's really fast for what I use it for. And I can program a lot quicker in Python than in C or any other compiled language. So I get results quicker.