From d0aa9640bc9496b191d1da7da2cfa6399b91074d Mon Sep 17 00:00:00 2001 From: pepaskopec-blip Date: Fri, 11 Sep 2026 21:03:51 +0200 Subject: [PATCH] =?UTF-8?q?Add=20Technick=C3=A9=20vybaven=C3=AD=20unit=203?= =?UTF-8?q?:=20bits=20and=20bytes=20with=20quiz.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cursor --- hw.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++- i18n.c | 13 ++++++++++++ main.c | 2 ++ maturita.h | 5 ++++- 4 files changed, 76 insertions(+), 2 deletions(-) diff --git a/hw.c b/hw.c index 009d2e1..37f8bac 100644 --- a/hw.c +++ b/hw.c @@ -5,6 +5,7 @@ NetLesson hw_lessons[HW_LESSONS] = { { .n_slides = HW_SLIDES, .unit_page = "hwunit1", .ex_page = "hwex1" }, { .n_slides = HW2_SLIDES, .unit_page = "hwunit2", .ex_page = "hwex2" }, + { .n_slides = HW3_SLIDES, .unit_page = "hwunit3", .ex_page = "hwex3" }, }; void hw_rail_theme_reset(void); @@ -257,7 +258,7 @@ void hw_add_node(GtkFixed *fixed, int index) { GtkWidget *name; char *text; static const char *unit_keys[HW_LESSONS] = { - "hw_unit1", "hw_unit2" + "hw_unit1", "hw_unit2", "hw_unit3" }; card = gtk_button_new(); @@ -874,3 +875,58 @@ GtkWidget *build_hw_unit2_exercise_page(void) { return build_hw_mcq_page(1, "hwunit2", "hw_ex2_title", "hw_quiz2_head", qs, hints, 8); } + +GtkWidget *build_hw_unit3_page(void) { + static const NetSlide slides[HW3_SLIDES] = { + { + "1 / 2 • Bit", "Bit – nejmenší jednotka informace", + "Bit = binary digit (dvojková číslice)", + { + "Bit je dvojková číslice – nabývá hodnoty 0 nebo 1.", + "Je to nejmenší zobrazitelná jednotka informace.", + "Z bitů se skládají větší jednotky (např. byte).", + NULL, + }, + }, + { + "2 / 2 • Byte", "Byte – adresovatelná jednotka paměti", + "Tip: 1 B = 8 b", + { + "Byte je nejmenší adresovatelná jednotka paměti.", + "Počítač tedy paměť adresuje po bytech, ne po jednotlivých " + "bitech.", + "Jeden byte obvykle obsahuje 8 bitů.", + NULL, + }, + }, + }; + + return build_hw_unit_page(&hw_lessons[2], "hw_unit3", "hw_unit3_sub", + slides, HW3_SLIDES); +} + +GtkWidget *build_hw_unit3_exercise_page(void) { + static const ChoiceQ qs[] = { + {"Co je bit?", + {"Největší jednotka paměti", "Dvojková číslice – nejmenší jednotka " + "informace", "Jen klávesa na klávesnici", "Typ procesoru"}, + 4, 1}, + {"Jaké hodnoty může nabývat bit?", + {"Jen 0", "Jen 1", "0 nebo 1", "0 až 255"}, 4, 2}, + {"Co je byte?", + {"Nejmenší adresovatelná jednotka paměti", + "Nejmenší zobrazitelná jednotka informace", + "Jen síťový kabel", "Jen grafická karta"}, + 4, 0}, + {"Kolik bitů má obvykle jeden byte?", + {"2", "4", "8", "16"}, 4, 2}, + }; + static const char *hints[] = { + "Bit = dvojková číslice, nejmenší jednotka informace", + "Bit nabývá hodnoty 0 nebo 1", + "Byte = nejmenší adresovatelná jednotka paměti", + "1 B = 8 b", + }; + return build_hw_mcq_page(2, "hwunit3", "hw_ex3_title", "hw_quiz3_head", + qs, hints, 4); +} diff --git a/i18n.c b/i18n.c index 495af02..705a910 100644 --- a/i18n.c +++ b/i18n.c @@ -297,6 +297,13 @@ const TrEntry tr_ui[] = { "Quiz: history of computers"}, {"hw_quiz2_head", "Kvíz k historii počítačů", "Quiz on the history of computers"}, + {"hw_unit3", "Zobrazování dat v počítači", "Data representation"}, + {"hw_unit3_sub", "2 snímky o bitu a bytu a pak kvíz.", + "2 slides about bits and bytes, then a quiz."}, + {"hw_ex3_title", "Kvíz: zobrazování dat", + "Quiz: data representation"}, + {"hw_quiz3_head", "Kvíz k zobrazování dat v počítači", + "Quiz on data representation in computers"}, {NULL, NULL, NULL} }; @@ -957,6 +964,12 @@ const TrEntry tr_content[] = { {"4. generace – programovatelné mikroprocesory", NULL, "4th generation – programmable microprocessors"}, {"1972 – první počítačová hra", NULL, "1972 – first computer game"}, + {"Bit = dvojková číslice, nejmenší jednotka informace", NULL, + "A bit is a binary digit, the smallest unit of information"}, + {"Bit nabývá hodnoty 0 nebo 1", NULL, "A bit is either 0 or 1"}, + {"Byte = nejmenší adresovatelná jednotka paměti", NULL, + "A byte is the smallest addressable unit of memory"}, + {"1 B = 8 b", NULL, "1 B = 8 b"}, {NULL, NULL, NULL} }; diff --git a/main.c b/main.c index ea2d990..6c2c8ee 100644 --- a/main.c +++ b/main.c @@ -176,6 +176,8 @@ void activate(GtkApplication *app, gpointer user_data) { gtk_stack_add_named(main_stack, build_hw_unit1_exercise_page(), "hwex1"); gtk_stack_add_named(main_stack, build_hw_unit2_page(), "hwunit2"); gtk_stack_add_named(main_stack, build_hw_unit2_exercise_page(), "hwex2"); + gtk_stack_add_named(main_stack, build_hw_unit3_page(), "hwunit3"); + gtk_stack_add_named(main_stack, build_hw_unit3_exercise_page(), "hwex3"); { typedef GtkWidget *(*NetBuilder)(void); static const struct { diff --git a/maturita.h b/maturita.h index 09434f9..8904a0e 100644 --- a/maturita.h +++ b/maturita.h @@ -59,9 +59,10 @@ #define NET10_SLIDES 3 #define NET_LESSONS 10 #define HW_UNITS 10 -#define HW_LESSONS 2 +#define HW_LESSONS 3 #define HW_SLIDES 3 #define HW2_SLIDES 6 +#define HW3_SLIDES 2 typedef enum { THEME_CATPPUCCIN = 0, @@ -766,6 +767,8 @@ GtkWidget *build_hw_unit1_page(void); GtkWidget *build_hw_unit1_exercise_page(void); GtkWidget *build_hw_unit2_page(void); GtkWidget *build_hw_unit2_exercise_page(void); +GtkWidget *build_hw_unit3_page(void); +GtkWidget *build_hw_unit3_exercise_page(void); void draw_chip_icon(GtkDrawingArea *area, cairo_t *cr, int width, int height, gpointer data); void net_lesson_notes_ensure(NetLesson *L);