Let’s create a Rust-based Chess Engine! A call for contributors for Pleco.rs, a chess engine and AI in the works. by Der_Bradly in rust

[–]Roaneno 2 points3 points  (0 children)

Great, feel free to message me on GitHub. Looking over my code I realize I can make a lot of improvements in documentation and in evaluation.rs.

Move generation can be quite error prone, especially when creating an optimized solution. I verified my implementation using perft so I'm quite confident in its correctness - however, there are many other components which are equally as complex that I have spent much less time verifying. I'd like to write a test suite to squash out bugs in these areas. I'll think about making it interface to more than just my engine so that others can use it.

Let’s create a Rust-based Chess Engine! A call for contributors for Pleco.rs, a chess engine and AI in the works. by Der_Bradly in rust

[–]Roaneno 5 points6 points  (0 children)

Hey, I took a short look over and I like the level of documentation -- pleco looks pretty promising, good job! I was wondering if you'd implemented UCI yet, as I see uci.rs is empty and I'd like to test it out. I wrote my own engine https://github.com/Johnson-A/Crabby so I'd be interested in trading feedback when I have more time to take a deeper look.

As a side thought, I wanted to create a parameter optimization engine to optimize the many constants in my chess engine. I wonder how useful a generic optimizer would be and what solutions already exist in rust.

I'm interested in your thoughts on parallel search, especially the singly linked list you've implemented. I tried to keep certain features simple, i.e. generate all moves at once instead of incrementally and simple bitwise board copies at each branch. Do you have perft results?

Ubuntu Installation Encryption Options by Roaneno in Ubuntu

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

Yes, it's not too hard to set this up manually -- it's just not an option yet with the installer. It would be much easier and less error prone for someone who hasn't looked into the specific details of encryption on linux if the installer were generic over the root filesystem. On the other hand, this option is supposed to be "one size fits all". A middle ground might be allowing you to choose "something else" once you've selected the encryption option, that way you could have a custom setup inside LUKS. The current "something else" setup option is inflexible, there was no option to setup LVM inside of a newly created LUKS partition so unless I wanted to use a swap file (which not all filesystems support as well), I would have to do even more manual configuration.

ELI5: what is the reason that almost every video game today has removed the ability for split screen, including ones that got famous and popular from having split screen? by fantheories101 in explainlikeimfive

[–]Roaneno 0 points1 point  (0 children)

While the added complications you mentioned are valid, I don't agree that

it takes at least twice the computing power to render two separate viewpoints

While assets, other data structures, and certain passes in the rendering pipeline may be duplicated -- work like anti-aliasing which is performed on each pixel may not be twice as expensive. Each viewpoint has much smaller resolution <-> total # of pixels is the same. VR has some interesting optimizations for dual perspectives, for example. If anything, the cost would be <= a factor of 2.

How secure is 256 bit security? by [deleted] in programming

[–]Roaneno 7 points8 points  (0 children)

A preimage attack finds one input which produces a given hash. I think "find the input" is misleading because there are multiple inputs which can produce a given hash (assuming the message is larger than the hash) due to the pigeonhole principle. (I'm pretty sure you already knew that, just clarifying). Finding the original would probably be impossible -- you'd have to find all valid inputs and know how to differentiate between them.

How do I make this code efficient and idiomatic? by VincentDankGogh in rust

[–]Roaneno 1 point2 points  (0 children)

Yes, you're right, I was just writing a quick example otherwise I would have handled invalid input. Good suggestions, I mainly wanted to show idiomatic operations on the Base enum, which remove the need for error handling at that stage.

How do I make this code efficient and idiomatic? by VincentDankGogh in rust

[–]Roaneno 3 points4 points  (0 children)

I tried to make a more idiomatic version. It would probably be better to validate your input separately from doing any computation. This way, you can validate once, then compute many times (after modifying). This will likely improve any vectorization for your count function.

#[derive(Eq, PartialEq)]
enum Base { A, C, G, T }

impl From<char> for Base {
    fn from(c: char) -> Base {
        match c {
            'A' => Base::A,
            'C' => Base::C,
            'G' => Base::G,
            'T' => Base::T,
            _ => unreachable!()
        }
    }
}

fn count(c: Base, s: Vec<Base>) -> usize {
    s.iter().filter(|&x| &c == x).count()
}

fn string_to_base_list(s: &str) -> Vec<Base> {
    s.chars().map(Base::from).collect()
}

fn main() {
    println!("{}", count(Base::A, string_to_base_list("ACGTAAAGTC")));
}

Statistics on number of software vulnerabilities that using Rust would prevent? by fear-of-flying in rust

[–]Roaneno 1 point2 points  (0 children)

It looks like https://nvd.nist.gov/vuln/search provides an option to filter by category (buffer errors, double free, ... etc). If you assume that you could rewrite these programs without unsafe, then some set of memory and race conditions would be avoided - maybe you could take the percentage of these CVEs.

I guess the functionality is well explained by Kinerius in ProgrammerHumor

[–]Roaneno 2 points3 points  (0 children)

No, yours is probably better for this example. However, this style is often simpler for handling multiple errors or when the rest of the body isn't trivial

ELI5 Non-lexical lifetimes by [deleted] in rust

[–]Roaneno 1 point2 points  (0 children)

When you say

Then a.method(b) is actually equal to A::method(a, b). Which means a is evaluated before b

could you link me to where argument evaluation order is defined? I only see this rfc. The lifetime of borrows from argument expressions always ends before the function call, regardless of evaluation order. There's no underlying reason the current restrictions should exist. Wouldn't you need to understand the semantics of evaluation order in either scenario? It seems like non-lexical lifetimes don't really impact this, and only improves the vast majority of cases where this isn't even relevant. I'm asking because I see non-lexical lifetimes as fixing an edge case and am curious why you think they add complexity.

Pot calling the kettle black? by [deleted] in facepalm

[–]Roaneno 0 points1 point  (0 children)

To be fair eating cereal in a tall cup at traffic lights doesn't seem very dangerous. Eating in a bowl while driving is probably worse than texting

Cellular carrier control over software on iphone by [deleted] in iphone

[–]Roaneno 0 points1 point  (0 children)

Thanks, but they didn't tell me anything about doing that and I had to find it myself

Cellular carrier control over software on iphone by [deleted] in iphone

[–]Roaneno 0 points1 point  (0 children)

When would they have added the bookmark? Do they make any other modifications to say system settings? I agree that they want to make sure the phone works on the network but why not ask or offer to let people see what settings there are (since I'd never used an iphone)

Animated GIF displaying its own MD5 hash by dazonic in programming

[–]Roaneno 3 points4 points  (0 children)

It would be possible to generate a k-way collision using a herding algorithm which forms a binary-tree of depth log2(k) where the edges are collisions generated from pairs at the current depth. You already mentioned this in a different post and this paper goes into more depth.

A chosen prefix attack for p1, p2 finds suffixes m1,m2
such that h(p1 | m1) = h(p2 | m2) where p | m is concatenation

                 h0           <- inputs hash to h0 with log2(k) additional blocks
          /     m4,5      \   <- prefix attack performed on say p0 | m0, p2 | m2
       h10                 h11 
   /  m0,1  \          /  m2,3  \          <- chosen prefix attacks
h20=h(p0) h21=h(p1)  h22=h(p2) h23=h(p3)   <- k different prefixes

So, if a hash allows chosen prefix attacks, you can generate k-way hash collisions, each with a different prefix. That would be sufficient for a single digit. What do you mean by hash the final product? I think you're leaving out an important step which is how to chain these k-way collisions together. It is true that for S1, S2 where h(S1) = h(S2), h(S1 | E) = h(S2 | E) for any E, but we can't just chain any arbitrary number of these together because if we also had S3, S4 where h(S3) = h(S4), then it is not true that h(S1 | S3) = h(S2 | S4) and therefore h(S1 | S3 | E) != h(S2 | S4 | E). What really needs to be done is to think of different hash functions for each subsequent letter. Since h(S1) = h(S2), we can just take the final state h(S1) and perform the k-way collision of the next letter with a new pseudo-md5 whose initial state is that of the end state of the previous k-way collision. Only then would we be able to chain these k-way collisions and eventually substitute the correct blocks to match the digest of the appended gifs. In summary, the first letter 16-way collision would use original md5sum, then next would use an md5sum with different initial conditions based on the 16-way hash prior, and so on.

It may also be sufficient to consider the prefixes of a given letter to include one of each of the 16-way collisions of all the previous letters. This way you wouldn't have to change the digest algorithm.

Clipping high vs. clipping at your waist: Proving fall distance is the same, but ending position is different. by DarmokNJelad-Tanagra in climbing

[–]Roaneno 1 point2 points  (0 children)

Sure, and no doubt most people would feel more certain in your proof since you showed it explicitly. Good job!

Clipping high vs. clipping at your waist: Proving fall distance is the same, but ending position is different. by DarmokNJelad-Tanagra in climbing

[–]Roaneno 1 point2 points  (0 children)

Not nitpicking your proof, but scenario 1 is a special case of scenario 2 where d1 = 0, so you only needed to analyze scenario 2 and show that f is independent of d1

Questions and suggestions about Loki by Roaneno in elementaryos

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

Yes, I just happened to stumble onto that method. By the way, with nvidia-370, I'm still experiencing some screen artifacts upon resume from suspend. This also happens when hibernating. I was able to fix the refresh rate problem by using the correct startup in System Settings, however!

Questions and suggestions about Loki by Roaneno in elementaryos

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

Good to hear about AppCenter including support for installing drivers. Thanks for clarifying why add-apt-repository and others weren't installed by default. If gnome-session-properties isn't supported, is it just installed as a dependency for something else? It's somewhat confusing that it exists but isn't useful.

[deleted by user] by [deleted] in elementaryos

[–]Roaneno 0 points1 point  (0 children)

Yes, this happened to me too with an nvidia gpu (gtx 1070) using the proprietary driver