Automation (cheat)

Since the game exposes a lot of its functionality as global functions and variables, it's fairly straightforward to use it to your advantage in different ways. Using exposed variables can be considered cheating in some cases, in other cases it's a harmless tool which allows continuous automation of some repeated tasks. Below, I will describe a few of the possibilities and give some code examples for it. I will not list all possible exploits, so there will be plenty of opportunities for exploring and coming up with creative automation solutions.

A fully automated play-through script can be found here: [1]

## Disclaimer

**WARNING** Never copy and paste code into the development console in your browser without **fully understanding the consequences**. The examples below may be tampered with and could **potentially** be harmful to your system. My intention is to provide the ideas that can be achieved through Javascript programming, you're better off by reading the code and comments to it, and implementing your own solution. You are solely responsible for any damage inflicted on your system

## Environment

Open the developer console in your browser. I'm using Chrome, but this should work just as well with any modern browser that the game runs in (Firefox, Opera, latest Safari or IE). In most browsers, use the command ctrl+shift+I (cmd+shift+I on Mac) or the F12 key. Go to the console tab.

In some browsers you get autocomplete and suggestions to any expression you're trying to write, which is an easy way to see which variables and functions are exposed. Just type a single letter and wait a second to see if the list shows up. For example, type **wire** to see all variables and functions related to wire in the game. Choose one of the suggestions by writing the exact name (case sensitive!) and press enter. If it's a variable, your console should respond with the value of the variable, otherwise it may say that it's just a function, or print the actual code of the function. To call a function, for example buyWire, just write the name of the function and append two parentheses and press enter like below

```
buyWire()
```

Hopefully you'll see the action taking place in the game immediately.

I suggest using the existing functions as much as possible to manipulate the game. Just changing values directly (like giving yourself a huge number of clips of a lot of cash) may set the game in an inconsistent state, and potentially crashing it. The functions may do more than just setting a new value, in which case you're better off playing by the rules.

## Buy wire at the lowest price

The price for wire in the first stage of the game fluctuates a bit. Take advantage of this by creating an automated function that buys wire when the price is below a given threshold. I consider this a powerful automation and not a cheat, since you can play the game like this manually, but it would take a lot more time and concentration.

### Idea summary

* Set my price to define a limit of when to buy and when to wait
* With very high frequency, check if the wire price is below my price, if it is and I have enough money: buy wire. (this will result in potentially thousands of transactions in just a second or two)
* If the amount of wire on hand is low\*, slowly raise my price (it's probably low because the wire price hasn't been low enough for a while)
* Don't raise my price if I don't have enough money (it's useless to raise the limit if I can't pay anyway, just wait until more clips have been sold)

(\*: Low amount can be defined in different ways, either a fixed number (below 1000 for example) or a ratio (10% of the highest amount of wire I've ever had). The latter is a bit more complex, but will play nicely when you have more auto clippers and a higher production rate in general)

### Implementation details

1. Declare a variable for the price limit, I call it wireLimit
2. (optional) Declare a variable for keeping the maximum amount of wire ever had on hand (this dictates the limit of when to start increasing the price limit. I call it maxWire
3. Create an interval which runs up to once per ms, if wireCost (variable from the game) is less than wireLimit, buyWire().
4. Optionally directly after buyWire(), if wire is more than maxWire, update maxWire with the current amount
5. Create an interval which runs once every 10 seconds or so, if wire is less than a specified value (optional: maxWire / 10) and cash is higher than wireLimit (this means I could have bought wire if the price was right), increase wireLimit by one. (this might seem slow, but the game price takes time to variate, so otherwise you might be setting the limit too high, and by that make the whole function useless)

### Code example

```
var wireLimit = 15; // price limit starting at 15, usually lowest price is 14
var maxWire = 10000;
var autoBuyer = setInterval(function() { if(wireCost < wireLimit){ buyWire(); if(wire > maxWire) maxWire = wire; }}, 1); // A lot of things happening at once, this does step 3 and 4
var inflater = setInterval(function() { if(wire < (maxWire / 10) && funds > wireLimit) { console.log(++wireLimit)}}, 30000); // This does step 5, and also prints the current limit to the terminal

```

I usually save the result of intervals to variables so that they are easier to turn off using the clearInterval() function.

## Quantum computing exploit (free ops without extra memory)

Get Quantum computing and a photonic chip. Try mashing the compute button while having full ops and a black indicator for the chip. You'll see the amount of ops go beyond the limit for a while and then returning to normal. If you keep on computing often enough with positive results, you can go on indefinitely without resetting the value.

### Idea summary

There's a list of all the photonic chips which are objects describing whether each chip is activated (bought in the game), and if it would contribute positively or negatively if you were to compute right not. The general idea is to sum up the contributions of all active chips, and if the sum is positive, compute! Do this often enough to get you loads of ops when they are positive, and do nothing when they are negative. Combine this automation with focusing on buying all photonic chips as soon as possible to maximise your result.

In fairness, it's probably not humanly possible to play the game this way without automation, which in my opinion makes it a cheat.

### Implementation details

The list is called qChips, filled with items of the type

```
{
waveSeed: number in range 0.1 - 0.9
active: number either 0 or 1
value: number in range -1 - 1
}

```

Continuously loop over the array and sum up the value of the objects that are activated. If the sum is more than 0, call the function qComp()

### Code example

This could be done with a for-loop, but that's boring, so I'll show an array reduction instead.

```
quantum = setInterval(function() { if(qChips.reduce(function(acc, item) { return item.active ? acc + item.value : acc;}, 0) > 0) qComp();}, 1);

```

The reduction goes like this: start with value 0 (the second argument to the reduce function), runs the accumulator and each item through the provided function, which if item.active is 1 (true) returns the accumulator + the value as the new accumulator, and if active is 0 (false) just returns the incoming accumulator without manipulation. The final accumulator (the sum) is then returned from the reduce function, and compared in the if-statement. If the sum is more than 0, do qComp(). This is done in an interval with the delay period of 1 ms.