Ategon
Ill be submitting some logos and another banner that im making in gimp later in the week
Edit: exams are pain, will do that before the end of the month
Starting off banner submissions with a quick banner generated from midjourney
Example view of it in lemmy explorer
Turns out I got really lucky and my location value is much lower than most peoples which is why it can be solved relatively quickly
[JavaScript] Well that was by far the hardest out of all of the days, part 1 was relatively fine but part 2 took me awhile of trying different things
Ended up solving it by working backwards by trying different location values and seeing if that can become a valid seed. Takes around 3 secs to compute the answer.
Part 1 Code Block
// Part 1
// ======
function part1(input) {
const split = input.split("\r\n\r\n");
let pastValues = split[0].match(/\d+/g).map((x) => parseInt(x));
let currentValues = [];
for (const section of split.slice(1)) {
for (const line of section.split("\r\n")) {
const values = line.match(/\d+/g)?.map((x) => parseInt(x));
if (!values) {
continue;
}
const sourceStart = values[1];
const destinationStart = values[0];
const length = values[2];
for (let i = 0; i < pastValues.length; i++) {
if (
pastValues[i] >= sourceStart &&
pastValues[i] < sourceStart + length
) {
currentValues.push(destinationStart + pastValues[i] - sourceStart);
pastValues.splice(i, 1);
i--;
}
}
}
for (let i = 0; i < pastValues.length; i++) {
currentValues.push(pastValues[i]);
}
pastValues = [...currentValues];
currentValues = [];
}
return Math.min(...pastValues);
}
Part 2 Code Block
// Part 2
// ======
function part2(input) {
const split = input.split("\r\n\r\n");
let seeds = split[0].match(/\d+/g).map((x) => parseInt(x));
seeds = seeds
.filter((x, i) => i % 2 == 0)
.map((x, i) => [x, seeds[i * 2 + 1]]);
const maps = split
.slice(1)
.map((x) => {
const lines = x.split("\r\n");
return lines
.map((x) => x.match(/\d+/g)?.map((x) => parseInt(x)))
.filter((x) => x);
})
.reverse();
for (let i = 0; true; i++) {
let curValue = i;
for (const map of maps) {
for (const line of map) {
const sourceStart = line[1];
const destinationStart = line[0];
const length = line[2];
if (
curValue >= destinationStart &&
curValue < destinationStart + length
) {
curValue = sourceStart + curValue - destinationStart;
break;
}
}
}
for (const [seedRangeStart, seedRangeLength] of seeds) {
if (
curValue >= seedRangeStart &&
curValue < seedRangeStart + seedRangeLength
) {
return i;
}
}
}
}
Yeah, if that's causing the issue you might be running into a case where when trying to make the image smaller it ends up not having enough pixels to show the border properly. Typically people make textures the size of what they want the final texture size to be rather than messing with proportions afterwards due to things like that (and so you don't have to store larger images than required)
To make it go smaller tick the ignore texture size box
That will make it so you can force it past the texture size
the keep aspect covered is similar but one side will clip out while the other is the right size, and keep aspect with no modifier (and centered) will fit but not take the full button (it will take as much as it can without destroying the texture)
if theres issues with it appearing and you have scale set it might be something to do with the border being too small or sizes being a bit wonky so that it tries to take up the full space but it goes out of the bounds of the parent
I would try it with just a texturebutton like I did there with nothing else as the parent (or a basic control) and just set stretch mode and normal texture and see what happens
Stretch mode scale should do that, its what it was made for. The only things I changed are the two you can see on the right there
Improvement I found afterwards:
- Could have done a reduce on the amount array instead of the lines array since I don't use the line value at all
[JavaScript] Swapped over to javascript from rust since I want to also practice some js. Managed to get part 1 in 4 minutes and got top 400 on the global leaderboard. Second part took a bit longer and took me 13 mins since I messed up by originally trying to append to the card array. (eventually swapped to keeping track of amounts in a separate array)
Part 1
// Part 1
// ======
function part1(input) {
const lines = input.split("\n");
let sum = 0;
for (const line of lines) {
const content = line.split(":")[1];
const winningNums = content.split("|")[0].match(/\d+/g);
const myNums = content.split("|")[1].match(/\d+/g);
let cardSum = 0;
for (const num of winningNums) {
if (myNums.includes(num)) {
if (cardSum == 0) {
cardSum = 1;
} else {
cardSum = cardSum * 2;
}
}
}
sum = sum + cardSum;
}
return sum;
}
Part 2
// Part 2
// ======
function part2(input) {
let lines = input.split("\n");
let amount = Array(lines.length).fill(1);
for (const [i, line] of lines.entries()) {
const content = line.split(":")[1];
const winningNums = content.split("|")[0].match(/\d+/g);
const myNums = content.split("|")[1].match(/\d+/g);
let cardSum = 0;
for (const num of winningNums) {
if (myNums.includes(num)) {
cardSum += 1;
}
}
for (let j = 1; j <= cardSum; j++) {
if (i + j >= lines.length) {
break;
}
amount[i + j] += amount[i];
}
}
return lines.reduce((acc, line, i) => {
return acc + amount[i];
}, 0);
}
[JavaScript] Relatively easy one today
Paste
Part 1
Part 2
Was a bit late with posting the solution thread and solving this since I ended up napping until 2am, if anyone notices theres no solution thread and its after the leaderboard has been filled (can check from the stats page if 100 people are done) feel free to start one up (I just copy paste the text in each of them)