mirror of
https://github.com/MartinThoma/LaTeX-examples.git
synced 2025-04-26 06:48:04 +02:00
added 2048
This commit is contained in:
parent
66e8e178f2
commit
e0cb089f23
8 changed files with 232 additions and 0 deletions
42
documents/2048/2048.tex
Normal file
42
documents/2048/2048.tex
Normal file
|
@ -0,0 +1,42 @@
|
|||
\documentclass[a4paper]{scrartcl}
|
||||
\usepackage{amssymb, amsmath} % needed for math
|
||||
\usepackage[utf8]{inputenc} % this is needed for umlauts
|
||||
\usepackage[english]{babel} % this is needed for umlauts
|
||||
\usepackage[T1]{fontenc} % this is needed for correct output of umlauts in pdf
|
||||
\usepackage[margin=2.5cm]{geometry} %layout
|
||||
\usepackage{hyperref} % links im text
|
||||
\usepackage{parskip}
|
||||
\usepackage{csquotes}
|
||||
|
||||
\title{The Game '2048'}
|
||||
\author{Martin Thoma}
|
||||
|
||||
\hypersetup{
|
||||
pdfauthor = {Martin Thoma},
|
||||
pdfkeywords = {Game, combinatorics, 2048},
|
||||
pdftitle = {The Game '2048'}
|
||||
}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% Begin document %
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
\begin{document}
|
||||
\maketitle
|
||||
\begin{abstract}
|
||||
\enquote{2048} is a single-player game with random elements and a score.
|
||||
\end{abstract}
|
||||
|
||||
\section{Rules of '2048'}
|
||||
\enquote{2048} is played on a $4 \times 4$ grid.
|
||||
|
||||
\section{Best reachable highscore}
|
||||
|
||||
\section{Algorithms}
|
||||
|
||||
\section{Related}
|
||||
\begin{itemize}
|
||||
\item \url{http://math.stackexchange.com/q/716469/6876}
|
||||
\item
|
||||
\end{itemize}
|
||||
|
||||
\end{document}
|
7
documents/2048/Makefile
Normal file
7
documents/2048/Makefile
Normal file
|
@ -0,0 +1,7 @@
|
|||
SOURCE = 2048
|
||||
make:
|
||||
pdflatex $(SOURCE).tex -output-format=pdf
|
||||
make clean
|
||||
|
||||
clean:
|
||||
rm -rf $(TARGET) *.class *.html *.log *.aux *.out
|
35
documents/2048/template/Makefile
Normal file
35
documents/2048/template/Makefile
Normal file
|
@ -0,0 +1,35 @@
|
|||
SOURCE = pixel-art
|
||||
DELAY = 80
|
||||
DENSITY = 300
|
||||
WIDTH = 512
|
||||
|
||||
make:
|
||||
pdflatex $(SOURCE).tex -output-format=pdf
|
||||
make clean
|
||||
|
||||
clean:
|
||||
rm -rf $(TARGET) *.class *.html *.log *.aux *.data *.gnuplot *.gz *latexmk
|
||||
|
||||
gif:
|
||||
pdfcrop $(SOURCE).pdf
|
||||
convert -verbose -delay $(DELAY) -loop 0 -density $(DENSITY) $(SOURCE)-crop.pdf $(SOURCE).gif
|
||||
make clean
|
||||
|
||||
png:
|
||||
make
|
||||
make svg
|
||||
inkscape $(SOURCE).svg -w $(WIDTH) --export-png=$(SOURCE).png
|
||||
|
||||
transparentGif:
|
||||
convert $(SOURCE).pdf -transparent white result.gif
|
||||
make clean
|
||||
|
||||
svg:
|
||||
make
|
||||
#inkscape $(SOURCE).pdf --export-plain-svg=$(SOURCE).svg
|
||||
pdf2svg $(SOURCE).pdf $(SOURCE).svg
|
||||
# Necessary, as pdf2svg does not always create valid svgs:
|
||||
inkscape $(SOURCE).svg --export-plain-svg=$(SOURCE).svg
|
||||
rsvg-convert -a -w $(WIDTH) -f svg $(SOURCE).svg -o $(SOURCE)2.svg
|
||||
inkscape $(SOURCE)2.svg --export-plain-svg=$(SOURCE).svg
|
||||
rm $(SOURCE)2.svg
|
44
documents/2048/template/pixel-art.tex
Normal file
44
documents/2048/template/pixel-art.tex
Normal file
|
@ -0,0 +1,44 @@
|
|||
\documentclass[tikz]{standalone}
|
||||
\usepackage{ifthen}
|
||||
\renewcommand\familydefault{\sfdefault}
|
||||
\usepackage{tikz}
|
||||
\usetikzlibrary{calc}
|
||||
\def\pixels{
|
||||
{0,2,0,0},
|
||||
{0,8,0,4},
|
||||
{2,2,4,16},
|
||||
{8,16,128,2},
|
||||
}
|
||||
|
||||
% Font color for 2 and 4: #776e65
|
||||
% Font color for rest: #f9f6f2
|
||||
% Grid color: #bbada0
|
||||
% Font family: "Clear Sans", "Helvetica Neue", Arial, sans-serif
|
||||
|
||||
\definecolor{pixel 0}{HTML}{CCC0B3}
|
||||
\definecolor{pixel 2}{HTML}{EEE4DA}
|
||||
\definecolor{pixel 4}{HTML}{EEE4DA}
|
||||
\definecolor{pixel 8}{HTML}{F2B179}
|
||||
\definecolor{pixel 16}{HTML}{F59563}
|
||||
\definecolor{pixel 32}{HTML}{F2B179} % TODO
|
||||
\definecolor{pixel 64}{HTML}{F2B179}
|
||||
\definecolor{pixel 128}{HTML}{EDCF72}
|
||||
\definecolor{pixel 256}{HTML}{F2B179} % TODO
|
||||
\definecolor{pixel 512}{HTML}{F2B179} % TODO
|
||||
\definecolor{pixel 1024}{HTML}{F2B179} % TODO
|
||||
\definecolor{pixel 2048}{HTML}{F2B179} % TODO
|
||||
\definecolor{pixel 4096}{HTML}{F2B179} % TODO
|
||||
\begin{document}
|
||||
\begin{tikzpicture}
|
||||
\foreach \line [count=\y] in \pixels {
|
||||
\foreach \pix [count=\x] in \line {
|
||||
\draw[fill=pixel \pix] (\x,-\y) rectangle +(1,1);
|
||||
|
||||
\ifthenelse{\equal{0}{\pix}}
|
||||
{}
|
||||
{\node at ($(\x,-\y) + (0.5,0.5)$) {\Huge \pix};}
|
||||
}
|
||||
}
|
||||
|
||||
\end{tikzpicture}
|
||||
\end{document}
|
Loading…
Add table
Add a link
Reference in a new issue