Is that cheating?

Elijah Silverman
3 min readDec 9, 2021

Over the past two months I’ve had a number of situations where I asked myself “is this cheating”. I’m not talking about asking a dev friend what the answer is during a code challenge. Im talking about working on a lab, getting stuck, and then heading over to google to look for the answer, and just taking that answer and using it. At first, when my classmate Yuyi told me that the labs had solutions I told myself that I would never look at them, but of course that didn’t last long. This feeling of cheating has persisted and I want to get to the root of it.

To summarize, my burning question is — how can I call myself a coder, if I don’t understand what’s going on under the hood.

How does this very snippet of code work for example:

// [3,2,8,8,3,5].sort()

How does it go from being typed on my screen (how does that even work?!) to being interpreted by language I’ve written it in to changing 0s and 1s which then change little transistors on my computer….and on and on.

Unfortunately, I can’t answer answer this question. So I will briefly discuss a project I’ve been working on with Wes. Wes also has a great blog over at Substack — go check it out.

When learning ruby we were discussing how easy it would be to create a Zork style game. It seemed rather simple, but it quickly became apparent that in order for our game to sit on the web it would be a little more difficult than just a CLI game.

The first thing we did was determine the tables and relationships we would need and we came up with: “users”, “items”, “rooms”, and a join-table joining items to rooms.

The next step was determining what type of logic would happen on the front and what on the back. Initially it seemed ruby would be a good candidate to take on the heavy lifting of the logic, but we realized it would be much easier to simply have fetches that called in the items and rooms based on where the user was as determined by the front-end.

On the front we made a simple UI that shows the amount of time the user has been playing the game, the moves they’ve taken and their score. Another component displays the text as they move through the game, and a submit box component handles the logic.

The main part of the game is all handled in the ‘handlesubmit’ function which parses the user input into objects and verbs. We have 5 possible verbs (attack, talk, inspect, use, and take?) and the objects are all the items in the room.

Once determined which verb is being used on which item some very long and convoluted the handlesubmit goes to functions which handle that verb handleattack, handletalk, etc.

This game is a work in progress, but I think, what I described above examines the essence of the logic behind the game.

Take input → parse input into 5 main actions → run action-specific functions on ‘items’.

jhdsasdfgvb m,vxzZxdStuck in Space drops tomorrow! December 10th 2021 @ 11:00 AM

--

--

Elijah Silverman

Pursuing a Masters Degree in Always Learning. Also a SE student @ Flatiron