From a86354404076b8aa32c23dbddce718622c838ee0 Mon Sep 17 00:00:00 2001 From: Jens Tirsvad Nielsen Date: Tue, 13 Oct 2026 14:20:36 +0800 Subject: [PATCH] Add the wiki in English, Danish and Bahasa Malaysia --- Architecture-da.md | 33 +++++++++++++++++++++++++++++ Architecture-ms.md | 33 +++++++++++++++++++++++++++++ Architecture.md | 33 +++++++++++++++++++++++++++++ Home-da.md | 30 ++++++++++++++++++++++++++ Home-ms.md | 31 +++++++++++++++++++++++++++ Home.md | 30 ++++++++++++++++++++++++++ Install-da.md | 53 ++++++++++++++++++++++++++++++++++++++++++++++ Install-ms.md | 53 ++++++++++++++++++++++++++++++++++++++++++++++ Install.md | 53 ++++++++++++++++++++++++++++++++++++++++++++++ Play-da.md | 30 ++++++++++++++++++++++++++ Play-ms.md | 30 ++++++++++++++++++++++++++ Play.md | 29 +++++++++++++++++++++++++ _Sidebar.md | 20 +++++++++++++++++ 13 files changed, 458 insertions(+) create mode 100644 Architecture-da.md create mode 100644 Architecture-ms.md create mode 100644 Architecture.md create mode 100644 Home-da.md create mode 100644 Home-ms.md create mode 100644 Home.md create mode 100644 Install-da.md create mode 100644 Install-ms.md create mode 100644 Install.md create mode 100644 Play-da.md create mode 100644 Play-ms.md create mode 100644 Play.md create mode 100644 _Sidebar.md diff --git a/Architecture-da.md b/Architecture-da.md new file mode 100644 index 0000000..af71755 --- /dev/null +++ b/Architecture-da.md @@ -0,0 +1,33 @@ +# Arkitektur + +馃寪 [English](Architecture) 路 **Dansk** 路 [Bahasa Malaysia](Architecture-ms) + +## Moduler (`src/`) + +| Modul | Ansvar | +| --- | --- | +| `main.py` | Opretter sk忙rmen og objekterne og k酶rer spill酶kken | +| `constants.py` | Alle konstanter, defineret 茅t sted | +| `player.py` | `Player(Turtle)`: `go_up`, `is_at_finish_line`, `go_to_start` | +| `car_manager.py` | `CarManager`: `create_cars`, `move_cars`, `is_hit`, `level_up` | +| `car_shape.py` | Tegningen af en bil: karrosseri, kabine, ruder, forlygte, to hjul | +| `collision.py` | `is_colliding`: ren rektangeltest, uden turtle | +| `scoreboard.py` | `Scoreboard(Turtle)`: niveautekst og `GAME OVER` | + +## Designvalg + +- **Biler ligner biler.** En bil er en sammensat turtle-form inden for opgavens + fodaftryk p氓 40 x 20 pixel. Der registreres 茅n form pr. farve, s氓 der ikke + skal bruges billedfiler. +- **Kan testes uden vindue.** Geometrien (`car_components`), kollisionstesten og + reglen for oprettelse er almindelig kode. `CarManager` f氓r en bilfabrik og en + tilf忙ldighedskilde, s氓 testene bruger en falsk bil og en fastlagt terning. +- **Kollision bruger hele bilen.** Spilleren sammenlignes med bilens rektangel, + ikke kun dens midte. + +## Dokumentation + +Kommentarerne i kilden er Doxygen-kommentarer. Byg dem med `doxygen Doxyfile`. +Plan- og reviewdokumenter ligger i `docs/`. + +Tilbage til [Forside](Home-da). diff --git a/Architecture-ms.md b/Architecture-ms.md new file mode 100644 index 0000000..62e5d61 --- /dev/null +++ b/Architecture-ms.md @@ -0,0 +1,33 @@ +# Seni bina + +馃寪 [English](Architecture) 路 [Dansk](Architecture-da) 路 **Bahasa Malaysia** + +## Modul (`src/`) + +| Modul | Tanggungjawab | +| --- | --- | +| `main.py` | Mencipta skrin dan objek serta menjalankan gelung permainan | +| `constants.py` | Semua pemalar, ditakrifkan sekali sahaja | +| `player.py` | `Player(Turtle)`: `go_up`, `is_at_finish_line`, `go_to_start` | +| `car_manager.py` | `CarManager`: `create_cars`, `move_cars`, `is_hit`, `level_up` | +| `car_shape.py` | Lukisan sebuah kereta: badan, kabin, tingkap, lampu depan, dua roda | +| `collision.py` | `is_colliding`: ujian segi empat tepat tulen, tanpa turtle | +| `scoreboard.py` | `Scoreboard(Turtle)`: teks tahap dan `GAME OVER` | + +## Pilihan reka bentuk + +- **Kereta kelihatan seperti kereta.** Sebuah kereta ialah bentuk turtle + gabungan dalam tapak 40 x 20 piksel yang ditetapkan tugasan. Satu bentuk + didaftarkan bagi setiap warna, jadi tiada fail imej diperlukan. +- **Boleh diuji tanpa tetingkap.** Geometri (`car_components`), ujian perlanggaran + dan peraturan penciptaan ialah kod biasa. `CarManager` menerima kilang kereta + dan sumber rawak, jadi ujian menggunakan kereta palsu dan dadu yang ditetapkan. +- **Perlanggaran menggunakan seluruh kereta.** Pemain dibandingkan dengan segi + empat tepat kereta, bukan hanya bahagian tengahnya. + +## Dokumentasi + +Komen dalam sumber ialah komen Doxygen. Bina dengan `doxygen Doxyfile`. +Dokumen perancangan dan semakan terdapat dalam `docs/`. + +Kembali ke [Laman utama](Home-ms). diff --git a/Architecture.md b/Architecture.md new file mode 100644 index 0000000..884cf51 --- /dev/null +++ b/Architecture.md @@ -0,0 +1,33 @@ +# Architecture + +馃寪 **English** 路 [Dansk](Architecture-da) 路 [Bahasa Malaysia](Architecture-ms) + +## Modules (`src/`) + +| Module | Responsibility | +| --- | --- | +| `main.py` | Creates the screen, the objects and runs the game loop | +| `constants.py` | Every constant, defined once | +| `player.py` | `Player(Turtle)`: `go_up`, `is_at_finish_line`, `go_to_start` | +| `car_manager.py` | `CarManager`: `create_cars`, `move_cars`, `is_hit`, `level_up` | +| `car_shape.py` | The drawing of a car: body, cabin, windows, headlight, two wheels | +| `collision.py` | `is_colliding`: pure rectangle test, no turtle needed | +| `scoreboard.py` | `Scoreboard(Turtle)`: level text and `GAME OVER` | + +## Design choices + +- **Cars look like cars.** A car is a compound turtle shape inside the 40 x 20 + pixel footprint of the assignment. One shape is registered per colour, so no + image files are needed. +- **Testable without a window.** Geometry (`car_components`), the collision + test and the spawn rule are plain code. `CarManager` receives a car factory + and a random source, so tests use a fake car and a seeded dice. +- **Collision uses the whole car.** The player is compared with the car's + rectangle, not only with its centre. + +## Documentation + +Source comments are Doxygen comments. Build them with `doxygen Doxyfile`. +Planning and review documents are in `docs/`. + +Back to [Home](Home). diff --git a/Home-da.md b/Home-da.md new file mode 100644 index 0000000..980fa0f --- /dev/null +++ b/Home-da.md @@ -0,0 +1,30 @@ +# Turtle Crossing + +馃寪 [English](Home) 路 **Dansk** 路 [Bahasa Malaysia](Home-ms) + +Dag 23 i Udemys *100 Days of Code: The Complete Python Pro Bootcamp*: et spil i +Crossy Road-stil. Styr en skildpadde mod nord over en travl vej. Hver +krydsning g酶r bilerne hurtigere; 茅t sammenst酶d afslutter spillet. + +![Spillet: en skildpadde blandt biler p氓 niveau 4](https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/023-turtle-crossing/raw/branch/main/docs/images/gameplay.png) + +| Side | L忙s den, n氓r du vil | +| --- | --- | +| [Installation](Install-da) | Klone repositoryet, oprette `.venv` og k酶re spillet og testene | +| [Spil](Play-da) | L忙re reglerne og styringen | +| [Arkitektur](Architecture-da) | Se hvordan koden er delt i moduler, og hvorfor | + +## Overblik + +- Python 3.13 eller nyere, kun standardbiblioteket ved k酶rsel. +- Klasserne bruger opgavens navne: `Player`, `CarManager`, `Scoreboard`. +- Alle konstanter ligger i `src/constants.py`. +- Testene k酶res med `pytest`; kildedokumentationen bygges med Doxygen. + +## Links + +- [Repository][repo] +- [README][readme] + +[repo]: https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/023-turtle-crossing +[readme]: https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/023-turtle-crossing/src/branch/main/README.md diff --git a/Home-ms.md b/Home-ms.md new file mode 100644 index 0000000..de4a707 --- /dev/null +++ b/Home-ms.md @@ -0,0 +1,31 @@ +# Turtle Crossing + +馃寪 [English](Home) 路 [Dansk](Home-da) 路 **Bahasa Malaysia** + +Hari ke-23 dalam *100 Days of Code: The Complete Python Pro Bootcamp* Udemy: +permainan gaya Crossy Road. Pandu seekor penyu ke utara merentasi jalan yang +sibuk. Setiap kali berjaya melintas, kereta menjadi lebih laju; satu perlanggaran +menamatkan permainan. + +![Permainan: seekor penyu di antara kereta pada tahap 4](https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/023-turtle-crossing/raw/branch/main/docs/images/gameplay.png) + +| Halaman | Baca apabila anda mahu | +| --- | --- | +| [Pemasangan](Install-ms) | Klon repositori, cipta `.venv` dan jalankan permainan serta ujian | +| [Main](Play-ms) | Mempelajari peraturan dan kawalan | +| [Seni bina](Architecture-ms) | Melihat bagaimana kod dibahagikan kepada modul dan sebabnya | + +## Ringkasan + +- Python 3.13 atau lebih baharu, hanya pustaka standard semasa dijalankan. +- Kelas menggunakan nama tugasan: `Player`, `CarManager`, `Scoreboard`. +- Semua pemalar berada dalam `src/constants.py`. +- Ujian dijalankan dengan `pytest`; dokumentasi sumber dibina dengan Doxygen. + +## Pautan + +- [Repositori][repo] +- [README][readme] + +[repo]: https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/023-turtle-crossing +[readme]: https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/023-turtle-crossing/src/branch/main/README.md diff --git a/Home.md b/Home.md new file mode 100644 index 0000000..6374d28 --- /dev/null +++ b/Home.md @@ -0,0 +1,30 @@ +# Turtle Crossing + +馃寪 **English** 路 [Dansk](Home-da) 路 [Bahasa Malaysia](Home-ms) + +Day 23 of Udemy's *100 Days of Code: The Complete Python Pro Bootcamp*: a +Crossy Road style game. Steer a turtle north across a busy road. Every +crossing makes the cars faster; one collision ends the game. + +![The game: a turtle among cars on level 4](https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/023-turtle-crossing/raw/branch/main/docs/images/gameplay.png) + +| Page | Read it when you want to | +| --- | --- | +| [Install](Install) | Clone the repository, create the `.venv` and run the game and the tests | +| [Play](Play) | Learn the rules and the controls | +| [Architecture](Architecture) | See how the code is split into modules and why | + +## At a glance + +- Python 3.13 or newer, standard library only at runtime. +- Classes use the assignment's names: `Player`, `CarManager`, `Scoreboard`. +- All constants live in `src/constants.py`. +- Tests run with `pytest`; source documentation is built with Doxygen. + +## Links + +- [Repository][repo] +- [README][readme] + +[repo]: https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/023-turtle-crossing +[readme]: https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/023-turtle-crossing/src/branch/main/README.md diff --git a/Install-da.md b/Install-da.md new file mode 100644 index 0000000..bae67bb --- /dev/null +++ b/Install-da.md @@ -0,0 +1,53 @@ +# Installation + +馃寪 [English](Install) 路 **Dansk** 路 [Bahasa Malaysia](Install-ms) + +## Krav + +- Python 3.13 eller nyere med `tkinter`. +- `git`. +- Valgfrit: Doxygen til kildedokumentationen. + +## Windows PowerShell + +```powershell +git clone https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/023-turtle-crossing.git +cd 023-turtle-crossing +py -3.13 -m venv .venv +.\.venv\Scripts\Activate.ps1 +python -m pip install --upgrade pip +python -m pip install --group dev +``` + +## Linux Debian + +```bash +sudo apt update && sudo apt install -y git python3.13 python3.13-venv python3-tk +git clone https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/023-turtle-crossing.git +cd 023-turtle-crossing +python3.13 -m venv .venv +source .venv/bin/activate +python -m pip install --upgrade pip +python -m pip install --group dev +``` + +## macOS + +```bash +brew install python@3.13 python-tk@3.13 git +git clone https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/023-turtle-crossing.git +cd 023-turtle-crossing +python3.13 -m venv .venv +source .venv/bin/activate +python -m pip install --upgrade pip +python -m pip install --group dev +``` + +## K酶r og test + +```bash +python src/main.py +python -m pytest +``` + +N忙ste: [Spil](Play-da). diff --git a/Install-ms.md b/Install-ms.md new file mode 100644 index 0000000..500bcfd --- /dev/null +++ b/Install-ms.md @@ -0,0 +1,53 @@ +# Pemasangan + +馃寪 [English](Install) 路 [Dansk](Install-da) 路 **Bahasa Malaysia** + +## Keperluan + +- Python 3.13 atau lebih baharu dengan `tkinter`. +- `git`. +- Pilihan: Doxygen untuk dokumentasi sumber. + +## Windows PowerShell + +```powershell +git clone https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/023-turtle-crossing.git +cd 023-turtle-crossing +py -3.13 -m venv .venv +.\.venv\Scripts\Activate.ps1 +python -m pip install --upgrade pip +python -m pip install --group dev +``` + +## Linux Debian + +```bash +sudo apt update && sudo apt install -y git python3.13 python3.13-venv python3-tk +git clone https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/023-turtle-crossing.git +cd 023-turtle-crossing +python3.13 -m venv .venv +source .venv/bin/activate +python -m pip install --upgrade pip +python -m pip install --group dev +``` + +## macOS + +```bash +brew install python@3.13 python-tk@3.13 git +git clone https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/023-turtle-crossing.git +cd 023-turtle-crossing +python3.13 -m venv .venv +source .venv/bin/activate +python -m pip install --upgrade pip +python -m pip install --group dev +``` + +## Jalankan dan uji + +```bash +python src/main.py +python -m pytest +``` + +Seterusnya: [Main](Play-ms). diff --git a/Install.md b/Install.md new file mode 100644 index 0000000..50908f7 --- /dev/null +++ b/Install.md @@ -0,0 +1,53 @@ +# Install + +馃寪 **English** 路 [Dansk](Install-da) 路 [Bahasa Malaysia](Install-ms) + +## Requirements + +- Python 3.13 or newer with `tkinter`. +- `git`. +- Optional: Doxygen for the source documentation. + +## Windows PowerShell + +```powershell +git clone https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/023-turtle-crossing.git +cd 023-turtle-crossing +py -3.13 -m venv .venv +.\.venv\Scripts\Activate.ps1 +python -m pip install --upgrade pip +python -m pip install --group dev +``` + +## Linux Debian + +```bash +sudo apt update && sudo apt install -y git python3.13 python3.13-venv python3-tk +git clone https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/023-turtle-crossing.git +cd 023-turtle-crossing +python3.13 -m venv .venv +source .venv/bin/activate +python -m pip install --upgrade pip +python -m pip install --group dev +``` + +## macOS + +```bash +brew install python@3.13 python-tk@3.13 git +git clone https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/023-turtle-crossing.git +cd 023-turtle-crossing +python3.13 -m venv .venv +source .venv/bin/activate +python -m pip install --upgrade pip +python -m pip install --group dev +``` + +## Run and test + +```bash +python src/main.py +python -m pytest +``` + +Next: [Play](Play). diff --git a/Play-da.md b/Play-da.md new file mode 100644 index 0000000..d312432 --- /dev/null +++ b/Play-da.md @@ -0,0 +1,30 @@ +# Spil + +馃寪 [English](Play) 路 **Dansk** 路 [Bahasa Malaysia](Play-ms) + +## Styring + +| Tast | Handling | +| --- | --- | +| Pil op | Flyt skildpadden 茅t skridt mod nord. Skildpadden kan ikke g氓 tilbage, til venstre eller til h酶jre. | + +## Regler + +1. Biler dukker op i h酶jre kant i tilf忙ldige baner og k酶rer mod venstre. De + 酶verste og nederste 50 pixel er en sikker zone uden biler. +2. N氓 den 酶verste kant for at komme over. Skildpadden vender tilbage til + start, niveauet stiger med 茅n, og bilerne bliver hurtigere. +3. Ber酶rer du en bil, er spillet slut. `GAME OVER` vises i midten; klik p氓 + vinduet for at lukke det. + +## Tips + +- Vent p氓 et hul: en ny bil oprettes cirka hver sjette billedramme. +- Hvert niveau l忙gger det samme hastighedstrin til, s氓 senere niveauer kr忙ver + hurtige, korte tr忙k. + +![Spillet: en skildpadde blandt biler p氓 niveau 4](https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/023-turtle-crossing/raw/branch/main/docs/images/gameplay.png) + +![Game over: skildpadden blev ramt af en bil](https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/023-turtle-crossing/raw/branch/main/docs/images/game-over.png) + +Tilbage til [Forside](Home-da). diff --git a/Play-ms.md b/Play-ms.md new file mode 100644 index 0000000..23dea3a --- /dev/null +++ b/Play-ms.md @@ -0,0 +1,30 @@ +# Main + +馃寪 [English](Play) 路 [Dansk](Play-da) 路 **Bahasa Malaysia** + +## Kawalan + +| Kekunci | Tindakan | +| --- | --- | +| Anak panah atas | Gerakkan penyu satu langkah ke utara. Penyu tidak boleh bergerak ke belakang, kiri atau kanan. | + +## Peraturan + +1. Kereta muncul di tepi kanan dalam lorong rawak dan bergerak ke kiri. 50 + piksel teratas dan terbawah ialah zon selamat tanpa kereta. +2. Sampai ke tepi atas untuk melintas. Penyu kembali ke permulaan, tahap naik + satu dan kereta menjadi lebih laju. +3. Jika menyentuh kereta, permainan tamat. `GAME OVER` dipaparkan di tengah; + klik tetingkap untuk menutupnya. + +## Petua + +- Tunggu ruang kosong: kereta baharu dicipta kira-kira sekali dalam enam bingkai. +- Setiap tahap menambah langkah kelajuan yang sama, jadi tahap lebih tinggi + memerlukan gerakan pantas dan pendek. + +![Permainan: seekor penyu di antara kereta pada tahap 4](https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/023-turtle-crossing/raw/branch/main/docs/images/gameplay.png) + +![Permainan tamat: penyu dilanggar kereta](https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/023-turtle-crossing/raw/branch/main/docs/images/game-over.png) + +Kembali ke [Laman utama](Home-ms). diff --git a/Play.md b/Play.md new file mode 100644 index 0000000..6634160 --- /dev/null +++ b/Play.md @@ -0,0 +1,29 @@ +# Play + +馃寪 **English** 路 [Dansk](Play-da) 路 [Bahasa Malaysia](Play-ms) + +## Controls + +| Key | Action | +| --- | --- | +| Up arrow | Move the turtle one step north. The turtle cannot move back, left or right. | + +## Rules + +1. Cars appear on the right edge in random lanes and drive left. The top and + bottom 50 pixels are a safe zone with no cars. +2. Reach the top edge to cross. The turtle returns to the start, the level goes + up by one and the cars become faster. +3. Touching a car ends the game. `GAME OVER` is shown in the centre; click the + window to close it. + +## Tips + +- Wait for a gap: a new car is created on about one frame in six. +- Every level adds the same speed step, so later levels need quick, short moves. + +![The game: a turtle among cars on level 4](https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/023-turtle-crossing/raw/branch/main/docs/images/gameplay.png) + +![Game over: the turtle was hit by a car](https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/023-turtle-crossing/raw/branch/main/docs/images/game-over.png) + +Back to [Home](Home). diff --git a/_Sidebar.md b/_Sidebar.md new file mode 100644 index 0000000..0a39723 --- /dev/null +++ b/_Sidebar.md @@ -0,0 +1,20 @@ +**Turtle Crossing** + +- [Home](Home) +- [Install](Install) +- [Play](Play) +- [Architecture](Architecture) + +**Dansk** + +- [Forside](Home-da) +- [Installation](Install-da) +- [Spil](Play-da) +- [Arkitektur](Architecture-da) + +**Bahasa Malaysia** + +- [Laman utama](Home-ms) +- [Pemasangan](Install-ms) +- [Main](Play-ms) +- [Seni bina](Architecture-ms)