Awesome
Earth Debugger
๐ WWDC 2023 Swift Student Challenge Accepted
<img src="/res/app_icon.png" width="256px"/>Earth Debugger๋ ์ฝ๋ฉ์ ์ฒ์ ์์ํ๋ ์ฌ๋๋ค์ด ์ฝ๋ฉ์ ์ฝ๊ณ , ์ค์ํ ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ ์ ์๋ ๋๊ตฌ๋ก์ ๋ฐ์๋ค์ผ ์ ์๋๋ก ์ํ ์ง๊ตฌ๋ฅผ ์ฝ๋ฉ์ผ๋ก ๊นจ๋ํ๊ฒ ์น๋ฃํ์๋ ๋ชฉํ๋ฅผ ๊ฐ์ง๊ณ ์์ต๋๋ค.
Earth Debugger was born out of the idea of curing a sick planet with coding. The goal is to get people who are new to coding to embrace coding as a tool that is easy and can solve important problems.
Specs
<a href="https://developer.apple.com/kr/swift/"><img src="https://img.shields.io/badge/Swift-FA7343?style=flat&logo=Swift&logoColor=white"/></a> <a href="https://developer.apple.com/kr/xcode/swiftui/"><img src="https://img.shields.io/badge/SwiftUI-0D96F6?style=flat&logo=Swift&logoColor=black"/></a> <a href="https://developer.apple.com/kr/xcode/"><img src="https://img.shields.io/badge/Xcode-147EFB?style=flat&logo=Xcode&logoColor=white"/></a>
- Xcode 14.3 App Playground
- iPadOS Playground not tested
- Runnable: Mac(Mac Catalyst), iPad(iPadOS 16), iOS(iOS 16, some UI may not functional)
Details
<img src="/res/opening.gif"/> https://youtu.be/prc4jeNdFfAEarth Status
<img src="/res/status.png" width="256px"/>์ง๊ตฌ๋ water
, air
, soil
, ocean
, deforestation
์ ๋ค์ฏ ๊ฐ์ง Pollution Factor
์ motivated
, energy
์ Sustainable Factor
๋ฅผ ๊ฐ์ง๊ณ ์์ต๋๋ค.
๊ถ๊ทน์ ๋ชฉํ๋ ๋ชจ๋ Pollution Factor
์ ์์น๋ฅผ 10% ๋ฏธ๋ง์ผ๋ก ๋ง๋ค์ด ์ง๊ตฌ์ ํ๊ฒฝ์ ๊นจ๋ํ๊ฒ ๋ง๋๋ ๊ฒ์ด๋ฉฐ, ์ด๋ ์ค๋น๋ ๋ช ๊ฐ์ง์ ๋ช
๋ น์ด๋ฅผ ๋ฐฐ์นํ๊ณ ์คํํจ์ผ๋ก์จ ์ํํ ์ ์์ต๋๋ค.
Earth has five Pollution Factors
- water
, air
, soil
, ocean
, deforestation
, and two Sustainable Factors
- motivated
, energy
.
The goal is to get all the Pollution Factor
values below 10% to clean up the planet, and this can be done by placing and executing a few prepared commands.
Code
<img src="/res/code_sample.png" width="360px"/>๋ชจ๋ ์ฝ๋๊ฐ ํญ์ ๊ธ์ ์ ์ธ ์ํฅ์ ๋ผ์น๊ณ , ์ ์ฝ ์์ด ์คํ ๊ฐ๋ฅํ ๊ฒ์ ์๋๋๋ค.
์๋ฅผ ๋ค์ด, ์๊ณ ๊ธฐ๋ ์์ฐํ๊ธฐ ์ํด ๋ง์ ์์ ์จ์ค๊ฐ์ค๊ฐ ๋ฐ์ํ๊ณ , ๋ชฉ์ด์ง๋ฅผ ์ง๊ธฐ ์ํด ์ฐ๋ฆผ์ด ํ๊ดด๋์ง๋ง, ์ด๋ฅผ ์ ํํ๋ค๋ฉด ์ฌ๋๋ค์ ํ๊ฒฝ ๋ฌธ์ ์ ๋ ๊ด์ฌ์ ๊ฐ์ง๊ฒ ๋ ๊ฒ์ ๋๋ค.
์์๋ก ๋ณด์ฌ์ง๋ reduceBeef()
๋ air pollution
, soil pollution
, deforestation
์์น๋ฅผ ๋ฎ์ถ์ง๋ง, ์ด๋ฅผ ์คํํ๊ธฐ ์ํด์๋ motivated
์์น๊ฐ ์ถฉ๋ถํด์ผ ํฉ๋๋ค.
์ด๋ฌํ ์์๋ค์ ๊ณ ๋ คํ์ฌ ์ง์ ๊ฐ๋ฅํ ํ๊ฒฝ ๋ฌธ์ ์๋ฃจ์ ์ ๋ง๋ค์ด ๋ด๋ ๊ฒ์ด ์ข์ต๋๋ค.
Not all code will always have a positive impact, and not all code can be executed without constraints.
For example, beef produces a lot of greenhouse gases before it is consumed, and forests are destroyed to build pastures, but if we restricted it, people would care less about environmental issues.
The example reduceBeef()
will reduce the air pollution
, soil pollution
, and deforestation
values, but requires a sufficient motivated
value to execute.
It's important to place code blocks with these sustainability factors in mind.
Result
<div> <img src="/res/earth_healthy.png" width="360px"/> <img src="/res/code_fail.png" width="360px"/> </div>์ ๋ต์ด ์์ฑ๋์๋ค๋ฉด Run
๋ฒํผ์ ๋๋ฌ ์ด๋ฅผ ์คํํ ์ ์์ต๋๋ค.
์คํ์ด ์๋ฃ๋๋ฉด ์ง๊ตฌ๊ฐ ๊นจ๋ํด์ก๋์ง ํ์ธํ ์ ์๊ณ , ์ฝ๋๊ฐ ์ฑ๊ณต์ ์ผ๋ก ์คํ๋์๋์ง ์ฌ๋ถ์ ํด๋น ์ฝ๋๊ฐ ๋ผ์น ์ํฅ, ๊ทธ๋ฆฌ๊ณ ๋ง์ฝ ์คํ๋์ง ์์๋ค๋ฉด ๊ทธ ์ด์ ๋ฅผ ํ์ธํ ์ ์์ต๋๋ค.
์์๊ณผ ๋ค๋ฅด๊ฒ ์คํ๋์๋ค๋ฉด ๊ฒฐ๊ณผ์ฐฝ์ ๋ณด๊ณ ์์ ํ ์ดํ ๋ค์ ์๋ํด๋ณผ ์๋ ์์ต๋๋ค.
Once your strategy is complete, you can run it by pressing the Run
button.
After running, you can see if the planet is clean, if the code ran successfully, and what impact it had. If it failed, you'll also be able to check why.
If the result is not what you expected, you can fix it and try again.
<img src="/res/debugging.gif"/>Credit
- Earth Picture: from Wikipedia
- Material Icons: from Material Design
- SF Symbols: from Apple