Update cetz & ci

This commit is contained in:
2025-09-23 23:29:06 -07:00
parent 121780df6c
commit e5b0053465
17 changed files with 393 additions and 483 deletions

View File

@ -1,5 +1,5 @@
#import "@local/handout:0.1.0": *
#import "@preview/cetz:0.3.1"
#import "@preview/cetz:0.4.2"
#show: handout.with(
title: [Warm-Up: Big-Tac-Toe],
@ -75,16 +75,13 @@ How does your strategy change? \
#if extra_boards {
pagebreak()
align(
center,
grid(
stroke: none,
align: center,
columns: (1fr, 1fr),
rows: (1fr, 1fr, 1fr),
btt(0.35), btt(0.35),
btt(0.35), btt(0.35),
btt(0.35), btt(0.35),
),
)
align(center, grid(
stroke: none,
align: center,
columns: (1fr, 1fr),
rows: (1fr, 1fr, 1fr),
btt(0.35), btt(0.35),
btt(0.35), btt(0.35),
btt(0.35), btt(0.35),
))
}

View File

@ -1,5 +1,5 @@
#import "@local/handout:0.1.0": *
#import "@preview/cetz:0.3.1"
#import "@preview/cetz:0.4.2"
#show: handout.with(
@ -43,61 +43,56 @@ Now, consider the set of six-sided dice below:
- Die $E$: $0, 5, 5, 5, 5, 5$
On average, which die beats each of the others? Draw a diagram.
#solution(
align(
center,
cetz.canvas({
import cetz.draw: *
#solution(align(center, cetz.canvas({
import cetz.draw: *
let s = 0.8 // Scale
let t = 13pt * s // text size
let radius = 0.3 * s
let s = 0.8 // Scale
let t = 13pt * s // text size
let radius = 0.3 * s
// Points
let a = (-2 * s, 0.2 * s)
let b = (0 * s, 2 * s)
let c = (2 * s, 0.2 * s)
let d = (1.2 * s, -2.1 * s)
let e = (-1.2 * s, -2.1 * s)
// Points
let a = (-2 * s, 0.2 * s)
let b = (0 * s, 2 * s)
let c = (2 * s, 0.2 * s)
let d = (1.2 * s, -2.1 * s)
let e = (-1.2 * s, -2.1 * s)
set-style(
stroke: (thickness: 0.6mm * s),
mark: (
end: (
symbol: ">",
fill: black,
offset: radius + (0.025 * s),
width: 1.2mm * s,
length: 1.2mm * s,
),
),
)
set-style(
stroke: (thickness: 0.6mm * s),
mark: (
end: (
symbol: ">",
fill: black,
offset: radius + (0.025 * s),
width: 1.2mm * s,
length: 1.2mm * s,
),
),
)
line(a, b)
line(b, c)
line(c, d)
line(d, e)
line(e, a)
line(a, c)
line(b, d)
line(c, e)
line(d, a)
line(e, b)
line(a, b)
line(b, c)
line(c, d)
line(d, e)
line(e, a)
line(a, c)
line(b, d)
line(c, e)
line(d, a)
line(e, b)
circle(a, radius: radius, fill: oblue, stroke: none)
circle(b, radius: radius, fill: oblue, stroke: none)
circle(c, radius: radius, fill: oblue, stroke: none)
circle(d, radius: radius, fill: oblue, stroke: none)
circle(e, radius: radius, fill: oblue, stroke: none)
circle(a, radius: radius, fill: oblue, stroke: none)
circle(b, radius: radius, fill: oblue, stroke: none)
circle(c, radius: radius, fill: oblue, stroke: none)
circle(d, radius: radius, fill: oblue, stroke: none)
circle(e, radius: radius, fill: oblue, stroke: none)
content(a, text(fill: white, size: t, [*A*]))
content(b, text(fill: white, size: t, [*B*]))
content(c, text(fill: white, size: t, [*C*]))
content(d, text(fill: white, size: t, [*D*]))
content(e, text(fill: white, size: t, [*E*]))
}),
),
)
content(a, text(fill: white, size: t, [*A*]))
content(b, text(fill: white, size: t, [*B*]))
content(c, text(fill: white, size: t, [*C*]))
content(d, text(fill: white, size: t, [*D*]))
content(e, text(fill: white, size: t, [*E*]))
})))
#v(1fr)

View File

@ -1,5 +1,5 @@
#import "@local/handout:0.1.0": *
#import "@preview/cetz:0.3.1"
#import "@preview/cetz:0.4.2"
#show: handout.with(
title: [Warm-Up: What's an AST?],
@ -18,59 +18,56 @@ You may detach the string as you hang the painting, but it must be re-attached o
#v(2mm)
#align(
center,
cetz.canvas({
import cetz.draw: *
let s = 2.5
#align(center, cetz.canvas({
import cetz.draw: *
let s = 2.5
line(
(0 * s, 1 * s),
(2 * s, 1 * s),
(2 * s, 0 * s),
(0 * s, 0 * s),
close: true,
stroke: (thickness: 0.8mm),
)
line(
(0 * s, 1 * s),
(2 * s, 1 * s),
(2 * s, 0 * s),
(0 * s, 0 * s),
close: true,
stroke: (thickness: 0.8mm),
)
line(
(0.1 * s, 1 * s),
(0.5 * s, 1.5 * s),
(1.5 * s, 1.5 * s),
(1.9 * s, 1 * s),
stroke: (thickness: 0.5mm, dash: "dotted"),
)
line(
(0.1 * s, 1 * s),
(0.5 * s, 1.5 * s),
(1.5 * s, 1.5 * s),
(1.9 * s, 1 * s),
stroke: (thickness: 0.5mm, dash: "dotted"),
)
circle((0.5 * s, 1.5 * s), radius: 0.04 * s, fill: black, stroke: none)
circle((1.5 * s, 1.5 * s), radius: 0.04 * s, fill: black, stroke: none)
circle((0.5 * s, 1.5 * s), radius: 0.04 * s, fill: black, stroke: none)
circle((1.5 * s, 1.5 * s), radius: 0.04 * s, fill: black, stroke: none)
line(
(0.66 * s, 0.66 * s),
(0.66 * s, 0.35 * s),
(0.60 * s, 0.1 * s),
)
line(
(0.66 * s, 0.66 * s),
(0.66 * s, 0.35 * s),
(0.60 * s, 0.1 * s),
)
line(
(0.72 * s, 0.1 * s),
(0.66 * s, 0.35 * s),
)
line(
(0.72 * s, 0.1 * s),
(0.66 * s, 0.35 * s),
)
line(
(0.66 * s, 0.575 * s),
(0.6 * s, 0.475 * s),
(0.525 * s, 0.575 * s),
)
line(
(0.66 * s, 0.575 * s),
(0.6 * s, 0.475 * s),
(0.525 * s, 0.575 * s),
)
line(
(0.66 * s, 0.575 * s),
(0.72 * s, 0.475 * s),
(0.795 * s, 0.575 * s),
)
line(
(0.66 * s, 0.575 * s),
(0.72 * s, 0.475 * s),
(0.795 * s, 0.575 * s),
)
circle((0.66 * s, 0.66 * s), radius: 0.07 * s, fill: white)
}),
)
circle((0.66 * s, 0.66 * s), radius: 0.07 * s, fill: white)
}))
#solution([
Say we have a left nail and a right nail. The path of the string is as follows:

View File

@ -1,5 +1,5 @@
#import "@local/handout:0.1.0": *
#import "@preview/cetz:0.3.1"
#import "@preview/cetz:0.4.2"
#show: handout.with(
title: [Warm-Up: Passing Balls],
@ -78,32 +78,25 @@ Participant 1 has a black ball. Which balls are held by participants 2, 3, and 4
let i = 1
for p in pts {
circle(
p,
radius: radius * s,
fill: if i == 1 {
ored
} else if i == 2 {
ogreen
} else if i == 3 {
oorange
} else if i == 4 {
oblue
} else { white },
)
circle(p, radius: radius * s, fill: if i == 1 {
ored
} else if i == 2 {
ogreen
} else if i == 3 {
oorange
} else if i == 4 {
oblue
} else { white })
content(
p,
text(
fill: if i <= 4 {
white
} else {
black
},
size: t,
[*#i*],
),
)
content(p, text(
fill: if i <= 4 {
white
} else {
black
},
size: t,
[*#i*],
))
i = i + 1
}
}),
@ -118,32 +111,25 @@ Participant 1 has a black ball. Which balls are held by participants 2, 3, and 4
let l = calc.rem(((i - 1) * 5), 12) + 1
circle(
p,
radius: radius * s,
fill: if l == 1 {
ored
} else if l == 2 {
ogreen
} else if l == 3 {
oorange
} else if l == 4 {
oblue
} else { white },
)
circle(p, radius: radius * s, fill: if l == 1 {
ored
} else if l == 2 {
ogreen
} else if l == 3 {
oorange
} else if l == 4 {
oblue
} else { white })
content(
p,
text(
fill: if l <= 4 {
white
} else {
black
},
size: t,
[*#l*],
),
)
content(p, text(
fill: if l <= 4 {
white
} else {
black
},
size: t,
[*#l*],
))
i = i + 1
}
}),
@ -158,32 +144,25 @@ Participant 1 has a black ball. Which balls are held by participants 2, 3, and 4
let l = calc.rem(((i - 1) * 5), 12) + 1
circle(
p,
radius: radius * s,
fill: if l == 1 {
oblue
} else if l == 2 {
oorange
} else if l == 3 {
ored
} else if l == 4 {
ogreen
} else { white },
)
circle(p, radius: radius * s, fill: if l == 1 {
oblue
} else if l == 2 {
oorange
} else if l == 3 {
ored
} else if l == 4 {
ogreen
} else { white })
content(
p,
text(
fill: if l <= 4 {
white
} else {
black
},
size: t,
[*#l*],
),
)
content(p, text(
fill: if l <= 4 {
white
} else {
black
},
size: t,
[*#l*],
))
i = i + 1
}
}),

View File

@ -1,5 +1,5 @@
#import "@local/handout:0.1.0": *
#import "@preview/cetz:0.3.1"
#import "@preview/cetz:0.4.2"
#show: handout.with(
title: [Warm-Up: What's an AST?],
@ -24,51 +24,48 @@ respecting the order of operations $[and, times, div, +, -]$.
#v(2mm)
#align(
center,
cetz.canvas({
import cetz.draw: *
#align(center, cetz.canvas({
import cetz.draw: *
// spell:off
content((0, 0), $+$, name: "r")
content((-0.5, -1), $3$, name: "a")
content((0.5, -1), $div$, name: "b")
content((-0.3, -2), $times$, name: "ba")
content((1.3, -2), $and$, name: "bb")
content((-0.8, -3), $9$, name: "baa")
content((0.2, -3), $8$, name: "bab")
content((0.8, -3), $5$, name: "bba")
content((1.8, -3), $6$, name: "bbb")
// spell:on
// spell:off
content((0, 0), $+$, name: "r")
content((-0.5, -1), $3$, name: "a")
content((0.5, -1), $div$, name: "b")
content((-0.3, -2), $times$, name: "ba")
content((1.3, -2), $and$, name: "bb")
content((-0.8, -3), $9$, name: "baa")
content((0.2, -3), $8$, name: "bab")
content((0.8, -3), $5$, name: "bba")
content((1.8, -3), $6$, name: "bbb")
// spell:on
// Zero-sized arrows are a hack for offset.
set-style(
stroke: (thickness: 0.3mm),
mark: (
start: (
symbol: "|",
offset: 0.25,
width: 0mm,
length: 0mm,
),
end: (
symbol: "|",
offset: 0.25,
width: 0mm,
length: 0mm,
),
// Zero-sized arrows are a hack for offset.
set-style(
stroke: (thickness: 0.3mm),
mark: (
start: (
symbol: "|",
offset: 0.25,
width: 0mm,
length: 0mm,
),
)
end: (
symbol: "|",
offset: 0.25,
width: 0mm,
length: 0mm,
),
),
)
// spell:off
line("r", "a")
line("r", "b")
line("b", "ba")
line("b", "bb")
line("ba", "baa")
line("ba", "bab")
line("bb", "bba")
line("bb", "bbb")
// spell:on
}),
)
// spell:off
line("r", "a")
line("r", "b")
line("b", "ba")
line("b", "bb")
line("ba", "baa")
line("ba", "bab")
line("bb", "bba")
line("bb", "bbb")
// spell:on
}))

View File

@ -1,24 +1,21 @@
#import "@local/handout:0.1.0": *
#import "@preview/cetz:0.3.1"
#import "@preview/cetz:0.4.2"
#show: handout.with(
title: [Warm-Up: Wild Tic-Tac-Toe],
by: "Mark",
)
#let ttt = align(
center,
cetz.canvas({
import cetz.draw: *
let s = 0.7 // scale
#let ttt = align(center, cetz.canvas({
import cetz.draw: *
let s = 0.7 // scale
set-style(stroke: (thickness: 0.5mm * s))
line((-1 * s, 3 * s), (-1 * s, -3 * s))
line((1 * s, 3 * s), (1 * s, -3 * s))
line((3 * s, -1 * s), (-3 * s, -1 * s))
line((3 * s, 1 * s), (-3 * s, 1 * s))
}),
)
set-style(stroke: (thickness: 0.5mm * s))
line((-1 * s, 3 * s), (-1 * s, -3 * s))
line((1 * s, 3 * s), (1 * s, -3 * s))
line((3 * s, -1 * s), (-3 * s, -1 * s))
line((3 * s, 1 * s), (-3 * s, 1 * s))
}))
#problem()