# Outcore Code solutions level 4 to 7

This guide provides all the code solutions from level 4 to???. ?

# Introduction

I am a self-taught programmer who loves optimizing code. You can trust me!

First of all, if you're new at coding, I highly recommend that it be tried. It's so much fun and easy.

This guide was created to help me save my own code for the mini-coding game.

This guide will include codes for levels 4 to ????. This guide will have codes for levels 4 to????

Notes:

I hate JavaScript <3

All levels require that you have three functions: MoveForward(); TurnRight(); DoNothing()

So I'll only write those additional functions that i didn’t mention here

Last but not least, please like this:> # Level 4

None

Note:

You can change the while loop number to determine how many coins are needed.

Code:

```// to get to our initial point
Turn(2)
Move(2)

// coins we collected so far
var coins = 0;
// we need 35 to buy the key
while(coins < 35)
{
// go throught the maze
Move(8)
Turn(3)
Move(3)
Turn(3)
Move(8)

// collect the coins
Wait(5)
coins+=5;

Turn(3)
Move(3)
Turn(3)
}

// functions to simplify my life
function Move(x){
for (let i = 0; i < x; i++) {
MoveForward()
}
}

function Turn(x){
for (let i = 0; i < x; i++) {
TurnRight()
}
}

function Wait(x){
for (let i = 0; i < x; i++) {
DoNothing()
}
}
```

# Level 5

None

Note:

This code is too slow to execute if your goal is to buy everything

Code:

```// get to the initial position
Turn(3)
Move(1)
Turn(1)
Move(4)

// current amount coins held
var coins = 0;

// start the grind
while(coins < 250)
{
Turn(1)
Move(4)
Turn(1)
Move(3)
Turn(3)
Move(1)
Turn(1)
Move(7)
Turn(3)
Move(2)
Turn(2)
Move(7)
Turn(1)

// got to the bank and deposit your money
Move(4)
Wait(5)
coins += 5

// back to where we started
Move(6)
}

// functions to simplify my life
function Move(x){
for (let i = 0; i < x; i++) {
MoveForward()
}
}

function Turn(x){
for (let i = 0; i < x; i++) {
TurnRight()
}
}

function Wait(x){
for (let i = 0; i < x; i++) {
DoNothing()
}
}
```

# Level 6

– GetWorkerInventoryItems()

Note:

This is the first stage of the process where you will have 2 workers to manage. I'll provide 2 code blocks for each worker.

– This stage can be completed with 1 worker if desired. Simply make the first worker loop until it has collected 1000 coins.

Code:

Worker 1:

```// get to the initial position
Move(5)
Turn(3)

var coins = 0
while(coins < 500){
Move(13)
Turn(3)
Move(5)

// deposit
var coinsCollected = GetWorkerInventoryItems().length
Wait(coinsCollected)
coins += coinsCollected

Move(5)
Turn(3)
Move(16)
Turn(3)
Move(10)
Turn(3)
Move(3)
}

// when done get out of the way so the other worker can finish it's work
Turn(1)
Move(1)

// functions to simplify my life
function Move(x){
for (let i = 0; i < x; i++) {
MoveForward()
}
}

function Turn(x){
for (let i = 0; i < x; i++) {
TurnRight()
}
}

function Wait(x){
for (let i = 0; i < x; i++) {
DoNothing()
}
}
```

Worker 2:

```// Get to the initial position
Move(5)
Turn(3)

var coins = 0
while(coins < 500){
Move(10)
Turn(3)
Move(10)
Turn(3)
Move(16)
Turn(3)
Move(5)

// deposit
var coinsCollected = GetWorkerInventoryItems().length
Wait(coinsCollected)
coins += coinsCollected

Move(5)
Turn(3)
Move(6)
}

// when done get out of the way so the other worker can finish it's work
Turn(1)
Move(1)

// functions to simplify my life
function Move(x){
for (let i = 0; i < x; i++) {
MoveForward()
}
}

function Turn(x){
for (let i = 0; i < x; i++) {
TurnRight()
}
}

function Wait(x){
for (let i = 0; i < x; i++) {
DoNothing()
}
}
```

# Level 7

– SyncWorkers()

Note:

Although this is not the best way, it's the only way I know.

Code:

worker 1

```// get to the initial position
Move(5)
Turn(1)
Move(1)

while(true){
Move(2)
Turn(2)
if (SyncWorkers()){
break
}
}

// functions to simplify my life
function Move(x){
for (let i = 0; i < x; i++) {
MoveForward()
}
}

function Turn(x){
for (let i = 0; i < x; i++) {
TurnRight()
}
}

function Wait(x){
for (let i = 0; i < x; i++) {
DoNothing()
}
}
```

worker 2:

```// get to the initial position
Turn(1)

var coins = -1
while (coins < 2400){
Move(7)
Turn(3)
Move(2)
Turn(3)
Move(3)
Turn(3)
Move(2)
Turn(1)
Move(6)
// deposit
Wait(6)
coins += 6
Turn(2)
Move(2)
}

while(true){
if (SyncWorkers()){
break
}
}

// functions to simplify my life
function Move(x){
for (let i = 0; i < x; i++) {
MoveForward()
}
}

function Turn(x){
for (let i = 0; i < x; i++) {
TurnRight()
}
}

function Wait(x){
for (let i = 0; i < x; i++) {
DoNothing()
}
}
```

Written by cabiste

Hope you enjoy the post for Outcore Code solutions level 4 to 7, If you think we should update the post or something is wrong please let us know via comment and we will fix it how fast as possible! Thank you and have a great day!