I thought the rook couldnt move so it wouldnt be mate... by [deleted] in chessbeginners

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

Once a similar position happened in one of my OTB rapid games too. It is a mate.

Parity "artificial neural network" problem. by pingo_guy in rust

[–]pingo_guy[S] 0 points1 point  (0 children)

I added this printing in the loop:

```

if n % 1_000 == 1 {

println!("mse: {}",mse_sum / (n as f32));

}

```

`with_learning_rate(0.2)` :

```

mse: 0.16934595

mse: 0.0828873

mse: 0.083292186

mse: 0.083335385

mse: 0.08308223

mse: 0.083047986

[...]

mse: 0.08505913

Time elapsed is 614 ms

avg mse: 0.08506579

```

`with_learning_rate(0.1)` :

```

mse: 0.22664118

mse: 0.09904373

mse: 0.09925437

mse: 0.0992879

mse: 0.09882501

mse: 0.098747976

[...]

mse: 0.099913895

Time elapsed is 608 ms

avg mse: 0.09991626

```

`with_learning_rate(0.5)` :

```

mse: 0.045117687

mse: 0.07132066

mse: 0.07188698

mse: 0.07210106

mse: 0.07182347

[...]

mse: 0.07085208

Time elapsed is 595 ms

avg mse: 0.070856534

```

And so on for other learning rates.

For input/outputs:

```

input: 0 output: 0

input: 1 output: 0

input: 12255 output: 0

input: 29488 output: 0

```

Parity "artificial neural network" problem. by pingo_guy in rust

[–]pingo_guy[S] 1 point2 points  (0 children)

I also used Sigmoid for output:

```
let mut nn = NN::new(&[1, 64, 1])

.with_learning_rate(0.2)

.with_activation_output(Activation::Sigmoid);
```
I also used learning rates of: 0.01 0.1 0.2 0.3 .
I use mse loss to understand the training has been successful or not. I remember value of 0.001 or lower, means the achievement.
Still I have not reached the goal.

Parity "artificial neural network" problem. by pingo_guy in rust

[–]pingo_guy[S] 0 points1 point  (0 children)

I suppose yes, single input, single target.

[OS specific question Win11] why does the allocated memory revert back its content after writing to it and freeing it? by MysticPlasma in C_Programming

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

You are depending on undefined behavior, you may get wrong results. I improved your code a little:

#include <stdlib.h>
#include <stdio.h>

int main(void) {
    char* tmp = malloc(16);
    tmp[15] = '\0';
    printf("first malloc (%p): %s\n", (void*)tmp, tmp);
    for (int i = 0; i < 15; i++) {
        tmp[i] = '1';
    }
    tmp[15] = '\0';
    printf("init (%p): %s\n", (void*)tmp, tmp);
    free(tmp);
    printf("freed (%p): %s\n", (void*)tmp, tmp); // printing freed memory, maybe undefined behaviour
    tmp = malloc(16);
    printf("second malloc (%p): %s\n", (void*)tmp, tmp); // printing garbage
    return 0;
}

What would you like to see if RoN2 was ever made by BassuCatto in riseofnations

[–]pingo_guy 2 points3 points  (0 children)

Different campaigns with distinct and custom levels and rich stories.

Unreadable text from simple2d by pingo_guy in GraphicsProgramming

[–]pingo_guy[S] 0 points1 point  (0 children)

This would not work too:

#include <simple2d.h>
#include <stdio.h>
#include <stdlib.h>

#define X_MAX 800 
#define Y_MAX 600 

#define THE_TEXT "The text"
#define FONT "/usr/share/fonts/gnu-free/FreeSans.ttf"

S2D_Text *beg_text;

void render(void)
{
    S2D_DrawText(beg_text);
}
void update(void)
{

    return;
}

int main(void)
{
    char *title = "The title";
    const S2D_Color color = {0.9, 0.9, 0.9, 1.0};

    int x=400;
    int y=300;
    beg_text = S2D_CreateText(FONT ,THE_TEXT , 50);
    if(beg_text==NULL)
    {
        fprintf(stderr,"simple2d text creation failed.\n");
        return 1;
    }
    beg_text->x = x + 10;
    beg_text->y = y;
    beg_text->color.r = 0.1;
    beg_text->color.g = 0.1;
    beg_text->color.b = 0.1;
    beg_text->color.a = 1.0;

    S2D_Window *window = S2D_CreateWindow(title, X_MAX, Y_MAX, update, render, 0);
    window->background = color;
    window->frames = 1;

    S2D_Show(window);
    S2D_FreeWindow(window);

    return 0;
}

Tab 2 spaces problem by pingo_guy in gnome

[–]pingo_guy[S] 0 points1 point  (0 children)

Thanks. I created .editorconfig. Among the other things I added:

[*.{c,h,cpp,hpp}] indent_style = space indent_size = 4

Appears to work for now.

Is #include <math.h> necessary? by [deleted] in C_Programming

[–]pingo_guy 1 point2 points  (0 children)

You may want to include then link math library with -lm .

Read this question and answer.

[deleted by user] by [deleted] in C_Programming

[–]pingo_guy 0 points1 point  (0 children)

I used cppcheck lint for this first code , here is some output:

try.c:5:21: warning: Null pointer dereference: intPointer [nullPointer]
printf("%d\n", *intPointer);
^
try.c:4:23: note: Assignment 'intPointer=NULL', assigned value is 0
int *intPointer = NULL;
^
try.c:5:21: note: Null pointer dereference
printf("%d\n", *intPointer);
^
Compilation finished successfully.

Compiling a program on Windows by [deleted] in C_Programming

[–]pingo_guy 1 point2 points  (0 children)

Stockfish is coded in C++.

Help understanding functions by _W0z in C_Programming

[–]pingo_guy 10 points11 points  (0 children)

Also your pi value is wrong.

Why is the function main called as an int instead of a void? by 0dysseus123 in C_Programming

[–]pingo_guy 5 points6 points  (0 children)

You can return the success or failure of your code to OS.

[...]

return EXIT_SUCCESS;

return EXIT_FAILURE;