/dpt/ - Daily Programming Thread

old thread: What are you working on, Sup Forums?

Other urls found in this thread:

pastebin.com/3trwadwa
en.wikipedia.org/w/api.php?action=query&list=categorymembers&cmprop=title&cmlimit=500&cmtitle=Category:Gay_men's_choruses
algomation.com/algorithm/quick-sort-visualization
youtube.com/watch?v=QM1iUe6IofM
twitter.com/NSFWRedditGif

learning lisp ironically

nice pic but this thread's a tad early

she is the cutest

>she

Doesn't really matter.
The only people who actually care are the nerds who want to pick the OP image.
Is there really anyone else that has reasons to complain?

first for Java

First for D

because it's a waste of a bit of a thread and it puts another in the archive, plus it leads to thread wars

How are you enjoying this year's advent of code?
Here's my day 3 pt 2.
int valid_triangle(int *arr)
{
if (arr[0] + arr[1] > arr[2] &&
arr[0] + arr[2] > arr[1] &&
arr[1] + arr[2] > arr[0])
return 1;
else
return 0;
}

int main(void)
{
char *ins = get_filebuffer(DAY(03));
int sides[3][3] = { { 0 } };
unsigned col = 0, row = 0;
unsigned valid = 0;
char *tok = strtok(ins, " \n");
while (tok != NULL)
{
sscanf(tok, "%d", &sides[row++ % 3][col % 3]); /* vertical */
if ((row % 3) == 2)
col++;
if (!(row % 3) && !(col % 3))
{
unsigned i; /* flatten array */
for (i = 0; i < 3; i++)
{
int arr[3] = { sides[i][0], sides[i][1], sides[i][2] };
if (valid_triangle(arr))
valid++;
}
}
tok = strtok(NULL, " \n");
}
printf("Valid triangles: %d\n", valid);
free(ins);
return 0;
}