texlive[65374] Master: maze (27dec22)

commits+karl at tug.org commits+karl at tug.org
Tue Dec 27 22:24:57 CET 2022


Revision: 65374
          http://tug.org/svn/texlive?view=revision&revision=65374
Author:   karl
Date:     2022-12-27 22:24:57 +0100 (Tue, 27 Dec 2022)
Log Message:
-----------
maze (27dec22)

Modified Paths:
--------------
    trunk/Master/tlpkg/bin/tlpkg-ctan-check
    trunk/Master/tlpkg/tlpsrc/collection-games.tlpsrc

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/latex/maze/
    trunk/Master/texmf-dist/doc/latex/maze/README.md
    trunk/Master/texmf-dist/doc/latex/maze/maze.pdf
    trunk/Master/texmf-dist/doc/latex/maze/maze.tex
    trunk/Master/texmf-dist/tex/latex/maze/
    trunk/Master/texmf-dist/tex/latex/maze/maze.sty
    trunk/Master/tlpkg/tlpsrc/maze.tlpsrc

Added: trunk/Master/texmf-dist/doc/latex/maze/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/maze/README.md	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/maze/README.md	2022-12-27 21:24:57 UTC (rev 65374)
@@ -0,0 +1,37 @@
+The maze package
+=========
+
+The maze package can generate random square mazes of a specified size.
+
+Basic Usage
+-----------
+The package only provides a user command.
+
+    \maze {⟨size⟩}[⟨seed⟩]
+
+You can read the package manual for some explanations.
+
+Copyright and License
+---------------------
+
+    Copyright (C) 2022 by Sicheng Du <siddsc at foxmail.com>
+    -----------------------------------------------------------------
+
+    This work may be distributed and/or modified under the
+    conditions of the LaTeX Project Public License, either
+    version 1.3c of this license or (at your option) any later
+    version. This version of this license is in
+       http://www.latex-project.org/lppl/lppl-1-3c.txt
+    and the latest version of this license is in
+       http://www.latex-project.org/lppl.txt
+    and version 1.3 or later is part of all distributions of
+    LaTeX version 2005/12/01 or later.
+
+    This work has the LPPL maintenance status "maintained".
+
+    The Current Maintainer of this work is Sicheng Du.
+
+    This package consists of the files  maze.tex,
+                                        maze.pdf,
+                                        maze.sty and
+                                        README.md (this file).
\ No newline at end of file


Property changes on: trunk/Master/texmf-dist/doc/latex/maze/README.md
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/maze/maze.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/maze/maze.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/maze/maze.pdf	2022-12-27 21:24:08 UTC (rev 65373)
+++ trunk/Master/texmf-dist/doc/latex/maze/maze.pdf	2022-12-27 21:24:57 UTC (rev 65374)

Property changes on: trunk/Master/texmf-dist/doc/latex/maze/maze.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/maze/maze.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/maze/maze.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/maze/maze.tex	2022-12-27 21:24:57 UTC (rev 65374)
@@ -0,0 +1,33 @@
+\documentclass{ltxdoc}
+\title{The \textsf{maze} package\footnote{~~This project is distributed under the \LaTeX~Project Public License, version 1.3c.}}
+\usepackage{graphicx}
+\usepackage{fontspec}
+\setmainfont{Times New Roman}
+\usepackage[misc]{ifsym}
+\author{Sicheng Du\thanks{~~\Letter~~\href{mailto:siddsc at foxmail.com}{siddsc at foxmail.com}}}
+\date{\today~~~~v1.1}
+\usepackage[colorlinks,linkcolor=purple]{hyperref}
+\usepackage{maze}
+\begin{document}
+\maketitle
+The \textsf{maze} package can generate random square mazes of a specified size. You need to start from the bottom-left corner and reach the top-right corner to play it.
+\begin{macro}{\maze}
+\marg{size}\oarg{seed} is the syntax of the command that generates a maze. Thereinto
+\begin{description}
+\item[\marg{size}] controls the density of the walls inside the maze and directly influences its complexity. It must be a positive integer greater or equal to 2.
+
+To have the package produce a satisfactory outcome, it is recommended to input a number between 20 and 30 into \marg{text}. Over large numbers may cause \TeX~to exhaust its capacity and fail to produce anything.
+\item[\oarg{seed}] is an optional parameter that specifies the seed for random numbers. If it is omitted, the current time (minute) will be used as the seed instead.
+\end{description}\end{macro}
+
+As an example, the following can be created by \cs{maze{30}[4]} and \cs{maze{20}[6]} respectively.
+\begin{figure}[h]
+\begin{minipage}{.5\textwidth}
+\maze{30}[4]
+\end{minipage}\hfill
+\begin{minipage}{.5\textwidth}
+\maze{20}[6]
+\end{minipage}
+\end{figure}
+\eject
+\end{document}
\ No newline at end of file


Property changes on: trunk/Master/texmf-dist/doc/latex/maze/maze.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/tex/latex/maze/maze.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/maze/maze.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/maze/maze.sty	2022-12-27 21:24:57 UTC (rev 65374)
@@ -0,0 +1,87 @@
+% Copyright (C) 2022 by Sicheng Du <siddsc at foxmail.com>
+% This project is distributed under the LaTeX Project Public License, version 1.3c.
+%-------------------------%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{maze}[1.1]
+\ExplSyntaxOn
+\int_new:N\l_rand
+\int_new:N\l_old \int_new:N\l_new
+\dim_const:Nn\g_size{\linewidth}
+\newcommand{\m at ze}[2]{
+  \sys_gset_rand_seed:n{#2}
+  \let\g_map\undefined
+  \let\g_walls_v\undefined\let\g_walls_h\undefined
+  \intarray_new:Nn\g_map{#1*#1}
+  \intarray_new:Nn\g_walls_v{#1*(#1-1)}
+  \intarray_new:Nn\g_walls_h{#1*(#1-1)}
+  \int_step_inline:nn{#1*#1}{
+    \intarray_gset:Nnn\g_map{##1}{##1}
+  }
+  \int_step_inline:nn{#1*(#1-1)}{
+    \intarray_gset:Nnn\g_walls_v{##1}{1}
+    \intarray_gset:Nnn\g_walls_h{##1}{1}
+  }
+  \bool_do_until:nn{
+    \int_compare_p:nNn{\intarray_item:Nn\g_map{1}}
+    ={\intarray_item:Nn\g_map{#1*#1}}
+  }{
+    \int_set:Nn\l_rand{\int_rand:n{#1*(#1-1)}}
+    \int_compare:nNnTF{0}={\intarray_item:Nn\g_walls_v{\l_rand}}{}{
+      \int_compare:nNnTF{
+        \intarray_item:Nn\g_map{\l_rand+\int_div_truncate:nn{\l_rand-1}{#1-1}}
+      }={
+        \intarray_item:Nn\g_map{
+          1+\l_rand+\int_div_truncate:nn{\l_rand-1}{#1-1}
+        }
+        }{}{
+        \int_set:Nn\l_new{
+          \intarray_item:Nn\g_map{1+\l_rand+\int_div_truncate:nn{\l_rand-1}{#1-1}}
+        }
+        \int_set:Nn\l_old{
+          \intarray_item:Nn\g_map{\l_rand+\int_div_truncate:nn{\l_rand-1}{#1-1}}
+        }
+        \intarray_gset:Nnn\g_walls_v{\l_rand}{0}
+        \int_step_inline:nn{#1*#1}{
+          \int_compare:nNnTF{\l_old}={\intarray_item:Nn\g_map{##1}}
+          {\intarray_gset:Nnn\g_map{##1}{\l_new}}{}
+        }
+      }
+    }
+    \int_set:Nn\l_rand{\int_rand:n{#1*(#1-1)}}
+    \int_compare:nNnTF{0}={\intarray_item:Nn\g_walls_h{\l_rand}}{}{
+      \int_compare:nNnTF{\intarray_item:Nn\g_map{\l_rand}}
+      ={\intarray_item:Nn\g_map{#1+\l_rand}}{}{
+        \int_set:Nn\l_new{\intarray_item:Nn\g_map{#1+\l_rand}}
+        \int_set:Nn\l_old{\intarray_item:Nn\g_map{\l_rand}}
+        \intarray_gset:Nnn\g_walls_h{\l_rand}{0}
+        \int_step_inline:nn{#1*#1}{
+          \int_compare:nNnTF{\l_old}={\intarray_item:Nn\g_map{##1}}
+          {\intarray_gset:Nnn\g_map{##1}{\l_new}}{}
+        }
+      }
+    }
+  }
+}
+\NewDocumentCommand\maze{mO{\c_sys_minute_int}}{
+  \m at ze{#1}{#2}
+  \setlength{\unitlength}{\fp_eval:n{.4/#1}\g_size}
+  \begin{picture}(\int_eval:n{#1+2},\int_eval:n{#1+2})(-1,-1)
+  \put(0,0){\line(0,1){#1}}\put(0,0){\line(1,0){#1}}
+  \put(#1,#1){\line(0,-1){#1}}\put(#1,#1){\line(-1,0){#1}}
+  \int_step_inline:nn{#1*(#1-1)}{
+    \int_compare:nNnTF{0}={\intarray_item:Nn\g_walls_h{##1}}{}{
+      \put(
+        \int_mod:nn{##1-1}{#1},
+        \int_eval:n{1+\int_div_truncate:nn{##1-1}{#1}}
+      ){\line(1,0){1}}
+    }
+    \int_compare:nNnTF{0}={\intarray_item:Nn\g_walls_v{##1}}{}{
+      \put(
+        \int_mod:nn{##1}{#1-1},
+        \int_div_truncate:nn{##1-1}{#1-1}
+      ){\line(0,1){1}}
+    }
+  }
+  \end{picture}
+}
+\ExplSyntaxOff
\ No newline at end of file


Property changes on: trunk/Master/texmf-dist/tex/latex/maze/maze.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/tlpkg/bin/tlpkg-ctan-check
===================================================================
--- trunk/Master/tlpkg/bin/tlpkg-ctan-check	2022-12-27 21:24:08 UTC (rev 65373)
+++ trunk/Master/tlpkg/bin/tlpkg-ctan-check	2022-12-27 21:24:57 UTC (rev 65374)
@@ -531,7 +531,7 @@
     mathcommand mathcomp mathdesign mathdots mathexam
     mathfam256 mathfixs mathfont mathlig mathpartir mathpazo mathpunctspace
     mathsemantics mathspec mathtools matlab-prettifier mathspic maths-symbols
-    matrix-skeleton mattens maybemath
+    matrix-skeleton mattens maybemath maze
     mcaption mceinleger mcexam mcf2graph mcite mciteplus mcmthesis
     mdframed mdputu mdsymbol mdwtools mecaso media4svg media9 medstarbeamer
     meetingmins membranecomputing memdesign memexsupp

Modified: trunk/Master/tlpkg/tlpsrc/collection-games.tlpsrc
===================================================================
--- trunk/Master/tlpkg/tlpsrc/collection-games.tlpsrc	2022-12-27 21:24:08 UTC (rev 65373)
+++ trunk/Master/tlpkg/tlpsrc/collection-games.tlpsrc	2022-12-27 21:24:57 UTC (rev 65374)
@@ -28,6 +28,7 @@
 depend labyrinth
 depend logicpuzzle
 depend mahjong
+depend maze
 depend musikui
 depend nimsticks
 depend onedown

Added: trunk/Master/tlpkg/tlpsrc/maze.tlpsrc
===================================================================


More information about the tex-live-commits mailing list.