Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off & setlocal enableDelayedExpansion
- %multithread_dispatcher%
- set numDistances=7
- set /a "d0=1, d1=5, d2=200, d3=500, d4=400, d5=150, d6=50, d7=5, far=1"
- if not exist %temp%\Canvas_3.txt call :map
- call :updateCanvas /f 3
- call :mathMacros
- set /a "dx=18", "dy=14"
- set /a "totalSheep=6", "sheepMoveSpeed=0", "maxSheepRadarDistance=8"
- set "frame=-1"
- for /l %%a in (0,1,%totalSheep%) do set /a "sheep_x[%%a]=18 - (%%a + 2)", "sheep_y[%%a]=19 - %%a"
- call :multiThread GAME_ENGINE "wasdp"
- goto :eof
- :GAME_ENGINE
- ( for /l %%# in () do ( set /a "frame+=1", "sheepMoveChance=frame %% (sheepMoveSpeed + 1)", "currentSheep=frame %% (totalSheep + 1)"
- %controller% & %move% w a s d . . . . dx dy
- for /l %%a in (0,1,%totalSheep%) do %plot% sheep_x[%%a] sheep_y[%%a] %%a
- for /f "tokens=1,2" %%0 in ("!currentSheep! !random!") do ( set "com=nul" & set "totalRaffles=0"
- if !sheepMoveChance! equ 0 (
- set "dirID=0"
- for %%b in ("-1 -1","0 -1","1 -1","1 0","1 1","0 1","-1 1","-1 0") do (
- for /f "tokens=1,2" %%c in (%%b) do set /a "sheep[%%0][!dirID!]X=%%c + sheep_x[%%0]", "sheep[%%0][!dirID!]Y=%%d + sheep_y[%%0]"
- set /a "dirID+=1"
- )
- for /l %%b in (0,1,7) do ( for /l %%c in (0,1,!totalSheep!) do (
- if "%%c" neq "%%0" (
- set /A "x1=sheep[%%0][%%b]X, x2=sheep_x[%%c], y1=sheep[%%0][%%b]Y, y2=sheep_y[%%c], sheepDistance=%getDistance(x2,x1,y2,y1)%"
- set "forCatch=false"
- for /l %%d in (0,1,!numDistances!) do (
- if "!forCatch!" neq "true" if !sheepDistance! == %%d (
- set /a "sheep[%%0][%%b]+=!buyRaffles(x):x=d%%d!"
- set "forCatch=true"
- if !debug! == 1 (
- set /a "r=!buyRaffles(x):x=d%%d!"
- echo sheepDistance: !sheepDistance! +!d%%d! [!r!] raffles >>debug.txt
- )
- )
- )
- if !sheepDistance! GTR !numDistances! (
- set /a "sheep[%%0][%%b]+=!buyRaffles(x):x=far!"
- if !debug! == 1 (
- set /a "r=!buyRaffles(x):x=far!"
- echo sheepDistance: !sheepDistance! +!far! [!r!] raffles >>debug.txt
- )
- )
- )
- set /A "x1=dx, x2=sheep_x[%%0], y1=dy, y2=sheep_y[%%0], distance_D=%getDistance(x2,x1,y2,y1)%"
- if !distance_D! geq %maxSheepRadarDistance% (
- set "c[%%0]=0"
- REM if !distance_D! leq 2 ( set /a "sheep[%%0][%%b]+=(9362 * 2)"
- REM ) else if !distance_D! equ 3 ( set /a "sheep[%%0][%%b]+=(1560 * 2)"
- REM ) else if !distance_D! equ 4 ( set /a "sheep[%%0][%%b]+=(312 * 2)"
- REM ) else if !distance_D! equ 5 ( set /a "sheep[%%0][%%b]+=(78 * 2)"
- REM ) else if !distance_D! equ 6 ( set /a "sheep[%%0][%%b]+=(26 * 2)"
- REM ) else if !distance_D! equ 7 ( set /a "sheep[%%0][%%b]+=(13 * 2)"
- REM ) else if !distance_D! geq 8 ( set /a "sheep[%%0][%%b]+=(13 * 2)"
- REM )
- ) else ( set "c[%%0]=1" )
- )
- set /a "totalRaffles+=!sheep[%%0][%%b]!"
- )
- if !totalRaffles! gtr %%1 (
- if !debug! == 1 echo Picking a raffle winner, since totalRaffles [!totalRaffles!] is GTR than random [%%1] >>debug.txt
- set /a "selectedRaffle=%%1 %% totalRaffles"
- for /l %%b in (0,1,7) do (
- set /a "selectedRaffle-=!sheep[%%0][%%b]!", "sheep[%%0][%%b]=0"
- if !selectedRaffle! LEQ 0 if "!com!" equ "nul" ( set "com=%%b" )
- )
- )
- )
- %move% 1 7 5 3 4 6 2 0 sheep_x[%%0] sheep_y[%%0]
- )
- %adjustCamera% dx dy
- call:showCanvas !dx! !dy! D
- call:updateCanvas /v 3
- ) )
- exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement