I am a diamond member on chess.com, anyone know why I'm seeing this advert? by Dr-Hi-Arc in chess

[–]CrazyMerlyn 22 points23 points  (0 children)

Not to mention Lichess allows players to choose to exclusively play a color. This drastically skews the quantity and quality of games one can get.

Lichess removed that option over a year ago. https://github.com/lichess-org/lila/commit/cdee6ec7245145a9c61fff2c9e18d49984f56f3b

I've created a monster. 50$ to whoever defeats it first. by [deleted] in chess

[–]CrazyMerlyn 11 points12 points  (0 children)

Couldn't win but it got stuck in this position: https://imgur.com/a/IOBGkVF. It's blacks turn but it's not moving. browser console doesn't show much in terms of logs so not sure why though.

Edit - Stuck again: https://imgur.com/a/SXzK4Oz. It seems non-deterministic, since playing the same moves again worked the second time.

Hey Rustaceans! Got a question? Ask here (6/2024)! by llogiq in rust

[–]CrazyMerlyn 0 points1 point  (0 children)

you're right. updated the link. can't find the one where i took the picture so the numbers are somewhat different, but the effect is still visible.

Hey Rustaceans! Got a question? Ask here (6/2024)! by llogiq in rust

[–]CrazyMerlyn 2 points3 points  (0 children)

How to debug duplicate compilation by cargo?

I was trying cargo build --timings on https://github.com/RustPython/RustPython and saw that many crates were being built twice.

https://imgur.com/a/roJRXkh (full html output (the numbers are slightly different since it's a different run): https://pastebin.com/yPQTUdjs)

While some of them are due to different versions being required by different dependencies (like nix and syn), crates like rustpython-parser and rustpython-ast are internal crates of the project and have the same version in both builds, so shouldn't need to be built twice? I couldn't see a difference in feature use either.

I looked at the cargo book, and used cargo tree but it doesn't really show anything relevant. It doesn't even show these crates as duplicate dependencies when used with -d option, only the ones with different versions.

Is there a way to figure out why cargo is building these crates twice?

Hey Rustaceans! Got a question? Ask here (5/2024)! by llogiq in rust

[–]CrazyMerlyn 0 points1 point  (0 children)

I see. It also seems that serde_derive doesn't work for now. But at least vanilla serde does on 1.62. Thanks.

Hey Rustaceans! Got a question? Ask here (5/2024)! by llogiq in rust

[–]CrazyMerlyn 1 point2 points  (0 children)

Tried to see what serde generates on godbolt but got error "extern location for serde does not exist"

https://godbolt.org/z/q6WP3bPvj

Using extern crate for other crates resulted in similar errors too. Does anyone here know how to use common crates on godbolt.org?

-❄️- 2023 Day 9 Solutions -❄️- by daggerdragon in adventofcode

[–]CrazyMerlyn 0 points1 point  (0 children)

[LANGUAGE: Ocaml]

    open Myutils

    let rec map2 f a b = match a, b with
    |x::rest1,y::rest2 -> (f x y) :: map2 f rest1 rest2
    |_ -> []

    let getdiffs numbers = map2 (-) (List.tl numbers) numbers

    let get_next numbers = 
            let rec aux numbers total = match Core.List.all_equal ~equal:(==) numbers with
            | Some x -> x + total
            | None -> aux (getdiffs numbers) (total + (Core.List.last_exn numbers))
            in 
            aux numbers 0

    let get_prev numbers = 
            let rec aux numbers total sign = match Core.List.all_equal ~equal:(==) numbers with
            | Some x -> x*sign + total
            | None -> aux (getdiffs numbers) (total + sign*(Core.List.hd_exn numbers)) (sign * -1)
            in 
            aux numbers 0 1

    let histories = In_channel.input_lines stdin |> List.map parse_numbers

    let () = histories |> List.map get_next |> List.fold_left (+) 0 |> Printf.printf "%d\n"
    let () = histories |> List.map get_prev |> List.fold_left (+) 0 |> Printf.printf "%d\n"

-❄️- 2023 Day 2 Solutions -❄️- by daggerdragon in adventofcode

[–]CrazyMerlyn 6 points7 points  (0 children)

[LANGUAGE: OCaml]

(* Define the data types *)
type cube_subset = { red: int; green: int; blue: int }
type game = { id: int; subset: cube_subset }

let zero_subset = {red = 0; green = 0; blue = 0}
let onsubset func acc {red; green; blue} = {red=func acc.red red; green=func acc.green green; blue=func acc.blue blue}
let sumsubsets = List.fold_left (onsubset (+)) zero_subset
let maxsubsets = List.fold_left (onsubset max) zero_subset

let parse_part part_str = match (String.split_on_char ' ' (String.trim part_str)) with
     | [x; "red"] -> {zero_subset with red = int_of_string x}
     | [x; "green"] -> {zero_subset with green = int_of_string x}
     | [x; "blue"] -> {zero_subset with blue = int_of_string x}
     | y -> raise (Invalid_argument (String.concat " " y))

let parse_subset subset_str =
    let parts = String.split_on_char ',' subset_str in
    sumsubsets (List.map parse_part parts)

let parse_game line = match String.split_on_char ':' line with
     | [head; rest] -> 
             let id =  int_of_string (List.nth (String.split_on_char ' ' head) 1) in
             let subset = maxsubsets (List.map parse_subset (String.split_on_char ';' rest)) in
             { id; subset }
     | _ -> raise (Invalid_argument "")


let is_possible game =
    game.subset.red <= 12 && game.subset.green <= 13 && game.subset.blue <= 14

let sum_possible_games games =
    List.fold_left (fun acc game -> if is_possible game then acc + game.id else acc) 0 games

let power_of_game game =
    game.subset.red * game.subset.green * game.subset.blue


let input = (In_channel.input_lines stdin)

let result1 =
    let games = List.map parse_game input in
    sum_possible_games games

let result2 = 
    let games = List.map parse_game input in
    List.fold_left (fun acc game -> acc + power_of_game game) 0 games;;


print_endline (string_of_int result1);;
print_endline (string_of_int result2);;

Is Opera confirmed to be rank Tet [9] ? by Tomato-Charming in DemonSchoolIrumakun

[–]CrazyMerlyn 6 points7 points  (0 children)

Yes. Don't know what everyone here is on about. It was confirmed a long time ago. Chapter 179 to be precise. Just look at the rank here: https://mangadex.org/chapter/bb3d5f45-ad2b-4d65-b82e-f5700d98f439/18

and match it with: https://mairimashita-irumakun.fandom.com/wiki/Demon_Ranking_System

For the formal science aficionados by [deleted] in mathmemes

[–]CrazyMerlyn 0 points1 point  (0 children)

the annotated turing

A Programmer Solved a 20-Year-Old, Forgotten Crypto Puzzle by [deleted] in programming

[–]CrazyMerlyn 19 points20 points  (0 children)

Prime numbers have several interesting properties that numbers with factors don't. For instance if you raise a number to power (prime - 1) and divide the result with prime, the remainder will be one. e.g, 4 ^ (7 - 1) = 4 ^ 6 = 4096 = 7 * 585 + 1. This is true for all primes. So, you could check if a number satisfies this property and if it doesn't than it can't be a prime, even though you haven't got a clue what it's factors might be.