Add Technické vybavení unit 3: bits and bytes with quiz.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
pepaskopec-blip 2026-09-11 21:03:51 +02:00
commit d0aa9640bc
4 changed files with 76 additions and 2 deletions

58
hw.c
View file

@ -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);
}

13
i18n.c
View file

@ -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}
};

2
main.c
View file

@ -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 {

View file

@ -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);