18+ futurebird,
@futurebird@sauropods.win avatar

I have a list of 3 python objects w/ 4 attributes. If exactly 2 are identical (not all 3, not none) I want to return False.

mylist=[ob1, obj2, obj3]

if len(set([x.attribute1 for x in mylist]))==2:
return False
if len(set([x.attribute2 for x in mylist]))==2:
return False
if len(set([x.attribute3 for x in mylist]))==2:
return False
if len(set([x.attribute4 for x in mylist]))==2:
return False
return True

feels clunky. what am i missing?

(can you guess what card game?)

18+ Alon,
@Alon@mastodon.social avatar

@futurebird Can you transform the attributes from strings to numbers? Then three cards form a set iff they sum to 0 in (Z/3Z)^4.

18+ futurebird,
@futurebird@sauropods.win avatar

@Alon I can do this. And it gives and excuse to talk about mods (even better)

It’s possible there could be more attributes in a future variant of this game and this could be extendable.

Alon,
@Alon@mastodon.social avatar

@futurebird The cool thing is that this property is invariant under S_3 actions on the underlying set of alternatives, even if it is expressed in Z/3Z language. Now I'm trying to think if there's a reasonable 4-dimensional extension, in which four cards with four alternatives per attribute form a set iff they are coplanar in (Z/4Z)^n and no three are collinear.

Alon,
@Alon@mastodon.social avatar

@futurebird Thinking about it more clearly: the property of being coplanar with no three points collinear is not unique even over Z/3Z: for each set of three non-collinear points in (Z/3Z)^n, n \geq 2, there are three points on the plane they span that are not collinear with any two.

There already is a game based on this property. It's defined as, four cards form a *set if there is a way to divide them into two pairs, such as that each of the two pairs forms a set with the same card.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • GTA5RPClips
  • DreamBathrooms
  • thenastyranch
  • magazineikmin
  • osvaldo12
  • ethstaker
  • Youngstown
  • mdbf
  • slotface
  • rosin
  • ngwrru68w68
  • kavyap
  • tester
  • cisconetworking
  • JUstTest
  • InstantRegret
  • khanakhh
  • cubers
  • everett
  • Durango
  • tacticalgear
  • Leos
  • modclub
  • normalnudes
  • megavids
  • anitta
  • provamag3
  • lostlight
  • All magazines