mirror of
				https://github.com/Mabbs/mabbs.github.io
				synced 2025-10-31 04:56:38 +00:00 
			
		
		
		
	Update 4 files
- /_posts/2025-09-01-quine.md - /_layouts/default.html - /_data/other_repo_list.csv - /other_repo_list.md
This commit is contained in:
		| @@ -412,3 +412,9 @@ https://git.jbangit.com/mayx/blog | |||||||
| https://repo.gusdya.net/mayx/blog | https://repo.gusdya.net/mayx/blog | ||||||
| https://gitea.tmartens.dev/mayx/blog | https://gitea.tmartens.dev/mayx/blog | ||||||
| http://218.206.106.50:19901/mayx/blog | http://218.206.106.50:19901/mayx/blog | ||||||
|  | https://g.6tm.es/mayx/blog | ||||||
|  | https://git.slegeir.com/mayx/blog | ||||||
|  | https://git.kimcblog.com/mayx/blog | ||||||
|  | http://www.mygamework.com:3000/mayx/blog | ||||||
|  | https://gogs.m14xa.ru/mayx/blog | ||||||
|  | https://git.minaev.su/mayx/blog | ||||||
|   | |||||||
| 
 | 
| @@ -9,7 +9,7 @@ layout: xslt_container | |||||||
|   <meta name="viewport" content="width=device-width, initial-scale=1" /> |   <meta name="viewport" content="width=device-width, initial-scale=1" /> | ||||||
|  |  | ||||||
|   {% seo %} |   {% seo %} | ||||||
|   {% unless site.github %}<link rel="canonical" href="https://mabbs.github.io{{ page.url }}"/>{% endunless %} |   {% unless site.github %}<link rel="canonical" href="https://mabbs.github.io{{ page.url }}" />{% endunless %} | ||||||
|   {% feed_meta %} |   {% feed_meta %} | ||||||
|   <link rel="alternate" type="application/rss+xml" title="{{ site.title }}(RSS)" href="{{ "/rss.xml" | absolute_url }}" /> |   <link rel="alternate" type="application/rss+xml" title="{{ site.title }}(RSS)" href="{{ "/rss.xml" | absolute_url }}" /> | ||||||
|   <link rel="alternate" type="application/json" title="{{ site.title }}(JSON Feed)" href="{{ "/feed.json" | absolute_url }}" /> |   <link rel="alternate" type="application/json" title="{{ site.title }}(JSON Feed)" href="{{ "/feed.json" | absolute_url }}" /> | ||||||
|   | |||||||
| @@ -86,7 +86,7 @@ Hello, world! | |||||||
| ``` | ``` | ||||||
|   作为脚本执行的结果就是原样输出这段内容,不过把内容当作代码算不算作弊呢……如果看作是cat的输入显然是作弊,但如果是当作源代码的话应该就不算了吧😋……但这就不是能写出逻辑的语言了。所以说Quine的趣味并不在“能不能实现”,而在于如何在限制条件下实现。正是因为大多数语言不会直接“自我输出”,才会觉得那些精巧的Quine程序如此有意思。    |   作为脚本执行的结果就是原样输出这段内容,不过把内容当作代码算不算作弊呢……如果看作是cat的输入显然是作弊,但如果是当作源代码的话应该就不算了吧😋……但这就不是能写出逻辑的语言了。所以说Quine的趣味并不在“能不能实现”,而在于如何在限制条件下实现。正是因为大多数语言不会直接“自我输出”,才会觉得那些精巧的Quine程序如此有意思。    | ||||||
| ## Quine Relay的探索 | ## Quine Relay的探索 | ||||||
|   还有一个更加复杂的Quine变种是“Quine接力”(Quine Relay),即一个程序输出另一个程序的源代码,另一个程序又输出下一个程序的源代码,最后回到原始程序,就和之前所说的的嵌套循环ZIP Quine有点类似。最著名的例子是[Yusuke Endoh](https://github.com/mame)(这位还是[IOCCC](https://www.ioccc.org/)的冠军之一)创建的[quine-relay](https://github.com/mame/quine-relay)项目,它包含了128种编程语言的循环。    |   还有一个更加复杂的Quine变种是“Quine接力”(Quine Relay),即一个程序输出另一个程序的源代码,另一个程序又输出下一个程序的源代码,最后回到原始程序,就和之前所说的嵌套循环ZIP Quine有点类似。最著名的例子是[Yusuke Endoh](https://github.com/mame)(这位还是[IOCCC](https://www.ioccc.org/)的冠军之一)创建的[quine-relay](https://github.com/mame/quine-relay)项目,它包含了128种编程语言的循环。    | ||||||
|   这种程序写起来会更复杂一些,不过原理都差不多,通常除了当前运行的部分是可执行代码外,其他的代码都需要以额外包含的数据形式(如字符串)存储在变量中。如果想自己做个类似简单的Quine Relay,除了去看[维基百科](https://en.wikipedia.org/wiki/Quine_(computing)#Ouroboros_programs)之外,前段时间我还看到过一个不错的[文章](https://blog.mistivia.com/posts/2024-09-21-quine/),里面就讲了如何用“笨办法”编写Quine和Quine Relay,通过把变量中的内容编码为16进制来避免不同语言可能存在的特殊字符转译问题,思路不错,对于理解如何编写这类程序的问题很有帮助。当然这只是个**简单**的方案,仅适用于一些常规的编程语言,像上面那个[quine-relay](https://github.com/mame/quine-relay)项目中甚至还包含Brainfuck之类的esolang,这种估计得要想办法让相对高级一些的语言通过“生成”的方式得到输出下一种代码的代码,而不是简单的赋值了,所以只靠这点知识想去完全理解大佬的作品还是想多了😆。    |   这种程序写起来会更复杂一些,不过原理都差不多,通常除了当前运行的部分是可执行代码外,其他的代码都需要以额外包含的数据形式(如字符串)存储在变量中。如果想自己做个类似简单的Quine Relay,除了去看[维基百科](https://en.wikipedia.org/wiki/Quine_(computing)#Ouroboros_programs)之外,前段时间我还看到过一个不错的[文章](https://blog.mistivia.com/posts/2024-09-21-quine/),里面就讲了如何用“笨办法”编写Quine和Quine Relay,通过把变量中的内容编码为16进制来避免不同语言可能存在的特殊字符转译问题,思路不错,对于理解如何编写这类程序的问题很有帮助。当然这只是个**简单**的方案,仅适用于一些常规的编程语言,像上面那个[quine-relay](https://github.com/mame/quine-relay)项目中甚至还包含Brainfuck之类的esolang,这种估计得要想办法让相对高级一些的语言通过“生成”的方式得到输出下一种代码的代码,而不是简单的赋值了,所以只靠这点知识想去完全理解大佬的作品还是想多了😆。    | ||||||
|  |  | ||||||
| # 感想 | # 感想 | ||||||
|   | |||||||
| @@ -4,5 +4,6 @@ title: 其他Git仓库镜像列表 | |||||||
| --- | --- | ||||||
|  |  | ||||||
| # 其他Git仓库镜像列表 | # 其他Git仓库镜像列表 | ||||||
|  | 目前已有的社区/个人类型实例托管Git仓库共有{{ site.data.other_repo_list | size }}个:    | ||||||
| {% for item in site.data.other_repo_list %}- <{{ item.repo_url }}>     | {% for item in site.data.other_repo_list %}- <{{ item.repo_url }}>     | ||||||
| {% endfor %} | {% endfor %} | ||||||
		Reference in New Issue
	
	Block a user
	 mayx
					mayx