win10好玩的代码_windows下linux终端

win10好玩的代码_windows下linux终端Windows新终端中玩转ASCII和Emoji游戏的正确姿势

大家好,又见面了,我是你们的朋友全栈君。

前一段时间,我搬运了几个Windows Terminal中玩游戏的视频,详情请看 发布在即!来一睹官方团队如何玩转 Windows Terminal – 知乎.

今天我来给大家展示一下具体的玩法~

Emoji版双人碰碰球

目前有个现成的 .NET core 项目可以直接用,地址是:

mbcrump/pongemoji: A implementation of Pong using the new Windows Terminal announced during Build
https://github.com/mbcrump/pongemoji

只需要在Windows Terminal的CMD 或 PowerShell Tab中输入如下命令:

D:\Coding\pongemoji>git clone https://github.com/mbcrump/pongemoji

D:\Coding\pongemoji>cd pongemoji 

D:\Coding\pongemoji>dotnet build

D:\Coding\pongemoji>dotnet run

运行效果如下:

pong1

玩家 1 : 使用键盘上的 WASD 来控制 ↑,←,↓,→ 4个方向.

玩家 2 : 直接使用键盘上的方向键控制↑,←,↓,→ 4个方向.

游戏中一方先满5分,游戏会重新开始。目前该游戏还有一点bug噢~

ASCII 水族箱(ASCII quarium)

目前有个基于Perl的项目可以用,地址是:

cmatsuoka/asciiquarium: Enjoy the mysteries of the sea from the safety of your own terminal!

https://github.com/cmatsuoka/asciiquarium

只需要在Windows Terminal的WSL类(我自己安装是Ubuntu)的Tab中依次进行如下步骤:

  • 安装 Perl相关库
$ sudo apt-get install libcurses-perl
  • 安装cpan并进行相应配置
$ cpan
Loading internal null logger. Install Log::Log4perl for logging messages

CPAN.pm requires configuration, but most of it can be done automatically.
If you answer 'no' below, you will enter an interactive dialog for each
configuration option instead.

Would you like to configure as much as possible automatically? [yes] yes

...

What approach do you want?  (Choose 'local::lib', 'sudo' or 'manual')
 [local::lib] sudo


Autoconfiguration complete.

commit: wrote '/home/bruce/.cpan/CPAN/MyConfig.pm'

You can re-run configuration any time with 'o conf init' in the CPAN shell
Terminal does not support AddHistory.

cpan shell -- CPAN exploration and modules installation (v2.18)
Enter 'h' for help.
cpan[1]> ^CCaught SIGINT, trying to continue                                                                                                                                 ^Z
[2]+  Stopped                 cpan

$ sudo cpan Term::Animation
  • 拉取ASCII quarium v1.1的代码并执行
$ git clone https://github.com/cmatsuoka/asciiquarium.git                                 $ ls    
$ cd asciiquarium/          
$ ./asciiquarium 

运行效果如下:

AsciiQ

ASCII字符游戏 母牛说 “Hi”

还记得 Debian 下“Super Cow Powers” (超级牛力)这个有名的彩蛋吗?
Cowsay 是个 Perl 写成的文字过滤脚本,如果你把任何文字传给 cowsay,一只 ASCII 母牛就会帮你传达这个消息~

事实上,我们可以直接在Windows Terminal中玩转它喔~

只需在Windows Terminal的Ubuntu Tab中依次输入如下命令:

$ sudo apt-get install cowsay
$ sudo apt-get install fortune-mod

接下来,如果输入fortune | cowsay,得到的是:

cowSay

当然你也可以输入echo 'Hi!' | cowsay让他说”Hi”.

如果让牛思考,你可以输入uptime | cowthink

当然你还可以输入uptime | cowthink -f tux让它变回企鹅(Linux Logo).

此外,cowsay 还有很多可选参数,能显示更有趣的效果:

  • -d 死掉的母牛
  • -b 瞎眼母牛?
  • -g 财迷母牛
  • -p 多疑的母牛
  • -s 喝醉的母牛
  • -t 疲劳母牛
  • -w 吃惊的母牛
  • -y 小母牛

有兴趣的可以继续玩噢~

.NET版2048

在github中,我发现了一个.NET Framework版的游戏2048.

只需在Windows Terminal的CMD Tab中依次进行如下操作:

  • 从github拉取代码
C:\Users\Bruce>git clone https://github.com/kflu/2048.git
  • 编译项目

    如果你在Windows上安装了Visual Studio,请直接用VS编译~

    如果没装 VS,就使用MSBuild来编译吧,首先你得找对MSBuild的位置,如果已经为MSBuild设置了系统变量,这一步可以跳过~

    C:\Users\Bruce>cd C:\Windows\Microsoft.NET\Framework
    
    
    C:\Windows\Microsoft.NET\Framework>dir
    
     驱动器 C 中的卷是 Windows
    
     卷的序列号是 74E0-8254
    
    
    
     C:\Windows\Microsoft.NET\Framework 的目录
    
    ...
    
    2019/03/19  12:52    <DIR>          v1.0.3705
    
    2019/03/19  12:52    <DIR>          v1.1.4322
    
    2019/05/19  00:05    <DIR>          v2.0.50727
    
    2019/05/12  01:33    <DIR>          v3.0
    
    2019/05/12  01:33    <DIR>          v3.5
    
    2019/06/26  21:58    <DIR>          v4.0.30319
    
    ​              18 个文件        272,280 字节
    
    ​               9 个目录 70,716,755,968 可用字节
    
    
    C:\Windows\Microsoft.NET\Framework>cd v4.0.30319

用MSBuild编译 project 可以用下面几种命令中的任意一种:

C:\Windows\Microsoft.NET\Framework\v4.0.30319>MSBuild D:\Coding\2048\2048.csproj

C:\Windows\Microsoft.NET\Framework\v4.0.30319>MSBuild D:\Coding\2048\2048.csproj /t:Build 

C:\Windows\Microsoft.NET\Framework\v4.0.30319>MSBuild D:\Coding\2048\2048.csproj /t:Build /p:Configuration=Debug;Platform=x86;TargetFrameworkVersion=v4.0

个人倾向用第2种~

dotNETcore-build

  • 在Windows Terminal中运行游戏

接下来就是运行游戏了,切换到相应目录下bin中相关的exe即可~

> D:

> cd D:\Coding\2048\bin\Debug

> ConsoleApplication.exe

玩法:用↑ ↓ ← → 4个方向键来玩。

效果图如下:

2048play

笑到喷的直升机

ROFL: Rolling On the Floor Laughing的意写,可译为笑到呕吐,笑到喷~

ROFLCOPTER: Rolling On the Floor Laughing Can‘t OPerate Till Eyes Refocus的缩写,意为笑到满地打滚,直到眼神重聚.

  • ROFLCOPTER – 一种嘲笑他人的隐晦做法,经常被联想为大笑不止或笑得停不下来。

    据说该术语据称是由魔兽世界III论坛的版主在2003年创造的,而相应的网站www.roflcopter.com于2004年推出。

  • 同时,ROFLCOPTER 也经常被看成是ASCII字符画成的以ROFL和LOL为螺旋桨的直升机, 它的螺旋桨由ROFL和LOL「 laughing out loud 」制成,看起来像是在旋转。

相应的代码我已经上传到:

https://github.com/yanglr/GamesInWinTerminal

只需从Windows Terminal的PowerShell类Tab打开,执行如下命令~

> cd D:\Coding
> git clone git@github.com:yanglr/GamesInWinTerminal.git
> cd .\GamesInWinTerminal\charArt

> dotnet build
> dotnet run 

最后运行的效果如下:

ROFL

gaygithub上还有其他挺有意思的游戏:

Topic: terminal-game

https://github.com/topics/terminal-game

Topic: console-game

https://github.com/topics/console-game

参考:

roflcopter | Memes by Dictionary.com
https://www.dictionary.com/e/memes/roflcopter/

What is ROFL (Rolling On The Floor Laughing)?
https://www.computerhope.com/jargon/r/rofl.htm

superusercode/roflcopter.md
https://gist.github.com/superusercode/28f6d352c01b247f1747ef54b02fc8ec

转载于:https://www.cnblogs.com/enjoy233/p/Games_in_Windows_Terminal.html

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/106741.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • Map、斗地主案例

    Map、斗地主案例

    2021年5月19日
    116
  • Selenium WebDriver下载与安装[通俗易懂]

    Selenium WebDriver下载与安装[通俗易懂]1.python(anaconda环境)condainfo–envsactivateuntitled2.pip/condainstallselenium3.seleniumdriver(放在anaconda环境path中)Chrome(32位)http://chromedriver.storage.proxy.ustclug.org/index.htmlFire…

    2022年9月19日
    0
  • 教你如何把M3U8转换成MP4丨NueXini M3U8 Downloader

    教你如何把M3U8转换成MP4丨NueXini M3U8 Downloader准备工具:https://www.lanzous.com/i18d7sh步骤:1.下载软件并且解压到非中文目录,然后打开主程序2.把M3U8的网络地址,或者下载到本地的M3U8文件拖入编辑框(红色箭头)3.点击解析(这里使用网络地址:http://nuexini.shop/ceshi.m3u8)4.点击开始(软件自动下载并且完成合并)5.完成!!!…

    2022年6月24日
    41
  • 微信公众号支付开发全过程(Java 版)

    微信公众号支付开发全过程(Java 版)

    2021年6月8日
    114
  • TD—SCDMA_移动TD

    TD—SCDMA_移动TD
    GSM
     globalsystemformobilecommunications全球移动通信系统
     第二代移动电话系统。
         GSM是GlobalSystemofMobilecommunication全球移动通讯系统的英文缩写,是当前应用最为广泛的移动电话标准。全球超过200个国家和地区超过10亿人正在使用GSM电话。所有用户可以在签署了”漫游协定”移动电话运营商之间自由漫游。GSM较之它以前的标准最大的不同是他的信令和语音信道都是数

    2022年10月4日
    0
  • C语言经典面试题_c语言常见面试题

    C语言经典面试题_c语言常见面试题100道c语言面试题2018年01月12日18:52:35cocos+unity+服务器阅读数:9166https://blog.csdn.net/themagickeyjianan/article/details/79047242题目来源:1、中兴、华为、慧通、英华达、微软亚洲技术中心等中外企业面试题目;2、C语言面试宝典(林锐《高质量编程第三版》)。说明:1、部…

    2022年8月28日
    0

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号