Categorygithub.com/pladdy/synacor
repositorypackage
0.4.0
Repository: https://github.com/pladdy/synacor.git
Documentation: pkg.go.dev

# Packages

No description provided by the author

# README

synacor-challenge

The challenge

Details that would be spoilers are intentionally left out.

Getting Started

Start the Synacor challenge!

The Journey

Spoilers below. Codes have been omitted from the repo.

Signing up

Code 1 is gained by simply signing up at the site. Easy enough!

Download the project and read the arch-spec

Code 2! Read the arch-spec, you get a code, and a new task: implement a virtual machine to this specification.

VM Implemented

When the implemented VM runs the program downloaded with the project, a suite of tests are run first. If the VM functions correctly the tests will pass and yield code 3.

OMG ZORG!

No not really, but the program, after the tests, turns out to be an RPG style text game. If you 'take tablet' when the program starts the game, you'll find code 4 after you 'use tablet'.

Exploring

While exploring and playing the game, you'll find code 5 on the wall of a cave.

Teleporter, part 1

You will find a teleporter, and when you use it, you'll get code 6. However, you arrive at a dead end. You have to explore and read a book to learn that the teleporter needs to be hacked...

Teleporter, part 2

At this point in my endeavors, I got by with little debugging and introspection into the VM. Once I ran into the teleporter though, I needed to figure out how to debug, and ultimately change the program so it would get me to code 7.

At this point...I became blocked. I just hadn't this before. So I did some googling (the challenge is over/old now and the author says he doesn't give hints any more on the synacor challenge site), and got some hints.

Ultimately the best hints and explanation came from pankdm.

They provide a walk through and good explanation. Sadly, I couldn't make much sense of their explanation on how they came up with their teleporter hack. This is my fault.

I spent a long time on trying to get this code. I added better debugging so I could get output while the program ran and then I could see op codes, their arguments, the registers, and the stack.

I had to kept going back for hints though; I just couldn't get my mind around the program, how it was running in the VM and what optimizations I had to make.

After more hints...

I did get the program hacked to the point where I could disable the teleporter check, set the 8th register, and get to the next portion of the game. I even got a code! However that code was wrong. Turns out you need the right value in the 8th register to get the correct 7th code.

I ended up learning a lot but got blocked again. I chose to use the c++ implementation pankdm provided (I wrote mine in Go) to make the calculations and get the final result for the 8th register.

For more reading related to the function checking 8th register and optimizing it:

Tail call optimization might be needed for the teleporter function to be fast enough.

Developing the VM

  • Golang 1.14

Installation / Setup

make install

Usage

make run

API

Testing

make test

Docs

make docs

Versioning

Versioning is done using Semver

Tagging: TBD

References