Board logo

标题: [游戏娱乐] 塔珀自指公式自定义图形构造器 [打印本页]

作者: aa77dd@163.com    时间: 2016-10-8 00:20     标题: 塔珀自指公式自定义图形构造器

本帖最后由 aa77dd@163.com 于 2016-10-8 10:50 编辑

测试于 64bit Win7 Mathematica 10.0

  1. ::..........................................................................................................
  2. ::..........................................................................................................
  3. ::..........................................................................................................
  4. ::..........................................................................................................
  5. ::..........................................................................................................
  6. ::..........................................................................................................
  7. ::............####  ####   ####   ####   ###  ##### #   #  ###  #   # #####   #   # ##### #####.............
  8. ::............#   # #   # #       #   # #   #   #   #   # #   # ## ## #       ##  # #       #  .............
  9. ::............####  ####   ###    ####  #####   #   ##### #   # # # # #####   # # # #####   #  .............
  10. ::............#   # #   #     #   #   # #   #   #   #   # #   # #   # #       #  ## #       #  .............
  11. ::............####  ####  ####  # ####  #   #   #   #   #  ###  #   # ##### # #   # #####   #  .............
  12. ::..........................................................................................................
  13. ::..........................................................................................................
  14. ::..........................................................................................................
  15. ::..........................................................................................................
  16. ::..........................................................................................................
  17. ::..........................................................................................................
  18. ::                        上面区域除了左边的两个冒号外, 右边部分保持 106 宽 X 17 高
  19. ::                    不要增加多余的任何空行, 不要删除行, 不要用 # . 空格 之外的字符作图
  20. ::                                  # 是绘图像素, . 号和 空格 都是空白像素
  21. ::
  22. ::                                             BBS.BATHOME.NET
  23. :: aa77dd@163.com 20161008_001459
  24. ::
  25. :: 图像显示调整参数参考
  26. :: http://math.stackexchange.com/questions/27182/tuppers-self-referential-formula-with-mathematica
  27. :: 公式表达:  1/2 < floor(mod(floor(y/17)*2^(-17*floor(x)-mod(floor(y), 17)),2))
  28. :: Tupper's self-referential formula @ wikipedia
  29. :: https://en.wikipedia.org/wiki/Tupper%27s_self-referential_formula
  30. ::
  31. :: 公式自身图形常数值
  32. :: k=960939379918958884971672962127852754715004339660129306651505519271\
  33. :: 7028023952664246896428421743507181212671537827706233559932372808741443\
  34. :: 0789132596394133772348785773574982392662971551717371699516523289053822\
  35. :: 1612403238855866184013235585136048828693337902491454229288667081096184\
  36. :: 4960917051834540678277315517054053816273809676025656250169814820834187\
  37. :: 8316384911559022561000365235137034387446184837873723819822484986346503\
  38. :: 3159410054974700593138339226497249461751545728366702369745461014655997\
  39. :: 933798537483143786841806593422227898388722980000748404719;
  40. @echo off & setlocal enabledelayedexpansion
  41. chcp 936
  42. mode 110
  43. for /f usebackq^ delims^= %%a in ("%~f0") do (
  44.     set /a cnt+=1
  45.     if !cnt! leq 17 (
  46.         for %%i in (!cnt!) do (
  47.             set "L%%i=%%a"
  48.             set "L%%i=!L%%i:~2!"
  49.             set "L%%i=!L%%i:#=1!"
  50.             set "L%%i=!L%%i:.= !"
  51.             echo;[!L%%i!]
  52.         )
  53.     )
  54. )
  55. REM 左下角最最高位, 右上角是最低位
  56. set "BIN="
  57. for /L %%c in (0 1 105) do (
  58.     for /L %%r in (17 -1 1) do (
  59.         set "BIN=!BIN!!L%%r:~%%c,1!"
  60.         if "!BIN!"==" " set "BIN="
  61.     )
  62. )
  63. set "oFile=BBS.BATHOME.NET.Tupper_s_self-referential_formula.nb"
  64. >"!oFile!"  (
  65.     echo;k=17*FromDigits["!BIN: =0!",2]; sh = 1;
  66.     echo;tb = Table[
  67.     echo; 1/2 ^< Floor[ Mod[Floor[y/17]*2^^^(-17 Floor[x] - Mod[Floor[y], 17]^), 2]],
  68.     echo; {y, k + 17 - sh, k, -sh}, {x, 106 - sh, 0, -sh}];
  69.     echo;g = Graphics[Raster[tb /. {True -^> 0, False -^> 1}], ImagePadding -^> None, PlotRangePadding -^> None]
  70. )
  71. call :runNbAtMathematica
  72. pause
  73. exit
  74. :runNbAtMathematica
  75. for /f "delims== tokens=1*" %%a in ('ftype ^| findstr /i /r "\.nb.*Mathematica.exe"') do (
  76.     set "MathematicaPath=%%~dpnb.exe"
  77.     echo;找到 Mathematica 路径 !MathematicaPath!  启动 Mathematica ...
  78.     start "" "!MathematicaPath!" "%~dp0!oFile!"
  79.     exit /b
  80. )
  81. if not defined MathematicaPath echo;未安装 Mathematica
  82. exit /b
复制代码

作者: happy886rr    时间: 2016-10-8 08:28

很有数学艺术感
作者: codegay    时间: 2016-10-8 08:32


没图没JB




欢迎光临 批处理之家 (http://bathome.net./) Powered by Discuz! 7.2