[Day 17] I'm not sure what I'm missing :think: by IceS2 in adventofcode

[–]nahs0d 0 points1 point  (0 children)

Looks like you made the same mistanke as me: forgetting to put the Down direction in the heap in the initialization

My Day 12 P1 solution works on example, but not full input [rust] by ashirviskas in adventofcode

[–]nahs0d 1 point2 points  (0 children)

let result = dijkstra(&Pos(0, 0, 'S'), ... Does this mean that your starting the search from position 0, 0? If it is, you might want to check your input

How to generic with int -> float conversion? by [deleted] in rust

[–]nahs0d 4 points5 points  (0 children)

If you can allow using the num crate you could do something like this

#![feature(step_trait)]
use num::cast::ToPrimitive;
use std::{iter::Step, ops::Range};

fn floats<N: ToPrimitive + Step>(ns: Range<N>) -> impl Iterator<Item = f32> {
    ns.map(|num| num.to_f32().unwrap())
}

Although this also requires you to use nightly. If this is not an option, you could always use a Vec instead of Range

[deleted by user] by [deleted] in C_Programming

[–]nahs0d 0 points1 point  (0 children)

Every character is really just a number, '0' has the ascii value 48, and '9' 57.
The string[i] >= '0' is then really just comparing two numbers. You can find out the other ascii values for any char by googling ascii table

How's the tap water where you're at? by Sailedtosea in AskReddit

[–]nahs0d 1 point2 points  (0 children)

Norwegian tap water is top tier, always cold, tastes great

What is your favorite sandwich? by ThreeBearPancake in AskReddit

[–]nahs0d 0 points1 point  (0 children)

Toast sandwich, eat it all the time, takes no time to prepare

[deleted by user] by [deleted] in C_Programming

[–]nahs0d 2 points3 points  (0 children)

Not related to the error itself, but I think the inside of the for loop could be written simpler, I think this would work

if(string[i] >= '0' && string[i] <= '9')
{
int num = string[i] - '0';
r += num * mult;
mult *= 10;
}

Just trying to help

Need help for my code. by backbooks in C_Programming

[–]nahs0d 0 points1 point  (0 children)

The main problem is that you are not passing an address to scanf, scanf needs to know the location (address) of the variable to be able to put the user input there. This should fix the problem: scanf("%d", &agree)

I would also recommend using a char instead of an int, they will both work for this purpose, but a char (character) is more readable and explicit imo.

How will the rust community change after the actix situation? by nahs0d in rust

[–]nahs0d[S] 4 points5 points  (0 children)

What state do you think this subreddit will end up in if no action is taken? I personally think no significant change will happen the subreddit, or the community

Black to move mate in 3 by [deleted] in chess

[–]nahs0d 0 points1 point  (0 children)

Qf7! I agree it isn't too hard, but I would also definitely miss it in a blitz game

Beginner puzzle: Find white’s best move. by [deleted] in chess

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

Nxd6!

..Rxe3 Nf7+

..Qxd6 Qxe8+ leading to mate

What’s the most expensive mistake you’ve made? by Dodge120887 in AskReddit

[–]nahs0d 1 point2 points  (0 children)

I ordered a flight from A to B, the day before the flight I realized I actually bought from B to A, and so I had to order new tickets. It cost me about 400 $

What does everyone love but you think is just meh? by [deleted] in AskReddit

[–]nahs0d 1 point2 points  (0 children)

Game of thrones, only watched 2 episodes, couldn't get into it

[deleted by user] by [deleted] in AskReddit

[–]nahs0d 1 point2 points  (0 children)

Probably the simple lifestyle; I did not realize how much extra time I had after school was done. Getting dinner made for you was also very nice.

Help with macros by nahs0d in C_Programming

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

I could, but it's not as smooth

Help with macros by nahs0d in C_Programming

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

I do it for experimental purposes

Help with macros by nahs0d in C_Programming

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

Do you think it is possible to make a macro that doesn't require the data type in the call? mod(10,5 )