This guide has all the code solutions for level 4 to ????

## Guide to Coding Mini Game

*All credit goes to cabiste!*

### Introduction

**About this guide**

*First off if you’re new to coding i highly recommend you to give it a try it’s so fun and easy.*

So I honestly made this guide to save my own code for the coding mini game, this guide will have codes for levels from 4 to ???? above each level i’ll also write what functions are needed to run the code.

**Notes**

*I hate JavaScript <3*

All the levels require that you have 3 functions: MoveForward(), TurnRight(), DoNothing().

So I’ll only write the additional functions that i didn’t mention here.

### Level 4

**Additional Functions needed**

- None

**Note:**

You can change the number in the while loop to how much coins you need

**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;
// return to the initial position
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

**Additional Functions needed**

- None

**Note**

This code will take too long to execute if you want 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()
}
}
```

## Be the first to comment