Convert "Big-Tac-Toe" to typst

This commit is contained in:
Mark 2025-01-23 20:17:06 -08:00
parent 255081c189
commit a7d9103d51
Signed by: Mark
GPG Key ID: C6D63995FE72FD80
2 changed files with 90 additions and 187 deletions

View File

@ -1,187 +0,0 @@
\documentclass[
solutions,
hidewarning,
singlenumbering,
nopagenumber
]{../../../lib/tex/ormc_handout}
\usepackage{../../../lib/tex/macros}
% x,y,scale,style
\def\ttt#1#2#3#4{
\draw[#4] (#1, #2+#3) -- (#1+#3+#3+#3, #2+#3);
\draw[#4] (#1, #2+#3+#3) -- (#1+#3+#3+#3, #2+#3+#3);
\draw[#4] (#1+#3, #2) -- (#1+#3, #2+#3+#3+#3);
\draw[#4] (#1+#3+#3, #2) -- (#1+#3+#3, #2+#3+#3+#3);
}
\geometry{
paper = letterpaper,
top = 25mm,
bottom = 30mm,
left = 20mm,
right = 20mm,
headheight = 75mm,
footskip = 15mm
}
% misere ttt
% Numerical Tic Tac Toe is a variation invented by the mathematician Ronald Graham.
% The numbers 1 to 9 are used in this game. The first player plays with the odd numbers,
% the second player plays with the even numbers. All numbers can be used only once.
% The player who puts down 15 points in a line wins (sum of 3 numbers).
% This game can be generalized to a n × n board.
% In Treblecross, both players play with the same symbol.
% The game is played on a 1-by-n board with k equal to 3.
% The player who makes a three in a row of Xs (or black chips) wins the game
\title{Warm-Up: Big-Tac-Toe}
\uptitler{\smallurl{}}
\subtitle{Prepared by Mark on \today.}
\begin{document}
\maketitle
We have large tic-tac-toe grid, each cell of which contains another.
On each turn, one player puts their glyph into a cell of a small grid. When the next player goes,
they must make their move in the small grid in the same position as the previous player's move.
\begin{itemize}
\item The first player to move may pick any small grid to start in.
\item If a player is directed to a grid that is \textit{full}, that player may go anywhere. \par
A sub-grid that is \say{won} but not full may still be played in.
\end{itemize}
\vspace{2mm}
The first player to complete a line of three \say{won} subgrids wins the game.
\vfill\null\hfill
\begin{minipage}{0.48\textwidth}
\begin{center}
\begin{tikzpicture}[scale=0.65]
\ttt{0}{0}{4}{line width=0.5mm}
\ttt{0.5}{0.5}{1}{line width=0.25mm}
\ttt{0.5}{4.5}{1}{line width=0.25mm}
\ttt{0.5}{8.5}{1}{line width=0.25mm}
\ttt{4.5}{0.5}{1}{line width=0.25mm}
\ttt{4.5}{4.5}{1}{line width=0.25mm}
\ttt{4.5}{8.5}{1}{line width=0.25mm}
\ttt{8.5}{0.5}{1}{line width=0.25mm}
\ttt{8.5}{4.5}{1}{line width=0.25mm}
\ttt{8.5}{8.5}{1}{line width=0.25mm}
\end{tikzpicture}
\end{center}
\end{minipage}
\hfill
\begin{minipage}{0.48\textwidth}
\begin{center}
\begin{tikzpicture}[scale=0.65]
\ttt{0}{0}{4}{line width=0.5mm}
\ttt{0.5}{0.5}{1}{line width=0.25mm}
\ttt{0.5}{4.5}{1}{line width=0.25mm}
\ttt{0.5}{8.5}{1}{line width=0.25mm}
\ttt{4.5}{0.5}{1}{line width=0.25mm}
\ttt{4.5}{4.5}{1}{line width=0.25mm}
\ttt{4.5}{8.5}{1}{line width=0.25mm}
\ttt{8.5}{0.5}{1}{line width=0.25mm}
\ttt{8.5}{4.5}{1}{line width=0.25mm}
\ttt{8.5}{8.5}{1}{line width=0.25mm}
\end{tikzpicture}
\end{center}
\end{minipage}
\hfill\null\vfill
\problem{}
Play a few rounds of this game with someone nearby. \par
Can either player force a win?
\vfill
\problem{}
Modify the rules of this game to disallow play in won subgrids. \par
How does your strategy change?
\vfill
\pagebreak
\null\vfill\null\hfill
\begin{minipage}{0.48\textwidth}
\begin{center}
\begin{tikzpicture}[scale=0.65]
\ttt{0}{0}{4}{line width=0.5mm}
\ttt{0.5}{0.5}{1}{line width=0.25mm}
\ttt{0.5}{4.5}{1}{line width=0.25mm}
\ttt{0.5}{8.5}{1}{line width=0.25mm}
\ttt{4.5}{0.5}{1}{line width=0.25mm}
\ttt{4.5}{4.5}{1}{line width=0.25mm}
\ttt{4.5}{8.5}{1}{line width=0.25mm}
\ttt{8.5}{0.5}{1}{line width=0.25mm}
\ttt{8.5}{4.5}{1}{line width=0.25mm}
\ttt{8.5}{8.5}{1}{line width=0.25mm}
\end{tikzpicture}
\end{center}
\end{minipage}
\hfill
\begin{minipage}{0.48\textwidth}
\begin{center}
\begin{tikzpicture}[scale=0.65]
\ttt{0}{0}{4}{line width=0.5mm}
\ttt{0.5}{0.5}{1}{line width=0.25mm}
\ttt{0.5}{4.5}{1}{line width=0.25mm}
\ttt{0.5}{8.5}{1}{line width=0.25mm}
\ttt{4.5}{0.5}{1}{line width=0.25mm}
\ttt{4.5}{4.5}{1}{line width=0.25mm}
\ttt{4.5}{8.5}{1}{line width=0.25mm}
\ttt{8.5}{0.5}{1}{line width=0.25mm}
\ttt{8.5}{4.5}{1}{line width=0.25mm}
\ttt{8.5}{8.5}{1}{line width=0.25mm}
\end{tikzpicture}
\end{center}
\end{minipage}
\hfill\null\vfill
\vfill\null\hfill
\begin{minipage}{0.48\textwidth}
\begin{center}
\begin{tikzpicture}[scale=0.65]
\ttt{0}{0}{4}{line width=0.5mm}
\ttt{0.5}{0.5}{1}{line width=0.25mm}
\ttt{0.5}{4.5}{1}{line width=0.25mm}
\ttt{0.5}{8.5}{1}{line width=0.25mm}
\ttt{4.5}{0.5}{1}{line width=0.25mm}
\ttt{4.5}{4.5}{1}{line width=0.25mm}
\ttt{4.5}{8.5}{1}{line width=0.25mm}
\ttt{8.5}{0.5}{1}{line width=0.25mm}
\ttt{8.5}{4.5}{1}{line width=0.25mm}
\ttt{8.5}{8.5}{1}{line width=0.25mm}
\end{tikzpicture}
\end{center}
\end{minipage}
\hfill
\begin{minipage}{0.48\textwidth}
\begin{center}
\begin{tikzpicture}[scale=0.65]
\ttt{0}{0}{4}{line width=0.5mm}
\ttt{0.5}{0.5}{1}{line width=0.25mm}
\ttt{0.5}{4.5}{1}{line width=0.25mm}
\ttt{0.5}{8.5}{1}{line width=0.25mm}
\ttt{4.5}{0.5}{1}{line width=0.25mm}
\ttt{4.5}{4.5}{1}{line width=0.25mm}
\ttt{4.5}{8.5}{1}{line width=0.25mm}
\ttt{8.5}{0.5}{1}{line width=0.25mm}
\ttt{8.5}{4.5}{1}{line width=0.25mm}
\ttt{8.5}{8.5}{1}{line width=0.25mm}
\end{tikzpicture}
\end{center}
\end{minipage}
\hfill\null\vfill
\end{document}

View File

@ -0,0 +1,90 @@
#import "@local/handout:0.1.0": *
#import "@preview/cetz:0.3.1"
#show: handout.with(
title: [Warm-Up: Big-Tac-Toe],
by: "Mark",
)
#let extra_boards = false;
#let ttt(s, p) = {
// s: scale,
// p: position
let x = p.at(0) * s
let y = p.at(1) * s
cetz.draw.line((-1 * s + x, 3 * s + y), (-1 * s + x, -3 * s + y))
cetz.draw.line((1 * s + x, 3 * s + y), (1 * s + x, -3 * s + y))
cetz.draw.line((3 * s + x, -1 * s + y), (-3 * s + x, -1 * s + y))
cetz.draw.line((3 * s + x, 1 * s + y), (-3 * s + x, 1 * s + y))
}
#let btt(s) = cetz.canvas({
import cetz.draw: *
set-style(stroke: (thickness: 0.5mm * s))
ttt(s, (-7, -7))
ttt(s, (-7, 0))
ttt(s, (-7, 7))
ttt(s, (0, -7))
ttt(s, (0, 0))
ttt(s, (0, 7))
ttt(s, (7, -7))
ttt(s, (7, 0))
ttt(s, (7, 7))
set-style(stroke: (thickness: 2mm * s))
ttt(s * 3.5, (0, 0))
})
#problem()
Consider a large tic-tac-toe grid, each cell of which contains another.
On each turn, one player puts their glyph into a cell of a small grid. When the next player goes,
they must make their move in the small grid in the same position as the previous player's move.
- The first player to move may pick any small grid to start in.
- If a player is directed to a grid that is _full_, that player may go anywhere. \
A sub-grid that is "won" but not full may still be played in.
#v(2mm)
The first player to complete a line of three "won" subgrids wins the game.
#v(2mm)
#problem()
Play a few rounds of this game with someone nearby. \
Can either player force a win?
#table(
stroke: none,
align: center,
columns: (1fr, 1fr),
btt(0.35), btt(0.35),
);
#problem()
Modify the rules of this game to disallow play in won subgrids. \
How does your strategy change? \
#if extra_boards { note([Additional boards are available on the next page.]) }
#v(1fr)
#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),
),
)
}