Guest User

Untitled

a guest
Dec 12th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.70 KB | None | 0 0
  1. documentclass[12pt,tikz,border=3mm]{standalone}
  2. usetikzlibrary{calc}
  3. usepackage{xstring}
  4. begin{document}
  5. large
  6. begin{tikzpicture}
  7. defn{5}
  8. defmylist{}
  9. pgfmathsetmacro{numbermax}{n*n}
  10. foreach x in {1,...,numbermax}{
  11. xdefmylist{mylistnoexpand{xnoexpand}}
  12. }
  13. begin{scope}
  14. pgfmathsetmacro{nt}{n-1}
  15. foreach i in {0,...,nt}
  16. {
  17. foreach j in {0,...,nt}
  18. { pgfmathdeclarerandomlist{mynum}{mylist}
  19. pgfmathrandomitem{mynum}{mynum}
  20. StrSubstitute{mylist}{{mynum}}{}[sublist]
  21. globalletmylistsublist
  22. pgfmathparse{0.9*rnd+0.3} pgfmathsetmacro{maum}{pgfmathresult}
  23. pgfmathparse{0.8*rnd} pgfmathsetmacro{mauh}{pgfmathresult}
  24. definecolor{mau}{rgb}{maum,mauh,0.1}
  25. node[color=mau] at ($ (i+0.5, j+0.5 ) $) {mynum};
  26. }
  27. }
  28. draw (0,0) grid (n,n);
  29. end{scope}
  30. end{tikzpicture}
  31. end{document}
  32.  
  33. documentclass[12pt]{article}
  34. usepackage{pstricks,pst-calculate,multido}
  35. usepackage{auto-pst-pdf}
  36. definecolorseries{test}{rgb}{step}[rgb]{.95,.85,.55}{.17,.47,.37}
  37. begin{document}
  38.  
  39. defn{5}
  40. begin{pspicture}(n,n)
  41. psgrid[subgriddiv=0,gridlabels=0pt]
  42. resetcolorseries[25]{test}
  43. multido{rRow=0.5+1.0}{n}{%
  44. multido{rCol=0.5+1.0}{n}{%
  45. rput(rCol,rRow){textcolor{test!!+}{pscalculate{randint(1,25)}}}
  46. }}
  47. end{pspicture}
  48.  
  49. end{document}
  50.  
  51. documentclass[12pt]{article}
  52. usepackage{pst-calculate}
  53. usepackage{pstricks,multido}
  54.  
  55. definecolorseries{test}{rgb}{step}[rgb]{.95,.85,.55}{.17,.47,.37}
  56. newcounter{RandNo}setcounter{RandNo}{1}
  57. edefNumbers{pscalculate{randint(1,25)}}
  58.  
  59. defgetNoList{%
  60. edefNumber{pscalculate{randint(1,25)}}% Zufallszahl
  61. addNumber{Number}Numbers!!}
  62. defaddNumber#1#2!!{edefx{noexpandaddNumberA#1;#2}x,,relax}
  63. defaddNumberA#1;#2,#3,#4relax{%
  64. ifxrelax#2relax % we found new number
  65. xdefNumbers{Numbers,#1}%
  66. stepcounter{RandNo}%
  67. ifnumtheRandNo>25 defnext{}% Neue Zahl?
  68. else defnext{getNoList}fi%
  69. else
  70. ifnum#1=#2 % no new number
  71. defnext{getNoList}%
  72. else
  73. ifxrelax#3relax
  74. defnext{addNumberA#1;,,relax}%
  75. else %
  76. defnext{addNumberA#1;#3,#4relax}%
  77. fi
  78. fi
  79. fi
  80. ifnumtheRandNo<25 next fi
  81. }
  82. defgetRandomNo#1{%
  83. globalcount0 = 1
  84. edefx{noexpandgetIndex#1;Numbers,,relax}x}
  85. defgetIndex#1;#2,#3,#4relax{%
  86. ifnumthecount0=#1
  87. defnext{#2}%
  88. else
  89. globaladvancecount0 by 1
  90. defnext{getIndex#1;#3,#4relax}%
  91. fi
  92. next
  93. }
  94.  
  95. begin{document}
  96. defn{5}getNoList
  97. setcounter{RandNo}{1}
  98. begin{pspicture}(n,n)
  99. psgrid[subgriddiv=0,gridlabels=0pt]
  100. resetcolorseries[thenumexprn*n]{test}
  101. multido{rRow=0.5+1.0}{n}{%
  102. multido{rCol=0.5+1.0}{n}{%
  103. rput(rCol,rRow){textcolor{test!!+}{getRandomNo{theRandNo}}}%
  104. stepcounter{RandNo}%
  105. }}
  106. end{pspicture}
  107.  
  108. end{document}
  109.  
  110. documentclass[12pt,pstricks,border=1pt]{standalone}
  111. usepackage{tikz,xstring}
  112. usetikzlibrary{calc}
  113. defn{5}defmylist{}
  114.  
  115. pgfmathsetmacro{numbermax}{n*n}
  116. foreach x in {1,...,numbermax}{
  117. xdefmylist{mylistnoexpand{xnoexpand}}
  118. }
  119. pgfmathsetmacro{nt}{n-1}
  120. newpsstyle{gridstyle}{griddots=0,subgriddiv=1}
  121. begin{document}
  122. large
  123. begin{pspicture}[showgrid](n,n)
  124. foreach i in {0,...,nt}
  125. {
  126. foreach j in {0,...,nt}
  127. { pgfmathdeclarerandomlist{mynum}{mylist}
  128. pgfmathrandomitem{mynum}{mynum}
  129. StrSubstitute{mylist}{{mynum}}{}[sublist]
  130. globalletmylistsublist
  131. pgfmathparse{0.9*rnd+0.3} pgfmathsetmacro{maum}{pgfmathresult}
  132. pgfmathparse{0.8*rnd} pgfmathsetmacro{mauh}{pgfmathresult}
  133. definecolor{mau}{rgb}{maum,mauh,0.1}
  134. rput(!ispace .5 add jspace .5 add){color{mau}mynum}
  135. }
  136. }
  137. end{pspicture}
  138. end{document}
  139.  
  140. documentclass[pstricks,border=12pt,12pt]{standalone}
  141. pstVerb{realtime srand}
  142.  
  143. begin{document}
  144. begin{pspicture}[showgrid](6,6)
  145. psLoop{5}{qdisk(!Rand 6 mul Rand 6 mul){!Rand 4 div}}
  146. end{pspicture}
  147. end{document}
Add Comment
Please, Sign In to add comment