Ategon

joined 2 years ago
MODERATOR OF
[–] [email protected] 2 points 1 year ago* (last edited 1 year ago)

Yeah ill be editing it and trying to relaunch it in the new year with a different format

[–] [email protected] 3 points 1 year ago (2 children)

The issue with that and reason why AoC doesnt use that for the leaderboard is they dont have access to the code people write, just the final result

Adding that as an option would mean having something that takes into account differences in base runtimes of code for different languages (e.g. scripting languages taking longer) so that its feasible to code it in anything, and having the ability to execute many different kinds of code which can be a pain to set up (and would mean youre then running arbitrary code unless you sandbox it)

I used that as the way to rank people in [email protected] when I was running that and its been on hiatus for awhile due to the effort needed to run it since I havent had time due to building up things in the instance such as [email protected]

It could work if self reported but then its easy to cheat

[–] [email protected] 2 points 1 year ago* (last edited 1 year ago) (1 children)

Small warning, the change to change how lemmy as a whole calculates active users just got pushed so instances may mess up the stats as they upgrade to 0.19 when thats stable (and instances using it rn when they upgrade to a more recent release client) (Makes how programming.dev and lemmynsfw calculate community stats the default)

[–] [email protected] 2 points 1 year ago

It doesn't, still spams low upvote posts, just slightly tweaked ordering

[–] [email protected] 2 points 1 year ago* (last edited 1 year ago) (1 children)

btw if you put the url to nim as /c/[email protected] I dont think the url bot will trigger since it does the same thing the ! format does

[Nim](/c/[email protected])

Nim

Edit: yeah looks like it didnt reply to me so this format works

[–] [email protected] 13 points 1 year ago (1 children)

Looks like a camelCase variable to me so its likely just a temporary word they replace with the actual bot name but something went wrong and it didn't replace it properly leading to the temporary text showing instead

There could be some other reasons but the actual cause cant really be determined without looking at the source code

[–] [email protected] 8 points 1 year ago (1 children)

Congrats on the alpha 🎉

[–] [email protected] 18 points 1 year ago (2 children)

Advent of code is an coding advent calendar where a new puzzle is released every day for people to solve

The numbers there (apart from the timer) in the site that was linked can be clicked to bring you to specific puzzles (1 aka Day 1 for the puzzle on the 1st of december, 2 aka Day 2 for the 2nd of december, etc.)

[–] [email protected] 2 points 1 year ago (1 children)

Weve got a go community in the site that you might get some answers from rather than the general community here [email protected]

[–] [email protected] 3 points 1 year ago* (last edited 1 year ago) (1 children)

This is more a community for the development side being activitypub instead of fediverse

Theres communities like [email protected] though

I haven't touched friendica much so dont know the answer to that

[–] [email protected] 1 points 1 year ago* (last edited 1 year ago)

JavaScript

Ended up misreading the instructions due to trying to go fast. Built up a system to compare hand values like its poker before I realized its not poker

Likely last day im going to be able to write code for due to exams coming up

Code Link

Code Block

// Part 1
// ======

function part1(input) {
  const lines = input.replaceAll("\r", "").split("\n");
  const hands = lines.map((line) => line.split(" "));

  const sortedHands = hands.sort((a, b) => {
    const handA = calculateHandValue(a[0]);
    const handB = calculateHandValue(b[0]);

    if (handA > handB) {
      return -1;
    } else if (handA < handB) {
      return 1;
    } else {
      for (let i = 0; i < 5; i++) {
        const handACard = convertToNumber(a[0].split("")[i]);
        const handBCard = convertToNumber(b[0].split("")[i]);
        if (handACard > handBCard) {
          return 1;
        } else if (handACard < handBCard) {
          return -1;
        }
      }
    }
  });

  return sortedHands
    .filter((hand) => hand[0] != "")
    .reduce((acc, hand, i) => {
      return acc + hand[1] * (i + 1);
    }, 0);
}

function convertToNumber(card) {
  switch (card) {
    case "A":
      return 14;
    case "K":
      return 13;
    case "Q":
      return 12;
    case "J":
      return 11;
    case "T":
      return 10;
    default:
      return parseInt(card);
  }
}

function calculateHandValue(hand) {
  const dict = {};

  hand.split("").forEach((card) => {
    if (dict[card]) {
      dict[card] += 1;
    } else {
      dict[card] = 1;
    }
  });

  // 5
  if (Object.keys(dict).length === 1) {
    return 1;
  }

  // 4
  if (Object.keys(dict).filter((key) => dict[key] === 4).length === 1) {
    return 2;
  }

  // 3 + 2
  if (
    Object.keys(dict).filter((key) => dict[key] === 3).length === 1 &&
    Object.keys(dict).filter((key) => dict[key] === 2).length === 1
  ) {
    return 3;
  }

  // 3
  if (Object.keys(dict).filter((key) => dict[key] === 3).length === 1) {
    return 4;
  }

  // 2 + 2
  if (Object.keys(dict).filter((key) => dict[key] === 2).length === 2) {
    return 5;
  }

  // 2
  if (Object.keys(dict).filter((key) => dict[key] === 2).length === 1) {
    return 6;
  }

  return 7;
}

// Part 2
// ======

function part2(input) {
  const lines = input.replaceAll("\r", "").split("\n");
  const hands = lines.map((line) => line.split(" "));

  const sortedHands = hands.sort((a, b) => {
    const handA = calculateHandValuePart2(a[0]);
    const handB = calculateHandValuePart2(b[0]);

    if (handA > handB) {
      return -1;
    } else if (handA < handB) {
      return 1;
    } else {
      for (let i = 0; i < 5; i++) {
        const handACard = convertToNumberPart2(a[0].split("")[i]);
        const handBCard = convertToNumberPart2(b[0].split("")[i]);
        if (handACard > handBCard) {
          return 1;
        } else if (handACard < handBCard) {
          return -1;
        }
      }
    }
  });

  return sortedHands
    .filter((hand) => hand[0] != "")
    .reduce((acc, hand, i) => {
      console.log(acc, hand, i + 1);
      return acc + hand[1] * (i + 1);
    }, 0);
}

function convertToNumberPart2(card) {
  switch (card) {
    case "A":
      return 14;
    case "K":
      return 13;
    case "Q":
      return 12;
    case "J":
      return 1;
    case "T":
      return 10;
    default:
      return parseInt(card);
  }
}

function calculateHandValuePart2(hand) {
  const dict = {};

  let jokers = 0;

  hand.split("").forEach((card) => {
    if (card === "J") {
      jokers += 1;
      return;
    }
    if (dict[card]) {
      dict[card] += 1;
    } else {
      dict[card] = 1;
    }
  });

  // 5
  if (jokers === 5 || Object.keys(dict).length === 1) {
    return 1;
  }

  // 4
  if (
    jokers === 4 ||
    (jokers === 3 &&
      Object.keys(dict).filter((key) => dict[key] === 1).length >= 1) ||
    (jokers === 2 &&
      Object.keys(dict).filter((key) => dict[key] === 2).length === 1) ||
    (jokers === 1 &&
      Object.keys(dict).filter((key) => dict[key] === 3).length === 1) ||
    Object.keys(dict).filter((key) => dict[key] === 4).length === 1
  ) {
    return 2;
  }

  // 3 + 2
  if (
    (Object.keys(dict).filter((key) => dict[key] === 3).length === 1 &&
      Object.keys(dict).filter((key) => dict[key] === 2).length === 1) ||
    (Object.keys(dict).filter((key) => dict[key] === 2).length === 2 &&
      jokers === 1)
  ) {
    return 3;
  }

  // 3
  if (
    Object.keys(dict).filter((key) => dict[key] === 3).length === 1 ||
    (Object.keys(dict).filter((key) => dict[key] === 2).length === 1 &&
      jokers === 1) ||
    (Object.keys(dict).filter((key) => dict[key] === 1).length >= 1 &&
      jokers === 2) ||
    jokers === 3
  ) {
    return 4;
  }

  // 2 + 2
  if (
    Object.keys(dict).filter((key) => dict[key] === 2).length === 2 ||
    (Object.keys(dict).filter((key) => dict[key] === 2).length === 1 &&
      jokers === 1)
  ) {
    return 5;
  }

  // 2
  if (
    Object.keys(dict).filter((key) => dict[key] === 2).length === 1 ||
    jokers
  ) {
    return 6;
  }

  return 7;
}

export default { part1, part2 };

[–] [email protected] 2 points 1 year ago* (last edited 1 year ago)

top left of the site in the navbar, and for sites who collect all of the different instances such as join-lemmy and lemmyverse. Also shows up in things like error pages in the new frontend

Smaller in the navbar but in the cases of join-lemmy and the things like error pages its larger (you can see the size by going to https://join-lemmy.org/instances?topic=all_topics&language=all&scroll=true)

 

And were up to the third language to guess! This one might be a bit harder for most people compared to the last two. Throw your guesses down below and ill reveal the answer in a day

 

Answer will be revealed in a day. Comment your guesses below

 

Give your guesses below, answer will get posted in a day

3
Guess the language: #1 (programming.dev)
submitted 2 years ago* (last edited 2 years ago) by [email protected] to c/[email protected]
 

Throw your guesses down below. Answer will be given in a day

2
submitted 2 years ago* (last edited 2 years ago) by [email protected] to c/[email protected]
 

Welcome to the programming trivia community! This will be a spot where you can post questions related to the instance and others will have a chance to guess answers

Answers should be given in the comments around a day after the question was posted and do not look up answers on search engines if you are answering it. Just post a guess for what you think the answer is in the comments

Ill be doing daily questions (and will do some more today + tomorrow to start the community off) but feel free to post your own as well

To start off heres a history-related question, enjoy!

6
Comment language bug fix (programming.dev)
submitted 2 years ago* (last edited 2 years ago) by [email protected] to c/[email protected]
 

Ive recently been made aware of a language bug existing from building up my remindme bot

The bug was that comments from platforms such as kbin will naturally be set to an undetermined language regardless of what the community language settings are. This makes it so that if people try to reply to that comment, lemmy will break and not let the reply be posted (since its a language that goes against what the community has set)

As a fix to this I have set every community I have access to to be able to handle every single language. (This should be about 90% of the communities, you can check the list in my profile). You shouldnt run into any language invalid errors anymore and should be able to talk to people from kbin now in almost all communities in the instance

You may still run into the bug in other instances though depending on what they have their community language set to

 

Unity has 59% of all games Godot has 19% Gamemaker has 5% And unreal has a bit below 5%

Compared to last year Unity (-4%) Godot (+7%) Gamemaker (-6%) Unreal (~)

 

cross-posted from: https://lemmy.world/post/1712737

Saw the author tooting about this project on Mastodon and I wanted to share it with everyone here.

We’ve all been there. You get to the end of a game jam and realise you need to set up an Itch page asap, or you’re wrapping up a long term project and you’re too burnt out to have the energy to even think.

This is a template pack that aims to take that pesky thinking out of the process. Just follow the template dimensions for the various images on your Itch page, and that’s one less thing to worry about and one more thing helping you stand out from all those unloved pages out there.

Find the download at: https://jannikboysen.itch.io/easy-releasy

Originally posted in the other gamedev community by TeaHands

Mastodon author is https://peoplemaking.games/@sparkles

view more: ‹ prev next ›