├── .gitignore
├── Spring
├── day-3
│ ├── assets
│ │ ├── meow.wav
│ │ ├── purr.wav
│ │ ├── walk-0.wav
│ │ ├── walk-1.wav
│ │ ├── walk-2.wav
│ │ ├── walk-3.wav
│ │ ├── walk-4.wav
│ │ ├── walk-5.wav
│ │ ├── walk-6.wav
│ │ ├── walk-7.wav
│ │ ├── meow-with-purr.wav
│ │ └── credits.txt
│ ├── fonts
│ │ ├── OpenSans-Regular.ttf
│ │ └── fonts.conf
│ ├── maze-data.lisp
│ └── canvas.lisp
├── day-4
│ ├── assets
│ │ ├── bgm.mp3
│ │ ├── meow.wav
│ │ ├── purr.wav
│ │ ├── walk-0.wav
│ │ ├── walk-1.wav
│ │ ├── walk-2.wav
│ │ ├── walk-3.wav
│ │ ├── walk-4.wav
│ │ ├── walk-5.wav
│ │ ├── walk-6.wav
│ │ ├── walk-7.wav
│ │ ├── meow-with-purr.wav
│ │ └── credits.txt
│ ├── fonts
│ │ ├── SpecialElite-Regular.ttf
│ │ └── fonts.conf
│ ├── poem.txt
│ ├── maze-data.lisp
│ └── canvas.lisp
├── day-5
│ ├── assets
│ │ ├── bgm.ogg
│ │ ├── meow.ogg
│ │ ├── purr.ogg
│ │ ├── walk-0.ogg
│ │ ├── walk-1.ogg
│ │ ├── walk-2.ogg
│ │ ├── walk-3.ogg
│ │ ├── walk-4.ogg
│ │ ├── walk-5.ogg
│ │ ├── walk-6.ogg
│ │ ├── walk-7.ogg
│ │ ├── meow-with-purr.ogg
│ │ └── credits.txt
│ ├── images
│ │ ├── app.icns
│ │ ├── app.ico
│ │ ├── app.png
│ │ └── dmg.icns
│ ├── fonts
│ │ ├── SpecialElite-Regular.ttf
│ │ └── fonts.conf
│ ├── README.md
│ ├── LICENSE
│ └── canvas.lisp
├── day-6
│ ├── assets
│ │ ├── bgm.ogg
│ │ ├── meow.ogg
│ │ ├── purr.ogg
│ │ ├── walk-0.ogg
│ │ ├── walk-1.ogg
│ │ ├── walk-2.ogg
│ │ ├── walk-3.ogg
│ │ ├── walk-4.ogg
│ │ ├── walk-5.ogg
│ │ ├── walk-6.ogg
│ │ ├── walk-7.ogg
│ │ ├── meow-with-purr.ogg
│ │ └── credits.txt
│ ├── images
│ │ ├── app.icns
│ │ ├── app.ico
│ │ ├── app.png
│ │ └── dmg.icns
│ ├── fonts
│ │ ├── SpecialElite-Regular.ttf
│ │ └── fonts.conf
│ ├── README.md
│ └── LICENSE
├── afterwards
│ ├── assets
│ │ ├── bgm.ogg
│ │ ├── meow.ogg
│ │ ├── purr.ogg
│ │ ├── walk-0.ogg
│ │ ├── walk-1.ogg
│ │ ├── walk-2.ogg
│ │ ├── walk-3.ogg
│ │ ├── walk-4.ogg
│ │ ├── walk-5.ogg
│ │ ├── walk-6.ogg
│ │ ├── walk-7.ogg
│ │ ├── meow-with-purr.ogg
│ │ └── credits.txt
│ ├── images
│ │ ├── app.icns
│ │ ├── app.ico
│ │ ├── app.png
│ │ └── dmg.icns
│ ├── fonts
│ │ ├── SpecialElite-Regular.ttf
│ │ └── fonts.conf
│ ├── README.md
│ └── LICENSE
├── screenshots
│ ├── spring-1.png
│ ├── spring-2.png
│ ├── spring-3.png
│ └── spring-4.png
├── README.assets
│ ├── d1-maze-1.png
│ ├── d1-maze-2.png
│ ├── d1-maze-3.png
│ ├── d1-maze-4.png
│ ├── d2-maze-1.png
│ ├── d2-maze-2.png
│ ├── d2-maze-3.png
│ ├── d2-maze-4.png
│ ├── d2-maze-5.png
│ ├── d2-maze-6.png
│ ├── d2-maze-7.png
│ ├── d2-maze-8.png
│ ├── d2-maze-9.png
│ ├── d3-maze-1.png
│ ├── d3-maze-2.png
│ ├── d3-maze-3.png
│ ├── d3-maze-4.png
│ ├── d3-maze-5.png
│ ├── d3-maze-6.png
│ ├── d4-poem-page.png
│ ├── d3-maze-dark-1.png
│ ├── d4-finish-page.png
│ └── d4-maze-dark-2.png
├── day-2
│ ├── fonts
│ │ ├── OpenSans-Regular.ttf
│ │ └── fonts.conf
│ ├── maze-data.lisp
│ └── canvas.lisp
├── day-1
│ ├── fonts
│ │ └── fonts.conf
│ ├── maze2.lisp
│ └── canvas.lisp
└── README.md
├── README.md
└── .github
└── workflows
└── spring.yml
/.gitignore:
--------------------------------------------------------------------------------
1 | **/web/
2 | **/dist/
3 | **/*.app/
4 | **/*.dmg
--------------------------------------------------------------------------------
/Spring/day-3/assets/meow.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-3/assets/meow.wav
--------------------------------------------------------------------------------
/Spring/day-3/assets/purr.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-3/assets/purr.wav
--------------------------------------------------------------------------------
/Spring/day-4/assets/bgm.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-4/assets/bgm.mp3
--------------------------------------------------------------------------------
/Spring/day-4/assets/meow.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-4/assets/meow.wav
--------------------------------------------------------------------------------
/Spring/day-4/assets/purr.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-4/assets/purr.wav
--------------------------------------------------------------------------------
/Spring/day-5/assets/bgm.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-5/assets/bgm.ogg
--------------------------------------------------------------------------------
/Spring/day-5/assets/meow.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-5/assets/meow.ogg
--------------------------------------------------------------------------------
/Spring/day-5/assets/purr.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-5/assets/purr.ogg
--------------------------------------------------------------------------------
/Spring/day-5/images/app.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-5/images/app.icns
--------------------------------------------------------------------------------
/Spring/day-5/images/app.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-5/images/app.ico
--------------------------------------------------------------------------------
/Spring/day-5/images/app.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-5/images/app.png
--------------------------------------------------------------------------------
/Spring/day-5/images/dmg.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-5/images/dmg.icns
--------------------------------------------------------------------------------
/Spring/day-6/assets/bgm.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-6/assets/bgm.ogg
--------------------------------------------------------------------------------
/Spring/day-6/assets/meow.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-6/assets/meow.ogg
--------------------------------------------------------------------------------
/Spring/day-6/assets/purr.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-6/assets/purr.ogg
--------------------------------------------------------------------------------
/Spring/day-6/images/app.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-6/images/app.icns
--------------------------------------------------------------------------------
/Spring/day-6/images/app.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-6/images/app.ico
--------------------------------------------------------------------------------
/Spring/day-6/images/app.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-6/images/app.png
--------------------------------------------------------------------------------
/Spring/day-6/images/dmg.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-6/images/dmg.icns
--------------------------------------------------------------------------------
/Spring/day-3/assets/walk-0.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-3/assets/walk-0.wav
--------------------------------------------------------------------------------
/Spring/day-3/assets/walk-1.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-3/assets/walk-1.wav
--------------------------------------------------------------------------------
/Spring/day-3/assets/walk-2.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-3/assets/walk-2.wav
--------------------------------------------------------------------------------
/Spring/day-3/assets/walk-3.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-3/assets/walk-3.wav
--------------------------------------------------------------------------------
/Spring/day-3/assets/walk-4.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-3/assets/walk-4.wav
--------------------------------------------------------------------------------
/Spring/day-3/assets/walk-5.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-3/assets/walk-5.wav
--------------------------------------------------------------------------------
/Spring/day-3/assets/walk-6.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-3/assets/walk-6.wav
--------------------------------------------------------------------------------
/Spring/day-3/assets/walk-7.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-3/assets/walk-7.wav
--------------------------------------------------------------------------------
/Spring/day-4/assets/walk-0.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-4/assets/walk-0.wav
--------------------------------------------------------------------------------
/Spring/day-4/assets/walk-1.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-4/assets/walk-1.wav
--------------------------------------------------------------------------------
/Spring/day-4/assets/walk-2.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-4/assets/walk-2.wav
--------------------------------------------------------------------------------
/Spring/day-4/assets/walk-3.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-4/assets/walk-3.wav
--------------------------------------------------------------------------------
/Spring/day-4/assets/walk-4.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-4/assets/walk-4.wav
--------------------------------------------------------------------------------
/Spring/day-4/assets/walk-5.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-4/assets/walk-5.wav
--------------------------------------------------------------------------------
/Spring/day-4/assets/walk-6.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-4/assets/walk-6.wav
--------------------------------------------------------------------------------
/Spring/day-4/assets/walk-7.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-4/assets/walk-7.wav
--------------------------------------------------------------------------------
/Spring/day-5/assets/walk-0.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-5/assets/walk-0.ogg
--------------------------------------------------------------------------------
/Spring/day-5/assets/walk-1.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-5/assets/walk-1.ogg
--------------------------------------------------------------------------------
/Spring/day-5/assets/walk-2.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-5/assets/walk-2.ogg
--------------------------------------------------------------------------------
/Spring/day-5/assets/walk-3.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-5/assets/walk-3.ogg
--------------------------------------------------------------------------------
/Spring/day-5/assets/walk-4.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-5/assets/walk-4.ogg
--------------------------------------------------------------------------------
/Spring/day-5/assets/walk-5.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-5/assets/walk-5.ogg
--------------------------------------------------------------------------------
/Spring/day-5/assets/walk-6.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-5/assets/walk-6.ogg
--------------------------------------------------------------------------------
/Spring/day-5/assets/walk-7.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-5/assets/walk-7.ogg
--------------------------------------------------------------------------------
/Spring/day-6/assets/walk-0.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-6/assets/walk-0.ogg
--------------------------------------------------------------------------------
/Spring/day-6/assets/walk-1.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-6/assets/walk-1.ogg
--------------------------------------------------------------------------------
/Spring/day-6/assets/walk-2.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-6/assets/walk-2.ogg
--------------------------------------------------------------------------------
/Spring/day-6/assets/walk-3.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-6/assets/walk-3.ogg
--------------------------------------------------------------------------------
/Spring/day-6/assets/walk-4.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-6/assets/walk-4.ogg
--------------------------------------------------------------------------------
/Spring/day-6/assets/walk-5.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-6/assets/walk-5.ogg
--------------------------------------------------------------------------------
/Spring/day-6/assets/walk-6.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-6/assets/walk-6.ogg
--------------------------------------------------------------------------------
/Spring/day-6/assets/walk-7.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-6/assets/walk-7.ogg
--------------------------------------------------------------------------------
/Spring/afterwards/assets/bgm.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/afterwards/assets/bgm.ogg
--------------------------------------------------------------------------------
/Spring/afterwards/assets/meow.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/afterwards/assets/meow.ogg
--------------------------------------------------------------------------------
/Spring/afterwards/assets/purr.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/afterwards/assets/purr.ogg
--------------------------------------------------------------------------------
/Spring/afterwards/images/app.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/afterwards/images/app.icns
--------------------------------------------------------------------------------
/Spring/afterwards/images/app.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/afterwards/images/app.ico
--------------------------------------------------------------------------------
/Spring/afterwards/images/app.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/afterwards/images/app.png
--------------------------------------------------------------------------------
/Spring/afterwards/images/dmg.icns:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/afterwards/images/dmg.icns
--------------------------------------------------------------------------------
/Spring/screenshots/spring-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/screenshots/spring-1.png
--------------------------------------------------------------------------------
/Spring/screenshots/spring-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/screenshots/spring-2.png
--------------------------------------------------------------------------------
/Spring/screenshots/spring-3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/screenshots/spring-3.png
--------------------------------------------------------------------------------
/Spring/screenshots/spring-4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/screenshots/spring-4.png
--------------------------------------------------------------------------------
/Spring/README.assets/d1-maze-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/README.assets/d1-maze-1.png
--------------------------------------------------------------------------------
/Spring/README.assets/d1-maze-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/README.assets/d1-maze-2.png
--------------------------------------------------------------------------------
/Spring/README.assets/d1-maze-3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/README.assets/d1-maze-3.png
--------------------------------------------------------------------------------
/Spring/README.assets/d1-maze-4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/README.assets/d1-maze-4.png
--------------------------------------------------------------------------------
/Spring/README.assets/d2-maze-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/README.assets/d2-maze-1.png
--------------------------------------------------------------------------------
/Spring/README.assets/d2-maze-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/README.assets/d2-maze-2.png
--------------------------------------------------------------------------------
/Spring/README.assets/d2-maze-3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/README.assets/d2-maze-3.png
--------------------------------------------------------------------------------
/Spring/README.assets/d2-maze-4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/README.assets/d2-maze-4.png
--------------------------------------------------------------------------------
/Spring/README.assets/d2-maze-5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/README.assets/d2-maze-5.png
--------------------------------------------------------------------------------
/Spring/README.assets/d2-maze-6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/README.assets/d2-maze-6.png
--------------------------------------------------------------------------------
/Spring/README.assets/d2-maze-7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/README.assets/d2-maze-7.png
--------------------------------------------------------------------------------
/Spring/README.assets/d2-maze-8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/README.assets/d2-maze-8.png
--------------------------------------------------------------------------------
/Spring/README.assets/d2-maze-9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/README.assets/d2-maze-9.png
--------------------------------------------------------------------------------
/Spring/README.assets/d3-maze-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/README.assets/d3-maze-1.png
--------------------------------------------------------------------------------
/Spring/README.assets/d3-maze-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/README.assets/d3-maze-2.png
--------------------------------------------------------------------------------
/Spring/README.assets/d3-maze-3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/README.assets/d3-maze-3.png
--------------------------------------------------------------------------------
/Spring/README.assets/d3-maze-4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/README.assets/d3-maze-4.png
--------------------------------------------------------------------------------
/Spring/README.assets/d3-maze-5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/README.assets/d3-maze-5.png
--------------------------------------------------------------------------------
/Spring/README.assets/d3-maze-6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/README.assets/d3-maze-6.png
--------------------------------------------------------------------------------
/Spring/afterwards/assets/walk-0.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/afterwards/assets/walk-0.ogg
--------------------------------------------------------------------------------
/Spring/afterwards/assets/walk-1.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/afterwards/assets/walk-1.ogg
--------------------------------------------------------------------------------
/Spring/afterwards/assets/walk-2.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/afterwards/assets/walk-2.ogg
--------------------------------------------------------------------------------
/Spring/afterwards/assets/walk-3.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/afterwards/assets/walk-3.ogg
--------------------------------------------------------------------------------
/Spring/afterwards/assets/walk-4.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/afterwards/assets/walk-4.ogg
--------------------------------------------------------------------------------
/Spring/afterwards/assets/walk-5.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/afterwards/assets/walk-5.ogg
--------------------------------------------------------------------------------
/Spring/afterwards/assets/walk-6.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/afterwards/assets/walk-6.ogg
--------------------------------------------------------------------------------
/Spring/afterwards/assets/walk-7.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/afterwards/assets/walk-7.ogg
--------------------------------------------------------------------------------
/Spring/README.assets/d4-poem-page.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/README.assets/d4-poem-page.png
--------------------------------------------------------------------------------
/Spring/day-3/assets/meow-with-purr.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-3/assets/meow-with-purr.wav
--------------------------------------------------------------------------------
/Spring/day-4/assets/meow-with-purr.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-4/assets/meow-with-purr.wav
--------------------------------------------------------------------------------
/Spring/day-5/assets/meow-with-purr.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-5/assets/meow-with-purr.ogg
--------------------------------------------------------------------------------
/Spring/day-6/assets/meow-with-purr.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-6/assets/meow-with-purr.ogg
--------------------------------------------------------------------------------
/Spring/README.assets/d3-maze-dark-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/README.assets/d3-maze-dark-1.png
--------------------------------------------------------------------------------
/Spring/README.assets/d4-finish-page.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/README.assets/d4-finish-page.png
--------------------------------------------------------------------------------
/Spring/README.assets/d4-maze-dark-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/README.assets/d4-maze-dark-2.png
--------------------------------------------------------------------------------
/Spring/day-2/fonts/OpenSans-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-2/fonts/OpenSans-Regular.ttf
--------------------------------------------------------------------------------
/Spring/day-3/fonts/OpenSans-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-3/fonts/OpenSans-Regular.ttf
--------------------------------------------------------------------------------
/Spring/afterwards/assets/meow-with-purr.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/afterwards/assets/meow-with-purr.ogg
--------------------------------------------------------------------------------
/Spring/day-4/fonts/SpecialElite-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-4/fonts/SpecialElite-Regular.ttf
--------------------------------------------------------------------------------
/Spring/day-5/fonts/SpecialElite-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-5/fonts/SpecialElite-Regular.ttf
--------------------------------------------------------------------------------
/Spring/day-6/fonts/SpecialElite-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/day-6/fonts/SpecialElite-Regular.ttf
--------------------------------------------------------------------------------
/Spring/afterwards/fonts/SpecialElite-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VitoVan/lisp-game-jam-2023/HEAD/Spring/afterwards/fonts/SpecialElite-Regular.ttf
--------------------------------------------------------------------------------
/Spring/day-3/assets/credits.txt:
--------------------------------------------------------------------------------
1 | https://freesound.org/people/xoiziox/sounds/553375/
2 | https://freesound.org/people/Mafon2/sounds/436541/
3 | https://freesound.org/people/eZZin/sounds/683920/
4 | https://freesound.org/people/skymary/sounds/412017/
--------------------------------------------------------------------------------
/Spring/day-4/assets/credits.txt:
--------------------------------------------------------------------------------
1 | https://freesound.org/people/xoiziox/sounds/553375/
2 | https://freesound.org/people/Mafon2/sounds/436541/
3 | https://freesound.org/people/eZZin/sounds/683920/
4 | https://freesound.org/people/skymary/sounds/412017/
--------------------------------------------------------------------------------
/Spring/day-5/assets/credits.txt:
--------------------------------------------------------------------------------
1 | https://freesound.org/people/xoiziox/sounds/553375/
2 | https://freesound.org/people/Mafon2/sounds/436541/
3 | https://freesound.org/people/eZZin/sounds/683920/
4 | https://freesound.org/people/skymary/sounds/412017/
--------------------------------------------------------------------------------
/Spring/day-6/assets/credits.txt:
--------------------------------------------------------------------------------
1 | https://freesound.org/people/xoiziox/sounds/553375/
2 | https://freesound.org/people/Mafon2/sounds/436541/
3 | https://freesound.org/people/eZZin/sounds/683920/
4 | https://freesound.org/people/skymary/sounds/412017/
--------------------------------------------------------------------------------
/Spring/afterwards/assets/credits.txt:
--------------------------------------------------------------------------------
1 | https://freesound.org/people/xoiziox/sounds/553375/
2 | https://freesound.org/people/Mafon2/sounds/436541/
3 | https://freesound.org/people/eZZin/sounds/683920/
4 | https://freesound.org/people/skymary/sounds/412017/
--------------------------------------------------------------------------------
/Spring/day-5/README.md:
--------------------------------------------------------------------------------
1 | # How to Run
2 |
3 | This project was built with [CALM](https://github.com/VitoVan/calm/releases/tag/test-calm-013-06), with `calm` command at your disposal, you could just `cd` to this directory, and execute the command `calm`, then you will see the application running.
4 |
5 | # How to Compile
6 |
7 | With `calm publish` to publish desktop binaries, with `calm publish-web` to publish WebAssembly and JavaScript which can be run in the browser.
8 |
9 | # Oh no, this is not a sufficient README!
10 |
11 | I'm sorry, life came in, I have to leave this here now.
12 |
13 | Have fun, and I wish you happy!
14 |
--------------------------------------------------------------------------------
/Spring/day-6/README.md:
--------------------------------------------------------------------------------
1 | # How to Run
2 |
3 | This project was built with [CALM](https://github.com/VitoVan/calm/releases/tag/test-calm-013-06), with `calm` command at your disposal, you could just `cd` to this directory, and execute the command `calm`, then you will see the application running.
4 |
5 | # How to Compile
6 |
7 | With `calm publish` to publish desktop binaries, with `calm publish-web` to publish WebAssembly and JavaScript which can be run in the browser.
8 |
9 | # Oh no, this is not a sufficient README!
10 |
11 | I'm sorry, life came in, I have to leave this here now.
12 |
13 | Have fun, and I wish you happy!
14 |
--------------------------------------------------------------------------------
/Spring/afterwards/README.md:
--------------------------------------------------------------------------------
1 | # How to Run
2 |
3 | This project was built with [CALM](https://github.com/VitoVan/calm), with `calm` command at your disposal, you could just `cd` to this directory, and execute the command `calm`, then you will see the application running.
4 |
5 | # How to Compile
6 |
7 | With `calm publish` to publish desktop binaries, with `calm publish-web` to publish WebAssembly and JavaScript which can be run in the browser.
8 |
9 | # Can you tell me the detailed steps?
10 |
11 | Yes, check the [CI configuration](../../.github/workflows/spring.yml), it contains all the compilation steps for all the platforms: Linux, macOS, Windows and the web!
12 |
13 |
14 | Have fun, and I wish you happy!
15 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Lisp Game Jam 2023
2 |
3 | This repository contains the source code and devlogs for my Lisp Game Jam submissions.
4 |
5 | ## Autumn
6 |
7 | ~~Time is flying, is flying.~~
8 |
9 | Damn, life came in.
10 |
11 |
12 | > “I love deadlines. I love the whooshing noise they make as they go by.”
13 | > ― Douglas Adams, The Salmon of Doubt
14 |
15 | ## Spring: The Maze and Lost Cat
16 |
17 | [](https://vitovan.itch.io/maze)
18 |
19 | The Owl and the Pussy-cat went to sea
20 |
21 | 
22 | 
23 | 
24 | 
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/Spring/day-4/poem.txt:
--------------------------------------------------------------------------------
1 | 1.
2 | The Owl and the Pussy-cat went to sea
3 |
4 | 2.
5 | In a beautiful pea-green boat,
6 | They took some honey, and plenty of money,
7 | Wrapped up in a five-pound note.
8 |
9 | 3.
10 | The Owl looked up to the stars above,
11 | And sang to a small guitar,
12 | ‘O lovely Pussy! O Pussy, my love,
13 | What a beautiful Pussy you are,
14 | You are,
15 | You are!
16 | What a beautiful Pussy you are!’
17 |
18 | 4.
19 | Pussy said to the Owl, ‘You elegant fowl!
20 | How charmingly sweet you sing!
21 | O let us be married! too long we have tarried:
22 | But what shall we do for a ring?’
23 |
24 | 5.
25 | They sailed away, for a year and a day,
26 | To the land where the Bong-Tree grows
27 | And there in a wood a Piggy-wig stood
28 | With a ring at the end of his nose,
29 | His nose,
30 | His nose,
31 | With a ring at the end of his nose.
32 |
33 | 6.
34 | ‘Dear Pig, are you willing to sell for one shilling
35 | Your ring?’ Said the Piggy, ‘I will.’
36 |
37 | 7.
38 | So they took it away, and were married next day
39 | By the Turkey who lives on the hill.
40 |
41 | 8.
42 | They dined on mince, and slices of quince,
43 | Which they ate with a runcible spoon;
44 |
45 | 9.
46 | And hand in hand, on the edge of the sand,
47 | They danced by the light of the moon,
48 | The moon,
49 | The moon,
50 | They danced by the light of the moon.
51 |
--------------------------------------------------------------------------------
/Spring/day-2/maze-data.lisp:
--------------------------------------------------------------------------------
1 | (in-package :calm)
2 |
3 | (defparameter *maze-1*
4 | (list
5 | #2A(
6 | (1 1 1 1 1 1 1 1 1 1 1 1 1)
7 | (0 0 1 0 0 0 1 0 0 0 1 0 1)
8 | (1 0 1 0 1 0 1 1 1 0 1 0 1)
9 | (1 0 1 0 1 0 0 0 0 0 1 0 1)
10 | (1 0 1 0 1 1 1 1 1 0 1 0 1)
11 | (1 0 1 0 0 0 0 0 1 0 0 0 1)
12 | (1 0 1 1 1 0 1 1 1 0 1 0 1)
13 | (1 0 0 0 1 0 0 0 1 0 1 0 1)
14 | (1 1 1 0 1 1 1 0 1 0 1 0 1)
15 | (1 0 0 0 1 0 0 0 1 0 1 0 1)
16 | (1 0 1 1 1 0 1 1 1 0 1 0 1)
17 | (1 0 0 0 0 0 1 0 0 0 1 0 1)
18 | (1 1 1 1 1 1 1 1 1 1 1 0 1)
19 | )
20 | ;; player position
21 | '(1 0)
22 | ;; kitty position
23 | '(5 7)
24 | )
25 | )
26 |
27 | (defparameter *maze-2*
28 | (list
29 | #2A(
30 | (1 1 1 1 1 1 1 1 1 1 1 1 1)
31 | (0 0 1 0 0 0 0 0 0 0 0 0 1)
32 | (1 0 1 0 1 1 1 1 1 1 1 0 1)
33 | (1 0 1 0 0 0 0 0 1 0 0 0 1)
34 | (1 0 1 0 1 1 1 1 1 0 1 0 1)
35 | (1 0 1 0 1 0 0 0 1 0 1 0 1)
36 | (1 0 1 1 1 0 1 0 1 0 1 1 1)
37 | (1 0 1 0 0 0 1 0 1 0 0 0 1)
38 | (1 0 1 0 1 1 1 0 1 1 1 0 1)
39 | (1 0 0 0 1 0 1 0 0 0 0 0 1)
40 | (1 1 1 0 1 0 1 1 1 1 1 0 1)
41 | (1 0 0 0 1 0 0 0 0 0 0 0 1)
42 | (1 1 1 1 1 1 1 1 1 1 1 0 1)
43 | )
44 | ;; player position
45 | '(1 0)
46 | ;; kitty position
47 | '(5 3)
48 | ))
49 |
50 |
51 | (defparameter *maze-3*
52 | (list
53 | #2A(
54 | (1 1 1 1 1 1 1 1 1 1 1 1 1)
55 | (0 0 1 0 0 0 0 0 0 0 0 0 1)
56 | (1 0 1 1 1 0 1 1 1 1 1 0 1)
57 | (1 0 0 0 1 0 0 0 0 0 1 0 1)
58 | (1 1 1 0 1 0 1 1 1 0 1 0 1)
59 | (1 0 0 0 1 0 0 0 1 0 1 0 1)
60 | (1 0 1 1 1 1 1 1 1 0 1 0 1)
61 | (1 0 1 0 0 0 0 0 0 0 1 0 1)
62 | (1 0 1 0 1 0 1 1 1 1 1 0 1)
63 | (1 0 1 0 1 0 1 0 0 0 0 0 1)
64 | (1 0 1 1 1 0 1 0 1 1 1 1 1)
65 | (1 0 0 0 0 0 1 0 0 0 0 0 1)
66 | (1 1 1 1 1 1 1 1 1 1 1 0 1)
67 | )
68 | ;; player position
69 | '(1 0)
70 | ;; kitty position
71 | '(9 3)
72 | ))
73 |
74 | (defparameter *maze-4*
75 | (list
76 | #2A(
77 | (1 1 1 1 1 1 1 1 1 1 1 1 1)
78 | (0 0 1 0 0 0 0 0 0 0 0 0 1)
79 | (1 0 1 1 1 1 1 0 1 1 1 0 1)
80 | (1 0 0 0 0 0 1 0 1 0 1 0 1)
81 | (1 1 1 1 1 0 1 0 1 0 1 0 1)
82 | (1 0 0 0 1 0 0 0 1 0 0 0 1)
83 | (1 0 1 0 1 1 1 1 1 0 1 1 1)
84 | (1 0 1 0 0 0 0 0 1 0 1 0 1)
85 | (1 0 1 1 1 1 1 1 1 0 1 0 1)
86 | (1 0 1 0 0 0 0 0 1 0 1 0 1)
87 | (1 0 1 0 1 1 1 0 1 0 1 0 1)
88 | (1 0 0 0 0 0 1 0 0 0 0 0 1)
89 | (1 1 1 1 1 1 1 1 1 1 1 0 1)
90 | )
91 | ;; player position
92 | '(1 0)
93 | ;; kitty position
94 | '(11 5)
95 | ))
96 |
97 | (defparameter *maze-data-list* (list *maze-1* *maze-2* *maze-3* *maze-4*))
98 |
--------------------------------------------------------------------------------
/Spring/day-3/maze-data.lisp:
--------------------------------------------------------------------------------
1 | (in-package :calm)
2 |
3 | (defparameter *maze-1*
4 | (list
5 | #2A(
6 | (1 1 1 1 1 1 1 1 1 1 1 1 1)
7 | (0 0 1 0 0 0 1 0 0 0 1 0 1)
8 | (1 0 1 0 1 0 1 1 1 0 1 0 1)
9 | (1 0 1 0 1 0 0 0 0 0 1 0 1)
10 | (1 0 1 0 1 1 1 1 1 0 1 0 1)
11 | (1 0 1 0 0 0 0 0 1 0 0 0 1)
12 | (1 0 1 1 1 0 1 1 1 0 1 0 1)
13 | (1 0 0 0 1 0 0 0 1 0 1 0 1)
14 | (1 1 1 0 1 1 1 0 1 0 1 0 1)
15 | (1 0 0 0 1 0 0 0 1 0 1 0 1)
16 | (1 0 1 1 1 0 1 1 1 0 1 0 1)
17 | (1 0 0 0 0 0 1 0 0 0 1 0 1)
18 | (1 1 1 1 1 1 1 1 1 1 1 0 1)
19 | )
20 | ;; player position
21 | '(1 0)
22 | ;; kitty position
23 | '(5 7)
24 | )
25 | )
26 |
27 | (defparameter *maze-2*
28 | (list
29 | #2A(
30 | (1 1 1 1 1 1 1 1 1 1 1 1 1)
31 | (0 0 1 0 0 0 0 0 0 0 0 0 1)
32 | (1 0 1 0 1 1 1 1 1 1 1 0 1)
33 | (1 0 1 0 0 0 0 0 1 0 0 0 1)
34 | (1 0 1 0 1 1 1 1 1 0 1 0 1)
35 | (1 0 1 0 1 0 0 0 1 0 1 0 1)
36 | (1 0 1 1 1 0 1 0 1 0 1 1 1)
37 | (1 0 1 0 0 0 1 0 1 0 0 0 1)
38 | (1 0 1 0 1 1 1 0 1 1 1 0 1)
39 | (1 0 0 0 1 0 1 0 0 0 0 0 1)
40 | (1 1 1 0 1 0 1 1 1 1 1 0 1)
41 | (1 0 0 0 1 0 0 0 0 0 0 0 1)
42 | (1 1 1 1 1 1 1 1 1 1 1 0 1)
43 | )
44 | ;; player position
45 | '(1 0)
46 | ;; kitty position
47 | '(5 3)
48 | ))
49 |
50 |
51 | (defparameter *maze-3*
52 | (list
53 | #2A(
54 | (1 1 1 1 1 1 1 1 1 1 1 1 1)
55 | (0 0 1 0 0 0 0 0 0 0 0 0 1)
56 | (1 0 1 1 1 0 1 1 1 1 1 0 1)
57 | (1 0 0 0 1 0 0 0 0 0 1 0 1)
58 | (1 1 1 0 1 0 1 1 1 0 1 0 1)
59 | (1 0 0 0 1 0 0 0 1 0 1 0 1)
60 | (1 0 1 1 1 1 1 1 1 0 1 0 1)
61 | (1 0 1 0 0 0 0 0 0 0 1 0 1)
62 | (1 0 1 0 1 0 1 1 1 1 1 0 1)
63 | (1 0 1 0 1 0 1 0 0 0 0 0 1)
64 | (1 0 1 1 1 0 1 0 1 1 1 1 1)
65 | (1 0 0 0 0 0 1 0 0 0 0 0 1)
66 | (1 1 1 1 1 1 1 1 1 1 1 0 1)
67 | )
68 | ;; player position
69 | '(1 0)
70 | ;; kitty position
71 | '(9 3)
72 | ))
73 |
74 | (defparameter *maze-4*
75 | (list
76 | #2A(
77 | (1 1 1 1 1 1 1 1 1 1 1 1 1)
78 | (0 0 1 0 0 0 0 0 0 0 0 0 1)
79 | (1 0 1 1 1 1 1 0 1 1 1 0 1)
80 | (1 0 0 0 0 0 1 0 1 0 1 0 1)
81 | (1 1 1 1 1 0 1 0 1 0 1 0 1)
82 | (1 0 0 0 1 0 0 0 1 0 0 0 1)
83 | (1 0 1 0 1 1 1 1 1 0 1 1 1)
84 | (1 0 1 0 0 0 0 0 1 0 1 0 1)
85 | (1 0 1 1 1 1 1 1 1 0 1 0 1)
86 | (1 0 1 0 0 0 0 0 1 0 1 0 1)
87 | (1 0 1 0 1 1 1 0 1 0 1 0 1)
88 | (1 0 0 0 0 0 1 0 0 0 0 0 1)
89 | (1 1 1 1 1 1 1 1 1 1 1 0 1)
90 | )
91 | ;; player position
92 | '(1 0)
93 | ;; kitty position
94 | '(11 5)
95 | ))
96 |
97 | (defparameter *maze-data-list* (list *maze-1* *maze-2* *maze-3* *maze-4*))
98 |
--------------------------------------------------------------------------------
/Spring/day-4/maze-data.lisp:
--------------------------------------------------------------------------------
1 | (in-package :calm)
2 |
3 | (defparameter *maze-1*
4 | (list
5 | #2A(
6 | (1 1 1 1 1 1 1 1 1 1 1 1 1)
7 | (0 0 1 0 0 0 1 0 0 0 1 0 1)
8 | (1 0 1 0 1 0 1 1 1 0 1 0 1)
9 | (1 0 1 0 1 0 0 0 0 0 1 0 1)
10 | (1 0 1 0 1 1 1 1 1 0 1 0 1)
11 | (1 0 1 0 0 0 0 0 1 0 0 0 1)
12 | (1 0 1 1 1 0 1 1 1 0 1 0 1)
13 | (1 0 0 0 1 0 0 0 1 0 1 0 1)
14 | (1 1 1 0 1 1 1 0 1 0 1 0 1)
15 | (1 0 0 0 1 0 0 0 1 0 1 0 1)
16 | (1 0 1 1 1 0 1 1 1 0 1 0 1)
17 | (1 0 0 0 0 0 1 0 0 0 1 0 1)
18 | (1 1 1 1 1 1 1 1 1 1 1 0 1)
19 | )
20 | ;; player position
21 | '(1 0)
22 | ;; kitty position
23 | '((5 7) (11 7) (1 7))
24 | )
25 | )
26 |
27 | (defparameter *maze-2*
28 | (list
29 | #2A(
30 | (1 1 1 1 1 1 1 1 1 1 1 1 1)
31 | (0 0 1 0 0 0 0 0 0 0 0 0 1)
32 | (1 0 1 0 1 1 1 1 1 1 1 0 1)
33 | (1 0 1 0 0 0 0 0 1 0 0 0 1)
34 | (1 0 1 0 1 1 1 1 1 0 1 0 1)
35 | (1 0 1 0 1 0 0 0 1 0 1 0 1)
36 | (1 0 1 1 1 0 1 0 1 0 1 1 1)
37 | (1 0 1 0 0 0 1 0 1 0 0 0 1)
38 | (1 0 1 0 1 1 1 0 1 1 1 0 1)
39 | (1 0 0 0 1 0 1 0 0 0 0 0 1)
40 | (1 1 1 0 1 0 1 1 1 1 1 0 1)
41 | (1 0 0 0 1 0 0 0 0 0 0 0 1)
42 | (1 1 1 1 1 1 1 1 1 1 1 0 1)
43 | )
44 | ;; player position
45 | '(1 0)
46 | ;; kitty position
47 | '((5 3) (3 7) (11 1) (9 5))
48 | ))
49 |
50 |
51 | (defparameter *maze-3*
52 | (list
53 | #2A(
54 | (1 1 1 1 1 1 1 1 1 1 1 1 1)
55 | (0 0 1 0 0 0 0 0 0 0 0 0 1)
56 | (1 0 1 1 1 0 1 1 1 1 1 0 1)
57 | (1 0 0 0 1 0 0 0 0 0 1 0 1)
58 | (1 1 1 0 1 0 1 1 1 0 1 0 1)
59 | (1 0 0 0 1 0 0 0 1 0 1 0 1)
60 | (1 0 1 1 1 1 1 1 1 0 1 0 1)
61 | (1 0 1 0 0 0 0 0 0 0 1 0 1)
62 | (1 0 1 0 1 0 1 1 1 1 1 0 1)
63 | (1 0 1 0 1 0 1 0 0 0 0 0 1)
64 | (1 0 1 1 1 0 1 0 1 1 1 1 1)
65 | (1 0 0 0 0 0 1 0 0 0 0 0 1)
66 | (1 1 1 1 1 1 1 1 1 1 1 0 1)
67 | )
68 | ;; player position
69 | '(1 0)
70 | ;; kitty position
71 | '((9 3) (5 7))
72 | ))
73 |
74 | (defparameter *maze-4*
75 | (list
76 | #2A(
77 | (1 1 1 1 1 1 1 1 1 1 1 1 1)
78 | (0 0 1 0 0 0 0 0 0 0 0 0 1)
79 | (1 0 1 1 1 1 1 0 1 1 1 0 1)
80 | (1 0 0 0 0 0 1 0 1 0 1 0 1)
81 | (1 1 1 1 1 0 1 0 1 0 1 0 1)
82 | (1 0 0 0 1 0 0 0 1 0 0 0 1)
83 | (1 0 1 0 1 1 1 1 1 0 1 1 1)
84 | (1 0 1 0 0 0 0 0 1 0 1 0 1)
85 | (1 0 1 1 1 1 1 1 1 0 1 0 1)
86 | (1 0 1 0 0 0 0 0 1 0 1 0 1)
87 | (1 0 1 0 1 1 1 0 1 0 1 0 1)
88 | (1 0 0 0 0 0 1 0 0 0 0 0 1)
89 | (1 1 1 1 1 1 1 1 1 1 1 0 1)
90 | )
91 | ;; player position
92 | '(1 0)
93 | ;; kitty position
94 | '((11 5) (7 7) (3 9))
95 | ))
96 |
97 | (defparameter *maze-data-list* (list *maze-1* *maze-2* *maze-3* *maze-4*))
98 |
--------------------------------------------------------------------------------
/Spring/day-1/fonts/fonts.conf:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | Default configuration file
10 | /usr/share/fonts
11 | /System/Library/Fonts
12 | /Library/Fonts
13 | ~/Library/Fonts
14 | /System/Library/Assets/com_apple_MobileAsset_Font5
15 | fonts
16 |
17 | ~/.fonts
18 |
19 | ./
20 |
21 | ./fonts
22 |
23 |
26 |
27 |
28 | mono
29 |
30 |
31 | monospace
32 |
33 |
34 |
35 |
38 |
39 |
40 | sans serif
41 |
42 |
43 | sans-serif
44 |
45 |
46 |
47 |
50 |
51 |
52 | sans
53 |
54 |
55 | sans-serif
56 |
57 |
58 |
59 |
62 | conf.d
63 |
64 |
65 |
66 | /usr/local/var/cache/fontconfig
67 | fontconfig
68 |
69 | ~/.fontconfig
70 |
71 |
72 |
75 |
76 | 30
77 |
78 |
79 |
80 |
81 |
--------------------------------------------------------------------------------
/Spring/day-2/fonts/fonts.conf:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | Default configuration file
10 | /usr/share/fonts
11 | /System/Library/Fonts
12 | /Library/Fonts
13 | ~/Library/Fonts
14 | /System/Library/Assets/com_apple_MobileAsset_Font5
15 | fonts
16 |
17 | ~/.fonts
18 |
19 | ./
20 |
21 | ./fonts
22 |
23 |
26 |
27 |
28 | mono
29 |
30 |
31 | monospace
32 |
33 |
34 |
35 |
38 |
39 |
40 | sans serif
41 |
42 |
43 | sans-serif
44 |
45 |
46 |
47 |
50 |
51 |
52 | sans
53 |
54 |
55 | sans-serif
56 |
57 |
58 |
59 |
62 | conf.d
63 |
64 |
65 |
66 | /usr/local/var/cache/fontconfig
67 | fontconfig
68 |
69 | ~/.fontconfig
70 |
71 |
72 |
75 |
76 | 30
77 |
78 |
79 |
80 |
81 |
--------------------------------------------------------------------------------
/Spring/day-3/fonts/fonts.conf:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | Default configuration file
10 | /usr/share/fonts
11 | /System/Library/Fonts
12 | /Library/Fonts
13 | ~/Library/Fonts
14 | /System/Library/Assets/com_apple_MobileAsset_Font5
15 | fonts
16 |
17 | ~/.fonts
18 |
19 | ./
20 |
21 | ./fonts
22 |
23 |
26 |
27 |
28 | mono
29 |
30 |
31 | monospace
32 |
33 |
34 |
35 |
38 |
39 |
40 | sans serif
41 |
42 |
43 | sans-serif
44 |
45 |
46 |
47 |
50 |
51 |
52 | sans
53 |
54 |
55 | sans-serif
56 |
57 |
58 |
59 |
62 | conf.d
63 |
64 |
65 |
66 | /usr/local/var/cache/fontconfig
67 | fontconfig
68 |
69 | ~/.fontconfig
70 |
71 |
72 |
75 |
76 | 30
77 |
78 |
79 |
80 |
81 |
--------------------------------------------------------------------------------
/Spring/day-4/fonts/fonts.conf:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | Default configuration file
10 | /usr/share/fonts
11 | /System/Library/Fonts
12 | /Library/Fonts
13 | ~/Library/Fonts
14 | /System/Library/Assets/com_apple_MobileAsset_Font5
15 | fonts
16 |
17 | ~/.fonts
18 |
19 | ./
20 |
21 | ./fonts
22 |
23 |
26 |
27 |
28 | mono
29 |
30 |
31 | monospace
32 |
33 |
34 |
35 |
38 |
39 |
40 | sans serif
41 |
42 |
43 | sans-serif
44 |
45 |
46 |
47 |
50 |
51 |
52 | sans
53 |
54 |
55 | sans-serif
56 |
57 |
58 |
59 |
62 | conf.d
63 |
64 |
65 |
66 | /usr/local/var/cache/fontconfig
67 | fontconfig
68 |
69 | ~/.fontconfig
70 |
71 |
72 |
75 |
76 | 30
77 |
78 |
79 |
80 |
81 |
--------------------------------------------------------------------------------
/Spring/day-5/fonts/fonts.conf:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | Default configuration file
10 | /usr/share/fonts
11 | /System/Library/Fonts
12 | /Library/Fonts
13 | ~/Library/Fonts
14 | /System/Library/Assets/com_apple_MobileAsset_Font5
15 | fonts
16 |
17 | ~/.fonts
18 |
19 | ./
20 |
21 | ./fonts
22 |
23 |
26 |
27 |
28 | mono
29 |
30 |
31 | monospace
32 |
33 |
34 |
35 |
38 |
39 |
40 | sans serif
41 |
42 |
43 | sans-serif
44 |
45 |
46 |
47 |
50 |
51 |
52 | sans
53 |
54 |
55 | sans-serif
56 |
57 |
58 |
59 |
62 | conf.d
63 |
64 |
65 |
66 | /usr/local/var/cache/fontconfig
67 | fontconfig
68 |
69 | ~/.fontconfig
70 |
71 |
72 |
75 |
76 | 30
77 |
78 |
79 |
80 |
81 |
--------------------------------------------------------------------------------
/Spring/day-6/fonts/fonts.conf:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | Default configuration file
10 | /usr/share/fonts
11 | /System/Library/Fonts
12 | /Library/Fonts
13 | ~/Library/Fonts
14 | /System/Library/Assets/com_apple_MobileAsset_Font5
15 | fonts
16 |
17 | ~/.fonts
18 |
19 | ./
20 |
21 | ./fonts
22 |
23 |
26 |
27 |
28 | mono
29 |
30 |
31 | monospace
32 |
33 |
34 |
35 |
38 |
39 |
40 | sans serif
41 |
42 |
43 | sans-serif
44 |
45 |
46 |
47 |
50 |
51 |
52 | sans
53 |
54 |
55 | sans-serif
56 |
57 |
58 |
59 |
62 | conf.d
63 |
64 |
65 |
66 | /usr/local/var/cache/fontconfig
67 | fontconfig
68 |
69 | ~/.fontconfig
70 |
71 |
72 |
75 |
76 | 30
77 |
78 |
79 |
80 |
81 |
--------------------------------------------------------------------------------
/Spring/afterwards/fonts/fonts.conf:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | Default configuration file
10 | /usr/share/fonts
11 | /System/Library/Fonts
12 | /Library/Fonts
13 | ~/Library/Fonts
14 | /System/Library/Assets/com_apple_MobileAsset_Font5
15 | fonts
16 |
17 | ~/.fonts
18 |
19 | ./
20 |
21 | ./fonts
22 |
23 |
26 |
27 |
28 | mono
29 |
30 |
31 | monospace
32 |
33 |
34 |
35 |
38 |
39 |
40 | sans serif
41 |
42 |
43 | sans-serif
44 |
45 |
46 |
47 |
50 |
51 |
52 | sans
53 |
54 |
55 | sans-serif
56 |
57 |
58 |
59 |
62 | conf.d
63 |
64 |
65 |
66 | /usr/local/var/cache/fontconfig
67 | fontconfig
68 |
69 | ~/.fontconfig
70 |
71 |
72 |
75 |
76 | 30
77 |
78 |
79 |
80 |
81 |
--------------------------------------------------------------------------------
/Spring/day-1/maze2.lisp:
--------------------------------------------------------------------------------
1 | (in-package #:calm)
2 | (setq *random-state* (make-random-state t))
3 | ;; https://rosettacode.org/wiki/Knuth_shuffle#Common_Lisp
4 | (defun nshuffle (sequence)
5 | (loop for i from (length sequence) downto 2
6 | do (rotatef (elt sequence (random i))
7 | (elt sequence (1- i))))
8 | sequence)
9 |
10 | (defparameter *maze-width* 13)
11 | (defparameter *maze-height* 13)
12 |
13 | (defparameter maze nil)
14 |
15 | (defun reset-maze ()
16 | ;; in the beginning, there was a piece of flat land, each plot has the initial value 1, means it's solid.
17 | (setf maze (make-array (list *maze-width* *maze-height*) :initial-element 1))
18 | ;; then, we dig an entrance in the upper left corner,
19 | ;; because we need the left wall to exist, so we start from (1 0) instead of (0 0)
20 | (setf (aref maze 1 0) 0)
21 | ;; and then, we dig one step further
22 | (setf (aref maze 1 1) 0)
23 | ;; add the escape
24 | (setf (aref maze (- *maze-width* 1) (- *maze-height* 2)) 0)
25 | )
26 |
27 | (reset-maze)
28 |
29 |
30 |
31 | ;; now, from this step, let's release the maze digger
32 | ;; the digger will randomly dig through this piece of flat land until no plot to dig
33 | ;; how to determine if a plot is digable?
34 | ;; - if a plot has already been dug, i.e. it's value is 0
35 | ;; - if a plot is the outer wall, i.e. (or (= x *maze-width*) (= y *maze-height*) (= x 0) (= y 0))
36 | ;; how to determine the next digging direction?
37 | ;; - we randomly pick it
38 | ;; how to guarantee that we will dig all the digable plots?
39 | ;; - at the beginning, we release 4 maze digger for four directions, their priority is randomly set
40 | ;; - this will guarantee that all four directions are taken cared of,
41 | ;; ---- then we recursively release 4 maze digger for four directions for every subsequent plot,
42 | ;; ---- their priority is also randomly set
43 | ;; -------- ......
44 | ;; - since we are not using multiple-threads, there will be no conflicts, only some later diggers will find no plot to dig
45 | ;; how to guarantee that we don't dig through the wall?
46 | ;; - for one same direction, we dig twice at a time
47 | ;; - if both of them are digable, then we do it,
48 | ;; - otherwise we abandon this direction
49 |
50 | (defun dig-maze (x y)
51 | ;; randomize
52 | ;; we don't mess with the current plot,
53 | ;; only we should dig around all four plots near the current plot
54 | ;; note that the directions are randomized, so random direction will be dug first
55 | (let ((directions (nshuffle '(1 2 3 4))))
56 | ;; (format t "directions: ~A~%" directions)
57 | (loop
58 | for direction in directions
59 | for x-direction = (case direction (1 0) (2 0) (3 -1) (4 1))
60 | for y-direction = (case direction (1 -1) (2 1) (3 0) (4 0))
61 | for x1 = (+ x x-direction)
62 | for y1 = (+ y y-direction)
63 | for x2 = (+ x1 x-direction)
64 | for y2 = (+ y1 y-direction)
65 | do
66 | ;; test if all these two plots are digable
67 | (when (and
68 | (> x2 0) (> y2 0) ;; don't dig the outer wall
69 | (< x2 *maze-width*) (< y2 *maze-height*) ;; don't dig the outer wall
70 | (= (aref maze x1 y1) 1) ;; must be solid
71 | (= (aref maze x2 y2) 1)) ;; must be solid
72 | ;; now dig
73 | (setf (aref maze x1 y1) 0)
74 | (setf (aref maze x2 y2) 0)
75 | ;; and set new diggers for the next plots
76 | (dig-maze x2 y2)
77 | )
78 | ))
79 | )
80 |
81 | ;; (trace dig-maze)
82 |
83 | ;; let's do it
84 | (dig-maze 1 1)
85 |
86 | ;; now show the maze
87 | (defun show-maze-ascii ()
88 | (loop
89 | for x from 0 to (1- *maze-width*)
90 | do
91 | (loop
92 | for y from 0 to (1- *maze-height*)
93 | ;; do (format t "~A,~A" x y)
94 | if (= (aref maze x y) 1)
95 | do (princ "[]")
96 | else do
97 | (princ " "))
98 | (terpri)))
99 |
--------------------------------------------------------------------------------
/.github/workflows/spring.yml:
--------------------------------------------------------------------------------
1 | name: spring
2 |
3 | permissions:
4 | contents: write
5 |
6 | on:
7 | push:
8 | tags:
9 | - "spring-*.*.*"
10 | - "test-spring-*"
11 |
12 | jobs:
13 | Web:
14 | runs-on: ubuntu-20.04
15 |
16 | steps:
17 | - uses: actions/checkout@v3
18 |
19 | - name: Build
20 | working-directory: ./Spring/afterwards
21 | run: |
22 | set -x
23 | curl -L -o calm.tgz https://github.com/VitoVan/calm/releases/download/1.3.2/calm.tgz
24 | mkdir calm
25 | tar xvf calm.tgz
26 | ls -lah calm
27 | export PATH=$PATH:$(pwd)/calm/
28 | # we don't need ogg in wasm,
29 | # since we are using web audio
30 | rm assets/*.ogg
31 | export APP_NAME=Maze
32 | # we need to rebuild wasm,
33 | # since we are using custom fonts
34 | export REBUILD_WASM_P=yes
35 | calm publish-web
36 | # restore audio files,
37 | # copy them into web folder
38 | git restore assets/*.ogg
39 | cp -R assets ./web/assets
40 | ls -lah .
41 | zip -r -9 ${APP_NAME}-web.zip ./web
42 | cp *.zip ../../
43 | - name: GH Release
44 | uses: softprops/action-gh-release@v0.1.14
45 | with:
46 | draft: true
47 | files: |
48 | *-web.zip
49 | Linux:
50 | runs-on: ubuntu-20.04
51 |
52 | steps:
53 | - uses: actions/checkout@v3
54 |
55 | - name: Build
56 | working-directory: ./Spring/afterwards
57 | run: |
58 | set -x
59 | curl -L -o calm.tgz https://github.com/VitoVan/calm/releases/download/1.3.2/calm.tgz
60 | mkdir calm
61 | tar xvf calm.tgz
62 | ls -lah calm
63 | export PATH=$PATH:$(pwd)/calm/
64 | export APP_NAME=Maze
65 | export APP_ICON="$(pwd)/images/app.png"
66 | calm publish
67 | ls -lah .
68 | mv *.AppImage ../../
69 | - name: GH Release
70 | uses: softprops/action-gh-release@v0.1.14
71 | with:
72 | draft: true
73 | files: |
74 | *.AppImage
75 | macOS:
76 | runs-on: ${{ matrix.os }}
77 |
78 | strategy:
79 | matrix:
80 | os: [macos-12, macos-13, macos-14]
81 |
82 | env:
83 | CI_MATRIX_OS: ${{ matrix.os }}
84 |
85 | steps:
86 | - uses: actions/checkout@v3
87 |
88 | - name: Build
89 | working-directory: ./Spring/afterwards
90 | run: |
91 | set -x
92 | export OS_SUBFIX=".${CI_MATRIX_OS}"
93 | curl -L -o calm.dmg https://github.com/VitoVan/calm/releases/download/1.3.2/calm${OS_SUBFIX}.dmg
94 | hdiutil attach calm.dmg
95 | cp -R "/Volumes/Calm - CALM/Calm.app/Contents/MacOS/" calm
96 | ls -lah calm
97 | rm calm.dmg
98 | export PATH=$PATH:$(pwd)/calm/
99 | export APP_ICON="$(pwd)/images/app.icns"
100 | export DMG_ICON="$(pwd)/images/dmg.icns"
101 | export APP_VERSION=0.0.3
102 | export APP_ID=com.vitovan.maze
103 | export APP_NAME=Maze
104 | calm publish
105 | ls -lah .
106 | mv *.dmg ../../Maze${OS_SUBFIX}.dmg
107 | - name: GH Release
108 | uses: softprops/action-gh-release@v0.1.14
109 | with:
110 | draft: true
111 | files: |
112 | *.dmg
113 | Windows:
114 | runs-on: windows-2019
115 |
116 | steps:
117 | - uses: actions/checkout@v3
118 |
119 | - uses: msys2/setup-msys2@v2
120 |
121 | - name: Build
122 | working-directory: ./Spring/afterwards
123 | shell: msys2 {0}
124 | run: |
125 | set -x
126 | pacman -S --noconfirm --needed unzip
127 | curl -L -o calm.zip https://github.com/VitoVan/calm/releases/download/1.3.2/calm.zip
128 | unzip calm.zip
129 | ls -lah calm
130 | export PATH=$PATH:$(pwd)/calm/
131 | export APP_ICON="$(pwd)/images/app.ico"
132 | export APP_NAME=Maze
133 | calm publish
134 | mv ./*-Installer.exe ../../
135 | ls -lah .
136 | - name: GH Release
137 | uses: softprops/action-gh-release@v0.1.14
138 | with:
139 | draft: true
140 | files: |
141 | *.exe
142 |
--------------------------------------------------------------------------------
/Spring/day-1/canvas.lisp:
--------------------------------------------------------------------------------
1 | (in-package #:calm)
2 |
3 | ;;
4 | ;; CALM version check
5 | ;; version check won't work on JSCL, since the lack of ASDF
6 | ;;
7 | #-jscl
8 | (let ((required-version "0.1.2")
9 | (calm-version (slot-value (asdf:find-system 'calm) 'asdf:version)))
10 | (when (uiop:version< calm-version required-version)
11 | (format t
12 | "Sorry, this is built on CALM ~A, older version (current: ~A) of CALM won't work.~%"
13 | required-version calm-version)
14 | (uiop:quit)))
15 |
16 |
17 | ;;
18 | ;; the swank server is for debugging, for usage please check
19 | ;; Emacs:
20 | ;; https://slime.common-lisp.dev/
21 | ;; Visual Studio Code
22 | ;; https://lispcookbook.github.io/cl-cookbook/vscode-alive.html
23 | ;;
24 | ;; uncomment the following line to enable SWANK Server
25 | (unless (str:starts-with? "dist" (uiop:getenv "CALM_CMD")) (swank:create-server))
26 |
27 | ;;
28 | ;; by default, the screensaver is disabled,
29 | ;; if you want to enable screensaver,
30 | ;; please uncomment the following line
31 | ;;
32 | (setf (uiop:getenv "SDL_VIDEO_ALLOW_SCREENSAVER") "1")
33 |
34 | ;;
35 | ;; setting window properties, for more of this, please check
36 | ;; https://github.com/VitoVan/calm/blob/main/src/config.lisp
37 | ;;
38 | (setf *calm-window-width* 1024)
39 | (setf *calm-window-height* 768)
40 | (setf *calm-window-title* "Save Pupu")
41 |
42 | (u:load-from-app "maze2.lisp")
43 |
44 | (defparameter *scale-factor* (/ *calm-window-width* (+ *maze-width* 8)))
45 |
46 | (defparameter *player-start-index* (random 20))
47 | (defparameter *player-position* nil)
48 | (defparameter *pupu-start-index* (+ *player-start-index* 5))
49 | (defparameter *pupu-position* nil)
50 |
51 | (defparameter *player-color* '(0 0.35 0.59))
52 | (defparameter *pupu-color* '(0.94 0.87 0.47))
53 |
54 | (defun on-keydown (key)
55 | (when (c:keq key :scancode-return)
56 | (reset-maze)
57 | (dig-maze 1 1)
58 | (setf
59 | *player-start-index* (random 20)
60 | *player-position* nil
61 | *pupu-start-index* (+ *player-start-index* 5)
62 | *pupu-position* nil
63 | ))
64 | (let ((next-player-position (copy-list *player-position*)))
65 | (cond
66 | ((c:keq key :scancode-left :scancode-h)
67 | (decf (cadr next-player-position)))
68 | ((c:keq key :scancode-right :scancode-l)
69 | (incf (cadr next-player-position)))
70 | ((c:keq key :scancode-up :scancode-k)
71 | (decf (car next-player-position)))
72 | ((c:keq key :scancode-down :scancode-j)
73 | (incf (car next-player-position))))
74 | (ignore-errors
75 | (when (= (aref maze (car next-player-position) (cadr next-player-position)) 0)
76 | (setf *player-position* next-player-position)))))
77 |
78 | (defun draw-maze ()
79 | (show-maze-ascii)
80 | (c:set-source-rgb 0 0 0)
81 | (c:set-line-width 1)
82 | (let ((empty-plot-index 0))
83 | (loop
84 | for x from 0 to (1- *maze-width*)
85 | do
86 | (loop
87 | for y from 0 to (1- *maze-height*)
88 | ;; cairo has different coordinate system with Array, x and y are reversed
89 | for cx = (* (+ y 4) *scale-factor*)
90 | for cy = (* (+ x 1) *scale-factor*)
91 | do
92 | (c:set-source-rgb 0 0 0)
93 | (c:rectangle cx cy *scale-factor* *scale-factor*)
94 | (c:stroke-preserve)
95 | if (= (aref maze x y) 1) ;; wall
96 | do
97 | (c:set-source-rgb 0 0 0)
98 | (c:fill-path)
99 | else ;; empty plot
100 | do
101 | (cond
102 | ((or
103 | ;; this is the initial location for the player
104 | (and (null *player-position*) (= empty-plot-index *player-start-index*))
105 | ;; this is the current location for the player
106 | (and *player-position* (= x (car *player-position*)) (= y (cadr *player-position*)))
107 | )
108 | (when (null *player-position*)
109 | (setf *player-position* (list x y)))
110 | (apply #'c:set-source-rgb *player-color*)
111 | (c:new-path)
112 | (c:arc (+ cx (/ *scale-factor* 2)) (+ cy (/ *scale-factor* 2)) (- (/ *scale-factor* 2) 4) 0 (* 2 pi))
113 | (c:fill-path))
114 | ((or
115 | ;; this is the initial location for pupu
116 | (and (null *pupu-position*) (= empty-plot-index *pupu-start-index*))
117 | ;; this is the current location for pupu
118 | (and *pupu-position* (= x (car *pupu-position*)) (= y (cadr *pupu-position*)))
119 | )
120 | (apply #'c:set-source-rgb *pupu-color*)
121 | (c:new-path)
122 | (c:arc (+ cx (/ *scale-factor* 2)) (+ cy (/ *scale-factor* 2)) (- (/ *scale-factor* 2) 4) 0 (* 2 pi))
123 | (c:fill-path))
124 | (t (c:set-source-rgb 0 0 0)
125 | (c:stroke)))
126 | (incf empty-plot-index)
127 | )
128 | ))
129 | )
130 |
131 | (defun draw-player ()
132 | (let ((player-plot-index (+ 5 (random 5)))
133 | (plot-index 0))
134 | (loop
135 | for x from 0 to (1- *maze-width*)
136 | do
137 | (loop
138 | for y from 0 to (1- *maze-height*)
139 | ;; cairo has different coordinate system with Array, x and y are reversed
140 | for xc = (* (+ y 4) *scale-factor*)
141 | for yc = (* (+ x 1) *scale-factor*)
142 | when (= (aref maze x y) 0)
143 | do
144 | (incf plot-index)
145 | (when (= plot-index player-plot-index)
146 | ;; (c:save)
147 | (c:set-source-rgb 255 0 0)
148 | ;; (c:translate xc yc)
149 | ;; (c:scale *scale-factor* *scale-factor*)
150 | (format t "arc: ~A,~A : ~A,~A~%" xc yc x y)
151 | (c:arc (- xc 20) (- yc 20) 20 0 (* 2 pi))
152 | ;; (c:arc 0 0 1 0 (* 2 pi))
153 | (c:fill-path)
154 | ;; (c:restore)
155 | (return))
156 | )
157 | )))
158 |
159 | (defun draw ()
160 | (c:set-source-rgb 255 255 255)
161 | (c:paint)
162 | (draw-maze)
163 | )
164 |
--------------------------------------------------------------------------------
/Spring/day-2/canvas.lisp:
--------------------------------------------------------------------------------
1 | (in-package #:calm)
2 |
3 | ;;
4 | ;; CALM version check
5 | ;; version check won't work on JSCL, since the lack of ASDF
6 | ;;
7 | #-jscl
8 | (let ((required-version "0.1.2")
9 | (calm-version (slot-value (asdf:find-system 'calm) 'asdf:version)))
10 | (when (uiop:version< calm-version required-version)
11 | (format t
12 | "Sorry, this is built on CALM ~A, older version (current: ~A) of CALM won't work.~%"
13 | required-version calm-version)
14 | (uiop:quit)))
15 |
16 |
17 | ;;
18 | ;; the swank server is for debugging, for usage please check
19 | ;; Emacs:
20 | ;; https://slime.common-lisp.dev/
21 | ;; Visual Studio Code
22 | ;; https://lispcookbook.github.io/cl-cookbook/vscode-alive.html
23 | ;;
24 | ;; uncomment the following line to enable SWANK Server
25 | (unless (str:starts-with? "dist" (uiop:getenv "CALM_CMD")) (swank:create-server))
26 |
27 | ;;
28 | ;; by default, the screensaver is disabled,
29 | ;; if you want to enable screensaver,
30 | ;; please uncomment the following line
31 | ;;
32 | (setf (uiop:getenv "SDL_VIDEO_ALLOW_SCREENSAVER") "1")
33 |
34 | ;;
35 | ;; setting window properties, for more of this, please check
36 | ;; https://github.com/VitoVan/calm/blob/main/src/config.lisp
37 | ;;
38 | (setf *calm-window-width* 600)
39 | (setf *calm-window-height* 600)
40 | (setf *calm-window-title* "Save Kitties")
41 |
42 | (u:load-from-app "maze-data.lisp")
43 |
44 | ;; https://rosettacode.org/wiki/Knuth_shuffle#Common_Lisp
45 | (defun nshuffle (sequence)
46 | (loop for i from (length sequence) downto 2
47 | do (rotatef (elt sequence (random i))
48 | (elt sequence (1- i))))
49 | sequence)
50 |
51 | (defparameter *maze-index* nil)
52 | (defparameter *maze-data* nil)
53 | (defparameter *maze* nil)
54 | (defparameter *player-position* nil)
55 | (defparameter *kitty-position* nil)
56 | (defparameter *kitty-collected* nil)
57 |
58 | (defparameter *player-color* '(0 0.35 0.59))
59 | (defparameter *kitty-color* '(0.94 0.87 0.47))
60 | (defparameter *player-with-kitty-color* '(0.89 0.12 0.17))
61 | (defparameter *maze-color-solid* '(0.83 0.82 0.84))
62 | (defparameter *maze-color-border* '(0.6 0.6 0.6))
63 | (defparameter *win* 0)
64 | (defparameter *win-pause* nil)
65 | (defparameter *steps* 0)
66 | (defparameter *game-over* nil)
67 |
68 | (defun init-maze (&optional (maze-index 0))
69 | (when (> maze-index 3)
70 | (nshuffle *maze-data-list*))
71 | (setf
72 | *maze-index* (if (> maze-index 3) 0 maze-index)
73 | *maze-data* (nth *maze-index* *maze-data-list*)
74 | *maze* (nth 0 *maze-data*)
75 | *player-position* (nth 1 *maze-data*)
76 | *kitty-position* (nth 2 *maze-data*)
77 | *kitty-collected* nil))
78 |
79 | (init-maze)
80 |
81 | (defun on-keydown (key)
82 | (when (c:keq key :scancode-q :scancode-escape)
83 | (setf *game-over* t))
84 |
85 | (when (and *game-over* (c:keq key :scancode-return))
86 | (setf
87 | *game-over* nil
88 | *win* 0
89 | *steps* 0)
90 | (init-maze 0))
91 |
92 | (when (and *win-pause* (c:keq key :scancode-return))
93 | (init-maze (1+ *maze-index*))
94 | (setf *win-pause* nil))
95 |
96 | (unless *win-pause*
97 | (let ((next-player-position (copy-list *player-position*)))
98 | (cond
99 | ((c:keq key :scancode-left :scancode-h)
100 | (decf (car next-player-position)))
101 | ((c:keq key :scancode-right :scancode-l)
102 | (incf (car next-player-position)))
103 | ((c:keq key :scancode-up :scancode-k)
104 | (decf (cadr next-player-position)))
105 | ((c:keq key :scancode-down :scancode-j)
106 | (incf (cadr next-player-position))))
107 | (ignore-errors
108 | (when (= (aref *maze* (car next-player-position) (cadr next-player-position)) 0)
109 | (setf *player-position* next-player-position)
110 | (incf *steps*))))
111 |
112 | (when (equalp *player-position* '(12 11))
113 | (incf *win*)
114 | (setf *win-pause* t)))
115 |
116 | (format t "current player position: ~A~%" *player-position*))
117 |
118 | (defun draw-kitty ()
119 | (c:save)
120 | (c:set-line-width 4)
121 | (c:set-line-cap :round)
122 | ;; body
123 | (c:move-to 0 0)
124 | (c:curve-to 10 10 20 10 30 0)
125 | (c:curve-to 60 50 30 45 30 45)
126 | (c:line-to 0 45)
127 | (c:curve-to -10 45 -20 35 0 0)
128 | (c:stroke)
129 | ;; eyes
130 | (c:arc 8 20 3 0 (* 2 pi))
131 | (c:arc 24 20 3 0 (* 2 pi))
132 | (c:fill-path)
133 | ;; smile
134 | (when *kitty-collected*
135 | (c:move-to 8 34)
136 | (c:curve-to 14 38 20 38 24 34)
137 | (c:stroke))
138 | ;; tail
139 | (c:move-to 0 45)
140 | (c:curve-to -10 45 -15 45 -20 40)
141 | (c:stroke)
142 | (c:restore))
143 |
144 | (defun draw-player ()
145 | (c:save)
146 | (c:set-line-width 4)
147 | (c:set-line-cap :round)
148 | ;; body
149 | (c:arc 16 20 28 0 (* 2 pi))
150 | (c:stroke)
151 | ;; eyes
152 | (c:arc 8 14 3 0 (* 2 pi))
153 | (c:arc 24 14 3 0 (* 2 pi))
154 | (c:fill-path)
155 | ;; nose
156 | (c:move-to 8 34)
157 | (c:line-to 24 34)
158 | (c:stroke)
159 | (c:restore))
160 |
161 | (defun draw-result ()
162 | (c:set-line-width 4)
163 | (apply #'c:set-source-rgba (append *player-color* (list (if *game-over* 1 0.5))))
164 | (c:paint)
165 | (apply #'c:set-source-rgb *player-with-kitty-color*)
166 | (c:rrectangle 200 380 200 30 :radius 15)
167 | (c:stroke-preserve)
168 | (c:set-source-rgb 1 1 1)
169 | (c:fill-path)
170 | (apply #'c:set-source-rgb *player-color*)
171 | (c:select-font-face "Open Sans" :normal :normal)
172 | (c:set-font-size 24)
173 | (c:move-to 274 404)
174 | (c:show-text (str:pad-left 4 (write-to-string *win*) :pad-char #\0))
175 | (c:fill-path)
176 | (c:save)
177 | (apply #'c:set-source-rgb *player-with-kitty-color*)
178 | (c:arc 300 300 50 0 (* 2 pi))
179 | (c:stroke-preserve)
180 | (c:set-source-rgb 1 1 1)
181 | (c:fill-path)
182 | (apply #'c:set-source-rgb *player-with-kitty-color*)
183 | (c:new-path)
184 | ;; (apply #'c:set-source-rgb *player-with-kitty-color*)
185 | (c:translate 285 280)
186 | (draw-kitty)
187 | (c:restore)
188 | )
189 |
190 | (defun draw-maze ()
191 | (c:set-line-width 1)
192 | (let* ((empty-plot-index 0)
193 | (maze-dimensions (array-dimensions *maze*))
194 | (maze-width (car maze-dimensions))
195 | (maze-height (cadr maze-dimensions))
196 | (scale-factor (/ *calm-window-width* (+ maze-width 2))))
197 | (loop
198 | for x from 0 to (1- maze-width)
199 | do
200 | (loop
201 | for y from 0 to (1- maze-height)
202 | for cx = (* (+ x 1) scale-factor)
203 | for cy = (* (+ y 1) scale-factor)
204 | do
205 | (apply #'c:set-source-rgb *maze-color-border*)
206 | (c:rectangle cx cy scale-factor scale-factor)
207 | if (= (aref *maze* x y) 1) ;; wall
208 | do
209 | (apply #'c:set-source-rgb *maze-color-solid*)
210 | (c:fill-preserve)
211 | (apply #'c:set-source-rgb *maze-color-border*)
212 | (c:stroke)
213 | else
214 | ;; empty plot
215 | do
216 | (c:new-path)
217 | (cond
218 | ;; player with kitty
219 | ((and ;; Kitty and the player overlapped
220 | *player-position*
221 | *kitty-position*
222 | (= x (car *player-position*)) (= y (cadr *player-position*))
223 | (= x (car *kitty-position*)) (= y (cadr *kitty-position*)))
224 | (apply #'c:set-source-rgb *player-with-kitty-color*)
225 | ;; (c:arc (+ cx (/ scale-factor 2)) (+ cy (/ scale-factor 2)) (- (/ scale-factor 2) 4) 0 (* 2 pi))
226 | ;; (c:fill-path)
227 | (c:save)
228 | (c:translate (+ cx 13) (+ cy 10))
229 | (c:scale 0.5 0.5)
230 | (draw-kitty)
231 | (c:restore)
232 | (setf *kitty-position* nil
233 | *kitty-collected* t))
234 | ;; player
235 | ((and *player-position* (= x (car *player-position*)) (= y (cadr *player-position*)))
236 | (apply #'c:set-source-rgb (if *kitty-collected* *player-with-kitty-color* *player-color*))
237 |
238 | (if *kitty-collected*
239 | (progn
240 | (c:save)
241 | (c:translate (+ cx 13) (+ cy 10))
242 | (c:scale 0.5 0.5)
243 | (draw-kitty)
244 | (c:restore))
245 | (progn
246 | ;; (c:arc (+ cx (/ scale-factor 2)) (+ cy (/ scale-factor 2)) (- (/ scale-factor 2) 4) 0 (* 2 pi))
247 | ;; (c:fill-path)
248 | (c:save)
249 | (c:translate (+ cx 13) (+ cy 10))
250 | (c:scale 0.5 0.5)
251 | (draw-player)
252 | (c:restore)
253 | ))
254 | )
255 | ;; kitty
256 | ((and (not *kitty-collected*) *kitty-position* (= x (car *kitty-position*)) (= y (cadr *kitty-position*)))
257 | (apply #'c:set-source-rgb *kitty-color*)
258 | ;; (c:arc (+ cx (/ scale-factor 2)) (+ cy (/ scale-factor 2)) (- (/ scale-factor 2) 4) 0 (* 2 pi))
259 | ;; (c:fill-path)
260 | (c:save)
261 | (c:translate (+ cx 13) (+ cy 10))
262 | (c:scale 0.5 0.5)
263 | (draw-kitty)
264 | (c:restore)
265 | )
266 | (t (apply #'c:set-source-rgb *maze-color-border*)
267 | (c:stroke)))
268 | (incf empty-plot-index)
269 | )
270 | ))
271 | )
272 |
273 | (defun draw-night ()
274 | (let* ((maze-dimensions (array-dimensions *maze*))
275 | (maze-width (car maze-dimensions))
276 | (maze-height (cadr maze-dimensions))
277 | (scale-factor (/ *calm-window-width* (+ maze-width 2)))
278 | (light-distance (round (max (* 20 (/ (- 1000 *steps*) 1000)) 0))))
279 | (loop
280 | for x from 0 to (1- maze-width)
281 | do
282 | (loop
283 | for y from 0 to (1- maze-height)
284 | for cx = (* (+ x 1) scale-factor)
285 | for cy = (* (+ y 1) scale-factor)
286 | for x-distance = (max (abs (- x (car *player-position*))) 1)
287 | for y-distance = (max (abs (- y (cadr *player-position*))) 1)
288 | do
289 | (c:set-source-rgba 0 0 0
290 | (if (= 0 light-distance)
291 | 1
292 | (max (/ x-distance light-distance) (/ y-distance light-distance))))
293 | (c:rectangle cx cy scale-factor scale-factor)
294 | (c:fill-path)
295 | )
296 | ))
297 | )
298 |
299 | (defun draw ()
300 | (c:set-source-rgb 1 1 1)
301 | (c:paint)
302 | (draw-maze)
303 | (unless *win-pause*
304 | (draw-night))
305 | (when (or *win-pause* *game-over*)
306 | (draw-result))
307 | )
308 |
--------------------------------------------------------------------------------
/Spring/README.md:
--------------------------------------------------------------------------------
1 | # The Maze and Lost Cat
2 |
3 | ## Spring Lisp Game Jam 2023
4 |
5 | Submitted:
6 |
7 | https://itch.io/jam/spring-lisp-game-jam-2023/rate/2101077
8 |
9 | Game Page:
10 |
11 | https://vitovan.itch.io/maze
12 |
13 | ## The Final Version
14 |
15 | Please check the [afterwards](./afterwards/) directory, I fixed some bugs after the jam.
16 |
17 | ## Development Log
18 |
19 | This is my development log for [Spring Lisp Game Jam 2023](https://itch.io/jam/spring-lisp-game-jam-2023), I started my work a bit late, but maybe I can finally make it.
20 |
21 | ### Day 1
22 |
23 | Today is May 30th 2023, Spring Lisp Game Jam 2023 has started 4 days ago, 6 days left.
24 |
25 | That means: I don't have much time, so I have to find something easy to achieve, and interesting to play with.
26 |
27 | #### Save Pupu
28 |
29 | How about this:
30 |
31 | There is a kitty whose name is Pupu, she is young and energetic, so she goes out everyday, and get lost. The player's task is to find Pupu in a maze, and take her back home.
32 |
33 | #### The Maze
34 |
35 | I don't know how to make a maze, or even how to represent one in Lisp, so I searched around, here is something I found:
36 |
37 | 1. https://en.wikipedia.org/wiki/Maze_generation_algorithm
38 | 2. https://github.com/keesiemeijer/maze-generator
39 | 3. https://github.com/joewing/maze/blob/master/maze.lisp
40 |
41 | The first link will take me more than 1 day to understand and implement; the second one is in JavaScript, may take me more than half a day to understand and rewrite to Lisp; the third one, is in Lisp, so be it.
42 |
43 | But, it does not have a typical open source license, and I am not a lawyer, here is its license:
44 |
45 | https://github.com/joewing/maze/blob/20b9e7ddfdfac96cd43f11b52f14924ceb1c25bc/LICENSE
46 |
47 | Can I use the code with GPL-2.0 or WTFPL? I don't know.
48 |
49 | So I have to read and understand the code, and close the page, and write my own version.
50 |
51 | Then I write my own version, and rendered it with [CALM](https://github.com/VitoVan/calm/):
52 |
53 | 
54 |
55 | This seems promising, but:
56 |
57 | 
58 |
59 | Sometimes it generates unreasonable maze.
60 |
61 | This may take me a week to debug, maybe it's just a very little detail, but still, I don't have time to debug this. So the current decision should be:
62 |
63 | Choose some better looking maze, and hard code their data in my game.
64 |
65 | I gotta go, life comes in, I will leave this task to day 2.
66 |
67 | ### Day 2
68 |
69 | 5 days left.
70 |
71 | I need to finish the prototype:
72 |
73 | - ~~player moving (already done by day 1)~~
74 |
75 | - Canned Cat Food
76 |
77 | player can pick up the can first, then Pupu will follow the player, but only in a cute way, that Pupu will not find the right path, but try to cross the wall (but she won't)
78 |
79 | - Shit
80 |
81 | if the player stepped on a piece of shit, Pupu will try move away from the player.
82 |
83 | - Win / Loose
84 |
85 | Timed game? There are 4 mazes, 8 levels in total.
86 |
87 | - the first 4 levels are in daytime, so the player just play as usual.
88 | - level 1: player + Pupu
89 | - level 2: player + Pupu + canned cat food
90 | - level 3: player + Pupu + shit
91 | - level 4: player + Pupu + canned cat food + shit
92 | - the later 4 levels are in nighttime, so the player will only see the 8? blocks around
93 |
94 | - position
95 |
96 | the initial position of Pupu and the player should be placed meticulously, not randomly.
97 |
98 | #### Abandon
99 |
100 | The above plan was abandoned, the game was redesigned.
101 |
102 | Because the cat food and shit parts makes me feel trivial and uninteresting to implement. They feel like some hard-coded features, may take a lot of time to implement and debug, so I left them.
103 |
104 | The story of this game should be told like this:
105 |
106 | > It was getting dark and darker, some kitties were lost in a maze, how many of them can you save before the sunset? Or, do you have the ability to "see" in the dark? Give it a try.
107 |
108 | 
109 |
110 | There is no limit of rounds, the player could try as many times as the player wants, but the surrounding light will be dimmer and dimmer, at last it will turn into complete darkness.
111 |
112 | Can a player play in the darkness?
113 |
114 | I think it's possible if the kitty could meow and there are sound effects when the player hits the wall or walks through the maze.
115 |
116 | Let's leave them tomorrow.
117 |
118 |
119 | ### Day 3
120 |
121 | 4 days left, actually, it's 3 days 20 hours left.
122 |
123 | Sound effects added:
124 |
125 | 1. Kitty will meow, the closer you get, the louder the meow is
126 | 2. Walk will generate walking sound, if you hit the wall, there will be no sound
127 | 3. When you collected the kitty, there will be a special meow
128 | 4. When you successfully lead the kitty out of the maze, there will be purring.
129 |
130 | Now kitty will follow the player, if they have met each other (overlapped), and some other small improvement on the avatars.
131 |
132 | 
133 |
134 | Now, added dark mode, even in complete darkness, the game is also playable:
135 |
136 |  
137 |
138 | But it's far more difficult.
139 |
140 | And the day can turn into night, the night can turn into day.
141 |
142 | I should call it a day, tomorrow should be:
143 |
144 | - doing more sound effect, like BGM?
145 |
146 | - should add more user incitements? But how?
147 | - random kitty position
148 |
149 | Oh, I also added a `auto-move` feature, which will save the player some key presses by auto-moving ahead, but it's buggy, could move ahead to much, should be fixed tomorrow.
150 |
151 |
152 | ### Day 4
153 |
154 | 3 days 3 hours left.
155 |
156 | Let's sort out today's work:
157 |
158 | 1. BGM
159 | 2. Random Kitty Location
160 | 3. Fix Auto-move feature (should pause at the intersection)
161 | 4. More user incitement
162 |
163 | #### day 4 update - 1
164 |
165 | Let's see what we have done:
166 |
167 | 1. BGM, done, using one of GarageBand sound pack loop forever
168 |
169 | it's good to know that all [sound pack in GarageBand is free as freedom and free-charge to use anywhere](https://support.apple.com/en-us/HT201808)
170 |
171 | 2. Auto-move fixed
172 |
173 | What's left?
174 |
175 | 1. Random Kitty Location
176 | 2. More user incitement
177 |
178 | I found a poem by Edward Lear, it's weird and interesting: *The Owl and the Pussycat*
179 |
180 | Maybe I could use this in my game, slice it into small pieces, show one piece of it each round, print out all of it at the end.
181 |
182 | #### day 4 update -2
183 |
184 | I integrated Edward Lear's text into my game! As an user incitement, the parts of the poem will show up after the player finished a maze. I also added a finish page.
185 |
186 | 
187 |
188 | #### day 4 update -2
189 |
190 | I manually picked some nice spots for the kitties, and randomly pick from the list for the kitties to appear.
191 |
192 | I think it's time to call it a day.
193 |
194 | ### Day 5
195 |
196 | 2 days left.
197 |
198 | It's about time to wrap it up. So today I should:
199 |
200 | - fix knowns bugs
201 | - publish binaries
202 | - Linux
203 | - macOS
204 | - Windows
205 | - Web
206 | - write documents
207 |
208 | As for tomorrow, maybe I will send it to Jack as the first player, if he said something and I still have time, maybe I will fix it and re-publish again.
209 |
210 | #### producing binaries
211 |
212 | 1
213 |
214 | [CALM](https://github.com/VitoVan/calm/) is already capable of publishing binaries for Linux / Windows / macOS, albeit with a little higher OS requirements, like:
215 |
216 | - on Linux, GCC should >= 2.33
217 | - on macOS, only the most recent three version of macOS supported, the earliest one is Big Sur for now
218 | - on Windows, it should be Windows 10 and 11
219 |
220 | It might be enough for non-wizard users, but some BSD wizards won't be happy, so a Web version is a must-have. Of course, a document to show how to run from source is also needed.
221 |
222 | 2
223 |
224 | Web version targets [JSCL](https://github.com/jscl-project/jscl/).
225 |
226 | It turns out JSCL has a poor support for `array`:
227 |
228 | https://github.com/jscl-project/jscl/issues/482
229 |
230 | https://github.com/jscl-project/jscl/issues/127
231 |
232 | But for this small game, `list` is more than enough, so I could rewrite `array` related stuff to `list`.
233 |
234 | 3
235 |
236 | JSCL lacks of `equalp`, which is fine, I can compare manually. I hope one day I could close this issue:
237 |
238 | https://github.com/jscl-project/jscl/issues/479
239 |
240 | 4
241 |
242 | Add touch screen support, since some user may use their phone to play this game (within a web browser).
243 |
244 | 5
245 |
246 | SDL2_Mixer on the browser performs weirdly, sound glitches during canvas repainting, why?
247 |
248 | Maybe, threads?
249 |
250 | By default, I disabled pthreads with `-s USE_PTHREADS=0` , but this makes the canvas painting and audio playing in the same thread, so while painting, the audio will be blocked.
251 |
252 | No luck with thread enabled, maybe I didn't really enabled it, since my Cairo build was not built with pthread.
253 |
254 | I'm not gonna build Cairo with pthread and try it for now, since it also requires extra [HTTP header](https://web.dev/coop-coep/) to be working, it's [overburden](https://github.com/gzuidhof/coi-serviceworker) for Github pages.
255 |
256 | 6
257 |
258 | it's the double `loop` inside my `draw-*` functions, they loop the maze 13x13 times. It causes the browser hang.
259 |
260 | WTF?
261 |
262 | 13 x 13 = 169 loop will hang? I even tried empty `(format t "hang?~%")` inside the loop, it still blocks the browser.
263 |
264 | 7
265 |
266 | Ah, I don't have time to debug the WebAssembly multithreading thing, so I made a workaround:
267 |
268 | For all the audio in the browser, I call `new Audio()` to play it, like this in JSCL:
269 |
270 | ```lisp
271 | #+jscl
272 | (defun play-audio (audio-url &key (loop-audio-p nil) (volume 1))
273 | (format t "playing audio: ~A~%" audio-url)
274 | (let* ((audio-object-cache
275 | (cdr (assoc audio-url calm::*calm-state-loaded-audio* :test #'string=)))
276 | (audio-object
277 | (or audio-object-cache
278 | ;; https://github.com/jscl-project/jscl/wiki/JSCL-and-manipulations-with-JS-objects
279 | (#j:window:eval (concatenate 'string "new Audio('" audio-url "')"))
280 | )))
281 | (unless audio-object-cache
282 | (push (cons audio-url audio-object) calm::*calm-state-loaded-audio*))
283 | (when loop-audio-p
284 | (setf (jscl::oget audio-object "loop") t))
285 | (setf (jscl::oget audio-object "volume") volume)
286 | ((jscl::oget audio-object "play"))))
287 | ```
288 |
289 | And it worked. So be it.
290 |
291 | Life came in, I don't have too much time left, I must wrap it up and submit, today.
292 |
293 |
294 | ### Day 6
295 |
296 | 20 hours left, a huge bug was found in the Web version, fuck.
297 |
298 | The game will hang at the end of fourth maze. Why?
299 |
300 | ```lisp
301 | Welcome to JSCL (version 25e0341 built on 18 May 2023)
302 |
303 | JSCL is a Common Lisp implementation on Javascript.
304 | For more information, visit the project page at GitHub.
305 |
306 | CL-USER> (let ((n 0)
307 | ... (x (list 'a 'b 'c 'd 'e 'f 'g)))
308 | ... (rotatef (nth (incf n) x)
309 | ... (nth (incf n) x)
310 | ... (nth (incf n) x))
311 | ... x)
312 | ERROR: Function 'ROTATEF' undefined
313 | CL-USER>
314 | ```
315 |
316 | When it's the fourth maze, I will randomise the maze list and give out one again. In the randomisation function:
317 |
318 | ```lisp
319 | ;; https://rosettacode.org/wiki/Knuth_shuffle#Common_Lisp
320 | (defun nshuffle (sequence)
321 | (loop for i from (length sequence) downto 2
322 | do (rotatef (elt sequence (random i))
323 | (elt sequence (1- i))))
324 | sequence)
325 | ```
326 |
327 | I called `rotatef` which does not exist in [JSCL](https://github.com/jscl-project/jscl/issues/483).
328 |
329 | What do I do?
330 |
331 | Ah, ha! Delete this feature in Web version!
332 |
333 | This is the shortest path to the new working version.
334 |
335 | #### Another giant BUG!!!!
336 |
337 | High CPU usage enven when idling!
338 |
339 | Fixing and publishing!
340 |
--------------------------------------------------------------------------------
/Spring/day-3/canvas.lisp:
--------------------------------------------------------------------------------
1 | (in-package #:calm)
2 |
3 | ;;
4 | ;; CALM version check
5 | ;; version check won't work on JSCL, since the lack of ASDF
6 | ;;
7 | #-jscl
8 | (let ((required-version "0.1.2")
9 | (calm-version (slot-value (asdf:find-system 'calm) 'asdf:version)))
10 | (when (uiop:version< calm-version required-version)
11 | (format t
12 | "Sorry, this is built on CALM ~A, older version (current: ~A) of CALM won't work.~%"
13 | required-version calm-version)
14 | (uiop:quit)))
15 |
16 |
17 | ;;
18 | ;; the swank server is for debugging, for usage please check
19 | ;; Emacs:
20 | ;; https://slime.common-lisp.dev/
21 | ;; Visual Studio Code
22 | ;; https://lispcookbook.github.io/cl-cookbook/vscode-alive.html
23 | ;;
24 | ;; uncomment the following line to enable SWANK Server
25 | (unless (str:starts-with? "dist" (uiop:getenv "CALM_CMD")) (swank:create-server))
26 |
27 | ;;
28 | ;; by default, the screensaver is disabled,
29 | ;; if you want to enable screensaver,
30 | ;; please uncomment the following line
31 | ;;
32 | (setf (uiop:getenv "SDL_VIDEO_ALLOW_SCREENSAVER") "1")
33 |
34 | ;;
35 | ;; setting window properties, for more of this, please check
36 | ;; https://github.com/VitoVan/calm/blob/main/src/config.lisp
37 | ;;
38 | (setf *calm-delay* 40)
39 | (setf *calm-window-width* 600)
40 | (setf *calm-window-height* 600)
41 | (setf *calm-window-title* "Save Kitties")
42 |
43 | (u:load-from-app "maze-data.lisp")
44 |
45 | ;; https://rosettacode.org/wiki/Knuth_shuffle#Common_Lisp
46 | (defun nshuffle (sequence)
47 | (loop for i from (length sequence) downto 2
48 | do (rotatef (elt sequence (random i))
49 | (elt sequence (1- i))))
50 | sequence)
51 |
52 | (defparameter *maze-index* nil)
53 | (defparameter *maze-data* nil)
54 | (defparameter *maze* nil)
55 | (defparameter *sight-distance* 0)
56 | (defparameter *player-position* nil)
57 | (defparameter *player-position-previous* nil)
58 | (defparameter *kitty-position* nil)
59 | (defparameter *kitty-collected* nil)
60 |
61 | (defparameter *player-color* '(0 0.35 0.59))
62 | ;; (defparameter *kitty-color* '(0.94 0.87 0.47))
63 | (defparameter *kitty-color* '(0.89 0.12 0.17))
64 | (defparameter *player-with-kitty-color* '(0.89 0.12 0.17))
65 | (defparameter *maze-color-solid* '(0.83 0.82 0.84))
66 | ;; (defparameter *maze-color-solid* '(0.4 1 0.4))
67 | (defparameter *maze-color-border* '(0.6 0.6 0.6))
68 | (defparameter *win* 0)
69 | (defparameter *win-pause* nil)
70 | (defparameter *max-steps* 512)
71 | (defparameter *steps* 0)
72 | (defparameter *getting-dark* t)
73 | (defparameter *game-over* nil)
74 |
75 | (defparameter *last-meow* nil)
76 | (defun meow ()
77 | (when (> (- (get-universal-time) *last-meow*) (+ 10 (random 100)))
78 | (setf *last-meow* (get-universal-time))
79 | (let* ((kitty-x (car *kitty-position*))
80 | (kitty-y (cadr *kitty-position*))
81 | (player-x (car *player-position*))
82 | (player-y (cadr *player-position*))
83 | (distance (sqrt (+ (expt (abs (- kitty-x player-x)) 2) (expt (abs (- kitty-y player-y)) 2))))
84 | (volume (round (* 128 (/ (max (- 8 distance) 1) 8)))))
85 | (sdl2-mixer:volume-music volume)
86 | (format t "distance: ~A, volume: ~A~%" distance volume)
87 | ;; (c:play-wav (str:concat "assets/meow-" (write-to-string (random 2)) ".wav") :channel 0)
88 | (c:play-music "assets/meow.wav")
89 | )))
90 |
91 | (defparameter *already-purring* nil)
92 | (defun purr ()
93 | (unless *already-purring*
94 | (c:play-music "assets/purr.wav" :loops -1)
95 | (setf *already-purring* t)))
96 |
97 | (defparameter *already-meow-with-purring* nil)
98 | (defun meow-with-purr ()
99 | (unless *already-meow-with-purring*
100 | (sdl2-mixer:volume-music 128)
101 | (c:play-music "assets/meow-with-purr.wav")
102 | (setf *already-meow-with-purring* t)))
103 |
104 | (defparameter *walk-index* 0)
105 | (defun walk ()
106 | (c:play-wav (str:concat "assets/walk-" (write-to-string *walk-index*) ".wav"))
107 | (if (< *walk-index* 7)
108 | (incf *walk-index*)
109 | (setf *walk-index* 0)))
110 |
111 | (defun init-maze (&optional (maze-index 0))
112 | (c:halt-wav)
113 | (c:halt-music)
114 | (setf *already-purring* nil
115 | *already-meow-with-purring* nil
116 | *last-meow* (get-universal-time))
117 | (when (> maze-index 3)
118 | (nshuffle *maze-data-list*))
119 | (setf
120 | *maze-index* (if (> maze-index 3) 0 maze-index)
121 | *maze-data* (nth *maze-index* *maze-data-list*)
122 | *maze* (nth 0 *maze-data*)
123 | *player-position* (nth 1 *maze-data*)
124 | *kitty-position* (nth 2 *maze-data*)
125 | *kitty-collected* nil))
126 |
127 | (init-maze)
128 |
129 |
130 | (defparameter *last-move* 0)
131 | (defun auto-move ()
132 | (when (and (not *win-pause*) *player-position-previous* (> (- (c:get-ticks) *last-move*) 100))
133 | (let* ((x-incf-factor (- (car *player-position*) (car *player-position-previous*)))
134 | (y-incf-factor (- (cadr *player-position*) (cadr *player-position-previous*)))
135 | (next-player-position (list (+ (car *player-position*) x-incf-factor) (+ (cadr *player-position*) y-incf-factor))))
136 | (when (and
137 | (array-in-bounds-p *maze* (car next-player-position) (cadr next-player-position))
138 | (not (equalp next-player-position *player-position*)))
139 | (when (= (aref *maze* (car next-player-position) (cadr next-player-position)) 0)
140 | (when *kitty-collected*
141 | (setf *kitty-position* *player-position*))
142 | (setf *player-position-previous* *player-position*)
143 | (setf *player-position* next-player-position)
144 | (when (> *steps* *max-steps*)
145 | (setf *getting-dark* (not *getting-dark*)))
146 | (if *getting-dark* (incf *steps*) (decf *steps*))
147 | (setf *last-move* (c:get-ticks))
148 | (format t "cur: ~A, nxt: ~A~%" *player-position* next-player-position))
149 | ))
150 | (when (and *kitty-collected* (equalp *player-position* '(12 11)))
151 | (purr)
152 | (incf *win*)
153 | (setf *win-pause* t))))
154 |
155 | (defun on-keydown (key)
156 | (when (c:keq key :scancode-q :scancode-escape)
157 | (setf *game-over* t))
158 |
159 | (when (and *game-over* (c:keq key :scancode-return))
160 | (setf
161 | *game-over* nil
162 | *win* 0
163 | *steps* 0)
164 | (init-maze 0))
165 |
166 | (when (and *win-pause* (c:keq key :scancode-return))
167 | (init-maze (1+ *maze-index*))
168 | (setf *win-pause* nil))
169 |
170 | (unless *win-pause*
171 | (let ((next-player-position (copy-list *player-position*)))
172 | (cond
173 | ((c:keq key :scancode-left :scancode-h)
174 | (decf (car next-player-position)))
175 | ((c:keq key :scancode-right :scancode-l)
176 | (incf (car next-player-position)))
177 | ((c:keq key :scancode-up :scancode-k)
178 | (decf (cadr next-player-position)))
179 | ((c:keq key :scancode-down :scancode-j)
180 | (incf (cadr next-player-position))))
181 | (when (and
182 | (array-in-bounds-p *maze* (car next-player-position) (cadr next-player-position))
183 | (not (equalp next-player-position *player-position*)))
184 | (when (= (aref *maze* (car next-player-position) (cadr next-player-position)) 0)
185 | (walk)
186 | (when *kitty-collected*
187 | (setf *kitty-position* *player-position*))
188 | (setf *player-position-previous* *player-position*)
189 | (setf *player-position* next-player-position)
190 | (when (or (> *steps* *max-steps*) (< *steps* 0))
191 | (setf *getting-dark* (not *getting-dark*)))
192 | (if *getting-dark* (incf *steps*) (decf *steps*))
193 | (setf *last-move* (c:get-ticks)))
194 | ))
195 |
196 | (when (and *kitty-collected* (equalp *player-position* '(12 11)))
197 | (purr)
198 | (incf *win*)
199 | (setf *win-pause* t)))
200 |
201 | (format t "current player position: ~A~%" *player-position*))
202 |
203 | (defun draw-kitty ()
204 | (when (or *kitty-collected* (< (- (get-universal-time) *last-meow*) 1))
205 | (c:save)
206 | (c:set-line-width 4)
207 | (c:set-line-cap :round)
208 | ;; body
209 | (c:move-to 0 0)
210 | (c:curve-to 10 10 20 10 30 0)
211 | (c:curve-to 60 50 30 45 30 45)
212 | (c:line-to 0 45)
213 | (c:curve-to -10 45 -20 35 0 0)
214 | (c:stroke)
215 | ;; eyes
216 | (c:arc 8 20 3 0 (* 2 pi))
217 | (c:arc 24 20 3 0 (* 2 pi))
218 | (c:fill-path)
219 | ;; smile
220 | (when *kitty-collected*
221 | (c:move-to 8 34)
222 | (c:curve-to 14 38 20 38 24 34)
223 | (c:stroke))
224 | ;; tail
225 | (c:move-to 0 45)
226 | (c:curve-to -10 45 -15 45 -20 40)
227 | (c:stroke)
228 | (c:restore)))
229 |
230 | (defun draw-player ()
231 | (c:save)
232 | (c:set-line-width 4)
233 | (c:set-line-cap :round)
234 | (when (or (> *sight-distance* 1) *win-pause*)
235 | ;; body
236 | (c:arc 16 20 28 0 (* 2 pi))
237 | (c:stroke))
238 | ;; eyes
239 | (c:arc 8 14 3 0 (* 2 pi))
240 | (c:arc 24 14 3 0 (* 2 pi))
241 | (c:fill-path)
242 | ;; smile
243 | (c:move-to 8 34)
244 | (if *kitty-collected*
245 | (c:curve-to 12 38 20 38 24 34)
246 | (c:line-to 24 34))
247 | (c:stroke)
248 | (c:restore))
249 |
250 | (defun draw-result ()
251 | (c:set-line-width 4)
252 | (apply #'c:set-source-rgba (append *player-color* (list (if *game-over* 1 0.5))))
253 | (c:paint)
254 | (apply #'c:set-source-rgb *player-with-kitty-color*)
255 | (c:rrectangle 200 380 200 30 :radius 15)
256 | (c:stroke-preserve)
257 | (c:set-source-rgb 1 1 1)
258 | (c:fill-path)
259 | (apply #'c:set-source-rgb *player-color*)
260 | (c:select-font-face "Open Sans" :normal :normal)
261 | (c:set-font-size 24)
262 | (c:move-to 274 404)
263 | (c:show-text (str:pad-left 4 (write-to-string *win*) :pad-char #\0))
264 | (c:fill-path)
265 | (c:save)
266 | (apply #'c:set-source-rgb *player-with-kitty-color*)
267 | (c:arc 300 300 50 0 (* 2 pi))
268 | (c:stroke-preserve)
269 | (c:set-source-rgb 1 1 1)
270 | (c:fill-path)
271 | (apply #'c:set-source-rgb *player-with-kitty-color*)
272 | (c:new-path)
273 | ;; (apply #'c:set-source-rgb *player-with-kitty-color*)
274 | (c:translate 285 280)
275 | (draw-kitty)
276 | (c:restore)
277 | )
278 |
279 | (defun draw-maze ()
280 | (c:set-line-width 1)
281 | (let* ((maze-dimensions (array-dimensions *maze*))
282 | (maze-width (car maze-dimensions))
283 | (maze-height (cadr maze-dimensions))
284 | (scale-factor (/ *calm-window-width* (+ maze-width 2))))
285 | (loop
286 | for x from 0 to (1- maze-width)
287 | do
288 | (loop
289 | for y from 0 to (1- maze-height)
290 | for cx = (* (+ x 1) scale-factor)
291 | for cy = (* (+ y 1) scale-factor)
292 | do
293 | (apply #'c:set-source-rgb *maze-color-border*)
294 | (c:rectangle cx cy scale-factor scale-factor)
295 | if (= (aref *maze* x y) 1) ;; wall
296 | do
297 | (apply #'c:set-source-rgb *maze-color-solid*)
298 | (c:fill-preserve)
299 | (apply #'c:set-source-rgb *maze-color-border*)
300 | (c:stroke)
301 | else
302 | ;; empty plot
303 | do
304 | (c:new-path)
305 | (apply #'c:set-source-rgb *maze-color-border*)
306 | (c:stroke)
307 | )
308 | ))
309 | )
310 |
311 | (defun draw-night ()
312 | (let* ((maze-dimensions (array-dimensions *maze*))
313 | (maze-width (car maze-dimensions))
314 | (maze-height (cadr maze-dimensions))
315 | (scale-factor (/ *calm-window-width* (+ maze-width 2))))
316 | (setf *sight-distance* (max (* 24 (/ (- *max-steps* *steps*) *max-steps*)) 1))
317 | (loop
318 | for x from 0 to (1- maze-width)
319 | do
320 | (loop
321 | for y from 0 to (1- maze-height)
322 | for cx = (* (+ x 1) scale-factor)
323 | for cy = (* (+ y 1) scale-factor)
324 | for x-distance = (max (abs (- x (car *player-position*))) 1)
325 | for y-distance = (max (abs (- y (cadr *player-position*))) 1)
326 | do
327 | (c:set-source-rgba 0 0 0
328 | (if (= 0 *sight-distance*)
329 | 1
330 | (max (/ x-distance *sight-distance*) (/ y-distance *sight-distance*))))
331 | (c:rectangle cx cy scale-factor scale-factor)
332 | (c:fill-path)
333 | )
334 | ))
335 | )
336 |
337 | (defun draw-player-and-kitty ()
338 | (let* ((maze-dimensions (array-dimensions *maze*))
339 | (maze-width (car maze-dimensions))
340 | (maze-height (cadr maze-dimensions))
341 | (scale-factor (/ *calm-window-width* (+ maze-width 2))))
342 | (loop
343 | for x from 0 to (1- maze-width)
344 | do
345 | (loop
346 | for y from 0 to (1- maze-height)
347 | for cx = (* (+ x 1) scale-factor)
348 | for cy = (* (+ y 1) scale-factor)
349 | do
350 | (cond
351 | ;; player with kitty
352 | ((and ;; Kitty and the player overlapped
353 | *player-position*
354 | *kitty-position*
355 | (= x (car *player-position*)) (= y (cadr *player-position*))
356 | (= x (car *kitty-position*)) (= y (cadr *kitty-position*)))
357 | (apply #'c:set-source-rgb *player-with-kitty-color*)
358 | ;; (c:arc (+ cx (/ scale-factor 2)) (+ cy (/ scale-factor 2)) (- (/ scale-factor 2) 4) 0 (* 2 pi))
359 | ;; (c:fill-path)
360 | (c:save)
361 | (c:translate (+ cx 13) (+ cy 10))
362 | (c:scale 0.5 0.5)
363 | (draw-kitty)
364 | (c:restore)
365 | (setf *kitty-collected* t))
366 | ;; player
367 | ((and *player-position* (= x (car *player-position*)) (= y (cadr *player-position*)))
368 | (apply #'c:set-source-rgb *player-color*)
369 | (c:save)
370 | (c:translate (+ cx 13) (+ cy 10))
371 | (c:scale 0.5 0.5)
372 | (draw-player)
373 | (c:restore)
374 | )
375 | ;; kitty
376 | ((and *kitty-position* (= x (car *kitty-position*)) (= y (cadr *kitty-position*)))
377 | (apply #'c:set-source-rgb *kitty-color*)
378 | ;; (c:arc (+ cx (/ scale-factor 2)) (+ cy (/ scale-factor 2)) (- (/ scale-factor 2) 4) 0 (* 2 pi))
379 | ;; (c:fill-path)
380 | (c:save)
381 | (c:translate (+ cx 13) (+ cy 10))
382 | (c:scale 0.5 0.5)
383 | (draw-kitty)
384 | (c:restore)
385 | )
386 | (t (apply #'c:set-source-rgb *maze-color-border*)
387 | (c:stroke)))
388 | )
389 | ))
390 | )
391 |
392 | (defun draw-forever ()
393 | (c:set-source-rgb 1 1 1)
394 | (c:paint)
395 | (draw-maze)
396 | (unless (or *win-pause* *game-over* *kitty-collected*)
397 | (meow))
398 | (unless *win-pause* (draw-night))
399 | (draw-player-and-kitty)
400 | (when (or *win-pause* *game-over*)
401 | (draw-result))
402 | (when (equalp *player-position* *kitty-position*)
403 | (meow-with-purr))
404 | (auto-move))
405 |
--------------------------------------------------------------------------------
/Spring/day-5/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 2, June 1991
3 |
4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6 | Everyone is permitted to copy and distribute verbatim copies
7 | of this license document, but changing it is not allowed.
8 |
9 | Preamble
10 |
11 | The licenses for most software are designed to take away your
12 | freedom to share and change it. By contrast, the GNU General Public
13 | License is intended to guarantee your freedom to share and change free
14 | software--to make sure the software is free for all its users. This
15 | General Public License applies to most of the Free Software
16 | Foundation's software and to any other program whose authors commit to
17 | using it. (Some other Free Software Foundation software is covered by
18 | the GNU Lesser General Public License instead.) You can apply it to
19 | your programs, too.
20 |
21 | When we speak of free software, we are referring to freedom, not
22 | price. Our General Public Licenses are designed to make sure that you
23 | have the freedom to distribute copies of free software (and charge for
24 | this service if you wish), that you receive source code or can get it
25 | if you want it, that you can change the software or use pieces of it
26 | in new free programs; and that you know you can do these things.
27 |
28 | To protect your rights, we need to make restrictions that forbid
29 | anyone to deny you these rights or to ask you to surrender the rights.
30 | These restrictions translate to certain responsibilities for you if you
31 | distribute copies of the software, or if you modify it.
32 |
33 | For example, if you distribute copies of such a program, whether
34 | gratis or for a fee, you must give the recipients all the rights that
35 | you have. You must make sure that they, too, receive or can get the
36 | source code. And you must show them these terms so they know their
37 | rights.
38 |
39 | We protect your rights with two steps: (1) copyright the software, and
40 | (2) offer you this license which gives you legal permission to copy,
41 | distribute and/or modify the software.
42 |
43 | Also, for each author's protection and ours, we want to make certain
44 | that everyone understands that there is no warranty for this free
45 | software. If the software is modified by someone else and passed on, we
46 | want its recipients to know that what they have is not the original, so
47 | that any problems introduced by others will not reflect on the original
48 | authors' reputations.
49 |
50 | Finally, any free program is threatened constantly by software
51 | patents. We wish to avoid the danger that redistributors of a free
52 | program will individually obtain patent licenses, in effect making the
53 | program proprietary. To prevent this, we have made it clear that any
54 | patent must be licensed for everyone's free use or not licensed at all.
55 |
56 | The precise terms and conditions for copying, distribution and
57 | modification follow.
58 |
59 | GNU GENERAL PUBLIC LICENSE
60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61 |
62 | 0. This License applies to any program or other work which contains
63 | a notice placed by the copyright holder saying it may be distributed
64 | under the terms of this General Public License. The "Program", below,
65 | refers to any such program or work, and a "work based on the Program"
66 | means either the Program or any derivative work under copyright law:
67 | that is to say, a work containing the Program or a portion of it,
68 | either verbatim or with modifications and/or translated into another
69 | language. (Hereinafter, translation is included without limitation in
70 | the term "modification".) Each licensee is addressed as "you".
71 |
72 | Activities other than copying, distribution and modification are not
73 | covered by this License; they are outside its scope. The act of
74 | running the Program is not restricted, and the output from the Program
75 | is covered only if its contents constitute a work based on the
76 | Program (independent of having been made by running the Program).
77 | Whether that is true depends on what the Program does.
78 |
79 | 1. You may copy and distribute verbatim copies of the Program's
80 | source code as you receive it, in any medium, provided that you
81 | conspicuously and appropriately publish on each copy an appropriate
82 | copyright notice and disclaimer of warranty; keep intact all the
83 | notices that refer to this License and to the absence of any warranty;
84 | and give any other recipients of the Program a copy of this License
85 | along with the Program.
86 |
87 | You may charge a fee for the physical act of transferring a copy, and
88 | you may at your option offer warranty protection in exchange for a fee.
89 |
90 | 2. You may modify your copy or copies of the Program or any portion
91 | of it, thus forming a work based on the Program, and copy and
92 | distribute such modifications or work under the terms of Section 1
93 | above, provided that you also meet all of these conditions:
94 |
95 | a) You must cause the modified files to carry prominent notices
96 | stating that you changed the files and the date of any change.
97 |
98 | b) You must cause any work that you distribute or publish, that in
99 | whole or in part contains or is derived from the Program or any
100 | part thereof, to be licensed as a whole at no charge to all third
101 | parties under the terms of this License.
102 |
103 | c) If the modified program normally reads commands interactively
104 | when run, you must cause it, when started running for such
105 | interactive use in the most ordinary way, to print or display an
106 | announcement including an appropriate copyright notice and a
107 | notice that there is no warranty (or else, saying that you provide
108 | a warranty) and that users may redistribute the program under
109 | these conditions, and telling the user how to view a copy of this
110 | License. (Exception: if the Program itself is interactive but
111 | does not normally print such an announcement, your work based on
112 | the Program is not required to print an announcement.)
113 |
114 | These requirements apply to the modified work as a whole. If
115 | identifiable sections of that work are not derived from the Program,
116 | and can be reasonably considered independent and separate works in
117 | themselves, then this License, and its terms, do not apply to those
118 | sections when you distribute them as separate works. But when you
119 | distribute the same sections as part of a whole which is a work based
120 | on the Program, the distribution of the whole must be on the terms of
121 | this License, whose permissions for other licensees extend to the
122 | entire whole, and thus to each and every part regardless of who wrote it.
123 |
124 | Thus, it is not the intent of this section to claim rights or contest
125 | your rights to work written entirely by you; rather, the intent is to
126 | exercise the right to control the distribution of derivative or
127 | collective works based on the Program.
128 |
129 | In addition, mere aggregation of another work not based on the Program
130 | with the Program (or with a work based on the Program) on a volume of
131 | a storage or distribution medium does not bring the other work under
132 | the scope of this License.
133 |
134 | 3. You may copy and distribute the Program (or a work based on it,
135 | under Section 2) in object code or executable form under the terms of
136 | Sections 1 and 2 above provided that you also do one of the following:
137 |
138 | a) Accompany it with the complete corresponding machine-readable
139 | source code, which must be distributed under the terms of Sections
140 | 1 and 2 above on a medium customarily used for software interchange; or,
141 |
142 | b) Accompany it with a written offer, valid for at least three
143 | years, to give any third party, for a charge no more than your
144 | cost of physically performing source distribution, a complete
145 | machine-readable copy of the corresponding source code, to be
146 | distributed under the terms of Sections 1 and 2 above on a medium
147 | customarily used for software interchange; or,
148 |
149 | c) Accompany it with the information you received as to the offer
150 | to distribute corresponding source code. (This alternative is
151 | allowed only for noncommercial distribution and only if you
152 | received the program in object code or executable form with such
153 | an offer, in accord with Subsection b above.)
154 |
155 | The source code for a work means the preferred form of the work for
156 | making modifications to it. For an executable work, complete source
157 | code means all the source code for all modules it contains, plus any
158 | associated interface definition files, plus the scripts used to
159 | control compilation and installation of the executable. However, as a
160 | special exception, the source code distributed need not include
161 | anything that is normally distributed (in either source or binary
162 | form) with the major components (compiler, kernel, and so on) of the
163 | operating system on which the executable runs, unless that component
164 | itself accompanies the executable.
165 |
166 | If distribution of executable or object code is made by offering
167 | access to copy from a designated place, then offering equivalent
168 | access to copy the source code from the same place counts as
169 | distribution of the source code, even though third parties are not
170 | compelled to copy the source along with the object code.
171 |
172 | 4. You may not copy, modify, sublicense, or distribute the Program
173 | except as expressly provided under this License. Any attempt
174 | otherwise to copy, modify, sublicense or distribute the Program is
175 | void, and will automatically terminate your rights under this License.
176 | However, parties who have received copies, or rights, from you under
177 | this License will not have their licenses terminated so long as such
178 | parties remain in full compliance.
179 |
180 | 5. You are not required to accept this License, since you have not
181 | signed it. However, nothing else grants you permission to modify or
182 | distribute the Program or its derivative works. These actions are
183 | prohibited by law if you do not accept this License. Therefore, by
184 | modifying or distributing the Program (or any work based on the
185 | Program), you indicate your acceptance of this License to do so, and
186 | all its terms and conditions for copying, distributing or modifying
187 | the Program or works based on it.
188 |
189 | 6. Each time you redistribute the Program (or any work based on the
190 | Program), the recipient automatically receives a license from the
191 | original licensor to copy, distribute or modify the Program subject to
192 | these terms and conditions. You may not impose any further
193 | restrictions on the recipients' exercise of the rights granted herein.
194 | You are not responsible for enforcing compliance by third parties to
195 | this License.
196 |
197 | 7. If, as a consequence of a court judgment or allegation of patent
198 | infringement or for any other reason (not limited to patent issues),
199 | conditions are imposed on you (whether by court order, agreement or
200 | otherwise) that contradict the conditions of this License, they do not
201 | excuse you from the conditions of this License. If you cannot
202 | distribute so as to satisfy simultaneously your obligations under this
203 | License and any other pertinent obligations, then as a consequence you
204 | may not distribute the Program at all. For example, if a patent
205 | license would not permit royalty-free redistribution of the Program by
206 | all those who receive copies directly or indirectly through you, then
207 | the only way you could satisfy both it and this License would be to
208 | refrain entirely from distribution of the Program.
209 |
210 | If any portion of this section is held invalid or unenforceable under
211 | any particular circumstance, the balance of the section is intended to
212 | apply and the section as a whole is intended to apply in other
213 | circumstances.
214 |
215 | It is not the purpose of this section to induce you to infringe any
216 | patents or other property right claims or to contest validity of any
217 | such claims; this section has the sole purpose of protecting the
218 | integrity of the free software distribution system, which is
219 | implemented by public license practices. Many people have made
220 | generous contributions to the wide range of software distributed
221 | through that system in reliance on consistent application of that
222 | system; it is up to the author/donor to decide if he or she is willing
223 | to distribute software through any other system and a licensee cannot
224 | impose that choice.
225 |
226 | This section is intended to make thoroughly clear what is believed to
227 | be a consequence of the rest of this License.
228 |
229 | 8. If the distribution and/or use of the Program is restricted in
230 | certain countries either by patents or by copyrighted interfaces, the
231 | original copyright holder who places the Program under this License
232 | may add an explicit geographical distribution limitation excluding
233 | those countries, so that distribution is permitted only in or among
234 | countries not thus excluded. In such case, this License incorporates
235 | the limitation as if written in the body of this License.
236 |
237 | 9. The Free Software Foundation may publish revised and/or new versions
238 | of the General Public License from time to time. Such new versions will
239 | be similar in spirit to the present version, but may differ in detail to
240 | address new problems or concerns.
241 |
242 | Each version is given a distinguishing version number. If the Program
243 | specifies a version number of this License which applies to it and "any
244 | later version", you have the option of following the terms and conditions
245 | either of that version or of any later version published by the Free
246 | Software Foundation. If the Program does not specify a version number of
247 | this License, you may choose any version ever published by the Free Software
248 | Foundation.
249 |
250 | 10. If you wish to incorporate parts of the Program into other free
251 | programs whose distribution conditions are different, write to the author
252 | to ask for permission. For software which is copyrighted by the Free
253 | Software Foundation, write to the Free Software Foundation; we sometimes
254 | make exceptions for this. Our decision will be guided by the two goals
255 | of preserving the free status of all derivatives of our free software and
256 | of promoting the sharing and reuse of software generally.
257 |
258 | NO WARRANTY
259 |
260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268 | REPAIR OR CORRECTION.
269 |
270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278 | POSSIBILITY OF SUCH DAMAGES.
279 |
280 | END OF TERMS AND CONDITIONS
281 |
282 | How to Apply These Terms to Your New Programs
283 |
284 | If you develop a new program, and you want it to be of the greatest
285 | possible use to the public, the best way to achieve this is to make it
286 | free software which everyone can redistribute and change under these terms.
287 |
288 | To do so, attach the following notices to the program. It is safest
289 | to attach them to the start of each source file to most effectively
290 | convey the exclusion of warranty; and each file should have at least
291 | the "copyright" line and a pointer to where the full notice is found.
292 |
293 |
294 | Copyright (C)
295 |
296 | This program is free software; you can redistribute it and/or modify
297 | it under the terms of the GNU General Public License as published by
298 | the Free Software Foundation; either version 2 of the License, or
299 | (at your option) any later version.
300 |
301 | This program is distributed in the hope that it will be useful,
302 | but WITHOUT ANY WARRANTY; without even the implied warranty of
303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304 | GNU General Public License for more details.
305 |
306 | You should have received a copy of the GNU General Public License along
307 | with this program; if not, write to the Free Software Foundation, Inc.,
308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
309 |
310 | Also add information on how to contact you by electronic and paper mail.
311 |
312 | If the program is interactive, make it output a short notice like this
313 | when it starts in an interactive mode:
314 |
315 | Gnomovision version 69, Copyright (C) year name of author
316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317 | This is free software, and you are welcome to redistribute it
318 | under certain conditions; type `show c' for details.
319 |
320 | The hypothetical commands `show w' and `show c' should show the appropriate
321 | parts of the General Public License. Of course, the commands you use may
322 | be called something other than `show w' and `show c'; they could even be
323 | mouse-clicks or menu items--whatever suits your program.
324 |
325 | You should also get your employer (if you work as a programmer) or your
326 | school, if any, to sign a "copyright disclaimer" for the program, if
327 | necessary. Here is a sample; alter the names:
328 |
329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330 | `Gnomovision' (which makes passes at compilers) written by James Hacker.
331 |
332 | , 1 April 1989
333 | Ty Coon, President of Vice
334 |
335 | This General Public License does not permit incorporating your program into
336 | proprietary programs. If your program is a subroutine library, you may
337 | consider it more useful to permit linking proprietary applications with the
338 | library. If this is what you want to do, use the GNU Lesser General
339 | Public License instead of this License.
340 |
--------------------------------------------------------------------------------
/Spring/day-6/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 2, June 1991
3 |
4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6 | Everyone is permitted to copy and distribute verbatim copies
7 | of this license document, but changing it is not allowed.
8 |
9 | Preamble
10 |
11 | The licenses for most software are designed to take away your
12 | freedom to share and change it. By contrast, the GNU General Public
13 | License is intended to guarantee your freedom to share and change free
14 | software--to make sure the software is free for all its users. This
15 | General Public License applies to most of the Free Software
16 | Foundation's software and to any other program whose authors commit to
17 | using it. (Some other Free Software Foundation software is covered by
18 | the GNU Lesser General Public License instead.) You can apply it to
19 | your programs, too.
20 |
21 | When we speak of free software, we are referring to freedom, not
22 | price. Our General Public Licenses are designed to make sure that you
23 | have the freedom to distribute copies of free software (and charge for
24 | this service if you wish), that you receive source code or can get it
25 | if you want it, that you can change the software or use pieces of it
26 | in new free programs; and that you know you can do these things.
27 |
28 | To protect your rights, we need to make restrictions that forbid
29 | anyone to deny you these rights or to ask you to surrender the rights.
30 | These restrictions translate to certain responsibilities for you if you
31 | distribute copies of the software, or if you modify it.
32 |
33 | For example, if you distribute copies of such a program, whether
34 | gratis or for a fee, you must give the recipients all the rights that
35 | you have. You must make sure that they, too, receive or can get the
36 | source code. And you must show them these terms so they know their
37 | rights.
38 |
39 | We protect your rights with two steps: (1) copyright the software, and
40 | (2) offer you this license which gives you legal permission to copy,
41 | distribute and/or modify the software.
42 |
43 | Also, for each author's protection and ours, we want to make certain
44 | that everyone understands that there is no warranty for this free
45 | software. If the software is modified by someone else and passed on, we
46 | want its recipients to know that what they have is not the original, so
47 | that any problems introduced by others will not reflect on the original
48 | authors' reputations.
49 |
50 | Finally, any free program is threatened constantly by software
51 | patents. We wish to avoid the danger that redistributors of a free
52 | program will individually obtain patent licenses, in effect making the
53 | program proprietary. To prevent this, we have made it clear that any
54 | patent must be licensed for everyone's free use or not licensed at all.
55 |
56 | The precise terms and conditions for copying, distribution and
57 | modification follow.
58 |
59 | GNU GENERAL PUBLIC LICENSE
60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61 |
62 | 0. This License applies to any program or other work which contains
63 | a notice placed by the copyright holder saying it may be distributed
64 | under the terms of this General Public License. The "Program", below,
65 | refers to any such program or work, and a "work based on the Program"
66 | means either the Program or any derivative work under copyright law:
67 | that is to say, a work containing the Program or a portion of it,
68 | either verbatim or with modifications and/or translated into another
69 | language. (Hereinafter, translation is included without limitation in
70 | the term "modification".) Each licensee is addressed as "you".
71 |
72 | Activities other than copying, distribution and modification are not
73 | covered by this License; they are outside its scope. The act of
74 | running the Program is not restricted, and the output from the Program
75 | is covered only if its contents constitute a work based on the
76 | Program (independent of having been made by running the Program).
77 | Whether that is true depends on what the Program does.
78 |
79 | 1. You may copy and distribute verbatim copies of the Program's
80 | source code as you receive it, in any medium, provided that you
81 | conspicuously and appropriately publish on each copy an appropriate
82 | copyright notice and disclaimer of warranty; keep intact all the
83 | notices that refer to this License and to the absence of any warranty;
84 | and give any other recipients of the Program a copy of this License
85 | along with the Program.
86 |
87 | You may charge a fee for the physical act of transferring a copy, and
88 | you may at your option offer warranty protection in exchange for a fee.
89 |
90 | 2. You may modify your copy or copies of the Program or any portion
91 | of it, thus forming a work based on the Program, and copy and
92 | distribute such modifications or work under the terms of Section 1
93 | above, provided that you also meet all of these conditions:
94 |
95 | a) You must cause the modified files to carry prominent notices
96 | stating that you changed the files and the date of any change.
97 |
98 | b) You must cause any work that you distribute or publish, that in
99 | whole or in part contains or is derived from the Program or any
100 | part thereof, to be licensed as a whole at no charge to all third
101 | parties under the terms of this License.
102 |
103 | c) If the modified program normally reads commands interactively
104 | when run, you must cause it, when started running for such
105 | interactive use in the most ordinary way, to print or display an
106 | announcement including an appropriate copyright notice and a
107 | notice that there is no warranty (or else, saying that you provide
108 | a warranty) and that users may redistribute the program under
109 | these conditions, and telling the user how to view a copy of this
110 | License. (Exception: if the Program itself is interactive but
111 | does not normally print such an announcement, your work based on
112 | the Program is not required to print an announcement.)
113 |
114 | These requirements apply to the modified work as a whole. If
115 | identifiable sections of that work are not derived from the Program,
116 | and can be reasonably considered independent and separate works in
117 | themselves, then this License, and its terms, do not apply to those
118 | sections when you distribute them as separate works. But when you
119 | distribute the same sections as part of a whole which is a work based
120 | on the Program, the distribution of the whole must be on the terms of
121 | this License, whose permissions for other licensees extend to the
122 | entire whole, and thus to each and every part regardless of who wrote it.
123 |
124 | Thus, it is not the intent of this section to claim rights or contest
125 | your rights to work written entirely by you; rather, the intent is to
126 | exercise the right to control the distribution of derivative or
127 | collective works based on the Program.
128 |
129 | In addition, mere aggregation of another work not based on the Program
130 | with the Program (or with a work based on the Program) on a volume of
131 | a storage or distribution medium does not bring the other work under
132 | the scope of this License.
133 |
134 | 3. You may copy and distribute the Program (or a work based on it,
135 | under Section 2) in object code or executable form under the terms of
136 | Sections 1 and 2 above provided that you also do one of the following:
137 |
138 | a) Accompany it with the complete corresponding machine-readable
139 | source code, which must be distributed under the terms of Sections
140 | 1 and 2 above on a medium customarily used for software interchange; or,
141 |
142 | b) Accompany it with a written offer, valid for at least three
143 | years, to give any third party, for a charge no more than your
144 | cost of physically performing source distribution, a complete
145 | machine-readable copy of the corresponding source code, to be
146 | distributed under the terms of Sections 1 and 2 above on a medium
147 | customarily used for software interchange; or,
148 |
149 | c) Accompany it with the information you received as to the offer
150 | to distribute corresponding source code. (This alternative is
151 | allowed only for noncommercial distribution and only if you
152 | received the program in object code or executable form with such
153 | an offer, in accord with Subsection b above.)
154 |
155 | The source code for a work means the preferred form of the work for
156 | making modifications to it. For an executable work, complete source
157 | code means all the source code for all modules it contains, plus any
158 | associated interface definition files, plus the scripts used to
159 | control compilation and installation of the executable. However, as a
160 | special exception, the source code distributed need not include
161 | anything that is normally distributed (in either source or binary
162 | form) with the major components (compiler, kernel, and so on) of the
163 | operating system on which the executable runs, unless that component
164 | itself accompanies the executable.
165 |
166 | If distribution of executable or object code is made by offering
167 | access to copy from a designated place, then offering equivalent
168 | access to copy the source code from the same place counts as
169 | distribution of the source code, even though third parties are not
170 | compelled to copy the source along with the object code.
171 |
172 | 4. You may not copy, modify, sublicense, or distribute the Program
173 | except as expressly provided under this License. Any attempt
174 | otherwise to copy, modify, sublicense or distribute the Program is
175 | void, and will automatically terminate your rights under this License.
176 | However, parties who have received copies, or rights, from you under
177 | this License will not have their licenses terminated so long as such
178 | parties remain in full compliance.
179 |
180 | 5. You are not required to accept this License, since you have not
181 | signed it. However, nothing else grants you permission to modify or
182 | distribute the Program or its derivative works. These actions are
183 | prohibited by law if you do not accept this License. Therefore, by
184 | modifying or distributing the Program (or any work based on the
185 | Program), you indicate your acceptance of this License to do so, and
186 | all its terms and conditions for copying, distributing or modifying
187 | the Program or works based on it.
188 |
189 | 6. Each time you redistribute the Program (or any work based on the
190 | Program), the recipient automatically receives a license from the
191 | original licensor to copy, distribute or modify the Program subject to
192 | these terms and conditions. You may not impose any further
193 | restrictions on the recipients' exercise of the rights granted herein.
194 | You are not responsible for enforcing compliance by third parties to
195 | this License.
196 |
197 | 7. If, as a consequence of a court judgment or allegation of patent
198 | infringement or for any other reason (not limited to patent issues),
199 | conditions are imposed on you (whether by court order, agreement or
200 | otherwise) that contradict the conditions of this License, they do not
201 | excuse you from the conditions of this License. If you cannot
202 | distribute so as to satisfy simultaneously your obligations under this
203 | License and any other pertinent obligations, then as a consequence you
204 | may not distribute the Program at all. For example, if a patent
205 | license would not permit royalty-free redistribution of the Program by
206 | all those who receive copies directly or indirectly through you, then
207 | the only way you could satisfy both it and this License would be to
208 | refrain entirely from distribution of the Program.
209 |
210 | If any portion of this section is held invalid or unenforceable under
211 | any particular circumstance, the balance of the section is intended to
212 | apply and the section as a whole is intended to apply in other
213 | circumstances.
214 |
215 | It is not the purpose of this section to induce you to infringe any
216 | patents or other property right claims or to contest validity of any
217 | such claims; this section has the sole purpose of protecting the
218 | integrity of the free software distribution system, which is
219 | implemented by public license practices. Many people have made
220 | generous contributions to the wide range of software distributed
221 | through that system in reliance on consistent application of that
222 | system; it is up to the author/donor to decide if he or she is willing
223 | to distribute software through any other system and a licensee cannot
224 | impose that choice.
225 |
226 | This section is intended to make thoroughly clear what is believed to
227 | be a consequence of the rest of this License.
228 |
229 | 8. If the distribution and/or use of the Program is restricted in
230 | certain countries either by patents or by copyrighted interfaces, the
231 | original copyright holder who places the Program under this License
232 | may add an explicit geographical distribution limitation excluding
233 | those countries, so that distribution is permitted only in or among
234 | countries not thus excluded. In such case, this License incorporates
235 | the limitation as if written in the body of this License.
236 |
237 | 9. The Free Software Foundation may publish revised and/or new versions
238 | of the General Public License from time to time. Such new versions will
239 | be similar in spirit to the present version, but may differ in detail to
240 | address new problems or concerns.
241 |
242 | Each version is given a distinguishing version number. If the Program
243 | specifies a version number of this License which applies to it and "any
244 | later version", you have the option of following the terms and conditions
245 | either of that version or of any later version published by the Free
246 | Software Foundation. If the Program does not specify a version number of
247 | this License, you may choose any version ever published by the Free Software
248 | Foundation.
249 |
250 | 10. If you wish to incorporate parts of the Program into other free
251 | programs whose distribution conditions are different, write to the author
252 | to ask for permission. For software which is copyrighted by the Free
253 | Software Foundation, write to the Free Software Foundation; we sometimes
254 | make exceptions for this. Our decision will be guided by the two goals
255 | of preserving the free status of all derivatives of our free software and
256 | of promoting the sharing and reuse of software generally.
257 |
258 | NO WARRANTY
259 |
260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268 | REPAIR OR CORRECTION.
269 |
270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278 | POSSIBILITY OF SUCH DAMAGES.
279 |
280 | END OF TERMS AND CONDITIONS
281 |
282 | How to Apply These Terms to Your New Programs
283 |
284 | If you develop a new program, and you want it to be of the greatest
285 | possible use to the public, the best way to achieve this is to make it
286 | free software which everyone can redistribute and change under these terms.
287 |
288 | To do so, attach the following notices to the program. It is safest
289 | to attach them to the start of each source file to most effectively
290 | convey the exclusion of warranty; and each file should have at least
291 | the "copyright" line and a pointer to where the full notice is found.
292 |
293 |
294 | Copyright (C)
295 |
296 | This program is free software; you can redistribute it and/or modify
297 | it under the terms of the GNU General Public License as published by
298 | the Free Software Foundation; either version 2 of the License, or
299 | (at your option) any later version.
300 |
301 | This program is distributed in the hope that it will be useful,
302 | but WITHOUT ANY WARRANTY; without even the implied warranty of
303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304 | GNU General Public License for more details.
305 |
306 | You should have received a copy of the GNU General Public License along
307 | with this program; if not, write to the Free Software Foundation, Inc.,
308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
309 |
310 | Also add information on how to contact you by electronic and paper mail.
311 |
312 | If the program is interactive, make it output a short notice like this
313 | when it starts in an interactive mode:
314 |
315 | Gnomovision version 69, Copyright (C) year name of author
316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317 | This is free software, and you are welcome to redistribute it
318 | under certain conditions; type `show c' for details.
319 |
320 | The hypothetical commands `show w' and `show c' should show the appropriate
321 | parts of the General Public License. Of course, the commands you use may
322 | be called something other than `show w' and `show c'; they could even be
323 | mouse-clicks or menu items--whatever suits your program.
324 |
325 | You should also get your employer (if you work as a programmer) or your
326 | school, if any, to sign a "copyright disclaimer" for the program, if
327 | necessary. Here is a sample; alter the names:
328 |
329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330 | `Gnomovision' (which makes passes at compilers) written by James Hacker.
331 |
332 | , 1 April 1989
333 | Ty Coon, President of Vice
334 |
335 | This General Public License does not permit incorporating your program into
336 | proprietary programs. If your program is a subroutine library, you may
337 | consider it more useful to permit linking proprietary applications with the
338 | library. If this is what you want to do, use the GNU Lesser General
339 | Public License instead of this License.
340 |
--------------------------------------------------------------------------------
/Spring/afterwards/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 2, June 1991
3 |
4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6 | Everyone is permitted to copy and distribute verbatim copies
7 | of this license document, but changing it is not allowed.
8 |
9 | Preamble
10 |
11 | The licenses for most software are designed to take away your
12 | freedom to share and change it. By contrast, the GNU General Public
13 | License is intended to guarantee your freedom to share and change free
14 | software--to make sure the software is free for all its users. This
15 | General Public License applies to most of the Free Software
16 | Foundation's software and to any other program whose authors commit to
17 | using it. (Some other Free Software Foundation software is covered by
18 | the GNU Lesser General Public License instead.) You can apply it to
19 | your programs, too.
20 |
21 | When we speak of free software, we are referring to freedom, not
22 | price. Our General Public Licenses are designed to make sure that you
23 | have the freedom to distribute copies of free software (and charge for
24 | this service if you wish), that you receive source code or can get it
25 | if you want it, that you can change the software or use pieces of it
26 | in new free programs; and that you know you can do these things.
27 |
28 | To protect your rights, we need to make restrictions that forbid
29 | anyone to deny you these rights or to ask you to surrender the rights.
30 | These restrictions translate to certain responsibilities for you if you
31 | distribute copies of the software, or if you modify it.
32 |
33 | For example, if you distribute copies of such a program, whether
34 | gratis or for a fee, you must give the recipients all the rights that
35 | you have. You must make sure that they, too, receive or can get the
36 | source code. And you must show them these terms so they know their
37 | rights.
38 |
39 | We protect your rights with two steps: (1) copyright the software, and
40 | (2) offer you this license which gives you legal permission to copy,
41 | distribute and/or modify the software.
42 |
43 | Also, for each author's protection and ours, we want to make certain
44 | that everyone understands that there is no warranty for this free
45 | software. If the software is modified by someone else and passed on, we
46 | want its recipients to know that what they have is not the original, so
47 | that any problems introduced by others will not reflect on the original
48 | authors' reputations.
49 |
50 | Finally, any free program is threatened constantly by software
51 | patents. We wish to avoid the danger that redistributors of a free
52 | program will individually obtain patent licenses, in effect making the
53 | program proprietary. To prevent this, we have made it clear that any
54 | patent must be licensed for everyone's free use or not licensed at all.
55 |
56 | The precise terms and conditions for copying, distribution and
57 | modification follow.
58 |
59 | GNU GENERAL PUBLIC LICENSE
60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61 |
62 | 0. This License applies to any program or other work which contains
63 | a notice placed by the copyright holder saying it may be distributed
64 | under the terms of this General Public License. The "Program", below,
65 | refers to any such program or work, and a "work based on the Program"
66 | means either the Program or any derivative work under copyright law:
67 | that is to say, a work containing the Program or a portion of it,
68 | either verbatim or with modifications and/or translated into another
69 | language. (Hereinafter, translation is included without limitation in
70 | the term "modification".) Each licensee is addressed as "you".
71 |
72 | Activities other than copying, distribution and modification are not
73 | covered by this License; they are outside its scope. The act of
74 | running the Program is not restricted, and the output from the Program
75 | is covered only if its contents constitute a work based on the
76 | Program (independent of having been made by running the Program).
77 | Whether that is true depends on what the Program does.
78 |
79 | 1. You may copy and distribute verbatim copies of the Program's
80 | source code as you receive it, in any medium, provided that you
81 | conspicuously and appropriately publish on each copy an appropriate
82 | copyright notice and disclaimer of warranty; keep intact all the
83 | notices that refer to this License and to the absence of any warranty;
84 | and give any other recipients of the Program a copy of this License
85 | along with the Program.
86 |
87 | You may charge a fee for the physical act of transferring a copy, and
88 | you may at your option offer warranty protection in exchange for a fee.
89 |
90 | 2. You may modify your copy or copies of the Program or any portion
91 | of it, thus forming a work based on the Program, and copy and
92 | distribute such modifications or work under the terms of Section 1
93 | above, provided that you also meet all of these conditions:
94 |
95 | a) You must cause the modified files to carry prominent notices
96 | stating that you changed the files and the date of any change.
97 |
98 | b) You must cause any work that you distribute or publish, that in
99 | whole or in part contains or is derived from the Program or any
100 | part thereof, to be licensed as a whole at no charge to all third
101 | parties under the terms of this License.
102 |
103 | c) If the modified program normally reads commands interactively
104 | when run, you must cause it, when started running for such
105 | interactive use in the most ordinary way, to print or display an
106 | announcement including an appropriate copyright notice and a
107 | notice that there is no warranty (or else, saying that you provide
108 | a warranty) and that users may redistribute the program under
109 | these conditions, and telling the user how to view a copy of this
110 | License. (Exception: if the Program itself is interactive but
111 | does not normally print such an announcement, your work based on
112 | the Program is not required to print an announcement.)
113 |
114 | These requirements apply to the modified work as a whole. If
115 | identifiable sections of that work are not derived from the Program,
116 | and can be reasonably considered independent and separate works in
117 | themselves, then this License, and its terms, do not apply to those
118 | sections when you distribute them as separate works. But when you
119 | distribute the same sections as part of a whole which is a work based
120 | on the Program, the distribution of the whole must be on the terms of
121 | this License, whose permissions for other licensees extend to the
122 | entire whole, and thus to each and every part regardless of who wrote it.
123 |
124 | Thus, it is not the intent of this section to claim rights or contest
125 | your rights to work written entirely by you; rather, the intent is to
126 | exercise the right to control the distribution of derivative or
127 | collective works based on the Program.
128 |
129 | In addition, mere aggregation of another work not based on the Program
130 | with the Program (or with a work based on the Program) on a volume of
131 | a storage or distribution medium does not bring the other work under
132 | the scope of this License.
133 |
134 | 3. You may copy and distribute the Program (or a work based on it,
135 | under Section 2) in object code or executable form under the terms of
136 | Sections 1 and 2 above provided that you also do one of the following:
137 |
138 | a) Accompany it with the complete corresponding machine-readable
139 | source code, which must be distributed under the terms of Sections
140 | 1 and 2 above on a medium customarily used for software interchange; or,
141 |
142 | b) Accompany it with a written offer, valid for at least three
143 | years, to give any third party, for a charge no more than your
144 | cost of physically performing source distribution, a complete
145 | machine-readable copy of the corresponding source code, to be
146 | distributed under the terms of Sections 1 and 2 above on a medium
147 | customarily used for software interchange; or,
148 |
149 | c) Accompany it with the information you received as to the offer
150 | to distribute corresponding source code. (This alternative is
151 | allowed only for noncommercial distribution and only if you
152 | received the program in object code or executable form with such
153 | an offer, in accord with Subsection b above.)
154 |
155 | The source code for a work means the preferred form of the work for
156 | making modifications to it. For an executable work, complete source
157 | code means all the source code for all modules it contains, plus any
158 | associated interface definition files, plus the scripts used to
159 | control compilation and installation of the executable. However, as a
160 | special exception, the source code distributed need not include
161 | anything that is normally distributed (in either source or binary
162 | form) with the major components (compiler, kernel, and so on) of the
163 | operating system on which the executable runs, unless that component
164 | itself accompanies the executable.
165 |
166 | If distribution of executable or object code is made by offering
167 | access to copy from a designated place, then offering equivalent
168 | access to copy the source code from the same place counts as
169 | distribution of the source code, even though third parties are not
170 | compelled to copy the source along with the object code.
171 |
172 | 4. You may not copy, modify, sublicense, or distribute the Program
173 | except as expressly provided under this License. Any attempt
174 | otherwise to copy, modify, sublicense or distribute the Program is
175 | void, and will automatically terminate your rights under this License.
176 | However, parties who have received copies, or rights, from you under
177 | this License will not have their licenses terminated so long as such
178 | parties remain in full compliance.
179 |
180 | 5. You are not required to accept this License, since you have not
181 | signed it. However, nothing else grants you permission to modify or
182 | distribute the Program or its derivative works. These actions are
183 | prohibited by law if you do not accept this License. Therefore, by
184 | modifying or distributing the Program (or any work based on the
185 | Program), you indicate your acceptance of this License to do so, and
186 | all its terms and conditions for copying, distributing or modifying
187 | the Program or works based on it.
188 |
189 | 6. Each time you redistribute the Program (or any work based on the
190 | Program), the recipient automatically receives a license from the
191 | original licensor to copy, distribute or modify the Program subject to
192 | these terms and conditions. You may not impose any further
193 | restrictions on the recipients' exercise of the rights granted herein.
194 | You are not responsible for enforcing compliance by third parties to
195 | this License.
196 |
197 | 7. If, as a consequence of a court judgment or allegation of patent
198 | infringement or for any other reason (not limited to patent issues),
199 | conditions are imposed on you (whether by court order, agreement or
200 | otherwise) that contradict the conditions of this License, they do not
201 | excuse you from the conditions of this License. If you cannot
202 | distribute so as to satisfy simultaneously your obligations under this
203 | License and any other pertinent obligations, then as a consequence you
204 | may not distribute the Program at all. For example, if a patent
205 | license would not permit royalty-free redistribution of the Program by
206 | all those who receive copies directly or indirectly through you, then
207 | the only way you could satisfy both it and this License would be to
208 | refrain entirely from distribution of the Program.
209 |
210 | If any portion of this section is held invalid or unenforceable under
211 | any particular circumstance, the balance of the section is intended to
212 | apply and the section as a whole is intended to apply in other
213 | circumstances.
214 |
215 | It is not the purpose of this section to induce you to infringe any
216 | patents or other property right claims or to contest validity of any
217 | such claims; this section has the sole purpose of protecting the
218 | integrity of the free software distribution system, which is
219 | implemented by public license practices. Many people have made
220 | generous contributions to the wide range of software distributed
221 | through that system in reliance on consistent application of that
222 | system; it is up to the author/donor to decide if he or she is willing
223 | to distribute software through any other system and a licensee cannot
224 | impose that choice.
225 |
226 | This section is intended to make thoroughly clear what is believed to
227 | be a consequence of the rest of this License.
228 |
229 | 8. If the distribution and/or use of the Program is restricted in
230 | certain countries either by patents or by copyrighted interfaces, the
231 | original copyright holder who places the Program under this License
232 | may add an explicit geographical distribution limitation excluding
233 | those countries, so that distribution is permitted only in or among
234 | countries not thus excluded. In such case, this License incorporates
235 | the limitation as if written in the body of this License.
236 |
237 | 9. The Free Software Foundation may publish revised and/or new versions
238 | of the General Public License from time to time. Such new versions will
239 | be similar in spirit to the present version, but may differ in detail to
240 | address new problems or concerns.
241 |
242 | Each version is given a distinguishing version number. If the Program
243 | specifies a version number of this License which applies to it and "any
244 | later version", you have the option of following the terms and conditions
245 | either of that version or of any later version published by the Free
246 | Software Foundation. If the Program does not specify a version number of
247 | this License, you may choose any version ever published by the Free Software
248 | Foundation.
249 |
250 | 10. If you wish to incorporate parts of the Program into other free
251 | programs whose distribution conditions are different, write to the author
252 | to ask for permission. For software which is copyrighted by the Free
253 | Software Foundation, write to the Free Software Foundation; we sometimes
254 | make exceptions for this. Our decision will be guided by the two goals
255 | of preserving the free status of all derivatives of our free software and
256 | of promoting the sharing and reuse of software generally.
257 |
258 | NO WARRANTY
259 |
260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268 | REPAIR OR CORRECTION.
269 |
270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278 | POSSIBILITY OF SUCH DAMAGES.
279 |
280 | END OF TERMS AND CONDITIONS
281 |
282 | How to Apply These Terms to Your New Programs
283 |
284 | If you develop a new program, and you want it to be of the greatest
285 | possible use to the public, the best way to achieve this is to make it
286 | free software which everyone can redistribute and change under these terms.
287 |
288 | To do so, attach the following notices to the program. It is safest
289 | to attach them to the start of each source file to most effectively
290 | convey the exclusion of warranty; and each file should have at least
291 | the "copyright" line and a pointer to where the full notice is found.
292 |
293 |
294 | Copyright (C)
295 |
296 | This program is free software; you can redistribute it and/or modify
297 | it under the terms of the GNU General Public License as published by
298 | the Free Software Foundation; either version 2 of the License, or
299 | (at your option) any later version.
300 |
301 | This program is distributed in the hope that it will be useful,
302 | but WITHOUT ANY WARRANTY; without even the implied warranty of
303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304 | GNU General Public License for more details.
305 |
306 | You should have received a copy of the GNU General Public License along
307 | with this program; if not, write to the Free Software Foundation, Inc.,
308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
309 |
310 | Also add information on how to contact you by electronic and paper mail.
311 |
312 | If the program is interactive, make it output a short notice like this
313 | when it starts in an interactive mode:
314 |
315 | Gnomovision version 69, Copyright (C) year name of author
316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317 | This is free software, and you are welcome to redistribute it
318 | under certain conditions; type `show c' for details.
319 |
320 | The hypothetical commands `show w' and `show c' should show the appropriate
321 | parts of the General Public License. Of course, the commands you use may
322 | be called something other than `show w' and `show c'; they could even be
323 | mouse-clicks or menu items--whatever suits your program.
324 |
325 | You should also get your employer (if you work as a programmer) or your
326 | school, if any, to sign a "copyright disclaimer" for the program, if
327 | necessary. Here is a sample; alter the names:
328 |
329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330 | `Gnomovision' (which makes passes at compilers) written by James Hacker.
331 |
332 | , 1 April 1989
333 | Ty Coon, President of Vice
334 |
335 | This General Public License does not permit incorporating your program into
336 | proprietary programs. If your program is a subroutine library, you may
337 | consider it more useful to permit linking proprietary applications with the
338 | library. If this is what you want to do, use the GNU Lesser General
339 | Public License instead of this License.
340 |
--------------------------------------------------------------------------------
/Spring/day-4/canvas.lisp:
--------------------------------------------------------------------------------
1 | (in-package #:calm)
2 |
3 | ;;
4 | ;; CALM version check
5 | ;; version check won't work on JSCL, since the lack of ASDF
6 | ;;
7 | #-jscl
8 | (let ((required-version "0.1.2")
9 | (calm-version (slot-value (asdf:find-system 'calm) 'asdf:version)))
10 | (when (uiop:version< calm-version required-version)
11 | (format t
12 | "Sorry, this is built on CALM ~A, older version (current: ~A) of CALM won't work.~%"
13 | required-version calm-version)
14 | (uiop:quit)))
15 |
16 |
17 | ;;
18 | ;; the swank server is for debugging, for usage please check
19 | ;; Emacs:
20 | ;; https://slime.common-lisp.dev/
21 | ;; Visual Studio Code
22 | ;; https://lispcookbook.github.io/cl-cookbook/vscode-alive.html
23 | ;;
24 | ;; uncomment the following line to enable SWANK Server
25 | (unless (str:starts-with? "dist" (uiop:getenv "CALM_CMD")) (swank:create-server))
26 |
27 | ;;
28 | ;; by default, the screensaver is disabled,
29 | ;; if you want to enable screensaver,
30 | ;; please uncomment the following line
31 | ;;
32 | (setf (uiop:getenv "SDL_VIDEO_ALLOW_SCREENSAVER") "1")
33 |
34 | ;;
35 | ;; setting window properties, for more of this, please check
36 | ;; https://github.com/VitoVan/calm/blob/main/src/config.lisp
37 | ;;
38 | #-jscl
39 | (setf *calm-delay* 10)
40 | #+jscl
41 | (setf *calm-fps* 0)
42 | (setf *calm-window-width* 600)
43 | (setf *calm-window-height* 600)
44 | (setf *calm-window-title* "The Maze and Lost Cat")
45 |
46 | (u:load-from-app "maze-data.lisp")
47 |
48 | ;; https://rosettacode.org/wiki/Knuth_shuffle#Common_Lisp
49 | (defun nshuffle (sequence)
50 | (loop for i from (length sequence) downto 2
51 | do (rotatef (elt sequence (random i))
52 | (elt sequence (1- i))))
53 | sequence)
54 |
55 | (defparameter *maze-index* nil)
56 | (defparameter *maze-data* nil)
57 | (defparameter *maze* nil)
58 | (defparameter *sight-distance* 0)
59 | (defparameter *player-position* nil)
60 | (defparameter *player-position-previous* nil)
61 | (defparameter *kitty-position* nil)
62 | (defparameter *kitty-collected* nil)
63 |
64 | (defparameter *bgm-started* nil)
65 |
66 | (defparameter *player-color* '(0 0.35 0.59))
67 | ;; (defparameter *kitty-color* '(0.94 0.87 0.47))
68 | (defparameter *kitty-color* '(0.89 0.12 0.17))
69 | (defparameter *player-with-kitty-color* '(0.89 0.12 0.17))
70 | (defparameter *maze-color-solid* '(0.83 0.82 0.84))
71 | ;; (defparameter *maze-color-solid* '(0.4 1 0.4))
72 | (defparameter *maze-color-border* '(0.6 0.6 0.6))
73 | (defparameter *win* 0)
74 | (defparameter *win-pause* nil)
75 | (defparameter *max-steps* 512)
76 | (defparameter *steps* 0)
77 | (defparameter *getting-dark* t)
78 | (defparameter *game-over* nil)
79 | (defparameter *let-go* nil)
80 |
81 | (defparameter *last-meow* nil)
82 | (defun meow ()
83 | (when (> (- (get-universal-time) *last-meow*) (+ 10 (random 100)))
84 | (setf *last-meow* (get-universal-time))
85 | (let* ((kitty-x (car *kitty-position*))
86 | (kitty-y (cadr *kitty-position*))
87 | (player-x (car *player-position*))
88 | (player-y (cadr *player-position*))
89 | (distance (sqrt (+ (expt (abs (- kitty-x player-x)) 2) (expt (abs (- kitty-y player-y)) 2))))
90 | (volume (round (* 128 (/ (max (- 8 distance) 1) 8)))))
91 | (sdl2-mixer:volume-music volume)
92 | ;; (format t "distance: ~A, volume: ~A~%" distance volume)
93 | (c:play-music "assets/meow.wav")
94 | )))
95 |
96 | (defparameter *already-purring* nil)
97 | (defun purr ()
98 | (unless *already-purring*
99 | (c:play-music "assets/purr.wav" :loops -1)
100 | (setf *already-purring* t)))
101 |
102 | (defparameter *already-meow-with-purring* nil)
103 | (defun meow-with-purr ()
104 | (unless *already-meow-with-purring*
105 | (sdl2-mixer:volume-music 128)
106 | (c:play-music "assets/meow-with-purr.wav")
107 | (setf *already-meow-with-purring* t)))
108 |
109 | (defparameter *walk-index* 0)
110 | (defun walk ()
111 | (c:play-wav (str:concat "assets/walk-" (write-to-string *walk-index*) ".wav"))
112 | (if (< *walk-index* 7)
113 | (incf *walk-index*)
114 | (setf *walk-index* 0)))
115 |
116 | (defun init-maze (&optional (maze-index 0))
117 | (c:halt-music)
118 | (setf *already-purring* nil
119 | *already-meow-with-purring* nil
120 | *last-meow* (get-universal-time))
121 | (when (> maze-index 3)
122 | (nshuffle *maze-data-list*))
123 | (setf
124 | *maze-index* (if (> maze-index 3) 0 maze-index)
125 | *maze-data* (nth *maze-index* *maze-data-list*)
126 | *maze* (nth 0 *maze-data*)
127 | *player-position* (nth 1 *maze-data*)
128 | *kitty-position* (nth (random (length (nth 2 *maze-data*))) (nth 2 *maze-data*))
129 | *kitty-collected* nil))
130 |
131 | (init-maze)
132 |
133 |
134 | (defparameter *last-move* 0)
135 | (defun auto-move ()
136 | (unless (> (- (c:get-ticks) *last-move*) 160)
137 | (setf *calm-redraw* t))
138 | (when (and (not *win-pause*) *player-position-previous* (> (- (c:get-ticks) *last-move*) 160))
139 | (let* ((x-incf-factor (- (car *player-position*) (car *player-position-previous*)))
140 | (y-incf-factor (- (cadr *player-position*) (cadr *player-position-previous*)))
141 | (next-player-position (list (+ (car *player-position*) x-incf-factor) (+ (cadr *player-position*) y-incf-factor)))
142 | (all-possible-positions
143 | (list
144 | (list (+ (car *player-position*) 1) (+ (cadr *player-position*) 0))
145 | (list (+ (car *player-position*) 0) (+ (cadr *player-position*) 1))
146 | (list (- (car *player-position*) 1) (- (cadr *player-position*) 0))
147 | (list (- (car *player-position*) 0) (- (cadr *player-position*) 1)))))
148 | (when (and
149 | (array-in-bounds-p *maze* (car next-player-position) (cadr next-player-position))
150 | (not (equalp next-player-position *player-position*)))
151 | ;; (format t "all-possible: ~A~%" all-possible-positions)
152 | (when
153 | (and
154 | ;; next plot is empty
155 | (= (aref *maze* (car next-player-position) (cadr next-player-position)) 0)
156 | ;; no more than 2 possible routes
157 | (<= (count-if #'(lambda (x) (and (array-in-bounds-p *maze* (car x) (cadr x)) (= (aref *maze* (car x) (cadr x)) 0))) all-possible-positions) 2)
158 | )
159 | (when *kitty-collected*
160 | (setf *kitty-position* *player-position*))
161 | (setf *player-position-previous* *player-position*)
162 | (setf *player-position* next-player-position)
163 | (when (> *steps* *max-steps*)
164 | (setf *getting-dark* (not *getting-dark*)))
165 | (if *getting-dark* (incf *steps*) (decf *steps*))
166 | (setf *last-move* (c:get-ticks))
167 | (setf *calm-redraw* t)
168 | ;; (format t "cur: ~A, nxt: ~A~%" *player-position* next-player-position)
169 | )
170 | ))
171 | (when (and *kitty-collected* (equalp *player-position* '(12 11)))
172 | (purr)
173 | (incf *win*)
174 | (setf *win-pause* t))))
175 |
176 | (defun on-keydown (key)
177 | (unless *bgm-started*
178 | (c:play-wav "assets/bgm.mp3" :loops -1)
179 | (setf *bgm-started* t))
180 | (when (c:keq key :scancode-q :scancode-escape)
181 | (setf *game-over* t))
182 |
183 | (when (and *game-over* (c:keq key :scancode-return))
184 | (setf
185 | *game-over* nil
186 | *win* 0
187 | *steps* 0)
188 | (init-maze 0))
189 |
190 | ;; let go
191 | (when (and *win-pause* (= *win* 10) (c:keq key :scancode-g))
192 | (setf *let-go* t)
193 | (c:halt-music))
194 |
195 | ;; trap kitty
196 | (when (and *win-pause* (= *win* 11) (c:keq key :scancode-t))
197 | (init-maze 0)
198 | (setf
199 | *win-pause* nil
200 | *win* 0))
201 |
202 | (when (and *win-pause* (c:keq key :scancode-return))
203 | (init-maze (1+ *maze-index*))
204 | (setf *win-pause* nil))
205 |
206 | (unless *win-pause*
207 | (let ((next-player-position (copy-list *player-position*)))
208 | (cond
209 | ((c:keq key :scancode-left :scancode-h)
210 | (decf (car next-player-position)))
211 | ((c:keq key :scancode-right :scancode-l)
212 | (incf (car next-player-position)))
213 | ((c:keq key :scancode-up :scancode-k)
214 | (decf (cadr next-player-position)))
215 | ((c:keq key :scancode-down :scancode-j)
216 | (incf (cadr next-player-position))))
217 | (when (and
218 | (array-in-bounds-p *maze* (car next-player-position) (cadr next-player-position))
219 | (not (equalp next-player-position *player-position*)))
220 | (when (= (aref *maze* (car next-player-position) (cadr next-player-position)) 0)
221 | (walk)
222 | (when *kitty-collected*
223 | (setf *kitty-position* *player-position*))
224 | (setf *player-position-previous* *player-position*)
225 | (setf *player-position* next-player-position)
226 | (when (or (> *steps* *max-steps*) (< *steps* 0))
227 | (setf *getting-dark* (not *getting-dark*)))
228 | (if *getting-dark* (incf *steps*) (decf *steps*))
229 | (setf *last-move* (c:get-ticks)))
230 | ))
231 |
232 | (when (and *kitty-collected* (equalp *player-position* '(12 11)))
233 | (purr)
234 | (incf *win*)
235 | (setf *win-pause* t)))
236 |
237 | ;;(format t "current player position: ~A~%" *player-position*)
238 | )
239 |
240 | (defun draw-kitty ()
241 | (when (or *kitty-collected* (< (- (get-universal-time) *last-meow*) 1))
242 | (c:save)
243 | (c:set-line-width 4)
244 | (c:set-line-cap :round)
245 | ;; body
246 | (c:move-to 0 0)
247 | (c:curve-to 10 10 20 10 30 0)
248 | (c:curve-to 60 50 30 45 30 45)
249 | (c:line-to 0 45)
250 | (c:curve-to -10 45 -20 35 0 0)
251 | (c:stroke)
252 | ;; eyes
253 | (c:arc 8 20 3 0 (* 2 pi))
254 | (c:arc 24 20 3 0 (* 2 pi))
255 | (c:fill-path)
256 | ;; smile
257 | (when *kitty-collected*
258 | (c:move-to 8 34)
259 | (c:curve-to 14 38 20 38 24 34)
260 | (c:stroke))
261 | ;; tail
262 | (c:move-to 0 45)
263 | (c:curve-to -10 45 -15 45 -20 40)
264 | (c:stroke)
265 | (c:restore)))
266 |
267 | (defun draw-player ()
268 | (c:save)
269 | (c:set-line-width 4)
270 | (c:set-line-cap :round)
271 | (when (or (> *sight-distance* 1) *win-pause*)
272 | ;; body
273 | (c:arc 16 20 28 0 (* 2 pi))
274 | (c:stroke))
275 | ;; eyes
276 | (c:arc 8 14 3 0 (* 2 pi))
277 | (c:arc 24 14 3 0 (* 2 pi))
278 | (c:fill-path)
279 | ;; smile
280 | (c:move-to 8 34)
281 | (if *kitty-collected*
282 | (c:curve-to 12 38 20 38 24 34)
283 | (c:line-to 24 34))
284 | (c:stroke)
285 | (c:restore))
286 |
287 | (defun draw-result ()
288 | (c:set-line-width 4)
289 | (c:set-source-rgba 0 0 0 0.7)
290 | (c:paint)
291 | (c:save)
292 | (apply #'c:set-source-rgb *player-with-kitty-color*)
293 | (c:arc 300 200 50 0 (* 2 pi))
294 | (c:stroke-preserve)
295 | (c:set-source-rgb 1 1 1)
296 | (c:fill-path)
297 | (apply #'c:set-source-rgb *player-with-kitty-color*)
298 | (c:new-path)
299 | ;; (apply #'c:set-source-rgb *player-with-kitty-color*)
300 | (c:translate 285 176)
301 | (draw-kitty)
302 | (c:restore)
303 | (c:set-source-rgb 1 1 1)
304 | (c:set-font-size 22)
305 | (c:select-font-family "Special Elite" :normal :normal)
306 | (case *win*
307 | (1
308 | (c:move-to 90 300)
309 | (c:show-text "The Owl and the Pussy-cat went to sea")
310 | )
311 | (2
312 | (c:move-to 60 300)
313 | (c:show-text "In a beautiful pea-green boat,")
314 | (c:move-to 60 340)
315 | (c:show-text "They took some honey, and plenty of money,")
316 | (c:move-to 60 380)
317 | (c:show-text "Wrapped up in a five-pound note."))
318 | (3
319 | (c:move-to 100 300)
320 | (c:show-text "The Owl looked up to the stars above,")
321 | (c:move-to 100 340)
322 | (c:show-text "And sang to a small guitar,")
323 | (c:move-to 100 380)
324 | (c:show-text "‘O lovely Pussy! O Pussy, my love,")
325 | (c:move-to 100 420)
326 | (c:show-text "What a beautiful Pussy you are,")
327 | (c:move-to 100 460)
328 | (c:show-text "You are,")
329 | (c:move-to 100 500)
330 | (c:show-text "You are!")
331 | (c:move-to 100 540)
332 | (c:show-text "What a beautiful Pussy you are!’"))
333 | (4
334 | (c:move-to 44 300)
335 | (c:show-text "Pussy said to the Owl, ‘You elegant fowl!")
336 | (c:move-to 44 340)
337 | (c:show-text "How charmingly sweet you sing!")
338 | (c:move-to 44 380)
339 | (c:show-text "O let us be married! too long we have tarried:")
340 | (c:move-to 44 420)
341 | (c:show-text "But what shall we do for a ring?’"))
342 | (5
343 | (c:move-to 94 300)
344 | (c:show-text "They sailed away, for a year and a day,")
345 | (c:move-to 94 340)
346 | (c:show-text "To the land where the Bong-Tree grows")
347 | (c:move-to 94 380)
348 | (c:show-text "And there in a wood a Piggy-wig stood")
349 | (c:move-to 94 420)
350 | (c:show-text "With a ring at the end of his nose,")
351 | (c:move-to 94 460)
352 | (c:show-text "His nose,")
353 | (c:move-to 94 500)
354 | (c:show-text "His nose,")
355 | (c:move-to 94 540)
356 | (c:show-text "With a ring at the end of his nose."))
357 | (6
358 | (c:move-to 10 300)
359 | (c:show-text "‘Dear Pig, are you willing to sell for one shilling")
360 | (c:move-to 10 340)
361 | (c:show-text "Your ring?’ Said the Piggy, ‘I will.’"))
362 | (7
363 | (c:move-to 34 300)
364 | (c:show-text "So they took it away, and were married next day")
365 | (c:move-to 34 340)
366 | (c:show-text "By the Turkey who lives on the hill."))
367 | (8
368 | (c:move-to 64 300)
369 | (c:show-text "They dinèd on mince, and slices of quince,")
370 | (c:move-to 64 340)
371 | (c:show-text "Which they ate with a runcible spoon;"))
372 | (9
373 | (c:move-to 64 300)
374 | (c:show-text "And hand in hand, on the edge of the sand,")
375 | (c:move-to 64 340)
376 | (c:show-text "They danced by the light of the moon,")
377 | (c:move-to 64 380)
378 | (c:show-text "The moon,")
379 | (c:move-to 64 420)
380 | (c:show-text "The moon,")
381 | (c:move-to 64 460)
382 | (c:show-text "They danced by the light of the moon."))
383 | (10
384 | (c:move-to 120 300)
385 | (c:show-text "Are you holding the cat,")
386 | (c:move-to 120 340)
387 | (c:show-text "That you just met?")
388 | (c:move-to 120 380)
389 | (c:show-text "Are you going to let it ") (apply #'c:set-source-rgb *kitty-color*) (c:show-text "g") (c:set-source-rgb 1 1 1) (c:show-text "o,")
390 | (c:move-to 120 420)
391 | (c:show-text "Go to its love, the elegant Owl?"))
392 | (11
393 | (c:move-to 70 300)
394 | (c:show-text "Or you feel lonely,")
395 | (c:move-to 70 340)
396 | (c:show-text "In this dark cold maze, you want a kitty,")
397 | (c:move-to 70 380)
398 | (c:show-text "To be ")
399 | (apply #'c:set-source-rgb *kitty-color*) (c:show-text "t") (c:set-source-rgb 1 1 1)
400 | (c:show-text "rapped with you, endlessly?")
401 | )
402 | (t
403 | (case (mod *win* 4)
404 | (0
405 | (c:move-to 16 300)
406 | (c:show-text "There was a Young Lady whose bonnet")
407 | (c:move-to 16 340)
408 | (c:show-text "Came untied when birds sate upon it;")
409 | (c:move-to 16 380)
410 | (c:show-text "But she said, ‘I don’t care! all the birds in the air")
411 | (c:move-to 16 420)
412 | (c:show-text "Are welcome to sit on my bonnet.’"))
413 | (1
414 | (c:move-to 42 300)
415 | (c:show-text "There was an Old Man on a hill,")
416 | (c:move-to 42 340)
417 | (c:show-text "Who seldom, if ever, stood still;")
418 | (c:move-to 42 380)
419 | (c:show-text "He ran up and down in his Grandmothers gown,")
420 | (c:move-to 42 420)
421 | (c:show-text "Which adorned that Old Man on a hill."))
422 | (2
423 | (c:move-to 60 300)
424 | (c:show-text "There was a Young Lady of Poole,")
425 | (c:move-to 60 340)
426 | (c:show-text "Whose soup was excessively cool;")
427 | (c:move-to 60 380)
428 | (c:show-text "So she put it to boil by the aid of some oil,")
429 | (c:move-to 60 420)
430 | (c:show-text "That ingenious Young Lady of Poole."))
431 | (3
432 | (c:move-to 80 300)
433 | (c:show-text "There was an Old Man with a beard,")
434 | (c:move-to 80 340)
435 | (c:show-text "Who said, ‘It is just as I feared! —")
436 | (c:move-to 80 380)
437 | (c:show-text "Two Owls and a Hen, four Larks and Wren,")
438 | (c:move-to 80 420)
439 | (c:show-text "Have all built their nests in my beard.’")))
440 | )
441 | )
442 | (when (>= *win* 9)
443 | ;; (c:move-to 160 200)
444 | ;; (c:show-text "shall the kitty be sailed away?")
445 | ;; (c:move-to 110 200)
446 | ;; (c:show-text "do we deserve the dark maze, lonely?")
447 | )
448 | )
449 |
450 | (defun draw-maze ()
451 | (c:set-line-width 1)
452 | (let* ((maze-dimensions (array-dimensions *maze*))
453 | (maze-width (car maze-dimensions))
454 | (maze-height (cadr maze-dimensions))
455 | (scale-factor (/ *calm-window-width* (+ maze-width 2))))
456 | (loop
457 | for x from 0 to (1- maze-width)
458 | do
459 | (loop
460 | for y from 0 to (1- maze-height)
461 | for cx = (* (+ x 1) scale-factor)
462 | for cy = (* (+ y 1) scale-factor)
463 | do
464 | (apply #'c:set-source-rgb *maze-color-border*)
465 | (c:rectangle cx cy scale-factor scale-factor)
466 | if (= (aref *maze* x y) 1) ;; wall
467 | do
468 | (apply #'c:set-source-rgb *maze-color-solid*)
469 | (c:fill-preserve)
470 | (apply #'c:set-source-rgb *maze-color-border*)
471 | (c:stroke)
472 | else
473 | ;; empty plot
474 | do
475 | (c:new-path)
476 | (apply #'c:set-source-rgb *maze-color-border*)
477 | (c:stroke)
478 | )
479 | ))
480 | )
481 |
482 | (defun draw-night ()
483 | (let* ((maze-dimensions (array-dimensions *maze*))
484 | (maze-width (car maze-dimensions))
485 | (maze-height (cadr maze-dimensions))
486 | (scale-factor (/ *calm-window-width* (+ maze-width 2))))
487 | (setf *sight-distance* (max (* 24 (/ (- *max-steps* *steps*) *max-steps*)) 1))
488 | (loop
489 | for x from 0 to (1- maze-width)
490 | do
491 | (loop
492 | for y from 0 to (1- maze-height)
493 | for cx = (* (+ x 1) scale-factor)
494 | for cy = (* (+ y 1) scale-factor)
495 | for x-distance = (max (abs (- x (car *player-position*))) 1)
496 | for y-distance = (max (abs (- y (cadr *player-position*))) 1)
497 | do
498 | (c:set-source-rgba 0 0 0
499 | (if (= 0 *sight-distance*)
500 | 1
501 | (max (/ x-distance *sight-distance*) (/ y-distance *sight-distance*))))
502 | (c:rectangle cx cy scale-factor scale-factor)
503 | (c:fill-path)
504 | )
505 | ))
506 | )
507 |
508 | (defun draw-player-and-kitty ()
509 | (let* ((maze-dimensions (array-dimensions *maze*))
510 | (maze-width (car maze-dimensions))
511 | (maze-height (cadr maze-dimensions))
512 | (scale-factor (/ *calm-window-width* (+ maze-width 2))))
513 | (loop
514 | for x from 0 to (1- maze-width)
515 | do
516 | (loop
517 | for y from 0 to (1- maze-height)
518 | for cx = (* (+ x 1) scale-factor)
519 | for cy = (* (+ y 1) scale-factor)
520 | do
521 | (cond
522 | ;; player with kitty
523 | ((and ;; Kitty and the player overlapped
524 | *player-position*
525 | *kitty-position*
526 | (= x (car *player-position*)) (= y (cadr *player-position*))
527 | (= x (car *kitty-position*)) (= y (cadr *kitty-position*)))
528 | (apply #'c:set-source-rgb *player-with-kitty-color*)
529 | ;; (c:arc (+ cx (/ scale-factor 2)) (+ cy (/ scale-factor 2)) (- (/ scale-factor 2) 4) 0 (* 2 pi))
530 | ;; (c:fill-path)
531 | (c:save)
532 | (c:translate (+ cx 13) (+ cy 10))
533 | (c:scale 0.5 0.5)
534 | (draw-kitty)
535 | (c:restore)
536 | (setf *kitty-collected* t))
537 | ;; player
538 | ((and *player-position* (= x (car *player-position*)) (= y (cadr *player-position*)))
539 | (apply #'c:set-source-rgb *player-color*)
540 | (c:save)
541 | (c:translate (+ cx 13) (+ cy 10))
542 | (c:scale 0.5 0.5)
543 | (draw-player)
544 | (c:restore)
545 | )
546 | ;; kitty
547 | ((and *kitty-position* (= x (car *kitty-position*)) (= y (cadr *kitty-position*)))
548 | (apply #'c:set-source-rgb *kitty-color*)
549 | ;; (c:arc (+ cx (/ scale-factor 2)) (+ cy (/ scale-factor 2)) (- (/ scale-factor 2) 4) 0 (* 2 pi))
550 | ;; (c:fill-path)
551 | (c:save)
552 | (c:translate (+ cx 13) (+ cy 10))
553 | (c:scale 0.5 0.5)
554 | (draw-kitty)
555 | (c:restore)
556 | )
557 | (t (apply #'c:set-source-rgb *maze-color-border*)
558 | (c:stroke)))
559 | )
560 | ))
561 | )
562 |
563 | (defun draw-forever ()
564 | (c:set-source-rgb 1 1 1)
565 | (c:paint)
566 | (when *let-go*
567 | (setf *calm-redraw* nil)
568 | (c:set-source-rgb 1 1 1)
569 | (c:select-font-family "Special Elite" :normal :normal)
570 | (apply #'c:set-source-rgb *player-color*)
571 | (c:set-font-size 40)
572 | (c:move-to 80 70)
573 | (c:show-text "The Maze and Lost Cat")
574 | (c:set-font-size 22)
575 | (c:set-source-rgb 0 0 0)
576 | (c:move-to 100 140)
577 | (c:show-text "The cat has gone, gone for its fowl.")
578 | (c:move-to 100 200)
579 | (c:show-text "Text")
580 | (c:move-to 200 200)
581 | (c:show-text "by Edward Lear")
582 | (c:move-to 100 240)
583 | (c:show-text "Sound")
584 | (c:move-to 200 240)
585 | (c:show-text "by eZZin")
586 | (c:move-to 200 280)
587 | (c:show-text " Mafon2")
588 | (c:move-to 200 320)
589 | (c:show-text " skymary")
590 | (c:move-to 200 360)
591 | (c:show-text " xoiziox")
592 | (c:move-to 200 400)
593 | (c:show-text "on freesound.org")
594 | (c:move-to 100 440)
595 | (c:show-text "Font")
596 | (c:move-to 200 440)
597 | (c:show-text "by Astigmatic (Special Elite)")
598 | (c:move-to 100 480)
599 | (c:show-text "Code")
600 | (c:move-to 200 480)
601 | (c:show-text "by Vito Van"))
602 | (unless *let-go*
603 | (draw-maze)
604 | (unless (or *win-pause* *game-over* *kitty-collected*)
605 | (meow))
606 | (unless *win-pause* (draw-night))
607 | (draw-player-and-kitty)
608 | (when (or *win-pause* *game-over*)
609 | (draw-result))
610 | (when (equalp *player-position* *kitty-position*)
611 | (meow-with-purr))
612 | (setf *calm-redraw* nil)
613 | (auto-move)
614 | ;; (format t "REDRAW: ~A~%" *calm-redraw*)
615 | ))
616 |
--------------------------------------------------------------------------------
/Spring/day-5/canvas.lisp:
--------------------------------------------------------------------------------
1 | (in-package #:calm)
2 |
3 | ;;
4 | ;; CALM version check
5 | ;; version check won't work on JSCL, since the lack of ASDF
6 | ;;
7 | #-jscl
8 | (let ((required-version "0.1.2")
9 | (calm-version (slot-value (asdf:find-system 'calm) 'asdf:version)))
10 | (when (uiop:version< calm-version required-version)
11 | (format t
12 | "Sorry, this is built on CALM ~A, older version (current: ~A) of CALM won't work.~%"
13 | required-version calm-version)
14 | (uiop:quit)))
15 |
16 |
17 | ;;
18 | ;; the swank server is for debugging, for usage please check
19 | ;; Emacs:
20 | ;; https://slime.common-lisp.dev/
21 | ;; Visual Studio Code
22 | ;; https://lispcookbook.github.io/cl-cookbook/vscode-alive.html
23 | ;;
24 | ;; uncomment the following line to enable SWANK Server
25 | #-jscl
26 | (unless (str:starts-with? "dist" (uiop:getenv "CALM_CMD")) (swank:create-server))
27 |
28 | ;;
29 | ;; by default, the screensaver is disabled,
30 | ;; if you want to enable screensaver,
31 | ;; please uncomment the following line
32 | ;;
33 | #-jscl
34 | (setf (uiop:getenv "SDL_VIDEO_ALLOW_SCREENSAVER") "1")
35 |
36 | ;;
37 | ;; setting window properties, for more of this, please check
38 | ;; https://github.com/VitoVan/calm/blob/main/src/config.lisp
39 | ;;
40 | #-jscl
41 | (setf *calm-delay* 10)
42 | #+jscl
43 | (setf *calm-fps* 0)
44 | (setf *calm-window-width* 600)
45 | (setf *calm-window-height* 600)
46 | (setf *calm-window-title* "The Maze and Lost Cat")
47 |
48 | (defparameter *maze-1*
49 | (list
50 | '(
51 | (1 1 1 1 1 1 1 1 1 1 1 1 1)
52 | (0 0 1 0 0 0 1 0 0 0 1 0 1)
53 | (1 0 1 0 1 0 1 1 1 0 1 0 1)
54 | (1 0 1 0 1 0 0 0 0 0 1 0 1)
55 | (1 0 1 0 1 1 1 1 1 0 1 0 1)
56 | (1 0 1 0 0 0 0 0 1 0 0 0 1)
57 | (1 0 1 1 1 0 1 1 1 0 1 0 1)
58 | (1 0 0 0 1 0 0 0 1 0 1 0 1)
59 | (1 1 1 0 1 1 1 0 1 0 1 0 1)
60 | (1 0 0 0 1 0 0 0 1 0 1 0 1)
61 | (1 0 1 1 1 0 1 1 1 0 1 0 1)
62 | (1 0 0 0 0 0 1 0 0 0 1 0 1)
63 | (1 1 1 1 1 1 1 1 1 1 1 0 1)
64 | )
65 | ;; player position
66 | '(1 0)
67 | ;; kitty position
68 | '((5 7) (11 7) (1 7))
69 | )
70 | )
71 |
72 | (defparameter *maze-2*
73 | (list
74 | '(
75 | (1 1 1 1 1 1 1 1 1 1 1 1 1)
76 | (0 0 1 0 0 0 0 0 0 0 0 0 1)
77 | (1 0 1 0 1 1 1 1 1 1 1 0 1)
78 | (1 0 1 0 0 0 0 0 1 0 0 0 1)
79 | (1 0 1 0 1 1 1 1 1 0 1 0 1)
80 | (1 0 1 0 1 0 0 0 1 0 1 0 1)
81 | (1 0 1 1 1 0 1 0 1 0 1 1 1)
82 | (1 0 1 0 0 0 1 0 1 0 0 0 1)
83 | (1 0 1 0 1 1 1 0 1 1 1 0 1)
84 | (1 0 0 0 1 0 1 0 0 0 0 0 1)
85 | (1 1 1 0 1 0 1 1 1 1 1 0 1)
86 | (1 0 0 0 1 0 0 0 0 0 0 0 1)
87 | (1 1 1 1 1 1 1 1 1 1 1 0 1)
88 | )
89 | ;; player position
90 | '(1 0)
91 | ;; kitty position
92 | '((5 3) (3 7) (11 1) (9 5))
93 | ))
94 |
95 |
96 | (defparameter *maze-3*
97 | (list
98 | '(
99 | (1 1 1 1 1 1 1 1 1 1 1 1 1)
100 | (0 0 1 0 0 0 0 0 0 0 0 0 1)
101 | (1 0 1 1 1 0 1 1 1 1 1 0 1)
102 | (1 0 0 0 1 0 0 0 0 0 1 0 1)
103 | (1 1 1 0 1 0 1 1 1 0 1 0 1)
104 | (1 0 0 0 1 0 0 0 1 0 1 0 1)
105 | (1 0 1 1 1 1 1 1 1 0 1 0 1)
106 | (1 0 1 0 0 0 0 0 0 0 1 0 1)
107 | (1 0 1 0 1 0 1 1 1 1 1 0 1)
108 | (1 0 1 0 1 0 1 0 0 0 0 0 1)
109 | (1 0 1 1 1 0 1 0 1 1 1 1 1)
110 | (1 0 0 0 0 0 1 0 0 0 0 0 1)
111 | (1 1 1 1 1 1 1 1 1 1 1 0 1)
112 | )
113 | ;; player position
114 | '(1 0)
115 | ;; kitty position
116 | '((9 3) (5 7))
117 | ))
118 |
119 | (defparameter *maze-4*
120 | (list
121 | '(
122 | (1 1 1 1 1 1 1 1 1 1 1 1 1)
123 | (0 0 1 0 0 0 0 0 0 0 0 0 1)
124 | (1 0 1 1 1 1 1 0 1 1 1 0 1)
125 | (1 0 0 0 0 0 1 0 1 0 1 0 1)
126 | (1 1 1 1 1 0 1 0 1 0 1 0 1)
127 | (1 0 0 0 1 0 0 0 1 0 0 0 1)
128 | (1 0 1 0 1 1 1 1 1 0 1 1 1)
129 | (1 0 1 0 0 0 0 0 1 0 1 0 1)
130 | (1 0 1 1 1 1 1 1 1 0 1 0 1)
131 | (1 0 1 0 0 0 0 0 1 0 1 0 1)
132 | (1 0 1 0 1 1 1 0 1 0 1 0 1)
133 | (1 0 0 0 0 0 1 0 0 0 0 0 1)
134 | (1 1 1 1 1 1 1 1 1 1 1 0 1)
135 | )
136 | ;; player position
137 | '(1 0)
138 | ;; kitty position
139 | '((11 5) (7 7) (3 9))
140 | ))
141 |
142 | (defparameter *maze-data-list* (list *maze-1* *maze-2* *maze-3* *maze-4*))
143 |
144 | ;; https://rosettacode.org/wiki/Knuth_shuffle#Common_Lisp
145 | (defun nshuffle (sequence)
146 | (loop for i from (length sequence) downto 2
147 | do (rotatef (elt sequence (random i))
148 | (elt sequence (1- i))))
149 | sequence)
150 |
151 | (defparameter *maze-index* nil)
152 | (defparameter *maze-data* nil)
153 | (defparameter *maze* nil)
154 | (defun maze-in-bounds-p (maze x y)
155 | (let ((height (length maze))
156 | (width (length (first maze))))
157 | (and (>= x 0) (>= y 0) (< x width) (< y height))
158 | ))
159 | (defun maze-aref (maze x y)
160 | (nth y (nth x maze)))
161 | (defun maze-dimensions (maze)
162 | (list (length maze) (length (first maze))))
163 | (defun maze-position-equalp (p1 p2)
164 | (and (= (car p1) (car p2)) (= (cadr p1) (cadr p2))))
165 |
166 | (defparameter *sight-distance* 0)
167 | (defparameter *player-position* nil)
168 | (defparameter *player-position-previous* nil)
169 | (defparameter *kitty-position* nil)
170 | (defparameter *kitty-collected* nil)
171 |
172 | (defparameter *bgm-started* nil)
173 |
174 | (defparameter *player-color* '(0 0.35 0.59))
175 | ;; (defparameter *kitty-color* '(0.94 0.87 0.47))
176 | (defparameter *kitty-color* '(0.89 0.12 0.17))
177 | (defparameter *player-with-kitty-color* '(0.89 0.12 0.17))
178 | (defparameter *maze-color-solid* '(0.83 0.82 0.84))
179 | ;; (defparameter *maze-color-solid* '(0.4 1 0.4))
180 | (defparameter *maze-color-border* '(0.6 0.6 0.6))
181 | (defparameter *win* 0)
182 | (defparameter *win-pause* nil)
183 | (defparameter *max-steps* 512)
184 | (defparameter *steps* 0)
185 | (defparameter *getting-dark* t)
186 | (defparameter *let-go* nil)
187 |
188 | (defparameter *last-meow* nil)
189 | (defun meow ()
190 | (when (> (- (get-universal-time) *last-meow*) (+ 10 (random 42)))
191 | (setf *last-meow* (get-universal-time))
192 | (let* ((kitty-x (car *kitty-position*))
193 | (kitty-y (cadr *kitty-position*))
194 | (player-x (car *player-position*))
195 | (player-y (cadr *player-position*))
196 | (distance (sqrt (+ (expt (abs (- kitty-x player-x)) 2) (expt (abs (- kitty-y player-y)) 2))))
197 | (volume (round (* 128 (/ (max (- 8 distance) 1) 8)))))
198 | #-jscl
199 | (c:volume-music volume)
200 | ;; (format t "distance: ~A, volume: ~A~%" distance volume)
201 | #-jscl
202 | (c:play-music "assets/meow.ogg")
203 | #+jscl
204 | (c:play-audio "assets/meow.ogg" :volume (/ volume 128))
205 | )))
206 |
207 | (defparameter *already-purring* nil)
208 | (defun purr ()
209 | (unless *already-purring*
210 | #-jscl
211 | (c:play-music "assets/purr.ogg" :loops -1)
212 | #+jscl
213 | (c:play-audio "assets/purr.ogg" :loop-audio-p t)
214 | (setf *already-purring* t)))
215 |
216 | (defparameter *already-meow-with-purring* nil)
217 | (defun meow-with-purr ()
218 | (unless *already-meow-with-purring*
219 | #-jscl
220 | (c:volume-music 128)
221 | #-jscl
222 | (c:play-music "assets/meow-with-purr.ogg")
223 | #+jscl
224 | (c:play-audio "assets/meow-with-purr.ogg")
225 | (setf *already-meow-with-purring* t)))
226 |
227 | (defparameter *walk-index* 0)
228 | (defun walk ()
229 | #-jscl
230 | (c:play-wav (concatenate 'string "assets/walk-" (write-to-string *walk-index*) ".ogg"))
231 | #+jscl
232 | (c:play-audio (concatenate 'string "assets/walk-" (write-to-string *walk-index*) ".ogg"))
233 | (if (< *walk-index* 7)
234 | (incf *walk-index*)
235 | (setf *walk-index* 0)))
236 |
237 | (defparameter *maze-initialized* nil)
238 |
239 | (defun init-maze (&optional (maze-index 0))
240 | #-jscl
241 | (c:halt-music)
242 | #+jscl
243 | (c:halt-audio "assets/purr.ogg")
244 | (setf *already-purring* nil
245 | *already-meow-with-purring* nil
246 | *last-meow* (get-universal-time))
247 | (when (> maze-index 3)
248 | (nshuffle *maze-data-list*))
249 | (setf
250 | *maze-index* (if (> maze-index 3) 0 maze-index)
251 | *maze-data* (nth *maze-index* *maze-data-list*)
252 | *maze* (nth 0 *maze-data*)
253 | *player-position* (nth 1 *maze-data*)
254 | *kitty-position* (nth (random (length (nth 2 *maze-data*))) (nth 2 *maze-data*))
255 | *kitty-collected* nil))
256 |
257 | (defparameter *last-move* 0)
258 | (defun auto-move ()
259 | (unless (> (- (c:get-ticks) *last-move*) 160)
260 | (setf *calm-redraw* t))
261 | (when (and (not *win-pause*) *player-position-previous* (> (- (c:get-ticks) *last-move*) 160))
262 | (let* ((x-incf-factor (- (car *player-position*) (car *player-position-previous*)))
263 | (y-incf-factor (- (cadr *player-position*) (cadr *player-position-previous*)))
264 | (next-player-position (list (+ (car *player-position*) x-incf-factor) (+ (cadr *player-position*) y-incf-factor)))
265 | (all-possible-positions
266 | (list
267 | (list (+ (car *player-position*) 1) (+ (cadr *player-position*) 0))
268 | (list (+ (car *player-position*) 0) (+ (cadr *player-position*) 1))
269 | (list (- (car *player-position*) 1) (- (cadr *player-position*) 0))
270 | (list (- (car *player-position*) 0) (- (cadr *player-position*) 1)))))
271 | (when (and
272 | (maze-in-bounds-p *maze* (car next-player-position) (cadr next-player-position))
273 | (not (maze-position-equalp next-player-position *player-position*)))
274 | ;; (format t "all-possible: ~A~%" all-possible-positions)
275 | (when
276 | (and
277 | ;; next plot is empty
278 | (= (maze-aref *maze* (car next-player-position) (cadr next-player-position)) 0)
279 | ;; no more than 2 possible routes
280 | (<= (count-if #'(lambda (x) (and (maze-in-bounds-p *maze* (car x) (cadr x)) (= (maze-aref *maze* (car x) (cadr x)) 0))) all-possible-positions) 2)
281 | )
282 | (when *kitty-collected*
283 | (setf *kitty-position* *player-position*))
284 | (setf *player-position-previous* *player-position*)
285 | (setf *player-position* next-player-position)
286 | (when (> *steps* *max-steps*)
287 | (setf *getting-dark* (not *getting-dark*)))
288 | (if *getting-dark* (incf *steps*) (decf *steps*))
289 | (setf *last-move* (c:get-ticks))
290 | (setf *calm-redraw* t)
291 | ;; (format t "cur: ~A, nxt: ~A~%" *player-position* next-player-position)
292 | )
293 | ))
294 | (when (and *kitty-collected* (maze-position-equalp *player-position* '(12 11)))
295 | (purr)
296 | (incf *win*)
297 | (setf *win-pause* t))))
298 |
299 | (defun on-keydown (key)
300 | (unless *bgm-started*
301 | #-jscl
302 | (c:play-wav "assets/bgm.ogg" :loops -1)
303 | #+jscl
304 | (c:play-audio "assets/bgm.ogg" :loop-audio-p t)
305 | (setf *bgm-started* t))
306 |
307 | (when (c:keq key :scancode-q :scancode-escape)
308 | (setf *let-go* t))
309 |
310 | (when (and *let-go* (c:keq key :scancode-return :scancode-space :scancode-lalt :scancode-ralt :scancode-lctrl :scancode-rctrl :scancode-delete :scancode-backspace))
311 | (setf
312 | *let-go* nil
313 | *win* 0
314 | *steps* 0)
315 | (init-maze 0))
316 |
317 | ;; let go
318 | (when (and *win-pause* (= *win* 10) (c:keq key :scancode-g))
319 | (setf *let-go* t)
320 | #-jscl
321 | (c:halt-music)
322 | #+jscl
323 | (c:halt-audio))
324 |
325 | ;; trap kitty
326 | (when (and *win-pause* (= *win* 11) (c:keq key :scancode-t))
327 | (init-maze 0)
328 | (setf
329 | *win-pause* nil
330 | *win* 0))
331 |
332 | (when (and *win-pause* (c:keq key :scancode-return :scancode-space :scancode-lalt :scancode-ralt :scancode-lctrl :scancode-rctrl :scancode-delete :scancode-backspace))
333 | (init-maze (1+ *maze-index*))
334 | (setf *win-pause* nil))
335 |
336 | (unless *win-pause*
337 | (let ((next-player-position (copy-list *player-position*)))
338 | (cond
339 | ((c:keq key :scancode-left :scancode-h)
340 | (decf (car next-player-position)))
341 | ((c:keq key :scancode-right :scancode-l)
342 | (incf (car next-player-position)))
343 | ((c:keq key :scancode-up :scancode-k)
344 | (decf (cadr next-player-position)))
345 | ((c:keq key :scancode-down :scancode-j)
346 | (incf (cadr next-player-position))))
347 | (when (and
348 | (maze-in-bounds-p *maze* (car next-player-position) (cadr next-player-position))
349 | (not (maze-position-equalp next-player-position *player-position*)))
350 | (when (= (maze-aref *maze* (car next-player-position) (cadr next-player-position)) 0)
351 | (when *kitty-collected*
352 | (setf *kitty-position* *player-position*))
353 | (setf *player-position-previous* *player-position*)
354 | (setf *player-position* next-player-position)
355 | (when (or (> *steps* *max-steps*) (< *steps* 0))
356 | (setf *getting-dark* (not *getting-dark*)))
357 | (if *getting-dark* (incf *steps*) (decf *steps*))
358 | (setf *last-move* (c:get-ticks))
359 | (walk))
360 | ))
361 |
362 | (when (and *kitty-collected* (maze-position-equalp *player-position* '(12 11)))
363 | (purr)
364 | (incf *win*)
365 | (setf *win-pause* t)))
366 |
367 | ;;(format t "current player position: ~A~%" *player-position*)
368 | )
369 |
370 | (defun on-fingerup (&key x y dx dy pressure finger-id)
371 | (declare (ignore x y dx dy pressure finger-id))
372 |
373 | (when *win-pause*
374 | (init-maze (1+ *maze-index*))
375 | (setf *win-pause* nil))
376 |
377 | (unless *win-pause*
378 | (let* ((dimensions (maze-dimensions *maze*))
379 | (maze-width (car dimensions))
380 | (scale-factor (/ *calm-window-width* (+ maze-width 2)))
381 | (m-x (1- (round (/ (- *calm-state-mouse-x* (/ scale-factor 2)) scale-factor))))
382 | (m-y (1- (round (/ (- *calm-state-mouse-y* (/ scale-factor 2)) scale-factor))))
383 | (p-x (car *player-position*))
384 | (p-y (cadr *player-position*))
385 | (distance-x (- m-x p-x))
386 | (distance-y (- m-y p-y))
387 | (abs-x (abs distance-x))
388 | (abs-y (abs distance-y)))
389 |
390 | (format t "x: ~A, y: ~A~%m-x: ~A, m-y: ~A~%"
391 | *calm-state-mouse-x* *calm-state-mouse-y*
392 | m-x m-y)
393 |
394 | (when (maze-in-bounds-p *maze* m-x m-y)
395 | (if (> abs-x abs-y)
396 | ;; go horizontally
397 | (if (> distance-x 0)
398 | (on-keydown :scancode-right)
399 | (on-keydown :scancode-left))
400 | ;; go vertically
401 | (if (> distance-y 0)
402 | (on-keydown :scancode-down)
403 | (on-keydown :scancode-up))
404 | ))))
405 | )
406 |
407 | (defun draw-kitty ()
408 | (when (or *kitty-collected* (< (- (get-universal-time) *last-meow*) 1))
409 | (c:save)
410 | (c:set-line-width 4)
411 | (c:set-line-cap :round)
412 | ;; body
413 | (c:move-to 0 0)
414 | (c:curve-to 10 10 20 10 30 0)
415 | (c:curve-to 60 50 30 45 30 45)
416 | (c:line-to 0 45)
417 | (c:curve-to -10 45 -20 35 0 0)
418 | (c:stroke)
419 | ;; eyes
420 | (c:arc 8 20 3 0 (* 2 pi))
421 | (c:arc 24 20 3 0 (* 2 pi))
422 | (c:fill-path)
423 | ;; smile
424 | (when *kitty-collected*
425 | (c:move-to 8 34)
426 | (c:curve-to 14 38 20 38 24 34)
427 | (c:stroke))
428 | ;; tail
429 | (c:move-to 0 45)
430 | (c:curve-to -10 45 -15 45 -20 40)
431 | (c:stroke)
432 | (c:restore)))
433 |
434 | (defun draw-player ()
435 | (c:save)
436 | (c:set-line-width 4)
437 | (c:set-line-cap :round)
438 | (when (or (> *sight-distance* 1) *win-pause*)
439 | ;; body
440 | (c:arc 16 20 28 0 (* 2 pi))
441 | (c:stroke))
442 | ;; eyes
443 | (c:arc 8 14 3 0 (* 2 pi))
444 | (c:arc 24 14 3 0 (* 2 pi))
445 | (c:fill-path)
446 | ;; smile
447 | (c:move-to 8 34)
448 | (if *kitty-collected*
449 | (c:curve-to 12 38 20 38 24 34)
450 | (c:line-to 24 34))
451 | (c:stroke)
452 | (c:restore))
453 |
454 | (defun draw-result ()
455 | (c:set-line-width 4)
456 | (c:set-source-rgba 0 0 0 0.7)
457 | (c:paint)
458 | (c:save)
459 | (apply #'c:set-source-rgb *player-with-kitty-color*)
460 | (c:arc 300 200 50 0 (* 2 pi))
461 | (c:stroke-preserve)
462 | (c:set-source-rgb 1 1 1)
463 | (c:fill-path)
464 | (apply #'c:set-source-rgb *player-with-kitty-color*)
465 | (c:new-path)
466 | ;; (apply #'c:set-source-rgb *player-with-kitty-color*)
467 | (c:translate 285 176)
468 | (draw-kitty)
469 | (c:restore)
470 | (c:set-source-rgb 1 1 1)
471 | (c:set-font-size 22)
472 | (c:select-font-family "Special Elite" :normal :normal)
473 | (case *win*
474 | (1
475 | (c:move-to 90 300)
476 | (c:show-text "The Owl and the Pussy-cat went to sea")
477 | )
478 | (2
479 | (c:move-to 60 300)
480 | (c:show-text "In a beautiful pea-green boat,")
481 | (c:move-to 60 340)
482 | (c:show-text "They took some honey, and plenty of money,")
483 | (c:move-to 60 380)
484 | (c:show-text "Wrapped up in a five-pound note."))
485 | (3
486 | (c:move-to 100 300)
487 | (c:show-text "The Owl looked up to the stars above,")
488 | (c:move-to 100 340)
489 | (c:show-text "And sang to a small guitar,")
490 | (c:move-to 100 380)
491 | (c:show-text "‘O lovely Pussy! O Pussy, my love,")
492 | (c:move-to 100 420)
493 | (c:show-text "What a beautiful Pussy you are,")
494 | (c:move-to 100 460)
495 | (c:show-text "You are,")
496 | (c:move-to 100 500)
497 | (c:show-text "You are!")
498 | (c:move-to 100 540)
499 | (c:show-text "What a beautiful Pussy you are!’"))
500 | (4
501 | (c:move-to 44 300)
502 | (c:show-text "Pussy said to the Owl, ‘You elegant fowl!")
503 | (c:move-to 44 340)
504 | (c:show-text "How charmingly sweet you sing!")
505 | (c:move-to 44 380)
506 | (c:show-text "O let us be married! too long we have tarried:")
507 | (c:move-to 44 420)
508 | (c:show-text "But what shall we do for a ring?’"))
509 | (5
510 | (c:move-to 94 300)
511 | (c:show-text "They sailed away, for a year and a day,")
512 | (c:move-to 94 340)
513 | (c:show-text "To the land where the Bong-Tree grows")
514 | (c:move-to 94 380)
515 | (c:show-text "And there in a wood a Piggy-wig stood")
516 | (c:move-to 94 420)
517 | (c:show-text "With a ring at the end of his nose,")
518 | (c:move-to 94 460)
519 | (c:show-text "His nose,")
520 | (c:move-to 94 500)
521 | (c:show-text "His nose,")
522 | (c:move-to 94 540)
523 | (c:show-text "With a ring at the end of his nose."))
524 | (6
525 | (c:move-to 10 300)
526 | (c:show-text "‘Dear Pig, are you willing to sell for one shilling")
527 | (c:move-to 10 340)
528 | (c:show-text "Your ring?’ Said the Piggy, ‘I will.’"))
529 | (7
530 | (c:move-to 34 300)
531 | (c:show-text "So they took it away, and were married next day")
532 | (c:move-to 34 340)
533 | (c:show-text "By the Turkey who lives on the hill."))
534 | (8
535 | (c:move-to 64 300)
536 | (c:show-text "They dinèd on mince, and slices of quince,")
537 | (c:move-to 64 340)
538 | (c:show-text "Which they ate with a runcible spoon;"))
539 | (9
540 | (c:move-to 64 300)
541 | (c:show-text "And hand in hand, on the edge of the sand,")
542 | (c:move-to 64 340)
543 | (c:show-text "They danced by the light of the moon,")
544 | (c:move-to 64 380)
545 | (c:show-text "The moon,")
546 | (c:move-to 64 420)
547 | (c:show-text "The moon,")
548 | (c:move-to 64 460)
549 | (c:show-text "They danced by the light of the moon."))
550 | (10
551 | (c:move-to 120 300)
552 | (c:show-text "Are you holding the cat,")
553 | (c:move-to 120 340)
554 | (c:show-text "That you just met?")
555 | (c:move-to 120 380)
556 | (c:show-text "Are you going to let it ") (apply #'c:set-source-rgb *kitty-color*) (c:show-text "g") (c:set-source-rgb 1 1 1) (c:show-text "o,")
557 | (c:move-to 120 420)
558 | (c:show-text "Go to its love, the elegant Owl?"))
559 | (11
560 | (c:move-to 70 300)
561 | (c:show-text "Or you feel lonely,")
562 | (c:move-to 70 340)
563 | (c:show-text "In this dark cold maze, you want a kitty,")
564 | (c:move-to 70 380)
565 | (c:show-text "To be ")
566 | (apply #'c:set-source-rgb *kitty-color*) (c:show-text "t") (c:set-source-rgb 1 1 1)
567 | (c:show-text "rapped with you, endlessly?")
568 | )
569 | (t
570 | (case (mod *win* 4)
571 | (0
572 | (c:move-to 16 300)
573 | (c:show-text "There was a Young Lady whose bonnet")
574 | (c:move-to 16 340)
575 | (c:show-text "Came untied when birds sate upon it;")
576 | (c:move-to 16 380)
577 | (c:show-text "But she said, ‘I don’t care! all the birds in the air")
578 | (c:move-to 16 420)
579 | (c:show-text "Are welcome to sit on my bonnet.’"))
580 | (1
581 | (c:move-to 42 300)
582 | (c:show-text "There was an Old Man on a hill,")
583 | (c:move-to 42 340)
584 | (c:show-text "Who seldom, if ever, stood still;")
585 | (c:move-to 42 380)
586 | (c:show-text "He ran up and down in his Grandmothers gown,")
587 | (c:move-to 42 420)
588 | (c:show-text "Which adorned that Old Man on a hill."))
589 | (2
590 | (c:move-to 60 300)
591 | (c:show-text "There was a Young Lady of Poole,")
592 | (c:move-to 60 340)
593 | (c:show-text "Whose soup was excessively cool;")
594 | (c:move-to 60 380)
595 | (c:show-text "So she put it to boil by the aid of some oil,")
596 | (c:move-to 60 420)
597 | (c:show-text "That ingenious Young Lady of Poole."))
598 | (3
599 | (c:move-to 80 300)
600 | (c:show-text "There was an Old Man with a beard,")
601 | (c:move-to 80 340)
602 | (c:show-text "Who said, ‘It is just as I feared! —")
603 | (c:move-to 80 380)
604 | (c:show-text "Two Owls and a Hen, four Larks and Wren,")
605 | (c:move-to 80 420)
606 | (c:show-text "Have all built their nests in my beard.’")))
607 | )
608 | )
609 | (when (>= *win* 9)
610 | ;; (c:move-to 160 200)
611 | ;; (c:show-text "shall the kitty be sailed away?")
612 | ;; (c:move-to 110 200)
613 | ;; (c:show-text "do we deserve the dark maze, lonely?")
614 | )
615 | )
616 |
617 | (defun draw-maze ()
618 | (c:set-line-width 1)
619 | (let* ((dimensions (maze-dimensions *maze*))
620 | (maze-width (car dimensions))
621 | (maze-height (cadr dimensions))
622 | (scale-factor (/ *calm-window-width* (+ maze-width 2))))
623 | (loop
624 | for x from 0 to (1- maze-width)
625 | do
626 | (loop
627 | for y from 0 to (1- maze-height)
628 | for cx = (* (+ x 1) scale-factor)
629 | for cy = (* (+ y 1) scale-factor)
630 | do
631 | (apply #'c:set-source-rgb *maze-color-border*)
632 | (c:rectangle cx cy scale-factor scale-factor)
633 | if (= (maze-aref *maze* x y) 1) ;; wall
634 | do
635 | (apply #'c:set-source-rgb *maze-color-solid*)
636 | (c:fill-preserve)
637 | (apply #'c:set-source-rgb *maze-color-border*)
638 | (c:stroke)
639 | else
640 | ;; empty plot
641 | do
642 | (c:new-path)
643 | (apply #'c:set-source-rgb *maze-color-border*)
644 | (c:stroke)
645 | )
646 | ))
647 | )
648 |
649 | (defun draw-night ()
650 | (let* ((dimensions (maze-dimensions *maze*))
651 | (maze-width (car dimensions))
652 | (maze-height (cadr dimensions))
653 | (scale-factor (/ *calm-window-width* (+ maze-width 2))))
654 | (setf *sight-distance* (max (* 24 (/ (- *max-steps* *steps*) *max-steps*)) 1))
655 | (loop
656 | for x from 0 to (1- maze-width)
657 | do
658 | (loop
659 | for y from 0 to (1- maze-height)
660 | for cx = (* (+ x 1) scale-factor)
661 | for cy = (* (+ y 1) scale-factor)
662 | for x-distance = (max (abs (- x (car *player-position*))) 1)
663 | for y-distance = (max (abs (- y (cadr *player-position*))) 1)
664 | do
665 | (c:set-source-rgba 0 0 0
666 | (if (= 0 *sight-distance*)
667 | 1
668 | (max (/ x-distance *sight-distance*) (/ y-distance *sight-distance*))))
669 | (c:rectangle cx cy scale-factor scale-factor)
670 | (c:fill-path)
671 | )
672 | ))
673 | )
674 |
675 | (defun draw-player-and-kitty ()
676 | (let* ((dimensions (maze-dimensions *maze*))
677 | (maze-width (car dimensions))
678 | (maze-height (cadr dimensions))
679 | (scale-factor (/ *calm-window-width* (+ maze-width 2))))
680 | (loop
681 | for x from 0 to (1- maze-width)
682 | do
683 | (loop
684 | for y from 0 to (1- maze-height)
685 | for cx = (* (+ x 1) scale-factor)
686 | for cy = (* (+ y 1) scale-factor)
687 | do
688 | (cond
689 | ;; player with kitty
690 | ((and ;; Kitty and the player overlapped
691 | *player-position*
692 | *kitty-position*
693 | (maze-position-equalp (list x y) *player-position*)
694 | (maze-position-equalp *kitty-position* *player-position*))
695 | (apply #'c:set-source-rgb *player-with-kitty-color*)
696 | (c:save)
697 | (c:translate (+ cx 13) (+ cy 10))
698 | (c:scale 0.5 0.5)
699 | (draw-kitty)
700 | (c:restore)
701 | (setf *kitty-collected* t))
702 | ;; player
703 | ((and *player-position* (maze-position-equalp (list x y) *player-position*))
704 | (apply #'c:set-source-rgb *player-color*)
705 | (c:save)
706 | (c:translate (+ cx 13) (+ cy 10))
707 | (c:scale 0.5 0.5)
708 | (draw-player)
709 | (c:restore)
710 | )
711 | ;; kitty
712 | ((and *kitty-position* (maze-position-equalp (list x y) *kitty-position*))
713 | (apply #'c:set-source-rgb *kitty-color*)
714 | (c:save)
715 | (c:translate (+ cx 13) (+ cy 10))
716 | (c:scale 0.5 0.5)
717 | (draw-kitty)
718 | (c:restore)
719 | )
720 | (t (apply #'c:set-source-rgb *maze-color-border*)
721 | (c:stroke)))
722 | )
723 | ))
724 | )
725 |
726 | (defun draw-forever ()
727 | (unless *maze-initialized*
728 | (init-maze)
729 | (setf *maze-initialized* t))
730 | (c:set-source-rgb 1 1 1)
731 | (c:paint)
732 | (when *let-go*
733 | (setf *calm-redraw* nil)
734 | (c:set-source-rgb 1 1 1)
735 | (c:select-font-family "Special Elite" :normal :normal)
736 | (apply #'c:set-source-rgb *player-color*)
737 | (c:set-font-size 40)
738 | (c:move-to 80 70)
739 | (c:show-text "The Maze and Lost Cat")
740 | (c:set-font-size 22)
741 | (c:set-source-rgb 0 0 0)
742 | (c:move-to 100 140)
743 | (c:show-text "The cat has gone, gone for its fowl.")
744 | (c:move-to 100 200)
745 | (c:show-text "Text")
746 | (c:move-to 200 200)
747 | (c:show-text "by Edward Lear")
748 | (c:move-to 100 240)
749 | (c:show-text "Sound")
750 | (c:move-to 200 240)
751 | (c:show-text "by eZZin")
752 | (c:move-to 200 280)
753 | (c:show-text " Mafon2")
754 | (c:move-to 200 320)
755 | (c:show-text " skymary")
756 | (c:move-to 200 360)
757 | (c:show-text " xoiziox")
758 | (c:move-to 200 400)
759 | (c:show-text "on freesound.org")
760 | (c:move-to 100 440)
761 | (c:show-text "Font")
762 | (c:move-to 200 440)
763 | (c:show-text "by Astigmatic (Special Elite)")
764 | (c:move-to 100 480)
765 | (c:show-text "Code")
766 | (c:move-to 200 480)
767 | (c:show-text "by Vito Van"))
768 | (unless *let-go*
769 | (draw-maze)
770 |
771 | (unless *win-pause* (draw-night))
772 | (draw-player-and-kitty)
773 | (when *win-pause* (draw-result))
774 | (setf *calm-redraw* nil)
775 | (auto-move)
776 | (unless
777 | (or *win-pause* *kitty-collected*)
778 | (meow)
779 | (setf *calm-redraw* t))
780 | (when
781 | (maze-position-equalp *player-position* *kitty-position*)
782 | (meow-with-purr)
783 | (setf *calm-redraw* t))
784 | )
785 | )
786 |
--------------------------------------------------------------------------------