Skip to content

Commit 21a8cc3

Browse files
committed
save 6 bytes
1 parent b8e203e commit 21a8cc3

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

main.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ void getSize(int *x, int *y) {
4949
#endif
5050
#define g(x, y, u, v, s) for (int j = 0, X = x, Y = y; j < v && Y + j < h - X / w && Y >= 0 && X >= 0; ++j) memcpy(&f[Y + j][X], &s[j * u], u)
5151
#define l(x, y, w, h, a, b, c, d) !((x - a > c && x >= a) || (a - x > w && a >= x) || (y - b > d && y >= b) || (b - y > h && b >= y))
52-
#define f(x, y, z) y += z * d; strcpy(b, x); break
52+
#define f(x, y, z) p.y += z * d; strcpy(b, x); break
5353
int main() {
5454
SetupConsole();
5555
puts("\x1b[?25l"); // hide cursor
@@ -67,13 +67,13 @@ int main() {
6767
memset(f, ' ', h * w); // clear the screen
6868
switch (u) { // could be minified...
6969
case UP:
70-
f(" /\\ / \\ vv ", p.y, -20);
70+
f(" /\\ / \\ vv ", y, -20);
7171
case DOWN:
72-
f(" ^^ \\ / \\/ ", p.y, 20);
72+
f(" ^^ \\ / \\/ ", y, 20);
7373
case RIGHT:
74-
f("<\\ < ></ ", p.x, 40);
74+
f("<\\ < ></ ", x, 40);
7575
case LEFT:
76-
f(" />< > \\>", p.x, -40);
76+
f(" />< > \\>", x, -40);
7777
}
7878
p.x = p.x < 4 ? 4 : p.x >= w - 4 ? w - 4 : p.x; // make sure the player is in the screen (horizontally)
7979
p.y = p.y < 2 ? 2 : p.y >= h - 3 ? h - 3 : p.y; // make sure the player is in the screen (vertically)

0 commit comments

Comments
 (0)