Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Immortal Wombat
Jan 19, 2005

Everliving Marsupial

Ranzear posted:

I definitely overthought the complication.

No I'm sure I'll encounter more issues like you described

KillHour posted:

Issue marked as Closed - Not a bug.

Comment from reviewer: "My unit of meat can definitely be consumed infinite times."

;-*

Immortal Wombat fucked around with this message at 18:17 on Nov 11, 2022

Adbot
ADBOT LOVES YOU

KillHour
Oct 28, 2007


Immortal Wombat posted:

No I'm sure I'll encounter more issues like you described


I know I said it to poke fun at Hadlock, but XSLT really is the right way to do it if you want anything more complex than "everything is now 0"

For instance, this will take all fDegradePerUse values that aren't 1 (because those are one-time-use items) and halve the amount of per-use degredation.

code:
<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:mode on-no-match="shallow-copy" />
  <xsl:template match="column[@name='fDegradePerUse']/text()[. ne '1']">
    <xsl:value-of select=". * 0.5" />
  </xsl:template>
</xsl:stylesheet>

camoseven
Dec 30, 2005

RODOLPHONE RINGIN'

No posts since 2018 :pressf:

Ihmemies
Oct 6, 2012

I am super stuck. I think I'm supposed to figure out which string is missing a character other two strings have.

Ie. in {'bcdefg', 'abdefg', 'acdefg'} abdefg doesn't have c. How I can figure out from that set that the correct choice is abdefg? :v:

I have been at this for 2 days and my brains just don't work. Normally I just compare 1vs1 but ugh this

Ihmemies fucked around with this message at 23:50 on Nov 11, 2022

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
acdefg is missing a b, which is present in the other two strings. Likewise, bcdefg is missing an a. Is there a more precise specification for what you're being asked to do?

Ihmemies
Oct 6, 2012

Jabor posted:

acdefg is missing a b, which is present in the other two strings. Likewise, bcdefg is missing an a. Is there a more precise specification for what you're being asked to do?

Well it's AoC 2021 day 8 b. It has a 7-segment display: https://en.wikipedia.org/wiki/Seven-segment_display https://adventofcode.com/2021/day/8

So 0, 6 and 9 share the same amount of on states. I'm supposed to figure out how to differentiate 0 6 and 9 from each other. I managed to do it for 2/3/5 I think.

0 is missing a character which both 6 and 9 have. Six is missing one chracter which is in one. Nine is then left...

Ihmemies fucked around with this message at 23:58 on Nov 11, 2022

robostac
Sep 23, 2009

camoseven posted:

No posts since 2018 :pressf:

There is also an ardunio thread in the hobby forum - https://forums.somethingawful.com/showthread.php?threadid=3505424

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

Ihmemies posted:

I am super stuck. I think I'm supposed to figure out which string is missing a character other two strings have.

Ie. in {'bcdefg', 'abdefg', 'acdefg'} abdefg doesn't have c. How I can figure out from that set that the correct choice is abdefg? :v:

I have been at this for 2 days and my brains just don't work. Normally I just compare 1vs1 but ugh this

As Jabor observed, the example given doesn't seem to match the rubric. But I'll proceed by supposing you just came up with that one off the top of your head, as opposed to it being an actual example.

In the absence of any compelling reason to optimise, I would approach this as follows:

1. Make a list of the distinct characters appearing at least once in any of the strings. In this case we would get 'b', 'c', 'd', 'e', 'f', 'g' and 'a' (ordering by first appearance).
2. For each character in the list, count how many of the strings contain it at least once. This results in a mapping of characters to positive integers (in principle nonnegative integers, however from the method of construction of the list, each character is in at least one string).
3. Look at the mapping and see which character maps to the value 2.
4. Look at the original strings and see which of them does not contain the character identified at step 3.

Hammerite fucked around with this message at 00:03 on Nov 12, 2022

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

Ihmemies posted:

Well it's AoC 2021 day 8 b. It has a 7-segment display: https://en.wikipedia.org/wiki/Seven-segment_display https://adventofcode.com/2021/day/8

So 0, 6 and 9 share the same amount of on states. I'm supposed to figure out how to differentiate 0 6 and 9 from each other. I managed to do it for 2/3/5 I think.

0 is missing two characters 6 and 9 both have. Six is missing one chracter which is in one. Nine is then left...

You can just start with what you already know, instead of trying to figure it out just by looking at that 0-6-9 set.

Why not start with figuring out which one is 6, instead of trying to figure out 0 first?

Ihmemies
Oct 6, 2012

Jabor posted:

You can just start with what you already know, instead of trying to figure it out just by looking at that 0-6-9 set.

Why not start with figuring out which one is 6, instead of trying to figure out 0 first?

My solution is not exactly great, so it's not easy to tell 0 and 9 from each other then. Maybe I should have kept book about which letter means which segment :v:

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

Ihmemies posted:

My solution is not exactly great, so it's not easy to tell 0 and 9 from each other then. Maybe I should have kept book about which letter means which segment :v:

Can you think of any other digits that have a segment that's in one of 0 or 9 but not the other? Thinking about it four a moment might give you some fivehead big brain enlightenment.

Ihmemies
Oct 6, 2012

Yes. I guess it is easier when you told me I can compare it to other numbers. Finally. What a piece of utter garbage my solution is. Luckily I don't need to submit the code anywhere, only the result. Well I'll submit the code here anyways so you can laugh at me: https://pastebin.com/2zd6vQSM

Thanks for the help!

Even with the uh.. spaghetti... runtime is "only" 3313.92020ms with 1000 iterations.

Sylink
Apr 17, 2004

Do we have a kubernetes specific thread ? I would ask this there if so, maybe devops thread is better, but anyway -

I am adding a ReadWriteOnce volume to an EKS cluster, and in this case I want to have one of them one each node in the cluster appear automatically, but only one, and assigned to each node, so 4 node = 4 volumes.

Then I may have 1 to N pods mounting this same volume to read from it, the pods all do the same thing, just scaling it so maybe more than one pod per node.

My question is how to configure the deployment templating such that when a pod comes up it knows what node its provisioning to and the volume name is set accordingly in the pod deployment. Not sure how to approach this dynamically really. Possible in helm perhaps ?

Volguus
Mar 3, 2009
Hello,
I have a little question: How would one generate a hashcode for a Bingo card?

A Bingo card is a class that has a 5x5 matrix, with numbers from 1..N (inclusive) with the middle cell ignored (let's say, set to 0). 2 bingo cards are equal if they have rows or columns or the diagonals equal. These are equal if they have the same numbers in them, regardless of order.

For example:

pre:
  1    2    3     4    5
  6    7    8     9   10
11    12         13   14
15    16   17    18   19
20    21   22    23   24 
is equal to

pre:
 5    2    3     4    1
25    26  27    28   29
30    31        32   33
34    35  36    37   38
39    40  41    42   43 
since they have the same first row. The same concept applies to columns and the 2 diagonals. They're also equal if a line appears as a column (or as a diagonal) in the other card.
The purpose of it all is to generate a set of X cards, where there are no 2 same cards, basically trying to ensure that there are no 2 winning cards.

Now, placing them all in a list and just calling contains works fine, since just equals is what matters. But, ideally, I'd have them placed in a set, both for speed of comparison and for code simplicity. But ... I can't figure out how could I go about generating a proper hashcode, given the equality rules. Is it even possible?

edit: updated the example

Volguus fucked around with this message at 16:50 on Nov 17, 2022

ultrafilter
Aug 23, 2007

It's okay if you have any questions.


Sort the numbers, concatenate them with your favorite separator, and generate your hash code from the resulting string.

Volguus
Mar 3, 2009

ultrafilter posted:

Sort the numbers, concatenate them with your favorite separator, and generate your hash code from the resulting string.

That I don't think would work, since the numbers are 1 to N where N is greater than 25 (can be 50, can be 100). So, it's possible to have this:

pre:
 1    2    3     4    5
 6    7    8     9   10
11    12         13   14
15    16   17    18   19
20    21   22    23   24 
is equal to

pre:
 5    2    3     4    1
25    26  27    28   29
30    31        32   33
34    35  36    37   38
39    40  41    42   43 
and of course any combinations of this. The 2 strings are not going to be equal. Maybe equal in parts, but no more than that.

Volguus fucked around with this message at 16:48 on Nov 17, 2022

ultrafilter
Aug 23, 2007

It's okay if you have any questions.


The ith column on a regular bingo card can only have numbers in the range [15 * (i - 1) + 1, 15 * i]. Is that not a constraint here?

Volguus
Mar 3, 2009

ultrafilter posted:

The ith column on a regular bingo card can only have numbers in the range [15 * (i - 1) + 1, 15 * i]. Is that not a constraint here?

No, not that I'm aware of. I have no idea how the regular bingo works, but for this exercise the numbers are to be replaced with pictures, as in christmas-themed bingo. So it has nothing to do with regular bingo that the elderly play.

KillHour
Oct 28, 2007


Volguus posted:

No, not that I'm aware of. I have no idea how the regular bingo works, but for this exercise the numbers are to be replaced with pictures, as in christmas-themed bingo. So it has nothing to do with regular bingo that the elderly play.

Brute force it and get the list of every winning combination of numbers/picture IDs and then sort those (both by the order within the row/column/diagonal and then sort the groups) and hash that.

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
I can’t think of any way to write a hash that’s consistent with your equivalence relation except to use a trivial hash.

Note that if you’re trying to make it structurally impossible for two people to achieve bingo in the same round, your rule isn’t good enough, and it’s not obvious that any rule could possibly be good enough besides every card having an independent set of numbers.

In normal bingo, I’m pretty sure organizers just aren’t supposed to hand out identical cards. In addition to the range restrictions on columns, numbers are sorted in columns, so card identity is purely reducible to the set of numbers.

KillHour
Oct 28, 2007


I think the intent is to prevent a situation where the cards are effectively identical (so avoid rotations, flips, etc), not necessarily prevent any rows/columns being the same. But yeah, you could just always sort the images by ID and enforce the regular bingo constraints to avoid that.

DoctorTristan
Mar 11, 2006

I would look up into your lifeless eyes and wave, like this. Can you and your associates arrange that for me, Mr. Morden?
Assuming you’re only going to generate at most few hundred cards per game I don’t see any reason to bother with a hash anyway - just generating a random sequence of cards and retrying any that .equals() any previous card in the sequence will certainly be Good Enough™️

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

KillHour posted:

I think the intent is to prevent a situation where the cards are effectively identical (so avoid rotations, flips, etc), not necessarily prevent any rows/columns being the same. But yeah, you could just always sort the images by ID and enforce the regular bingo constraints to avoid that.

Yeah. I think you wouldn’t have to go all the way to sorting if you didn’t want to, though. You’re just worried about rotations and flips, and there’s a way to find a traversal of the grid that will ignore those: pick the smallest corner, then traverse rows/columns from there starting with its smallest neighbor.

If OP was just worried about not having cards with the same 12 winning sets, they could hash that set of sets. But I can’t think of any non-trivial hash that will be equal for cards that share any of those sets.

KillHour
Oct 28, 2007


rjmccall posted:

Yeah. I think you wouldn’t have to go all the way to sorting if you didn’t want to, though. You’re just worried about rotations and flips, and there’s a way to find a traversal of the grid that will ignore those: pick the smallest corner, then traverse rows/columns from there starting with its smallest neighbor.

If OP was just worried about not having cards with the same 12 winning sets, they could hash that set of sets. But I can’t think of any non-trivial hash that will be equal for cards that share any of those sets.

For the case of any set, you would just add 12 hashes to the hashlist for each new card instead of one.

Volguus
Mar 3, 2009

DoctorTristan posted:

Assuming you’re only going to generate at most few hundred cards per game I don’t see any reason to bother with a hash anyway - just generating a random sequence of cards and retrying any that .equals() any previous card in the sequence will certainly be Good Enough™️

That's what I have and it is working, just my OCD wanted to optimize it.

The intent was to prevent any cards that haven the same line or column or diagonal, so that for a specific draw of numbers (well, images in this case) there cannot be 2 people that would say bingo at the same time. The odds of this happening, even when generating 50 cards from 36 numbers, are quite low, but not impossible.

I was just thinking that there must be a way to properly put them in a set and have them be generated until the set reaches a certain length (my desired number of cards) and I just don't see it.


rjmccall posted:

I can’t think of any way to write a hash that’s consistent with your equivalence relation except to use a trivial hash.

Note that if you’re trying to make it structurally impossible for two people to achieve bingo in the same round, your rule isn’t good enough, and it’s not obvious that any rule could possibly be good enough besides every card having an independent set of numbers.

In normal bingo, I’m pretty sure organizers just aren’t supposed to hand out identical cards. In addition to the range restrictions on columns, numbers are sorted in columns, so card identity is purely reducible to the set of numbers.

That's what I'm trying to make, is it not good enough? Here's the pastebin to my little program: https://pastebin.com/YE5srPFw . And here are the tests I made for it: https://pastebin.com/20xrfWN4 . I'd love to be pointed out what did I miss.

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
Yeah, so, if that’s what you’re going for, you are definitely not going to be able to satisfy it. Remember that it’s unusual for bingo to be achieved after exactly five calls.

Try thinking of it this way: flip it around. Given a list of >5 called numbers, can you construct two cards that satisfy your original condition and yet both achieve bingo on the last number? Almost certainly yes. The actual numbers don’t matter, so we can renumber them for our convenience; let’s make them 1, 2, 3, 4, 5, …, N. Make the top row on Card A (1,2,3,4,N) and the top row on Card B (1,2,3,5,N); now they’ll both achieve bingo in round N, and the top row satisfies your condition, so you just need to make sure neither achieves bingo earlier or violates your condition in a different row/column/diagonal.

Volguus
Mar 3, 2009

rjmccall posted:

Yeah, so, if that’s what you’re going for, you are definitely not going to be able to satisfy it. Remember that it’s unusual for bingo to be achieved after exactly five calls.

Try thinking of it this way: flip it around. Given a list of >5 called numbers, can you construct two cards that satisfy your original condition and yet both achieve bingo on the last number? Almost certainly yes. The actual numbers don’t matter, so we can renumber them for our convenience; let’s make them 1, 2, 3, 4, 5, …, N. Make the top row on Card A (1,2,3,4,N) and the top row on Card B (1,2,3,5,N); now they’ll both achieve bingo in round N, and the top row satisfies your condition, so you just need to make sure neither achieves bingo earlier or violates your condition in a different row/column/diagonal.

Oh drat, thanks for the explanation. That makes sense.

KillHour
Oct 28, 2007


You could emulate it by pregenerating a set of draws such that you know that they will always have exactly one winner (and you could even set the games to be a specific length). It would still be fair because the boards are passed out randomly, but it's not really in the spirit of Bingo.

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
That’s a cute idea.

Volguus
Mar 3, 2009

KillHour posted:

You could emulate it by pregenerating a set of draws such that you know that they will always have exactly one winner (and you could even set the games to be a specific length). It would still be fair because the boards are passed out randomly, but it's not really in the spirit of Bingo.

Heh, interesting. Not achievable since this is some thing my sister makes to give to other people (the cards, the images that are randomly drawn, etc.), so there's other people playing. She just asked me to generate "unique" cards for her, based on how many images she has (that's the 1 to N range). I think she now has 36 of them, so generating 50 or 100 cards should yield relatively unique combinations.

cheetah7071
Oct 20, 2010

honk honk
College Slice
Does anyone have any useful advice on when a C++ dependency should be a submodule of the git repository, or when you should just tell the user to figure it out themselves and have cmake do its best to find it?

having a submodule does seem easier, but also, it seems wasteful to force someone to download the entirety of boost just to build my program when boost binaries are easily available and there's even a good chance they already have the boost repository cloned, given that they work with C++. Perhaps the distinction should be that big, popular packages just get found with cmake, and smaller, more obscure packages get put in as submodules? Or anything that find_package can find should be found with find_package?

e: it's possible there's a third paradigm that I should be using instead, too. I really have no idea, I'm a complete novice with cmake

cheetah7071 fucked around with this message at 22:51 on Nov 17, 2022

Volguus
Mar 3, 2009

cheetah7071 posted:

Does anyone have any useful advice on when a C++ dependency should be a submodule of the git repository, or when you should just tell the user to figure it out themselves and have cmake do its best to find it?

having a submodule does seem easier, but also, it seems wasteful to force someone to download the entirety of boost just to build my program when boost binaries are easily available and there's even a good chance they already have the boost repository cloned, given that they work with C++. Perhaps the distinction should be that big, popular packages just get found with cmake, and smaller, more obscure packages get put in as submodules? Or anything that find_package can find should be found with find_package?

e: it's possible there's a third paradigm that I should be using instead, too. I really have no idea, I'm a complete novice with cmake

Just use vcpkg or conan to manage dependencies.

cheetah7071
Oct 20, 2010

honk honk
College Slice

Volguus posted:

Just use vcpkg or conan to manage dependencies.

drat i can't believe i struggled through manually getting cmake to do what I wanted instead of using *checks notes* a program which produces a cmake script, when cmake is itself a program that generates compiler settings

just programs that compile to programs that compile to programs all the way down

thanks though, conan has every package I need except one and I can just submodule that specific one without too much issue

Computer viking
May 30, 2011
Now with less breakage.

https://en.wikipedia.org/wiki/Fundamental_theorem_of_software_engineering

nielsm
Jun 1, 2009



Is it a module that you own, and it's at least nominally part of the same project portfolio? If yes, consider making it a git submodule.
Is it a third-party module that you have custom patches for, making it not directly replaceable with the upstream version? Consider making it a git submodule.
Otherwise, probably don't.

MikeJF
Dec 20, 2003




This might be more of a maths question, but: if I have a sequence of 90 degree left/right rotations and horizontal/vertical flips, is there a way to simplify that down to a minimum that is constant so that no matter the sequence of them you used, if you ended up with the same image orientation, the simplified sequence will be the same?

ultrafilter
Aug 23, 2007

It's okay if you have any questions.


Rotations and reflections are affine maps so their composition is also an affine map, but it won't necessarily be a rotation or a reflection. IIRC you can always represent the result as a composition of one reflection, one rotation and one translation, but the details are messy. Do you really need that info or is the final transformation good enough?

cheetah7071
Oct 20, 2010

honk honk
College Slice

MikeJF posted:

This might be more of a maths question, but: if I have a sequence of 90 degree left/right rotations and horizontal/vertical flips, is there a way to simplify that down to a minimum that is constant so that no matter the sequence of them you used, if you ended up with the same image orientation, the simplified sequence will be the same?

This is related to Group Theory, an incredibly important branch of math, if you're curious

If you add two more reflections (across the two diagonals) then you have the complete list of symmetries of a square, and composing and two of them will always give you another symmetry on the list. There's only 8 possibilities, no matter how many you do in sequence. There might be a more elegant way to do it (my knowledge of group theory is pretty light) but, if nothing else, here's a lookup table of all 64 compositions:

https://proofwiki.org/wiki/Definition:Symmetry_Group_of_Square

e: I'm assuming here that the reflections are right down the middle and the post above is assuming you can reflect about any line, I think. I guess it wasn't clear which you meant

MikeJF
Dec 20, 2003




ultrafilter posted:

Rotations and reflections are affine maps so their composition is also an affine map, but it won't necessarily be a rotation or a reflection. IIRC you can always represent the result as a composition of one reflection, one rotation and one translation, but the details are messy. Do you really need that info or is the final transformation good enough?

I can throw away the translation element here. Users will be rotating/flipping glyphs at will, and I want to be able to bring it down like that so that I can go 'oh output glyph 1 and 2 are equivalent, so I can throw away 2 and point it to the result of 1 in the output set'.

cheetah7071 posted:

This is related to Group Theory, an incredibly important branch of math, if you're curious

If you add two more reflections (across the two diagonals) then you have the complete list of symmetries of a square, and composing and two of them will always give you another symmetry on the list. There's only 8 possibilities, no matter how many you do in sequence. There might be a more elegant way to do it (my knowledge of group theory is pretty light) but, if nothing else, here's a lookup table of all 64 compositions:

https://proofwiki.org/wiki/Definition:Symmetry_Group_of_Square

e: I'm assuming here that the reflections are right down the middle and the post above is assuming you can reflect about any line, I think. I guess it wasn't clear which you meant

Thanks, I'll look into that.

MikeJF fucked around with this message at 05:11 on Nov 18, 2022

Adbot
ADBOT LOVES YOU

ultrafilter
Aug 23, 2007

It's okay if you have any questions.


What kind of shapes can the glyphs be?

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply