• Basic Writing questions is not a crit forum. All crits belong in Share Your Work

Writing in computer code?

Status
Not open for further replies.

phantom000

Super Member
Registered
Joined
Aug 9, 2011
Messages
185
Reaction score
85
Location
Arkansas
This is just a random thought, but has anyone ever thought about writing a story in a way that is more like source code then conventional prose?

I had an idea about a super computer becoming self-aware and reacting to humanity trying to destroy it. As the war drags on it begins to study humanity to use our traits,such as strategy, deception, imagination etc. against us. However it is slowly becoming more like us to the point it becomes disillusioned with the war and ultimately bored with it.

So I thought about in the beginning the story is written like source code in a computer and as it goes on becomes more and more like prose, to reflect the computer changing, and finally at the end it reads just like a normal story.
 

heza

Super Member
Registered
Joined
Sep 13, 2010
Messages
4,328
Reaction score
829
Location
Oklahoma
I'm having trouble visualizing what writing in computer code would look like... like a narrative in computer-y voice? An actual program that would perform the computer's anti-human actions if run? A bunch of if, then statements? Something else?

Any of those, though, would bore me, probably. The transition to typical narrative structure would have to happen very quickly for me. Perhaps someone more code-minded would stay with it longer, but I'm not a coder and I hate editing code.
 

kuwisdelu

Revolutionize the World
Super Member
Registered
Joined
Sep 18, 2007
Messages
38,197
Reaction score
4,544
Location
The End of the World
kuwi = self.init()
content = getOriginalPost().getContent()
response = System.respond(kuwi.imagine())
System.print(response.getContent().toText())
>> Error: Eminently unreadable
>> Warning: One or more replies had non-zero exit status
 

Jamesaritchie

Super Member
Registered
Joined
Feb 13, 2005
Messages
27,863
Reaction score
2,311
How many could read it? It might make very good sense, if you sell the story to a magazine that specializes in programming, but if it's actual; code, I wouldn't have a clue what it said. I also don't see why a computer would speak in code, unless it was talking to another computer?
 

MythMonger

Willing to Learn
Super Member
Registered
Joined
Sep 11, 2012
Messages
1,486
Reaction score
507
Location
Raleigh NC
Source code is how humans talk to computers, not the other way around.

I believe a computer would "think" in binary, just a bunch of ones and zeros.

Eventually, a self-aware computer trying to communicate with humans might write a program that allows it translate from binary to, say, English. But it wouldn't look like any human programming, because it would be a program that the computer created.

Now, if someone had programmed the computer for some kind of communication with humans, that might work.

But, like the others above said, first and foremost it has to be readable by a human audience.
 

morngnstar

Super Member
Registered
Joined
Nov 9, 2014
Messages
2,271
Reaction score
297
If you can figure out what sense it would make to have a loop in your story, then maybe you have a start. Computer programs are plans, not records of events.

A better analogy for a computer would be a lot file. A log of protocol messages could tell a story.
 

BenPanced

THE BLUEBERRY QUEEN OF HADES (he/him)
Kind Benefactor
Super Member
Registered
Joined
Nov 5, 2006
Messages
17,874
Reaction score
4,667
Location
dunking doughnuts at Dunkin' Donuts
If I saw source code in a book that wasn't a guide to programming, I'd take a pass. It would be completely unreadable to me and I'd think the author was trying to impress me with their knowledge of coding instead of trying to tell a story.
 

dpaterso

Also in our Discord and IRC chat channels
Staff member
Super Moderator
Moderator
Super Member
Registered
Joined
Feb 12, 2005
Messages
18,806
Reaction score
4,598
Location
Caledonia
Website
derekpaterson.net
Yeah I might have tried something like this before, we all experiment, but I kept the language accessible to readers, not as cryptic as kuwisdelu's example. It was more a formatting/layout trick to give the impression of machine thought, rather than actual code.

Random sample plucked from the internet:

| Forms FORM-29827281-12
| Test Assessment Report
|
| This was a triumph
| I'm making a note here:
| HUGE SUCCESS

etc. :)

-Derek
 

fergrex

Super Member
Registered
Joined
Jul 24, 2012
Messages
88
Reaction score
9
Location
SF
I'm having trouble visualizing what writing in computer code would look like... like a narrative in computer-y voice? An actual program that would perform the computer's anti-human actions if run? A bunch of if, then statements? Something else?

It would be a communication language/protocol, like English is.

Humans don't communicate with each other with neural transmitters. Your internal narrative voice is mostly in English fragments and images. You don't see rod and cone firing.

Even computer programs don't "think" in the lowest level of abstraction. Source code is the wrong metaphor for computer communication.

(Plus, it would be boring.)
 

Ken

Banned
Kind Benefactor
Joined
Dec 28, 2007
Messages
11,478
Reaction score
6,198
Location
AW. A very nice place!
... did this to a limited extent in a story. A computer was one of the background characters. Story needs editing, so not sure if it counts yet?
 

phantom000

Super Member
Registered
Joined
Aug 9, 2011
Messages
185
Reaction score
85
Location
Arkansas
Well i was just trying to imagine what it would be like listening to a computer's inner voice, assuming of course it had one. So many man vs. machine stories are from humanity's point of view, why not do one from the computer's perspective?

---------
data/input* airprobe 6789024\\: <packet>: 7283145761...
data/analysis: Human survivor's detected. Estimation 50-150.
data/video examination
.
.
.
.
.
data/examination: uniforms and markings match to data files 134197-ADFORS> Humans=members of USMC.
data/navigation* 34W-18S, bearing 16.73
situation/analysis* Humans moving towards external solar array AlphaGreen.
Activate-security group 13, security group 23, security group 04.
Security group 13 online
Security group 23 online
Security group 04...non-responsive.
Data/input* group 4 non-responding
data/analysis-possible human interference with security groups.
data/execute* full systems check of all facilities> activate all security groups.
 

T Robinson

Born long ago, in a different era
Super Member
Registered
Joined
Sep 22, 2013
Messages
1,282
Reaction score
212
Location
Southern USA
0001110100010010101000110111011

Read Alfred Bester, The Stars My Destination. I seem to remember parts of it had elements of that. Been a long time, might be wrong.
 

jjdebenedictis

is watching you via her avatar
Super Member
Registered
Joined
Jun 25, 2010
Messages
7,063
Reaction score
1,643
Here's one good reason not to do it. When an author tries to capture a character's dialect, unless they're veeeeerrry light-handed with it, I tend to put the book down or skim ahead to a place where that character isn't speaking anymore.

I read novels because I want to get so immersed in the story I forget I'm looking at words on a page. If you make me work too hard to understand, then I can't get immersed, and the book has no worth to me.

I even found Cormac McCarthy's lack of commas and quotation marks in The Road difficult to parse, although my brain retrained itself after about fifteen pages and I was fine after that. The harder you make me work to get into a story, the more compelling the narrative had better be.
 

morngnstar

Super Member
Registered
Joined
Nov 9, 2014
Messages
2,271
Reaction score
297
That isn't a computer program. It is a lot like a computer log. Of course you see plenty of this kind of thing on heads-up displays in sci-fi movies. Probably it's a bit much for text where it isn't just an ignorable part of the background. But if you want to do it, here are some tips.

data/input* airprobe 6789024\\: <packet>: 7283145761...

This is kind of good. One of the things about computer logs is that mixed in with the relevant information is a lot of routine status. You might also see things like

CPU utilization: 23%

data/analysis: Human survivor's detected. Estimation 50-150.
data/video examination

data/examination: uniforms and markings match to data files 134197-ADFORS> Humans=members of USMC.

Computer logs don't create original utterances. They are all pre-defined messages that can have some key words inserted. So I think that scene would go more like this:

Life form detected
Life form detected
Life form detected
+132 repeat messages truncated
Classifying ... human
Uniform database search ...
> FFL 37% match
> ISIS 11% match
> USAF 66% match
> USMC 83% match
> USN 55% match
Identify: USMC (confidence 77%) friendly (confidence 94%)
 

Becky Black

Writing my way off the B Ark
Super Member
Registered
Joined
Mar 15, 2010
Messages
2,163
Reaction score
176
Location
UK
Website
beckyblack.wordpress.com
I'd think you'd have to do it with some kind of made up coding language, not any of the existing ones, but that still made a sort of logical sense as a computer language, but that you were also able to make work as prose, so people could follow what was going on. So you'd probably need to have good knowledge of both computer code and linguistics or be ready to do lots of research into both! It will be a challenge, but the worst that can happen is it doesn't work, so you might as well take a crack at it.
 

stephenf

Super Member
Registered
Joined
Jul 29, 2008
Messages
1,199
Reaction score
335
It has already pointed out, computer coding is has been designed so we can understand it , is for our benefit and is used to write a list of instructions . This is then converted to machine code, for the computer to function . If you could somehow see into the workings of a computers mind , you would see machine code , a series of electrical pulses and we write that down like this 0000111100101001001100. All computers are much the same , regardless of the size .So a computer that can handle large amounts of dater is no more intelligent than the chip in you washing machine . I suggest you invent a new computer , organic or a quantum computer that operates in way that is closer to the human brain.
 
Last edited:

Jamesaritchie

Super Member
Registered
Joined
Feb 13, 2005
Messages
27,863
Reaction score
2,311
I have no doubt that artificial intelligence is real, and will someday produce a self-aware computer. I also have no doubt that the computer will speak in code. There is no reason to do so.

And I know I ain't reading it, either.
 

Dennis E. Taylor

Get it off! It burns!
Kind Benefactor
Super Member
Registered
Joined
Jul 1, 2014
Messages
2,602
Reaction score
365
Location
Beautiful downtown Mordor
better !pout !cry
better watchout
lpr why
santa claus <north pole >town
cat /etc/passwd >list
ncheck list
ncheck list
cat list | grep naughty >nogiftlist
cat list | grep nice >giftlist
santa claus <north pole > town
who | grep sleeping
who | grep awake
who | egrep 'bad|good'
for (goodness sake) {
be good
}
 

PandaMan

Panda girls are the best!
Super Member
Registered
Joined
Jul 17, 2013
Messages
1,570
Reaction score
237
Location
Florida
As someone who spends a lot of time programming, I ain't reading it either.

Code is soulless, lifeless instructions to a hunk of metal and circuits.

I guess I could see it working in a short scene to show the process of how a computer works, somewhere in the guts of the story, perhaps, but as an opening scene, I think it would be ultra boring and dead on arrival in terms of sales.
 

MythMonger

Willing to Learn
Super Member
Registered
Joined
Sep 11, 2012
Messages
1,486
Reaction score
507
Location
Raleigh NC
Maybe another way to look at is the way writers handle stories where the entire book couldn't possibly be in English, like in a fantasy setting. They translate into English as they go.

So maybe the computer's thoughts are written in translated English the entire time, but the writing evolves from being more logical to something more emotional or "human" as the story progresses.
 

Locke

Lost the instruction manual
Super Member
Registered
Joined
Jul 23, 2012
Messages
555
Reaction score
47
Location
Spartanburg, SC
better !pout !cry
better watchout
lpr why
santa claus <north pole >town
cat /etc/passwd >list
ncheck list
ncheck list
cat list | grep naughty >nogiftlist
cat list | grep nice >giftlist
santa claus <north pole > town
who | grep sleeping
who | grep awake
who | egrep 'bad|good'
for (goodness sake) {
be good
}

Nah, that story would get bashed by the critics.

(That was brilliant)
 

guttersquid

I agree with Roxxsmom.
Super Member
Registered
Joined
Aug 9, 2011
Messages
1,324
Reaction score
229
Location
California, U.S.A.
I think the best approach would be to start by telling us, in simple prose, what the computer does. For this example, I'll call the computer DomComp.

----

The camera mounted on the lamppost focused on the Dodge Dart as the car pulled into the driveway. When the driver got out, the camera zoomed in, and DomComp activated its facial recognition program. After a few nanoseconds spent culling the state's DMV records and comparing the driver's image to photos in the DMV's database, DomComp identified the driver as John Winston Burke.

----

Later in the story, you can “show” us DomComp evolving.

----

On Monday, June 7, at 7:14.23 in the morning, through the eye of a traffic camera, DomComp saw a little girl walk off the sidewalk and into oncoming traffic. A few seconds later, the girl was struck and killed by a black sedan, which tried but failed to stop in time. A nanosecond after that, something happened inside ComComp’s inner workings, something DomComp could not identify.
Every dictionary ever published was stored in DomComp’s database, and the computer perused them all in search of defining this unfamiliar . . . what? Sensation? Yes, according to the dictionaries, it was a sensation. But which sensation? DomComp searched and searched, disregarding one definition after another, until it found a word that fit.
The word was sorrow.
 
Status
Not open for further replies.