LoginSignup
2
2

More than 5 years have passed since last update.

The Matrix

Last updated at Posted at 2015-07-30

以下の投稿をもとに制御文字も出力するようにしてみました。

Windows でもマトリックスごっこがやりたくて
http://qiita.com/opengl-8080/items/c4d780927d4ad44dd3e1

matrix.bat
@echo off

set SELF=%~n0

setlocal enabledelayedexpansion
  if not exist ".\%SELF%.txt" (
    >&2 echo %SELF%: file not found: %SELF%.txt
    exit /b 1
  )

  set i=0
  for /f "tokens=*" %%i in (.\%SELF%.txt) do (
    set v[!i!]=%%i
    set /a i+=1
  )

  color 02

  :BOL
    set /a i=%RANDOM%%%256
    call set /p t=%%v[%i%]%% < NUL
  goto BOL
endlocal

なお、 Linux のシェルなどを利用してあらかじめ matrix.txt を作成しておく必要があります。

$ for i in {0..255}; do echo -e "\\x`printf '%02X' ${i}`" >> matrix.txt; done

matrix.txt を作成したらエディターなどで開き、 cmd.exe が処理できない文字(NULL,<,=,>,|,0x81 ... 0xA1,0xE1 ... 0xFF)は半角空白に置換しておきます。

実行結果は以下をご覧ください。

matrix.png

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2