diff --git a/README.md b/README.md index 2003840..6627b36 100644 --- a/README.md +++ b/README.md @@ -53,38 +53,39 @@ python -m tetris The `settings.toml` file is a configuration file for customizing various aspects of the game. ### General Settings -- `Pause`: Defines the keys to pause the game. Currently a work in progress (WIP). -- `Quit`: Defines the key(s) to quit the game. -- `Colorscheme`: Specifies the color scheme for the game interface. Options include: +- `pause`: Defines the keys to pause the game. Currently a work in progress (WIP[^WIP]). +- `quit`: Defines the key(s) to quit the game. +- `colorscheme`: Specifies the color scheme for the game interface. Options include: - `tokyonight-night` - `tokyonight-storm` - `tokyonight-day` - `tokyonight-moon` ### Movement Settings -- `Left`: Defines the keys to move the tetromino[^tetromino] left. -- `Right`: Defines the keys to move the tetromino right. -- `Down`: Defines the keys to accelerate the tetromino's fall. +- `left`: Defines the keys to move the tetromino[^tetromino] left. +- `right`: Defines the keys to move the tetromino right. +- `down`: Defines the keys to accelerate the tetromino's fall. ### Rotation Settings -- `Clockwise (cw)`: Defines the keys to rotate the tetromino in a clockwise direction. -- `Counter-Clockwise (ccw)`: Defines the keys to rotate the tetromino in a counter-clockwise direction. +- `cw (clockwise )`: Defines the keys to rotate the tetromino in a clockwise direction. +- `ccw (counter-clockwise)`: Defines the keys to rotate the tetromino in a counter-clockwise direction. ### Action Settings -- `Hold`: Defines the keys to hold the tetromino (WIP). -- `Drop`: Defines the keys to instantly drop the tetromino. +- `hold`: Defines the keys to hold the tetromino (WIP). +- `drop`: Defines the keys to instantly drop the tetromino. ### Volume Settings #### Music -- `Enabled`: Indicates whether music is enabled. -- `Level`: Specifies the volume level for the music. +- `enabled`: Indicates whether music is enabled. +- `level`: Specifies the volume level for the music. #### Sound Effects (SFX) -- `Enabled`: Indicates whether sound effects are enabled. -- `Level`: Specifies the volume level for the sound effects. +- `enabled`: Indicates whether sound effects are enabled. +- `level`: Specifies the volume level for the sound effects. ## Acknowledgments Thanks to [Folke](https://github.com/folke), the creator of [TokyoNight](https://github.com/folke/tokyonight.nvim) color theme. +[^WIP]: Work In Progress. [^tetromino]: A tetromino is a geometric shape composed of four squares, connected orthogonally (i.e. at the edges and not the corners). diff --git a/typst/img/tetris.png b/typst/img/tetris.png new file mode 100644 index 0000000..25dd85a Binary files /dev/null and b/typst/img/tetris.png differ diff --git a/typst/main.pdf b/typst/main.pdf new file mode 100644 index 0000000..d00be9d Binary files /dev/null and b/typst/main.pdf differ diff --git a/typst/main.typ b/typst/main.typ new file mode 100644 index 0000000..313f4ee --- /dev/null +++ b/typst/main.typ @@ -0,0 +1,165 @@ +#import "@preview/tablex:0.0.6": tablex, rowspanx, colspanx, cellx + +#let indent = 1cm +#let indent-par(body) = par(h(indent) + body) + +#let authors = ("Kristiāns Francis Cagulis, kc22015",) +#let title = [Kursa noslēguma projekts -- Tetris] + +#set document(author: authors, title: title) +#set page(numbering: "1", number-align: center) +#set text( font: "New Computer Modern", lang: "lv", region: "LV") +#show link: set text(blue) +#show link: it => {underline(it)} +#show math.equation: set text(weight: 400) + + // Headings +#set heading(numbering: "1.1.") + #show heading: it => { + if it.level == 1 { + text(14pt, align(center, upper(it))) + } else { + it + } +} + +#show figure: set par(justify: false) // disable justify for figures (tables) + +#let indent = 1cm +#let indent-par(body) = par(h(indent) + body) + +#set list(marker: ([•], [--], [\*], [·])) +#set enum(numbering: "1aiA.") + + // Title row. +#align(center)[ + #block(text(weight: 700, 1.75em, title)) +] + + // Author information. +#pad( + top: 0.5em, + bottom: 0.5em, + x: 2em, + grid( + columns: (1fr,) * calc.min(3, authors.len()), + gutter: 1em, + ..authors.map(author => align(center, strong(author))), + ), +) + +#show par: set block(spacing: 1.5em) // Set 1.5em gap between paragraphs +#show heading: set block(spacing: 1.5em) +#set terms(separator: [ -- ]) + + // Main body. +#set par( + justify: true, + leading: 1.5em, + first-line-indent: indent, +) + +/ Github: #link("https://github.com/kristoferssolo/Tetris") + += Apraksts +#indent-par([ +Tetris ir klasiska spēle, kuru esmu izveidojis, izmantojot `pygame` bibliotēku. +Spēle spēlētājs var manipulēt ar krāsainām tetrimino #footnote[Tetramino ir polimino, kurš sastāv no četriem vienības kvadrātiem, kuri ir savienoti gar malām.] formām, cenšoties izveidot pilnas rindas, lai tās pazustu un gūtu punktus. +]) + +Spēles pamatfunkcijas: + ++ *Grafika un dizains*: Spēle izmanto `pygame` bibliotēku, lai radītu vienkāršu lietotāja saskarni (@tetris). ++ *Kustība un kontroles*: Spēlētājs var vadīt tetrimino formas, izmantojot bulttaustiņus vai citas atbilstošas taustiņu kombinācijas (skat. `settings.toml` failu). Tetrimino var rotēties, pārvietoties pa labi vai pa kreisi, kā arī ātrāk nokrist uz leju. ++ *Punktu uzskaitīšana*: Spēlētājs nopelna punktus, izveidojot pilnas rindas. Jo vairāk rindas vienlaicīgi tiek izveidotas, jo lielāks ir punktu skaits. ++ *Spēles beigas*: Spēle beidzas, ja tetrimino formas sasniedz ekrāna augšējo malu un nevar turpināt nokrist. ++ *Dziesmas un skaņas efekti*: Spēlē ievietota dziesma un skaņas efekti. ++ *Augoša grūtības pakāpe*: Spēle piedāvā augošu grūtības pakāpi, kur ar pilnu rindu skaitu tetrimino kļūst ātrākas, radot spēlētājam arvien lielākus izaicinājumus. + +#indent-par([ +Sākotnēji plānoju arī iekļaut mākslīgo intelektu (AI), kas spētu patstāvīgi spēlēt Tetris. +AI ietvertu spēju izvēlēties optimālus gājienus un veikt stratēģiskus lēmumus, lai maksimāli palielinātu punktu skaitu. +Tomēr, saskāros ar tehniskām problēmām. Progress ir laikietilpīgāks nekā sākotnēji bija plānots un neuzspēju līdz galam to pabeig. +]) + + + += Lietošanas instrukcija +== Palaišanas instrukcija + +1. Klonējiet repozitoriju: +```bash +git clone https://github.com/kristoferssolo/Tetris +``` + +2. Pārejiet uz projekta direktoriju: +```bash +cd Tetris +``` + +3. Instalējiet nepieciešamās atkarības: +```bash +pip install . +``` + +4. Palaidiet spēli: +```bash +python main.py +``` +vai +```bash +python -m tetris +``` + +== Iestatījumi +`settings.toml` ir konfigurācijas fails dažādu spēles aspektu pielāgošanai. Tajā var atrast un mainīt sekojošus parametrus. + +=== Vispārīgi iestatījumi +#par(first-line-indent: 0cm, [ + / `pause`: definē taustiņu(-s), lai apturētu spēli (WIP #footnote[WIP (Work In Progress) -- nepabeigts darbs: darbs vai produkts, kas ir sākts, bet nav pabeigts vai gatavs.]). + / `quit`: definē taustiņu(-s), lai izietu no spēles. + / `colorscheme`: norāda spēles saskarnes krāsu shēmu. Iespējas ietver: + - `tokyonight-day` + - `tokyonight-moon` + - `tokyonight-night` + - `tokyonight-storm` +]) + +=== Kustību iestatījumi +#par(first-line-indent: 0cm, [ + / `left`: definē taustiņu(-s), lai pārvietotu tetromino @tetromino pa kreisi; + / `right`: definē taustiņu(-s), lai pārvietotu tetromino pa labi; + / `down`: definē taustiņu(-s), lai paātrinātu tetromino kustību uz leju (krišanu). +]) + +=== Rotācijas iestatījumi +#par(first-line-indent: 0cm, [ + / `cw (clockwise)`: definē taustiņu(-s), lai pagrieztu tetromino pulksteņrādītāja virzienā. + / `ccw (counter-clockwise)`: definē taustiņu(-s), lai pagrieztu tetromino pretēji pulksteņrādītāja virzienam. +]) + +=== Papildus darbību iestatījumi +#par(first-line-indent: 0cm, [ + / `hold`: definē taustiņu(-s), lai uzglabātu tetromino (WIP @WIP). + / `drop`: definē taustiņ(-s), lai nekavējoties nomestu tetromino. +]) + +=== Skaņas iestatījumi +==== Mūzika +#par(first-line-indent: 0cm, [ + / `enabled`: norāda, vai mūzika ir iespējota. + / `level`: norāda mūzikas skaļuma līmeni. +]) + +==== Skaņas efekti (SFX) +#par(first-line-indent: 0cm, [ + / `enabled`: norāda, vai ir iespējoti skaņas efekti. + / `level`: norāda skaņas efektu skaļuma līmeni. +]) + + +#figure( + caption: [Tetris spēle ar `tokyonight-night` krāsu shēmu], + placement: auto, + image("img/tetris.png", width:70%) +)