Skip to content

Instantly share code, notes, and snippets.

@TheMuellenator
Last active March 27, 2024 17:34
Show Gist options
  • Save TheMuellenator/a15238bb2a2ec48298d21dd5c9748fae to your computer and use it in GitHub Desktop.
Save TheMuellenator/a15238bb2a2ec48298d21dd5c9748fae to your computer and use it in GitHub Desktop.
iOS repl.it - Functions 1 Challenge Solution
print("Starting map")
start()
//4 steps right and 5 steps down.
right()
right()
right()
right()
down()
down()
down()
down()
down()
//Don't change the code below this line.
print("Final map")
visualise();
@Shazanbegum
Copy link

I am having the same issue, its not allowing me type and the bellow shows up after every line.
 down()

down()
bash: syntax error near unexpected token `down'
 down()

@ZiZasaurus
Copy link

ZiZasaurus commented Jan 15, 2024

I figured out the issue. First, you need to fork the project, as mtzfactory mentioned. Secondly, you need to add the game.swift file to the end of the compile list in replit. See this SO post for specifics.

@zora-san
Copy link

Thanks, @ZiZasaurus! <3

@justinking22
Copy link

when using the function "right" the text shows blue in the field but when using "down" or "up" they show up black. I tried the challenge and my code result was identical to the solution but the results were errors. the errors were due to the "down" function not calling correctly. I went into the game.swift section and the coding there had different colors as well. I tried to change the code there to "Down" vs "down" to see if it would have any affect and it did not. I tried to test this further by calling on just the "right" function 3 times and it worked perfectly. the "up" and "down" functions did not work at all.

That's sooo
right

@ERaff83
Copy link

ERaff83 commented Jan 28, 2024

Screenshot 2024-01-28 at 7 32 11 pm
HELP Please

@abrahammella
Copy link

@ERaff83 Follow the instruction as ZiZasaurus's mention, it should work by adding compile = ["swiftc", "-o", "main", "main.swift", "game.swift"] on the hidden .replit config file.

Screen Shot 2024-02-05 at 12 49 45 PM

@abrahammella
Copy link

func moveTheFox(){
  for moves in 1...5{
    if moves != 5{
      right()
    }
    down()
  }
}

moveTheFox()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment