Compile with:
pdftex "\catcode64=11 \input texmas2022.tex"
%#!lualatex | |
\documentclass{article} | |
\usepackage[papersize={100mm,148mm},margin=0cm, | |
noheadfoot]{geometry} | |
\usepackage{luatexja-fontspec} | |
\usepackage{amsmath,tikz,graphicx,xcolor,xparse,pgfmath} | |
\ltjsetparameter{jacharrange={-2}} | |
\usetikzlibrary{calc,positioning} | |
\colorlet{k}{black} | |
\newcommand{\cLet}{\pgfmathsetmacro} |
Compile with:
pdftex "\catcode64=11 \input texmas2022.tex"
% hanoi.satyh: Tower of Hanoi with graphics | |
% | |
% Copyright (c) 2022 Takayuki YATO (aka. "ZR") | |
% GitHub: https://github.com/zr-tex8r | |
% Twitter: @zr_tex8r | |
% Distributed under the MIT License. | |
%=========================================================== module Hanoi | |
module Hanoi : sig |
let text-box-board w h ib = | |
let (tw, th, _) = get-natural-metrics ib in | |
let gtxt = draw-text ((w -' tw) *' 0.5, (h -' th) *' 0.5) ib in | |
inline-graphics w h 0pt (fun p -> [shift-graphics p gtxt]) | |
let text-board ctx w h fname fsize str = | |
let ctx = ctx |> (set-font-size fsize) | |
|> (set-font Latin (fname, 1., 0.)) in | |
let ib = read-inline ctx (embed-string str) in | |
text-box-board w h ib |
let_=`888888888888888888888888888888888888888888888888888888888888888888888 | |
~#;}-\$"@`let([(-*);(-/)],nj,(^/)::(&/+-'+.>.*:/),(&-),(!))=((*)::[(/)],(!) | |
,[`@.]='}#*?;@=#\:<\=$<"|&^?"}~{?;ve;;`;`).':_,,`],[],8)let(*)o(*/)=((o)):: | |
(*/)let([(//);(/-)],[_;(^-);(&/.''<);rec-;(^--)],(/<+->),(/),_::(^*-)::_)=( | |
[(!)-(!);(!)-/(!)],(^/)*`ドド`*`スコ`*`スコ`*`スコ`*(&-),(!)-*8,(let-rec(>) | |
`@`i=i|(-)r=(-)^(r)in(>)),(^/)*`ラブ注入♡`*[`\-,::]${'<@,_>:~}"#_#"(`])let | |
(-:)(*<*+-)(*>-)=(*<*+-)-((*<*+-)-/(*>-)-*(*>-))let-rec(!->)|8=(^-)|_=(^--) | |
let((/--)::[(/->);(/.>);(/.-)],ov)=([(/-)+(/-);(!)>>(/-);(!)-(/-);(/<+->)-* | |
(/<+->)],{,'=~[__]:?(})let((!),(/.--)::[(/.*-);(/.->)],_)=(nj,[(/.>)-*(/.>) | |
-*(/.>)-*(/.>)-*(/.>);((/-)<<((/->)-*(!)-(/-)))-(/-);(!)-*((/--)-*8+(/-))<< |
% Compile this file with 'pdftex' command! | |
%% \DequeNew\DEQ : Makes a new deque \DEQ. | |
%% \DequePushBack\DEQ{<text>} : Pushes-back <text> to \DEQ. | |
%% \DequePushFront\DEQ{<text>} : Pushes-front <text> to \DEQ. | |
%% \DequePopBack\DEQ : Pops-back from \DEQ and sets the popped text | |
% to \DequePopped. | |
%% \DequePopFront\DEQ : Pops-front from \DEQ and sets the popped text | |
% to \DequePopped. |
\input sclatex | |
\dump |
%#!latex | |
% 0-2-4-6-8 | |
% 0######### How many moves are | |
% :# # # # needed to go | |
% 2# ## ## from (1,1) to (7,1) ? | |
% :### # # | |
% 4# # # | |
% :######### | |
\makeatletter | |
\newcount\my@x \newcount\my@y \newcount\my@m |