Finish the README and add the wiki in English, Danish and Bahasa Malaysia
CI / test (pull_request) Successful in 1m1s
CI / test (pull_request) Successful in 1m1s
Doxygen builds the source documentation without warnings. Task: MIL-007#1 Task: MIL-007#2 Task: MIL-007#3
This commit is contained in:
@@ -102,9 +102,17 @@ Open `docs/api/html/index.html` in a browser.
|
||||
|
||||
```text
|
||||
.
|
||||
├── src/ game source: main.py, constants.py, player.py, car_manager.py, scoreboard.py
|
||||
├── src/ game source
|
||||
│ ├── main.py screen, objects and the game loop
|
||||
│ ├── constants.py every constant
|
||||
│ ├── player.py Player
|
||||
│ ├── car_manager.py CarManager
|
||||
│ ├── car_shape.py how a car is drawn
|
||||
│ ├── collision.py collision test
|
||||
│ └── scoreboard.py Scoreboard
|
||||
├── tests/ pytest tests
|
||||
├── docs/ planning and review documents (business case, plan, milestones, reviews)
|
||||
├── wiki/ wiki pages in English, Danish (-da) and Bahasa Malaysia (-ms)
|
||||
├── Doxyfile Doxygen configuration
|
||||
├── pyproject.toml project configuration and development dependencies
|
||||
└── .gitea/ continuous integration workflow
|
||||
|
||||
@@ -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).
|
||||
@@ -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).
|
||||
@@ -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).
|
||||
@@ -0,0 +1,28 @@
|
||||
# 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.
|
||||
|
||||
| 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
|
||||
@@ -0,0 +1,29 @@
|
||||
# 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.
|
||||
|
||||
| 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
|
||||
@@ -0,0 +1,28 @@
|
||||
# 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.
|
||||
|
||||
| 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
|
||||
@@ -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).
|
||||
@@ -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).
|
||||
@@ -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).
|
||||
@@ -0,0 +1,26 @@
|
||||
# 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.
|
||||
|
||||
Tilbage til [Forside](Home-da).
|
||||
@@ -0,0 +1,26 @@
|
||||
# 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.
|
||||
|
||||
Kembali ke [Laman utama](Home-ms).
|
||||
@@ -0,0 +1,25 @@
|
||||
# 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.
|
||||
|
||||
Back to [Home](Home).
|
||||
@@ -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)
|
||||
Reference in New Issue
Block a user