前一段時間,我搬運了幾個Windows Terminal中玩遊戲的視頻,詳情請看 發布在即!來一睹官方團隊如何玩轉 Windows Terminal - Bravo Yeung.

今天我來給大家展示一下具體的玩法~

Emoji版雙人碰碰球

目前有個現成的 .NET core 項目可以直接用,地址是:

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

github.com/mbcrump/pong

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

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

D:Codingpongemoji>cd pongemoji

D:Codingpongemoji>dotnet build

D:Codingpongemoji>dotnet run

運行效果如下:

玩家 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!

github.com/cmatsuoka/as

只需要在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

運行效果如下:

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 還有很多可選參數,能顯示更有趣的效果:

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

有興趣的可以繼續玩噢~

.NET版2048

在github中,我發現了一個.NET Framework版的遊戲2048.

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

  • 從github拉取代碼

C:UsersBruce>git clone https://github.com/kflu/2048.git

  • 編譯項目如果你在Windows上安裝了Visual Studio,請直接用VS編譯~如果沒裝 VS,就使用MSBuild來編譯吧,首先你得找對MSBuild的位置,如果已經為MSBuild設置了系統變數,這一步可以跳過~

C:UsersBruce>cd C:WindowsMicrosoft.NETFramework
?
?
C:WindowsMicrosoft.NETFramework>dir
?
驅動器 C 中的卷是 Windows
?
卷的序列號是 74E0-8254
?
?
?
C:WindowsMicrosoft.NETFramework 的目錄
?
...
?
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:WindowsMicrosoft.NETFramework>cd v4.0.30319

用MSBuild編譯 project 可以用下面幾種命令中的任意一種:

C:WindowsMicrosoft.NETFrameworkv4.0.30319>MSBuild D:Coding20482048.csproj

C:WindowsMicrosoft.NETFrameworkv4.0.30319>MSBuild D:Coding20482048.csproj /t:Build

C:WindowsMicrosoft.NETFrameworkv4.0.30319>MSBuild D:Coding20482048.csproj /t:Build /p:Configuration=Debug;Platform=x86;TargetFrameworkVersion=v4.0

個人傾向用第2種~

  • 在Windows Terminal中運行遊戲

接下來就是運行遊戲了,切換到相應目錄下bin中相關的exe即可~

> D:

> cd D:Coding2048inDebug

> ConsoleApplication.exe

玩法:用↑ ↓ ← → 4個方向鍵來玩。

效果圖如下:

笑到噴的直升機

ROFL: Rolling On the Floor Laughing的意寫,可譯為笑到嘔吐,笑到噴~

ROFLCOPTER: Rolling On the Floor Laughing Can『t OPerate Till Eyes Refocus的縮寫,意為笑到滿地打滾,直到眼神重聚.

  • ROFLCOPTER - 一種嘲笑他人的隱晦做法,經常被聯想為大笑不止或笑得停不下來。據說該術語是由魔獸世界III論壇的版主在2003年創造的,而相應的網站roflcopter.com於2004年推出。
  • 同時,ROFLCOPTER 也經常被看成是ASCII字元畫成的以ROFL和LOL為螺旋槳的直升機, 它的螺旋槳由ROFL和LOL「 laughing out loud 」製成,看起來像是在旋轉。

相應的代碼我已經上傳到:

github.com/yanglr/Games

只需從Windows Terminal的PowerShell類Tab打開,執行如下命令~

> cd D:Coding
> git clone [email protected]:yanglr/GamesInWinTerminal.git
> cd .GamesInWinTerminalcharArt

> dotnet build
> dotnet run

最後運行的效果如下:

歡迎補充或交流~

gaygithub上還有其他挺有意思的遊戲:

Topic: terminal-game

github.com/topics/termi

Topic: console-game

github.com/topics/conso

參考:

roflcopter | Memes by Dictionary.com

dictionary.com/e/memes/

推薦閱讀:

相关文章