From fdfafa048c8e315a7ef488c09bce299f53b68ee4 Mon Sep 17 00:00:00 2001 From: ryzhpolsos Date: Wed, 13 May 2026 23:40:05 +0000 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=B8?= =?UTF-8?q?=D1=82=D1=8C=20=D1=84=D0=B0=D0=B9=D0=BB=D1=8B=20=D0=B2=20=C2=AB?= =?UTF-8?q?windows/bat/flappybird=C2=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- windows/bat/flappybird/FlappyBird.bat | 261 ++++++++++++++++++++++++++ windows/bat/flappybird/FlappyBird.exb | 123 ++++++++++++ windows/bat/flappybird/RUN.bat | 2 + 3 files changed, 386 insertions(+) create mode 100644 windows/bat/flappybird/FlappyBird.bat create mode 100644 windows/bat/flappybird/FlappyBird.exb create mode 100644 windows/bat/flappybird/RUN.bat diff --git a/windows/bat/flappybird/FlappyBird.bat b/windows/bat/flappybird/FlappyBird.bat new file mode 100644 index 0000000..23f31d6 --- /dev/null +++ b/windows/bat/flappybird/FlappyBird.bat @@ -0,0 +1,261 @@ +@echo off +setlocal EnableDelayedExpansion +chcp 65001> nul + +:beep +if "%~1"=="iKPv4R2cuLsTyHv6OKbV" ( shift /1 ) else ( goto _GAy9L3CwYDa531In9pst_end_beep ) + echo BA | choice /c A> nul +goto :eof +:_GAy9L3CwYDa531In9pst_end_beep + +:pause +if "%~1"=="iKPv4R2cuLsTyHv6OKbV" ( shift /1 ) else ( goto _GAy9L3CwYDa531In9pst_end_pause ) + pause> nul +goto :eof +:_GAy9L3CwYDa531In9pst_end_pause + +:choice +if "%~1"=="iKPv4R2cuLsTyHv6OKbV" ( shift /1 ) else ( goto _GAy9L3CwYDa531In9pst_end_choice ) + choice /c %~1> nul + set /a "%~2=!ERRORLEVEL!-1" +goto :eof +:_GAy9L3CwYDa531In9pst_end_choice + +:read_key +if "%~1"=="iKPv4R2cuLsTyHv6OKbV" ( shift /1 ) else ( goto _GAy9L3CwYDa531In9pst_end_read_key ) +if not exist "%temp%\readkey.exe" ( + set "nf_path=%windir%\Microsoft.NET\Framework" + for /f %%i in ('dir /b /a:d /o:-n "!nf_path!"') do ( + set "nf_ver=%%i" + goto got_nf_ver + ) + :got_nf_ver + set "csc=!nf_path!\!nf_ver!\csc.exe" + echo using System;namespace _{class _{public static void Main^(string[] args^){if^(args[0]^^!="0"^){System.Threading.Tasks.Task.Run^(^(^)=^>{System.Threading.Thread.Sleep^(int.Parse^(args[0]^)^);Console.Write^(args[1]^);Environment.Exit^(0^);}^);};Console.Write^(Console.ReadKey^(true^).Key.ToString^(^)^);}}}> "%temp%\readkey.cs" + "!csc!" /nologo "/out:%temp%\readkey.exe" "%temp%\readkey.cs" +) + for /f "tokens=*" %%i in ('"%temp%\readkey.exe" %~1 %~2') do set "%~3=%%i" +goto :eof +:_GAy9L3CwYDa531In9pst_end_read_key + +:set_size +if "%~1"=="iKPv4R2cuLsTyHv6OKbV" ( shift /1 ) else ( goto _GAy9L3CwYDa531In9pst_end_set_size ) + mode con cols=%~1 lines=%~2 +goto :eof +:_GAy9L3CwYDa531In9pst_end_set_size + +:set_title +if "%~1"=="iKPv4R2cuLsTyHv6OKbV" ( shift /1 ) else ( goto _GAy9L3CwYDa531In9pst_end_set_title ) + title %~1 +goto :eof +:_GAy9L3CwYDa531In9pst_end_set_title + +:echo +if "%~1"=="iKPv4R2cuLsTyHv6OKbV" ( shift /1 ) else ( goto _GAy9L3CwYDa531In9pst_end_echo ) + echo;%~1 +goto :eof +:_GAy9L3CwYDa531In9pst_end_echo + +:printf +if "%~1"=="iKPv4R2cuLsTyHv6OKbV" ( shift /1 ) else ( goto _GAy9L3CwYDa531In9pst_end_printf ) + +goto :eof +:_GAy9L3CwYDa531In9pst_end_printf + +:delay +if "%~1"=="iKPv4R2cuLsTyHv6OKbV" ( shift /1 ) else ( goto _GAy9L3CwYDa531In9pst_end_delay ) +if not exist "%temp%\del.js" ( + echo WScript.Sleep^(WScript.Arguments^(0^)^);> "%temp%\del.js" +) + cscript //nologo "%temp%\del.js" %~1 +goto :eof +:_GAy9L3CwYDa531In9pst_end_delay + +:pow +if "%~1"=="iKPv4R2cuLsTyHv6OKbV" ( shift /1 ) else ( goto _GAy9L3CwYDa531In9pst_end_pow ) + set "str=%~1" + for /l %%i in (2,1,%~2) do ( + set "str=!str! * %~1" + ) + set /a "%~3=!str!" +goto :eof +:_GAy9L3CwYDa531In9pst_end_pow + +:random +if "%~1"=="iKPv4R2cuLsTyHv6OKbV" ( shift /1 ) else ( goto _GAy9L3CwYDa531In9pst_end_random ) + set /a "%~3=%~1 + %random% %% (%~2 - %~1)" +goto :eof +:_GAy9L3CwYDa531In9pst_end_random + +:is_number_prime +if "%~1"=="iKPv4R2cuLsTyHv6OKbV" ( shift /1 ) else ( goto _GAy9L3CwYDa531In9pst_end_is_number_prime ) + if %~1 leq 1 ( + set "%~2=-1" + goto :eof + ) + + if %~1==2 ( + set "%~2=0" + goto :eof + ) + +set /a _PfhRdksThgGU7SB6uCE4=%~1-1 + for /l %%i in (2,1,!_PfhRdksThgGU7SB6uCE4!) do ( + set /a res=%~1 %% %%i + if !res!==0 ( + set "%~2=0" + goto :eof + ) + ) + + set "%~2=1" +goto :eof +:_GAy9L3CwYDa531In9pst_end_is_number_prime + + + + + + +:get_cell +if "%~1"=="iKPv4R2cuLsTyHv6OKbV" ( shift /1 ) else ( goto _GAy9L3CwYDa531In9pst_end_get_cell ) + set "%~3=!map[%~2][%~1]!" +goto :eof +:_GAy9L3CwYDa531In9pst_end_get_cell + +:set_cell +if "%~1"=="iKPv4R2cuLsTyHv6OKbV" ( shift /1 ) else ( goto _GAy9L3CwYDa531In9pst_end_set_cell ) + set "map[%~2][%~1]=%~3" +goto :eof +:_GAy9L3CwYDa531In9pst_end_set_cell + +rem function draw_map() +set /a _BjCMVGGvFMZyNXeDn7SU=15-1 +rem for /l %%i in (0,1,!_BjCMVGGvFMZyNXeDn7SU!) do ( +rem set "txt=" +set /a _ii5NEXWfGzLLFgUpdU6W=50-1 +rem for /l %%j in (0,1,!_ii5NEXWfGzLLFgUpdU6W!) do ( +rem set "txt=!txt!!map[%%i][%%j]!" +rem ) +rem echo.!txt! +rem ) +rem end function + +:draw_map +if "%~1"=="iKPv4R2cuLsTyHv6OKbV" ( shift /1 ) else ( goto _GAy9L3CwYDa531In9pst_end_draw_map ) + set i=0 + set j=0 + set /a mh=15-1 + set /a mw=50-1 + + :_dm_loop_y + set "txt=" + :_dm_loop_x + pause>nul + call set txt=%txt%%%map[%i%][%j%]%% + set /a j+=1 + if %j% lss %mw% goto _dm_loop_x + title %j% %i% + set /a i+=1 + if %i% lss %mh% goto _dm_loop_y +goto :eof +:_GAy9L3CwYDa531In9pst_end_draw_map + +:move_cell +if "%~1"=="iKPv4R2cuLsTyHv6OKbV" ( shift /1 ) else ( goto _GAy9L3CwYDa531In9pst_end_move_cell ) +call :get_cell iKPv4R2cuLsTyHv6OKbV %~1 %~2 _cell_val +call :set_cell iKPv4R2cuLsTyHv6OKbV %~1 %~2 " " +call :set_cell iKPv4R2cuLsTyHv6OKbV %~3 %~4 %_cell_val% +goto :eof +:_GAy9L3CwYDa531In9pst_end_move_cell + +:draw_player +if "%~1"=="iKPv4R2cuLsTyHv6OKbV" ( shift /1 ) else ( goto _GAy9L3CwYDa531In9pst_end_draw_player ) +call :set_cell iKPv4R2cuLsTyHv6OKbV !player_x! !player_y! "●" +goto :eof +:_GAy9L3CwYDa531In9pst_end_draw_player + +:create_pipe +if "%~1"=="iKPv4R2cuLsTyHv6OKbV" ( shift /1 ) else ( goto _GAy9L3CwYDa531In9pst_end_create_pipe ) +set /a _d7OVHSGjy7TxuuWcoyH7=%~2-3 + for /l %%i in (0,1,!_d7OVHSGjy7TxuuWcoyH7!) do ( +set /a _ukpQANtqDykSB50kUjGw=15-1-%%i +call :set_cell iKPv4R2cuLsTyHv6OKbV %~1 !_ukpQANtqDykSB50kUjGw! "%~3" + ) +set /a _RwrIfYaUK1AoM8l2S8V3=15-%~2-3 + for /l %%i in (0,1,!_RwrIfYaUK1AoM8l2S8V3!) do ( +call :set_cell iKPv4R2cuLsTyHv6OKbV %~1 %%i "%~3" + ) +goto :eof +:_GAy9L3CwYDa531In9pst_end_create_pipe + +:create_pipes +if "%~1"=="iKPv4R2cuLsTyHv6OKbV" ( shift /1 ) else ( goto _GAy9L3CwYDa531In9pst_end_create_pipes ) + for /l %%i in (1,1,4) do ( +set /a _iZg9XAvy4vIFsVq83hul=15-3 +call :random iKPv4R2cuLsTyHv6OKbV 0 !_iZg9XAvy4vIFsVq83hul! pipe%%i_val + ) +goto :eof +:_GAy9L3CwYDa531In9pst_end_create_pipes + +:move_pipes +if "%~1"=="iKPv4R2cuLsTyHv6OKbV" ( shift /1 ) else ( goto _GAy9L3CwYDa531In9pst_end_move_pipes ) + for /l %%i in (1,1,4) do ( +set /a _wYfLy6FDU7SWOMN1Prue=10*%%i-!pipe_offset! +call :create_pipe iKPv4R2cuLsTyHv6OKbV !_wYfLy6FDU7SWOMN1Prue! !pipe%%i_val! " " +set /a _nmaZs561Sn9vNtGJ3ULb=10*%%i-!pipe_offset!-%~1 +call :create_pipe iKPv4R2cuLsTyHv6OKbV !_nmaZs561Sn9vNtGJ3ULb! !pipe%%i_val! "█" + ) + set /a pipe_offset+=%~1 +goto :eof +:_GAy9L3CwYDa531In9pst_end_move_pipes + +title Flappy Bird + +set /a _5re6cw0fHysLwP8K8Gd2=15+2 +call :set_size iKPv4R2cuLsTyHv6OKbV 50 !_5re6cw0fHysLwP8K8Gd2! + +for /l %%i in (0,1,15) do ( + for /l %%j in (0,1,50) do ( + set "map[%%i][%%j]= " + ) +) + +set player_x=2 +set player_y=7 +set pipe_offset=0 + +call :create_pipes iKPv4R2cuLsTyHv6OKbV + +:game_loop + rem read key + rem read_key(3, "no_key", out key) + rem if(%key% == Spacebar) + rem rem jump + rem set_cell(%player_x%, %player_y%, " ") + rem set /a player_y-=2 + rem draw_player() + rem end if + + rem gravity +set /a _9Ovq7hIfFD84gTj5He66=%player_y%+1 +call :get_cell iKPv4R2cuLsTyHv6OKbV %player_x% !_9Ovq7hIfFD84gTj5He66! pc_val +set /a _Faud5y98v6Lx1Tbr6y85=15-1 +if "%pc_val%" equ " " if %player_y% lss !_Faud5y98v6Lx1Tbr6y85! ( +call :set_cell iKPv4R2cuLsTyHv6OKbV %player_x% %player_y% " " + set /a player_y+=1 +) +call :draw_player iKPv4R2cuLsTyHv6OKbV + + for /l %%i in (1,1,4) do ( +set /a _oVaD0xpcpCCeJgxjeRuJ=10*%%i-!pipe_offset! +call :create_pipe iKPv4R2cuLsTyHv6OKbV !_oVaD0xpcpCCeJgxjeRuJ! !pipe%%i_val! " " +set /a _iJtJ2KDN229TfBStAqnI=10*%%i-!pipe_offset!-1 +call :create_pipe iKPv4R2cuLsTyHv6OKbV !_iJtJ2KDN229TfBStAqnI! !pipe%%i_val! "█" + ) + set /a pipe_offset+=1 + + rem redraw map + cls +call :draw_map iKPv4R2cuLsTyHv6OKbV +goto game_loop \ No newline at end of file diff --git a/windows/bat/flappybird/FlappyBird.exb b/windows/bat/flappybird/FlappyBird.exb new file mode 100644 index 0000000..c72422f --- /dev/null +++ b/windows/bat/flappybird/FlappyBird.exb @@ -0,0 +1,123 @@ +noout(chcp 65001) + +include(console) +include(time) +include(math) + +define(MAP_WIDTH, 50) +define(MAP_HEIGHT, 15) +define(PIPES_COUNT, 4) + +function get_cell(x, y, out_res) + set "$out_res=!map[$y][$x]!" +end function + +function set_cell(x, y, val) + set "map[$y][$x]=$val" +end function + +//function draw_map() +// for /l %%i in (0,1,calc{MAP_HEIGHT-1}) do ( +// set "txt=" +// for /l %%j in (0,1,calc{MAP_WIDTH-1}) do ( +// set "txt=!txt!!map[%%i][%%j]!" +// ) +// echo.!txt! +// ) +//end function + +function draw_map() + set i=0 + set j=0 + set /a mh=MAP_HEIGHT-1 + set /a mw=MAP_WIDTH-1 + + :_dm_loop_y + set "txt=" + :_dm_loop_x + pause>nul + call set txt=%txt%%%map[%i%][%j%]%% + set /a j+=1 + if %j% lss %mw% goto _dm_loop_x + title %j% %i% + set /a i+=1 + if %i% lss %mh% goto _dm_loop_y +end function + +function move_cell(old_x, old_y, new_x, new_y) + get_cell($old_x, $old_y, out _cell_val) + set_cell($old_x, $old_y, " ") + set_cell($new_x, $new_y, %_cell_val%) +end function + +function draw_player() + set_cell($player_x, $player_y, "●") +end function + +function create_pipe(x, val, char) + for /l %%i in (0,1,calc{$val-3}) do ( + set_cell($x, calc{MAP_HEIGHT-1-%%i}, "$char") + ) + for /l %%i in (0,1,calc{MAP_HEIGHT-$val-3}) do ( + set_cell($x, %%i, "$char") + ) +end function + +function create_pipes() + for /l %%i in (1,1,4) do ( + random(0, calc{MAP_HEIGHT-3}, out pipe%%i_val) + ) +end function + +function move_pipes(off) + for /l %%i in (1,1,4) do ( + create_pipe(calc{10*%%i-$pipe_offset}, $pipe%%i_val, " ") + create_pipe(calc{10*%%i-$pipe_offset-$off}, $pipe%%i_val, "█") + ) + set /a pipe_offset+=$off +end function + +title Flappy Bird + +set_size(MAP_WIDTH, calc{MAP_HEIGHT+2}) + +for /l %%i in (0,1,MAP_HEIGHT) do ( + for /l %%j in (0,1,MAP_WIDTH) do ( + set "map[%%i][%%j]= " + ) +) + +set player_x=2 +set player_y=7 +set pipe_offset=0 + +create_pipes() + +:game_loop + //read key + //read_key(3, "no_key", out key) + //if(%key% == Spacebar) + // //jump + // set_cell(%player_x%, %player_y%, " ") + // set /a player_y-=2 + // draw_player() + //end if + + //gravity + get_cell(%player_x%, calc{%player_y%+1}, out pc_val) + if("%pc_val%" == " " && %player_y% < calc{MAP_HEIGHT-1}) + set_cell(%player_x%, %player_y%, " ") + set /a player_y+=1 + end if + draw_player() + + for /l %%i in (1,1,4) do ( + create_pipe(calc{10*%%i-$pipe_offset}, $pipe%%i_val, " ") + create_pipe(calc{10*%%i-$pipe_offset-1}, $pipe%%i_val, "█") + ) + set /a pipe_offset+=1 + + //redraw map + cls + draw_map() +goto game_loop \ No newline at end of file diff --git a/windows/bat/flappybird/RUN.bat b/windows/bat/flappybird/RUN.bat new file mode 100644 index 0000000..15f70f2 --- /dev/null +++ b/windows/bat/flappybird/RUN.bat @@ -0,0 +1,2 @@ +@echo off +D:\folder\cs\exbat\exbat.exe --compile FlappyBird.exb FlappyBird.bat \ No newline at end of file