前一段时间,我搬运了几个Windows Terminal中玩游戏的视频.
Windows Terminal - 动图GIF作背景图
Windows Terminal - 母牛说Hi
Windows Terminal - 字符水族箱
今天我来给大家展示一下具体的玩法~
目前有个现成的 .NET core 项目可以直接用,地址是:
mbcrump/pongemojihttps://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
运行效果如下:
玩家 1 : 使用键盘上的 WASD
来控制 ↑,←,↓,→ 4个方向.
玩家 2 : 直接使用键盘上的方向键控制↑,←,↓,→ 4个方向.
游戏中一方先满5分,游戏会重新开始。目前该游戏还有一点bug噢~
目前有个基于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
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
运行效果如下:
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
,得到的是:
当然你也可以输入echo 'Hi!' | cowsay
让他说"Hi".
如果让牛思考,你可以输入uptime | cowthink
,
当然你还可以输入uptime | cowthink -f tux
让它变回企鹅(Linux Logo).
此外,cowsay 还有很多可选参数,能显示更有趣的效果:
有兴趣的可以继续玩噢~
在github中,我发现了一个.NET Framework版的游戏2048.
只需在Windows Terminal的CMD Tab中依次进行如下操作:
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
种~
接下来就是运行游戏了,切换到相应目录下bin中相关的exe即可~
> D:
> cd D:\Coding\2048\bin\Debug
> ConsoleApplication.exe
玩法:用↑ ↓ ← → 4个方向键来玩。
效果图如下:
ROFL: Rolling On the Floor Laughing的意写,可译为笑到呕吐,笑到喷~
ROFLCOPTER: Rolling On the Floor Laughing Can't OPerate Till Eyes Refocus的缩写,意为笑到满地打滚,直到眼神重聚.
相应的代码我已经上传到:
https://github.com/yanglr/GamesInWinTerminal
只需从Windows Terminal的PowerShell类Tab打开,执行如下命令~
最后运行的效果如下:
gaygithub上还有其他挺有意思的游戏:
Topic: terminal-game
https://github.com/topics/terminal-game
Topic: console-game
https://github.com/topics/console-game
接下来,打算先从Python爬虫入手,熟练之后使用C#来做爬虫。买了一本Python大佬深入浅出爬虫的书,顺手安利给大家~
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有