Swift Playground

RSS for tag

Learn and explore coding in Swift through interactive learning experiences on the Swift Playground app for iPadOS and macOS.

Swift Playground Documentation

Posts under Swift Playground subtopic

Post

Replies

Boosts

Views

Activity

In "Learning Programming 2", I can't use "world.place"
I'm trying the "Connect and Solve" course of Swift Playground. I can't use "world.place" to place bricks at positions (2, 2), (6, 2) (automatically disappear), but I can place bricks at positions (4, 2) in the same way. Two bricks must be placed overlapping in positions (2, 2) and (6, 2) to achieve the goal. Only when a brick is placed in position (4, 2) can the goal be achieved. The problem is that the bricks placed on (6, 2) and (2, 2) will disappear and cannot be placed successfully. The following is my code writing... let Block1 = Block() for i in 1 ... 2 { world.place(Block1, atColumn: 2, row: 2) } for i in 1 ... 2 { world.place(Block1, atColumn: 6, row: 2) } world.place(Block1, atColumn: 4, row: 2) func turnaround() { turnRight() turnRight() } func walk4() { for i in 1 ... 3 { moveForward() } } func collet() { for i in 1 ... 2 { moveForward() } toggleSwitch() turnRight() walk4() collectGem() turnaround() walk4() turnRight() } for i in 1 ... 3 { collet() } ‌I would appreciate it if someone could offer some recommendations.‌ ‌Thanks a lot‌
0
0
70
2w