back to scratko.xyz
aboutsummaryrefslogtreecommitdiff
path: root/tetris.pas
diff options
context:
space:
mode:
authorscratko <m@scratko.xyz>2024-03-22 01:26:07 +0300
committerscratko <m@scratko.xyz>2024-03-22 01:26:07 +0300
commite9a54e7ad4cd49b4e5583da9f8ccfacf904d276c (patch)
tree0f66c90390264299981d71f8ef2be31db38730aa /tetris.pas
parent7524bcbda6a6aa8db0b6989563602aeb5e159bdf (diff)
downloadtetris-e9a54e7ad4cd49b4e5583da9f8ccfacf904d276c.tar.gz
tetris-e9a54e7ad4cd49b4e5583da9f8ccfacf904d276c.tar.bz2
tetris-e9a54e7ad4cd49b4e5583da9f8ccfacf904d276c.zip
minor changes
Diffstat (limited to 'tetris.pas')
-rw-r--r--tetris.pas49
1 files changed, 24 insertions, 25 deletions
diff --git a/tetris.pas b/tetris.pas
index f3ce680..5196f9c 100644
--- a/tetris.pas
+++ b/tetris.pas
@@ -107,7 +107,7 @@ begin
esc: status.GoOut := true;
WhiteSpace: status.pause := true
end
- end;
+ end;
ClrBuf
end;
@@ -130,7 +130,7 @@ begin
end
end;
-procedure NewTetramino(var shape, NextShape: ShapeList; CurBorders: borders;
+procedure NewTetramino(var shape, NextShape: ShapeList; CurBorders: borders;
var status: GameStatus);
begin
if NextShape.first = nil then
@@ -219,12 +219,12 @@ const
type
LinesType = array [1..RulesTotal] of string[MaxLength];
var
- lines: LinesType =
+ lines: LinesType =
(
- 'Control keys:', 'moving left - <-', 'moving right - ->',
+ 'Control keys:', 'moving left - <-', 'moving right - ->',
'figure turn - ^', 'fall down - (down arrow)', 'pause - whitespace',
'exit - esc', 'Scoring system:', '50 points for completing 1 row',
- 'combo X2, X3 and X4 to the current points',
+ 'combo X2, X3 and X4 to the current points',
'You need to score 100 000 points'
);
i, x, y: integer;
@@ -278,7 +278,7 @@ begin
for i := y to y+height do
for j := x to x+width do
begin
- if ((j = x) or (j = x+width)) and (i >= y + 1) and
+ if ((j = x) or (j = x+width)) and (i >= y + 1) and
(i <= y + height - 1) then
begin
GotoXY(j, i);
@@ -288,7 +288,7 @@ begin
begin
GotoXY(j, i);
write('-')
- end
+ end
end
end;
@@ -298,7 +298,7 @@ var
begin
for i := CurBorders.up to CurBorders.down do
for j := CurBorders.left to CurBorders.right+1 do
- if (j = CurBorders.left) or
+ if (j = CurBorders.left) or
(j = CurBorders.right+1) then
begin
GotoXY(j, i);
@@ -309,7 +309,7 @@ begin
write('-')
end;
-procedure SetParamsGame(var status: GameStatus; var arr: WayFinding;
+procedure SetParamsGame(var status: GameStatus; var arr: WayFinding;
GoOut: boolean; CurBorders: borders);
begin
status.GoOut := GoOut;
@@ -329,7 +329,7 @@ begin
status.IsWin := false;
end;
-procedure ReloadGame(var arr: WayFinding; var status: GameStatus;
+procedure ReloadGame(var arr: WayFinding; var status: GameStatus;
CurBorders: borders);
const
Msg = 'Reload Game? Y/N';
@@ -368,7 +368,7 @@ begin
end
end;
-procedure CheckFillLine(var arr: WayFinding; var shape: ShapeList;
+procedure CheckFillLine(var arr: WayFinding; var shape: ShapeList;
CurBorders: borders; var status: GameStatus);
var
PosFillLine: integer;
@@ -395,8 +395,8 @@ begin
end
end;
-procedure StayAtBottom(var shape, ChangedShape, NextShape: ShapeList;
- var arr: WayFinding; CurBorders: borders;
+procedure StayAtBottom(var shape, ChangedShape, NextShape: ShapeList;
+ var arr: WayFinding; CurBorders: borders;
var status: GameStatus);
begin
ClearShape(ChangedShape.first);
@@ -413,7 +413,7 @@ begin
NewTetramino(shape, NextShape, CurBorders, status)
end;
-procedure SolveBorderProblem(var shape, ChangedShape: ShapeList;
+procedure SolveBorderProblem(var shape, ChangedShape: ShapeList;
CurBorders: borders; var status: GameStatus);
begin
ClearShape(ChangedShape.first);
@@ -450,7 +450,7 @@ begin
end;
PrintTurnsCount(status.TurnsCount)
end
- else
+ else
begin
{default direction}
shape.CurDir := down;
@@ -460,8 +460,8 @@ begin
end
end;
-procedure SolveTetraminoCollision(var shape, ChangedShape, NextShape: ShapeList;
- var arr: WayFinding; CurBorders: borders;
+procedure SolveTetraminoCollision(var shape, ChangedShape, NextShape: ShapeList;
+ var arr: WayFinding; CurBorders: borders;
var status: GameStatus);
begin
ClearShape(ChangedShape.first);
@@ -476,7 +476,7 @@ begin
exit
else
NewTetramino(shape, NextShape, CurBorders, status);
- exit
+ exit
end;
if status.TurnsCount >= LimitTurns then
begin
@@ -519,7 +519,7 @@ begin
end;
PrintTurnsCount(status.TurnsCount)
end
- else
+ else
begin
{default direction}
shape.CurDir := down;
@@ -529,7 +529,7 @@ begin
end
end;
-procedure RepositionTetramino(var shape, ChangedShape: ShapeList;
+procedure RepositionTetramino(var shape, ChangedShape: ShapeList;
CurBorders: borders; var status: GameStatus);
const
FallDown = 50;
@@ -588,7 +588,7 @@ begin
{select next direction from user}
if not status.fall then
begin
- if (status.TurnsCount < LimitTurns) and
+ if (status.TurnsCount < LimitTurns) and
FigureInVision(shape, CurBorders) and KeyPressed then
begin
SetUserDirection(shape, status);
@@ -615,7 +615,7 @@ begin
if status.pause then
begin
MakePause(status);
- delay(FastDuration)
+ delay(FastDuration)
end;
shape.CurDir := down;
status.IsUserInput := false;
@@ -637,7 +637,6 @@ const
msg2 = 'Please press any key...';
var
x, y: integer;
- key: integer;
begin
if (ScreenWidth < width) or (ScreenHeight < height) then
begin
@@ -689,7 +688,7 @@ begin
{IsObstacle's init in CheckBorders each time}
CheckBorders(shape, ChangedShape, CurBorders, IsObstacle);
if IsObstacle and (shape.CurDir = down) then
- StayAtBottom(shape, ChangedShape, NextShape, arr, CurBorders,
+ StayAtBottom(shape, ChangedShape, NextShape, arr, CurBorders,
status)
else if IsObstacle then
SolveBorderProblem(shape, ChangedShape, CurBorders, status)
@@ -697,7 +696,7 @@ begin
begin
LineInspection(shape, ChangedShape, arr, IsObstacle);
if IsObstacle then
- SolveTetraminoCollision(shape, ChangedShape, NextShape, arr,
+ SolveTetraminoCollision(shape, ChangedShape, NextShape, arr,
CurBorders, status)
else
RepositionTetramino(shape, ChangedShape, CurBorders, status)