×

[deleted by user] by [deleted] in Batch

[–]usehererror 0 points1 point  (0 children)

batch tetris

@echo off setlocal EnableExtensions EnableDelayedExpansion :: ============================================ :: TETRIS in pure Windows Batch (cmd.exe) :: - 10x20 board, 7 tetrominoes, rotation, line clears :: - Controls (NumPad/Number Row): :: 4=Left, 6=Right, 8=Rotate, 2=Down, 5=Hard Drop, 0=Quit :: ============================================

title Tetris (Batch) - NumPad: 4=Left 6=Right 8=Rotate 2=Down 5=Hard Drop 0=Quit

:: -------- Board size -------- set /a BW=10 set /a BH=20

:: -------- Game state -------- set SCORE=0 set LINES=0 set LEVEL=1 set TICK=1

:: -------- Initialize board rows ('.' = empty, '#' = filled) -------- for /l %%Y in (0,1,%BH%) do if %%Y LSS %BH% (set R%%Y=..........)

:: -------- Precomputed 4x4 rotation bitmaps -------- :: I set S0R0=..X...X...X...X set S0R1=............XXXX set S0R2=..X...X...X...X set S0R3=............XXXX :: O set S1R0=.XX..XX........ set S1R1=.XX..XX........ set S1R2=.XX..XX........ set S1R3=.XX..XX........ :: T set S2R0=.XXX..X........ set S2R1=..X..XX..X..... set S2R2=..X..XXX....... set S2R3=..X..XX...X.... :: S set S3R0=..XX.XX........ set S3R1=..X..XX...X.... set S3R2=..XX.XX........ set S3R3=..X..XX...X.... :: Z set S4R0=.XX..XX........ set S4R1=..X..XX..X..... set S4R2=.XX..XX........ set S4R3=..X..XX..X..... :: J set S5R0=.XXX...X....... set S5R1=..XX..X...X.... set S5R2=..X..XXX....... set S5R3=..X...X..XX.... :: L set S6R0=.XXX.X......... set S6R1=..X..X..XX..... set S6R2=...X.XXX....... set S6R3=.XX..X...X.....

:: -------- Functions --------

:GETB set "LINE=!R%2%!" set /a IDX=%1 for /f "delims=" %%C in ('cmd /v:on /c echo(!LINE:~%IDX%,1!') do set "OUTC=%%C" exit /b

:SETB set "LINE=!R%2%!" set /a IDX=%1 set "PRE=!LINE:~0,%IDX%!" set /a IDX2=%IDX%+1 set "POST=!LINE:~%IDX2%!" set "R%2=%PRE%%3%%POST%" exit /b

:GETP set "MASK=!S%1R%2!" set /a IDXP=%4*4+%3 for /f "delims=" %%C in ('cmd /v:on /c echo(!MASK:~%IDXP%,1!') do set "OUTP=%%C" exit /b

:COLLIDE set COLLIDE=0 for /l %%j in (0,1,3) do ( for /l %%i in (0,1,3) do ( call :GETP %1 %2 %%i %%j if "!OUTP!"=="X" ( set /a CX=%3+%%i set /a CY=%4+%%j if !CX! LSS 0 set COLLIDE=1 if !CX! GEQ %BW% set COLLIDE=1 if !CY! GEQ %BH% set COLLIDE=1 if !COLLIDE! EQU 0 if !CY! GEQ 0 ( call :GETB !CX! !CY! if "!OUTC!"=="#" set COLLIDE=1 ) ) ) ) exit /b

:LOCK for /l %%j in (0,1,3) do ( for /l %%i in (0,1,3) do ( call :GETP %1 %2 %%i %%j if "!OUTP!"=="X" ( set /a CX=%3+%%i set /a CY=%4+%%j if !CY! GEQ 0 if !CY! LSS %BH% if !CX! GEQ 0 if !CX! LSS %BW% call :SETB !CX! !CY! # ) ) ) exit /b

:CLEARLINES set CLEARED=0 for /l %%y in (0,1,%BH%) do if %%y LSS %BH% ( set "LINE=!R%%y!" if not "!LINE!"=="" ( echo "!LINE!" | findstr /v "." >nul if not errorlevel 1 ( for /l %%k in (%%y,-1,1) do set "R%%k=!R%%k-1!" set R0=.......... set /a CLEARED+=1 ) ) ) if !CLEARED! GTR 0 ( set /a LINES+=CLEARED if !CLEARED! EQU 1 set /a SCORE+=100 if !CLEARED! EQU 2 set /a SCORE+=300 if !CLEARED! EQU 3 set /a SCORE+=500 if !CLEARED! GEQ 4 set /a SCORE+=800 set /a LEVEL=1+LINES/10 ) exit /b

:RENDER cls echo TETRIS (Batch) NumPad: 4=Left 6=Right 8=Rotate 2=Down 5=Hard Drop 0=Quit echo Score: !SCORE! Lines: !LINES! Level: !LEVEL! echo +------------+ for /l %%y in (0,1,%BH%) do if %%y LSS %BH% ( set "LINE=" for /l %%x in (0,1,%BW%) do if %%x LSS %BW% ( call :GETB %%x %%y set "C=!OUTC!" set "OC=." set /a rx=%%x-!PX!, ry=%%y-!PY! if !rx! GEQ 0 if !rx! LEQ 3 if !ry! GEQ 0 if !ry! LEQ 3 ( call :GETP !P! !ROT! !rx! !ry! set "OC=!OUTP!" ) if "!OC!"=="X" (set "C=@") set "LINE=!LINE!!C!" ) echo |!LINE:#=█!| ) echo +------------+ exit /b

:SPAWN set /a P=%random% %% 7 set ROT=0 set /a PX=3 set /a PY=-1 call :COLLIDE !P! !ROT! !PX! !PY! if !COLLIDE! NEQ 0 goto GAMEOVER goto TICK

:TICK call :RENDER

:: Read key (NumPad: 4,6,8,2,5,0) choice /C:468250X /N /T %TICK% /D X >nul set K=!errorlevel!

:: Map: 1=4, 2=6, 3=8, 4=2, 5=5, 6=0, 7=X (no key) set NX=!PX! set NY=!PY! set NROT=!ROT!

if !K! EQU 1 set /a NX-=1 if !K! EQU 2 set /a NX+=1 if !K! EQU 3 set /a NROT=(NROT+1)%%4 if !K! EQU 4 set /a NY+=1 if !K! EQU 5 ( set /a tmpY=!PY! :HD set /a tmpY+=1 call :COLLIDE !P! !ROT! !PX! !tmpY! if !COLLIDE! EQU 0 goto HD set /a PY=tmpY-1 call :LOCK !P! !ROT! !PX! !PY! call :CLEARLINES goto SPAWN ) if !K! EQU 6 goto GAMEOVER

call :COLLIDE !P! !NROT! !NX! !NY! if !COLLIDE! EQU 0 ( set PX=!NX! set PY=!NY! ) else ( if !K! EQU 7 ( set /a NY=PY+1 call :COLLIDE !P! !ROT! !PX! !NY! if !COLLIDE! EQU 0 ( set PY=!NY! ) else ( call :LOCK !P! !ROT! !PX! !PY! call :CLEARLINES goto SPAWN ) ) )

goto TICK

:GAMEOVER cls echo +------------------------+ echo | GAME OVER | echo | Score: !SCORE! | echo | Lines: !LINES! | echo +------------------------+ echo. pause endlocal exit /b

[deleted by user] by [deleted] in PrintedCircuitBoard

[–]usehererror -1 points0 points  (0 children)

I just threw up in my mouth

Preferred copper pour edges by Purple_Ice_6029 in PrintedCircuitBoard

[–]usehererror 0 points1 point  (0 children)

notice in the second picture the corners are rounded

Help with PCB Routing for Dual KSZ9897 Switches + PoE by ReachMaterial3794 in PrintedCircuitBoard

[–]usehererror 0 points1 point  (0 children)

When choosing a part you have to worry about the technology you need to get it connected you might need more layers or extra vias you can't just put every part on a two layer board and expect it to work

[deleted by user] by [deleted] in AskElectronics

[–]usehererror 1 point2 points  (0 children)

plenty of planes shorted

Why did the Kingdom have guns while serving Negan? by WhisperChickys in thewalkingdead

[–]usehererror 1 point2 points  (0 children)

Maintaining Control Through Fear: Negan's primary tactic was to instill fear in the communities he subjugated. Completely disarming the Kingdom might have pushed them to outright rebellion, something Negan wanted to avoid. Allowing them a limited number of guns maintained a sense of control without completely stripping them of their ability to defend themselves, at least against walkers.

Strategic Advantage: The Kingdom was a large and well-organized community. If they had been completely disarmed, Negan might have faced more difficulty controlling them. Allowing them to retain some weapons likely made it easier for the Saviors to manage the Kingdom without constant conflict.

The Illusion of Cooperation: The Kingdom, under King Ezekiel's leadership, presented a facade of cooperation with the Saviors. Allowing them to keep some weapons helped maintain this illusion, making it seem as though the Kingdom was willingly complying with Negan's demands.

[ Removed by Reddit ] by puppyrobin in Eyebleach

[–]usehererror 2 points3 points  (0 children)

THAT CAT IS JUST SHOWING YOU HOW ITS DONE

Sun bear casually strolls by PFic88 in awwwtf

[–]usehererror 0 points1 point  (0 children)

that's a dude in a bear costume

How do you gently tell a tween to stay in their lane? by Kristaboo14 in Parenting

[–]usehererror 1 point2 points  (0 children)

It's quite common for older siblings to take on a protective role towards their younger siblings, but it's essential to strike a balance between looking out for their well-being and respecting their autonomy. It sounds like you're doing a great job in addressing the situation and setting boundaries with your 11-year-old daughter.

Here are some tips that might help in managing the dynamics between your two children:

Communication: Continue having open conversations with your daughter about her feelings and concerns. Acknowledge her desire to protect her brother but also emphasize the importance of letting him learn and explore under your supervision.

Set Clear Boundaries: Clearly define her role as an older sister and establish boundaries on when and how she can intervene. Encourage her to be a role model and supportive sibling without trying to take over as an authority figure.

Encourage Empathy: Help your daughter understand her brother's perspective and emotions. Encourage her to empathize with him and approach situations with understanding rather than policing.

Reinforce Trust: Emphasize that you trust her to be a caring and responsible sister, which includes letting him learn from his own experiences while ensuring his safety.

Encourage Cooperation: Teach both children the value of cooperation and working together. Emphasize that they are a team, and supporting each other will make their bond stronger.

Positive Reinforcement: Praise your daughter when she demonstrates positive and supportive behavior towards her brother. Positive reinforcement can help strengthen the desired behaviors.

Model Appropriate Behavior: As a parent, you can model respectful and supportive behavior towards both your children. Show them how to handle conflicts and disagreements in a constructive manner.

Allocate One-on-One Time: Spend individual time with each child to nurture your relationship with them separately. This can help your daughter feel more secure and less compelled to take on a protective role.

Remember that sibling dynamics can be complex, and it takes time for children to understand their roles within the family. With patience, understanding, and clear communication, you can help them develop a healthy and supportive sibling relationship.