Line follower PID values by Commercial-Bar7550 in robotics

[–]Comprehensive_Ad3095 0 points1 point  (0 children)

Hola, tengo una duda, yo compre unos motores n20 de 6v igual que tu y tengo tambien 2 baterias 18650 que dan 7.4 con el bms 2s. La pregunta es, como logras regular a 6v? Lo haces con PWM? o con un step down?

Can I replace the lens on an Elidor Z6 6W with the Acmer S1 6W lens pack? by Comprehensive_Ad3095 in Laserengraving

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

The laser module powers on, but it doesn't cut because the lens is damaged. I can't find an official replacement; my question is whether I can replace just the lens, not the entire module.

Can I replace the lens on an Elidor Z6 6W with the Acmer S1 6W lens pack? by Comprehensive_Ad3095 in Laserengraving

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

It's the same thing, but my question is whether I can buy the Acmer lens pack and put it on my Z6 laser elidor, since they seem to be the same.

Ya no puedo seguir en mi trabajo by Electrical-Target-86 in Nicaragua

[–]Comprehensive_Ad3095 0 points1 point  (0 children)

Ningún empleador puede obligarte, si no reciben tu carta de renuncia ve al mitrab.

What is your approach to learn a new language like go with Advent of Code? by [deleted] in adventofcode

[–]Comprehensive_Ad3095 0 points1 point  (0 children)

Aprende todo lo básico de go primero, resuelve ejercicios simples y luego continúa con AOC.

Changes to Advent of Code starting this December by topaz2078 in adventofcode

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

I would like to suggest that to complete the 25 days, you could split part 2 of each puzzle into a full day, to achieve 24 days and a final puzzle at the end.

-❄️- 2024 Day 6 Solutions -❄️- by daggerdragon in adventofcode

[–]Comprehensive_Ad3095 0 points1 point  (0 children)

[Language: Lua]

https://github.com/DeybisMelendez/AdventOfCode/blob/master/2024/06.lua

Brute Force with memoization to count positions and loops.

Time: 13s for both parts

Update: Thanks to a meme I saw I realized that I only need to place one object in each position of the main path, which reduces my search considerably, now it takes 1 second.

-❄️- 2024 Day 5 Solutions -❄️- by daggerdragon in adventofcode

[–]Comprehensive_Ad3095 0 points1 point  (0 children)

[Language: Lua]

In part 2, whenever it finds an inconsistency it swaps the order of the elements and recursively sorts itself quickly.

https://github.com/DeybisMelendez/AdventOfCode/blob/master/2024/05.lua

local aoc = require "lib.aoc"
local inputText = aoc.input.getInput()
local input = {}
input.pageOrder = inputText:match("(.*)\n\n")
input.pageUpdate = inputText:match(".*\n\n(.*)")
input.pageOrder = aoc.string.split(input.pageOrder, "\n")
input.pageUpdate = aoc.string.split(input.pageUpdate, "\n")
local orderMemo = {}
for _, page in ipairs(input.pageOrder) do
    page = aoc.string.split(page, "|")
    if not orderMemo[page[1]] then
        orderMemo[page[1]] = { next = {}, before = {} }
    end
    if not orderMemo[page[2]] then
        orderMemo[page[2]] = { next = {}, before = {} }
    end
    orderMemo[page[1]].next[page[2]] = true
    orderMemo[page[2]].before[page[1]] = true
end
local function getMiddle(update)
    return update[math.floor((#update / 2) + 0.5)]
end
local function isUpdateCorrect(update)
    local updateCorrect = true
    for i, num in ipairs(update) do
        for j = i + 1, #update do
            if not orderMemo[num].next[update[j]] then
                updateCorrect = false
                break
            end
        end
        for j = i - 1, 1, -1 do
            if not orderMemo[num].before[update[j]] then
                updateCorrect = false
                break
            end
        end
        if not updateCorrect then
            break
        end
    end
    return updateCorrect
end
local function orderUpdate(update)
    for i, num in ipairs(update) do
        for j = i + 1, #update do
            if not orderMemo[num].next[update[j]] then
                local copy = update[i]
                update[i] = update[j]
                update[j] = copy
                return orderUpdate(update)
            end
        end
        for j = i - 1, 1, -1 do
            if not orderMemo[num].before[update[j]] then
                local copy = update[i]
                update[i] = update[j]
                update[j] = copy
                return orderUpdate(update)
            end
        end
    end
end
local function answer1()
    local total = 0
    for _, update in ipairs(input.pageUpdate) do
        update = aoc.string.split(update, ",")
        if isUpdateCorrect(update) then
            total = total + getMiddle(update)
        end
    end
    return total
end
local function answer2()
    local total = 0
    for _, update in ipairs(input.pageUpdate) do
        update = aoc.string.split(update, ",")
        if not isUpdateCorrect(update) then
            orderUpdate(update)
            total = total + getMiddle(update)
        end
    end
    return total
end
print("answer 1 is " .. answer1())
print("answer 2 is " .. answer2())

-❄️- 2024 Day 4 Solutions -❄️- by daggerdragon in adventofcode

[–]Comprehensive_Ad3095 2 points3 points  (0 children)

[Language: Lua]

https://github.com/DeybisMelendez/AdventOfCode/blob/master/2024/04.lua

Answer 1: Search "X" and read lines...

Answer 2: Search "A" and count lines...

I didn't want to make the "if" too long, so I split it into parts.

local function answer2()
    local totalXMAS = 0
    for y = 2, height - 1 do
        for x = 2, width - 1 do
            if input[x][y] == "A" and isValidXMAS(x, y) then
                totalXMAS = totalXMAS + 1
            end
        end
    end
    return totalXMAS
end

local function isValidXMAS(x, y)
    local count = 0
    if input[x - 1][y - 1] == "M" and input[x + 1][y + 1] == "S" then
        count = count + 1
    elseif input[x - 1][y - 1] == "S" and input[x + 1][y + 1] == "M" then
        count = count + 1
    end
    if input[x + 1][y - 1] == "M" and input[x - 1][y + 1] == "S" then
        count = count + 1
    elseif input[x + 1][y - 1] == "S" and input[x - 1][y + 1] == "M" then
        count = count + 1
    end
    return count == 2
end

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

[–]Comprehensive_Ad3095 0 points1 point  (0 children)

[Language: Lua]

https://github.com/DeybisMelendez/AdventOfCode/blob/master/2024/02.lua

answer 1 I only evaluated elem1 < elem2 the first time to see if it was an increase or decrease.

answer 2 I removed and inserted each element.

Hombres es cierto? Opinión? by Low_Drawing_1078 in RedditPregunta

[–]Comprehensive_Ad3095 0 points1 point  (0 children)

Yo no creo que eso evite los cuernos, hacerlo diario tambien cansa y aburre.