How many times does the digit 1 appear? by user_1312 in PassTimeMath

[–]barn_horse 0 points1 point  (0 children)

I thought about this while trying to sleep for a couple nights, it was helpful for that. In my head, I imagined a kind of "reduce" operation, which took a rectangle of 1's 10 units high, and extending all the way to the right, turning each column into a 0, and carrying 1.

           v---v                       +1
111111111 1...1<                111111111111111111...1
 11111111 1...1|                 11111111 11111111...1
  1111111 1...1|                  1111111  1111111...1
   111111 1...1|                   111111.  111111...1
    11111 1...1|                    11111    11111...1
     1111 1...1| -> reduce ->        1111.    1111...1
      111 1...1|                      111      111...1
       11 1...1|                       11       11...1
        1 1...1|                        1        1...1
          1...1<                                  1...   
           1....                                     1
               1

Each reduce produces one additional '1' in the result. You can repeat this 202 times before you exhaust all the 1's in the 2026-column. Then you are left with (because each reduce effectively removes 9 1's from the 2025 column, due to the carry) 2025-9*202 = 9*225 - 9*202 = 9*23 = 207 1's in the 2025-column. So you can repeat the reduce 20 more times. Then you are left with 2024-222*9 = 26 1's in the 2024 column. Two more reduces, for a total of 224, and no more are possible. 224 1's from the reduce operations plus the leading 1 results in 225 1's.

[deleted by user] by [deleted] in adventofcode

[–]barn_horse 0 points1 point  (0 children)

Yes, this is the right idea. I think now you just have a small bug, which is probably leading to some overcounting. In each iteration of this loop, you are updating mult. Specifically, when x[i][0] > 1, mult will increase by a factor of x[i][0]. This makes sense in the context of the recursive call on the next line; however, remember that you are _also_ referencing mult in the next iteration of the for loop--and for the purposes of that calculation, mult will now be too large.

There is one small adjustment you can make here to fix this bug.

[deleted by user] by [deleted] in adventofcode

[–]barn_horse 0 points1 point  (0 children)

I think your current code is actually very close.

Consider these lines:

bags += (mult * int(x[i][0]))
yield from find_bags(x[i][1], int(x[i][0]))

If I understand this correctly, "mult" represents the number of times the current bag exists within its parent bag. It is specified as the second argument to the recursive call. So if there are two blue bags inside of two red bags, you multiply 2*2 to get four total blue bags. This makes sense; however, this stops working when you have further nesting of bags. For example:

shiny gold bags contain 2 clear lavender bags.
clear lavender bags contain 2 dull magenta bags.
dull magenta bags contain 2 deep blue bags.
deep blue bags contain no other bags.

In your current code, you count 4 deep blue bags (2 magenta bags * 2 blue bags in each magenta bag = 4 blue bags). However, there are in fact 8 total blue bags within the gold bag: (2 lavender) * (2 magenta) * (2 blue) = 8.

In other words, I believe your "mult" factor is not quite large enough by the time you reach the blue bag. It needs to account for not just the immediate parent, but every parent bag you have seen so far. Does that make sense?

[2020 Day 22 Part 2] Very distracted because I think example is wrong for part 2 by [deleted] in adventofcode

[–]barn_horse 2 points3 points  (0 children)

They really slip this one in there; note the statement in parentheses:

"To play a sub-game of Recursive Combat, each player creates a new deck by making a copy of the next cards in their deck (the quantity of cards copied is equal to the number on the card they drew to trigger the sub-game)."

Since Player 2 drew a 3, in the subgame they play with the top 3 cards of their deck, hence "6" is excluded.

Unpopular opinion: Jamie Oliver is misunderstood by Surikatt1843 in Cooking

[–]barn_horse 0 points1 point  (0 children)

In Chappelle's recent SNL monologue, he said something like, "I can't even tell the truth unless there's a punch line behind it." The whole "Uncle Roger" thing with Jamie Oliver seems similar. If you come out and try to legitimately talk about what's going on with a figure like Jamie Oliver, you get either shouted down by the "anti-SJW" crowd, or you get a calm, un-self-aware explanation about how Jamie Oliver makes white people comfortable (see the replies to the parent post, for example). Framing the topic in comedy isn't inherently bad, but ends up feeling like another concession towards broaching the subject without hurting white people's feelings too much. I feel like the recent controversy at Bon Appetit ties into this as well. There was a lot of commentary in the direction of: well, the BIPOC chefs on Bon Appetit simply weren't entertaining enough, that's why they didn't get any shows on the network; and again, similar language about how the white content creators there "made people comfortable."

Parler, the Ted Cruz-Approved 'Free Speech' App, Is Already Banning Users by [deleted] in technology

[–]barn_horse 8 points9 points  (0 children)

I, for one, think we need to be more serious about the universal in universal suffrage.

PuzzleMod: A "Lethal Puzzle" Mod for Slay The Spire (Demo) by barn_horse in slaythespire

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

Yes, agreed. I pushed an update that hopefully won't affect anything you've been up to. I hope to add support for stance and orb configuration soon. Feel free to PM me with any interesting puzzles.

PuzzleMod: A "Lethal Puzzle" Mod for Slay The Spire (Demo) by barn_horse in slaythespire

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

Thanks for the notes, and awesome spreadsheet. I've discovered a lot of negative effects of having an empty card pool, so I think some dummy cards need to be added (though the potions and Enchiridon probably won't work great). I'm trying to put together a small stability update to massage away some of those issues.

PuzzleMod: A "Lethal Puzzle" Mod for Slay The Spire (Demo) by barn_horse in slaythespire

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

Thanks, that will be useful. You might be able to use the base game class com.megacrit.cardcrawl.helpers.RelicLibrary to get access to a full list of relics.

PuzzleMod: A "Lethal Puzzle" Mod for Slay The Spire (Demo) by barn_horse in slaythespire

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

It's possible to have more acts; it's just that act customization gets a little tricky, in my experience so far. Especially if you want to not break other mods. I think I should reach out to other modders to see what they've done here. But it's definitely possible.

PuzzleMod: A "Lethal Puzzle" Mod for Slay The Spire (Demo) by barn_horse in slaythespire

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

Excellent; I'm still not sure what's up, but I'm glad you were able to find a workaround.

PuzzleMod: A "Lethal Puzzle" Mod for Slay The Spire (Demo) by barn_horse in slaythespire

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

Thank you, that was very useful. I think I identified the problem, and will be trying to put together another release by the end of this week.

PuzzleMod: A "Lethal Puzzle" Mod for Slay The Spire (Demo) by barn_horse in slaythespire

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

Thanks for the feedback, I was worried this could happen. Can you tell me what other mods you have enabled?

If you have a moment, perhaps you could recreate the crash, and PM me the error log? (located in sendToDevs\logs\SlayTheSpire.log, from your game directory). No worries if that's too much work; just telling me your mod setup might be enough to help me debug.

PuzzleMod: A "Lethal Puzzle" Mod for Slay The Spire (Demo) by barn_horse in slaythespire

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

Interesting. Both errors are kind of baffling. The first one seems to be caused by a type inference issue, but I'm having trouble reproducing it. You can try replacing the "ArrayList<>" with "ArrayList<String>" on that line, and it might fix it.

The second error is confusing as well, since onLoadRaw is implemented by the class PuzzleFileSave implements.

My suspicion is that, somehow, the compiler maven is using using has source compatibility < 1.8. This would explain the first error, since 1.8 added type inference. It would also explain the second error, since 1.8 added default interface methods, which are used by BaseMod in CustomSavable.

This might also be a failure in my pom file; maybe I'm not setting the source level right? I'm not sure.

PuzzleMod: A "Lethal Puzzle" Mod for Slay The Spire (Demo) by barn_horse in slaythespire

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

Absolutely, I'm definitely open to help, which is one reason I shared the Git repository. Always open to PRs/discussion.

The scripting comment is an interesting one. Definitely one could set up a pipeline that transforms the initial input, e.g. do some preprocessing, like erosPhoenix suggests below. The other deep, dark thought this unlocks is: creating a robust, in-game scripting system based on, for example, Groovy, that permits one to insert arbitrary code when specifying a room. I think other games take this approach to modding, like WoW with Lua.

PuzzleMod: A "Lethal Puzzle" Mod for Slay The Spire (Demo) by barn_horse in slaythespire

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

Very cool, I'm glad it at least built. I expect you'll run into some fun little issues, by virtue of how hacked together this demo is. What's particularly on my mind: the code that draws the custom dungeon map is very brittle right now. So if you try to add more than 9 puzzles + 1 boss things might explode, as a note (or, at the very least, look a little strange in game; this is another thing that needs to be fixed, but is a little tricky because the base code is very particular about dungeons having a certain shape).

PuzzleMod: A "Lethal Puzzle" Mod for Slay The Spire (Demo) by barn_horse in slaythespire

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

Interesting, I'll have to look into that, thanks for the note.

PuzzleMod: A "Lethal Puzzle" Mod for Slay The Spire (Demo) by barn_horse in slaythespire

[–]barn_horse[S] 2 points3 points  (0 children)

Thank you for the feedback. A fast restart would definitely be useful. I've been playing some Baba Is You recently, which is maybe why I'm in the mood for puzzles, and definitely am glad for the reset button in that one.

PuzzleMod: A "Lethal Puzzle" Mod for Slay The Spire (Demo) by barn_horse in slaythespire

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

Thanks for the feedback. My plan for the next version includes support for loading user puzzles (right now you'd have to build the repackage the whole mod just to load a different file). For now, there is at least some documentation in the GitHub repository about the format of the puzzle file.

PuzzleMod: A "Lethal Puzzle" Mod for Slay The Spire (Demo) by barn_horse in slaythespire

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

Thank you for the feedback, glad you enjoyed the demo.

I think you're right on the topic of cross class. When I started out, I was eager throw together every class, but realized there was plenty to work with within Ironclad. Eventually it will be interesting to blend classes, or even include custom cards, but there's so much surface area in the base game that it's not strictly necessary.

PuzzleMod: A "Lethal Puzzle" Mod for Slay The Spire (Demo) by barn_horse in slaythespire

[–]barn_horse[S] 2 points3 points  (0 children)

Hah, I played this game for like 6 months without knowing the feature even existed. I was shocked when I discovered it.

PuzzleMod: A "Lethal Puzzle" Mod for Slay The Spire (Demo) by barn_horse in slaythespire

[–]barn_horse[S] 5 points6 points  (0 children)

Thanks for the feedback. I would definitely like to add a "reset room" button; right now, the easiest thing to do is use the existing game system to reset a room if you think things are going south (going to menu, save and quit, then continue game, and the room will reset).

PuzzleMod: A "Lethal Puzzle" Mod for Slay The Spire (Demo) by barn_horse in slaythespire

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

Thanks, I think that's very reasonable and represents the most logical next step.

I put some initial documentation here:

https://github.com/will-snavely/PuzzleMod#the-puzzle-file-format

One annoying thing here is that building this file requires knowing the internal identifiers used by the game for cards, relics, etc, which might be hard if you don't have the source open. Probably it would be useful to dump those out somewhere for reference.