Convert warm-ups to typst #2

Merged
Mark merged 19 commits from warmups into main 2025-01-24 22:41:36 -08:00
3 changed files with 192 additions and 47 deletions
Showing only changes of commit 255081c189 - Show all commits

View File

@ -1,47 +0,0 @@
\documentclass[
solutions,
singlenumbering,
nopagenumber
]{../../../lib/tex/ormc_handout}
\usepackage{../../../lib/tex/macros}
\usepackage{graphicx}
\title{Warm-Up: Passing Balls}
\uptitler{\smallurl{}}
\subtitle{Prepared by Mark on \today}
\begin{document}
\maketitle
\problem{}
Twelve people are standing in a circle. Each is assigned a number between 1 and 12. \par
Participants numbered 1, 2, 3, and 4 hold red, green, yellow, and black balls, respectively. \par
Everyone else is empty-handed.
\vspace{2mm}
Each participant can pass their ball to any student that is exactly 5 positions away. \par
Balls cannot be passed to someone who has one in hand.
\vspace{2mm}
After a number of passes, the first four participants again hold all the balls. \par
Participant 1 has a black ball. Which balls are held by participants 2, 3, and 4?
\begin{solution}
\begin{itemize}
\item the graph of possible moves is isomorphic to a circle (since 5 and 12 are coprime),
\item but the balls get passed around, so swapping the place of any two balls is not allowed. \\
Therefore, the balls will stay in their initial (cyclic) order:
\end{itemize}
\begin{center}
\includegraphics[width=\textwidth]{pass-sol.png}
\end{center}
\end{solution}
\end{document}

View File

@ -0,0 +1,192 @@
#import "@local/handout:0.1.0": *
#import "@preview/cetz:0.3.1"
#show: handout.with(
title: [Warm-Up: Passing Balls],
by: "Mark",
)
#problem()
Twelve people are standing in a circle. Each is assigned a number between 1 and 12. \
Participants numbered 1, 2, 3, and 4 hold red, green, yellow, and black balls, respectively. \
Everyone else is empty-handed.
#v(2mm)
Each participant can pass their ball to any student that is exactly 5 positions away. \
Balls cannot be passed to someone who has one in hand.
#v(2mm)
After a number of passes, the first four participants again hold all the balls. \
Participant 1 has a black ball. Which balls are held by participants 2, 3, and 4?
#solution([
The graph of possible moves is isomorphic to a circle (since 5 and 12 are coprime), \
so the order of the balls cannot be changed as they are passed around.
#v(2mm)
Therefore, the balls will stay in their initial (cyclic) order:
#v(2mm)
#{
let s = 0.7 // scale
let t = 12pt * s // text size
let radius = 0.35
let pts = (
(0 * s, 3 * s),
(1 * s, 2 * s),
(2 * s, 1 * s),
(3 * s, 0 * s),
(2 * s, -1 * s),
(1 * s, -2 * s),
(0 * s, -3 * s),
(-1 * s, -2 * s),
(-2 * s, -1 * s),
(-3 * s, 0 * s),
(-2 * s, 1 * s),
(-1 * s, 2 * s),
)
let pts_shuf = (
(0 * s, 3 * s), // 1
(1 * s, -2 * s), // 6
(-2 * s, 1 * s), // 11
(3 * s, 0 * s), // 4
(-2 * s, -1 * s), // 9
(1 * s, 2 * s), // 2
(0 * s, -3 * s), // 7
(-1 * s, 2 * s), // 12
(2 * s, -1 * s), // 5
(-3 * s, 0 * s), // 10
(2 * s, 1 * s), // 3
(-1 * s, -2 * s), // 8
)
table(
stroke: none,
align: center,
columns: (1fr, 1fr, 1fr),
cetz.canvas({
import cetz.draw: *
set-style(stroke: (thickness: 0.4mm, paint: black))
line(..pts_shuf, close: true)
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 },
)
content(
p,
text(
fill: if i <= 4 {
white
} else {
black
},
size: t,
[*#i*],
),
)
i = i + 1
}
}),
cetz.canvas({
import cetz.draw: *
set-style(stroke: (thickness: 0.4mm, paint: black))
line(..pts, close: true)
let i = 1
for p in pts {
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 },
)
content(
p,
text(
fill: if l <= 4 {
white
} else {
black
},
size: t,
[*#l*],
),
)
i = i + 1
}
}),
cetz.canvas({
import cetz.draw: *
set-style(stroke: (thickness: 0.4mm, paint: black))
line(..pts, close: true)
let i = 1
for p in pts {
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 },
)
content(
p,
text(
fill: if l <= 4 {
white
} else {
black
},
size: t,
[*#l*],
),
)
i = i + 1
}
}),
)
}
])

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB