• Published 4th Aug 2021
  • 435 Views, 14 Comments

Starlight and Sunburst's Misadventures in Creating Artificial Intelligence - Golden Tassel



Two nerds experiment with AI, but as it advances they find it increasingly difficult to control.

  • ...
1
 14
 435

Naughts and Crosses

This was a disaster.

Sunburst made a note in the margin of the page he had already covered in a mix of equations and arcane glyphs: HUGE FAILURE.

He leaned back in his seat with a heavy sigh while he levitated his glasses off his muzzle and rubbed his face. The three-by-three grid he'd been staring at since last evening was burned into his retinas, continuing to taunt him from behind his eyelids. At least that banging sound had stopped...

"There you are!"

Sunburst fell out of his chair with a shriek and quickly scrambled to get back up, squinting at the blurry pony who'd snuck up on him. His glasses, wreathed in turquoise magic, found their way back onto his face and she came into focus. "Oh, Starlight. You surprised me."

"Sorry about that," she said, adding, "Are you okay?" The strained tone of concern in her voice and the way she hid her mouth behind her hoof belied the effort required of her to keep from laughing. "You didn't hear me knocking?"

It dawned on Sunburst at that moment just how long he had been working. "We were supposed to meet for lunch today. And I completely forgot. Sorry. Sorry. I'm so sorry."

"Mhm. Well, I know how you can get caught up in your research." Starlight walked over to the table, her eyes curiously wandering across the spellbooks and scattered pages that covered its surface. Most of the books were open to simple spells that most foals learn to cast with little more than a bit of verbal coaching, though there were a few others that looked unfamiliar to Starlight—since when did spells do arithmetic? What drew her attention, however, was the artifact around which everything else had piled up. It was a small black cube about the size of her hoof with smooth, glassy faces. "Maybe you can explain what was so fascinating this time?" She asked as she sat down in Sunburst's chair.

Sunburst pulled a spare chair over and sat next to her. "It's an AC—Arcane Computer—or at least it's supposed to be, but I'm having trouble getting it to work right. I was reading through the latest publications from Canterlot Academy, and I saw one paper by Lovely Lace where she described a way of combining several spells together that would allow an enchanted object to cast them on its own according to a program structured into the enchantment framework."

Most of that flew past Starlight, but the mention of an enchanted object casting a spell on its own made her sit up straight. "It's not going to cast anything right now, is it?" Starlight eyed the cube suspiciously.

"Oh no. It just finished running before you came in, so it won't do anything until I cast the activation spell on it again. Watch." There was a brief spark of golden light around his horn, mirrored by the cube with its own crimson hue, followed by a shimmering green projection of a three-by-three grid that floated in the air above it.

Starlight craned her head from side to side, unsure what to make of it. "What's it doing?"

"Right now it's just maintaining an illusion spell while it waits for input. There's a telesthesia spell in there to detect interaction. Try it: touch one of the cells."

Starlight reached out her hoof and waved it through the middle-right cell of the grid. An "O" filled in the cell, and a moment later an "X" appeared in the center square. At Sunburst's encouragement to keep going, she waved her hoof through the middle-top square, placing another "O" there followed by an "X" in the top-left. Finally recognizing the game, Starlight put an "O" in the bottom-right. The AC responded with an "X" to block in the top-right, and the grid filled up quickly from there, finally displaying "Winner: None" in hazy green letters before the spell ended.

"It plays tic-tac-toe," Starlight deadpanned.

"Theoretically, it can play any game. But tic-tac-toe is a good game to start with because it's a solved game; either player can force a draw, and it's trivially easy for me to work out the best move in any given position, so I can know if it's playing correctly, as opposed to something more complicated like chess where I'd never be able to tell if any move is actually good even if it consistently beats me." Sunburst adjusted his glasses then added, "Which wouldn't be difficult because I'm not actually any good at chess."

Starlight gave her friend a sidelong glance. "I'll rephrase: You stood me up to play tic-tac-toe by yourself."

Sunburst grimaced. "When you say it like that, it sounds pretty bad. I'm sorry. B-but let me show you something." He cast the activation spell again, and the tic-tac-toe board hovered in front of them once more. This time he played the center square, and the cube played the top-left corner. Sunburst played middle-top, and the cube played bottom-left. Middle-bottom, and a line crossed through the column of O's in the center before displaying "Winner: O" and fading out.

Starlight was not impressed.

"It's not supposed to lose," Sunburst explained with a sheepish grin. "I was trying to figure out how to fix it."

Starlight scanned across the loose sheets of paper that littered the table. Her patience was wearing thin, and although she usually took care to be sensitive about her foalhood friend's limits when it came to correctly casting spells, the thought did occur to her to cast the spell herself to correct whatever mistake Sunburst had made when enchanting the cube and then leave just to spite him. Unfortunately, none of the spells she could see made any sense to her. In fact, most of them didn't even look like complete spells. The closest she could find was a tangled mess of glyphs and arcing lines that looked like several completely different spells had been stitched together. It certainly looked castable, but she had no idea how to predict its behavior. She sighed. If stacking this many spells on top of each other was what it took to make a brick play tic-tac-toe badly, then she had to admire the complexity of what Sunburst had accomplished. She might have to forgive him for losing track of time.

"Okay, so where's the problem?" she asked.

Sunburst rearranged the pages across the table, lining up a dozen of them to reveal that what Starlight had assumed was the entire spell was only one part of it, and the complete spell now made her head spin just trying to read it.

"This part here"—Sunburst tapped his hoof on one of the pages near the edge closest to them—"is supposed to play out the entire game in its memory so it can decide which moves are good and which are bad." He cleared his throat. "But when I cast it like that, the AC didn't make any moves. After a while I realized the cube was getting hot and I had to dispel it before it set the table on fire."

"So how did you get it play at all?" Starlight asked while she stared at that part of the spell, trying to make sense of why it was wound into some kind of fractal pattern. She felt like she was almost onto something when she realized it was a spell designed to cast itself, but before she could discern why, Sunburst covered it with a different page that looked more like it belonged in an algebra textbook instead of a spell.

"I think I got something wrong when I was casting the part that contains the recursive spell, and it got stuck in an infinite loop, so I thought that instead of having it play out every possible game to select its next move, I could come up with a way to score the board for any given position and then it would just select the move that resulted in the best score." Sunburst rubbed the back of his neck. "But the scoring methods I came up with are bad so the best score isn't always the best move, and that's why I can beat it."

Starlight moved that page off the table and went back to studying the recursive spell underneath. As her eyes traced along the lines leading off to other sub-spells, the whole thing stopped looking like a mess of spaghetti and she could actually recognize what some parts of it were doing: keeping track of the state, determining if the game was over, displaying the board, recognizing input, and—"Why is there a telekinesis spell in here?"

"What? Oh. When I was first trying it out, I thought it would be easier if it just drew on paper. That, um, turned out to cause problems..." Sunburst pointed toward the ceiling where a quill had been embedded almost completely into the wooden rafter.

Starlight's eyes widened. She wasn't sure she could do that herself with only a telekinesis spell even if she wanted to. "Maybe we should take that part out if we're not using it."

Her use of the word "we" made Sunburst's ears perk up. "That's probably a good idea," he said as he brought out a fresh sheet of paper and set to work rewriting that section of the spell.

Starlight returned her focus to the recursive spell. Something about it didn't seem right, and she started stepping through it in her head. So first it reads in the board, determines if the game is over, checks which player's turn it is, counts up all the open squares, then picks one to play and casts itself again, where it reads in—Ah-hah! "I think I know why it got stuck. Look here: when it casts itself, it's still looking at the same board, not the one with the new move in it."

Sunburst had just finished replacing the page that previously held the telekinesis spell and he leaned over to look at the part Starlight was pointing to. His eyes wandered back and forth across the spell, following its branching curves until he came right back to the start. "I can't believe I missed that!" He groaned and facehoofed.

"Shouldn't be too hard to fix," Starlight said as she took the quill in her magic and wrote in a simple glyph and a curve leading back to the move being considered. She sat back and ran through it again aloud. "Now after it picks a move to try, it casts itself again with the new board, picks a new move for the other player and so on until either there's a winner or no more moves. Then it starts working its way back up the chain, assigning each move a score based on if it terminates in a win, loss, or draw, and decides which move to play based on that."

"Exactly! At least that's how it should work..." Sunburst nervously tapped his hooves on the table. "Do—um—would you like to try casting it?"

"I can give it a try, but I've never cast anything like this before. Even time travel only needed a single page, but this is like casting twenty spells at once. I'm not even sure where to start." Starlight glanced over at her friend and saw him chewing his lip while staring at the cube in the center of the table. "You've been re-casting this thing all day. You go ahead. After you have it working, you can show me how."

Sunburst took a deep breath and turned his gaze back to the spell, reading through it one last time before his horn lit up with the yellow glow of his magic. The spell was complicated, certainly, but in a way that seemed to make it easier for him to cast. Spells which had given him trouble in school had seemed to be doing something that left him feeling as if he were always out of step in a dance that he couldn't hear the rhythm to. But the AC framework didn't have that. There was a structure to it that let him take his time to get it right without fizzling out halfway through, as if he were describing the spell instead of casting it.

The cube shimmered with crimson light briefly as Sunburst completed the enchantment and a moment later it projected the board into the air above it. This was the moment of truth: Sunburst waved his hoof through the center square and it filled in with an "O". The AC played a move—already better than his first attempt with the recursive sub-spell—in the top-left corner. Sunburst continued with the middle-top, as his scoring hack had given the AC a habit of preferring corners even it meant losing, but this time it correctly blocked his column with an "X" in the middle-bottom. He quickly played out the rest of the game, barely containing his giddy excitement as the game ended with "Winner: None."

Just to make sure it wasn't a fluke, he and Starlight took turns playing against the AC several more times. Each game ended in a draw; it was impossible to win against it.

This was a triumph!

Author's Note:

Ada Lovelace is considered to have been the first computer programmer for her work with Charles Babbage on his "analytical engine" (a mechanical computer) in the 19th century.

Tic-Tac-Toe (or Naughts and Crosses to you brits), was one of the first computer games to be programmed and was publicly demonstrated in 1950.