[ot][spam][crazy][crazy][spam]
Undiscussed Horrific Abuse, One Victim of Many
gmkarl at gmail.com
Sun May 15 08:48:23 PDT 2022
On Sun, May 15, 2022, 11:45 AM Undiscussed Horrific Abuse, One Victim of
Many <gmkarl at gmail.com> wrote:
> $ tput cup 2 2 | hd
> 00000000 1b 5b 33 3b 33 48 |.[3;3H|
> 00000006
> $ tput cup 4 5 | hd
> 00000000 1b 5b 35 3b 36 48 |.[5;6H|
> 00000006
>
> printf("\x1b\x5b%d;%dH", y, x);
>
#include <stdio.h>
typedef struct pt {
int x;
int y;
} pt;
void plot(int x, int y, char c)
{
printf("\x1b\x5b%d;%dH%c", y, x, c);
}
pt pt1 = {20,10};
pt pt2 = {40,30};
pt pt3 = {0,30};
void line(pt a, pt b)
{
pt change = {b.x - a.x, b.y - a.y};
int ctx = change.x > 0 ? change.x : -change.x;
int cty = change.y > 0 ? change.y : -change.y;
int ct = ctx > cty ? ctx : cty;
for (int t = 0; t <= ct; ++ t) {
plot(a.x + change.x * t / ct, a.y + change.y * t / ct, '*');
}
}
int main()
{
line(pt1, pt2);
line(pt2, pt3);
line(pt3, pt1);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/html
Size: 2471 bytes
Desc: not available
URL: <https://lists.cpunks.org/pipermail/cypherpunks/attachments/20220515/7e91fad4/attachment.txt>
More information about the cypherpunks
mailing list