even prev -> opposite parity; otherwise rank within 1

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.rank % 2 != prev.rank % 2
return abs(card.rank - prev.rank) <= 1


even prev -> same suit; otherwise rank within 3

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.suit == prev.suit
return abs(card.rank - prev.rank) <= 3


face prev -> higher rank; otherwise rank within 1

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.rank > prev.rank
return abs(card.rank - prev.rank) <= 1


red -> higher rank; otherwise rank within 5

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.rank > prev.rank
return abs(card.rank - prev.rank) <= 5


red -> different suit; otherwise decreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.suit != prev.suit
return card.rank < prev.rank


high prev -> rank within 4; otherwise opposite parity

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return abs(card.rank - prev.rank) <= 4
return card.rank % 2 != prev.rank % 2


red -> opposite parity; otherwise rank within 1

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.rank % 2 != prev.rank % 2
return abs(card.rank - prev.rank) <= 1


red -> different suit; otherwise rank within 4

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.suit != prev.suit
return abs(card.rank - prev.rank) <= 4


red -> nondecreasing; otherwise rank within 4

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.rank >= prev.rank
return abs(card.rank - prev.rank) <= 4


even prev -> rank within 2; otherwise decreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 2
return card.rank < prev.rank


high prev -> rank within 5; otherwise different color

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return abs(card.rank - prev.rank) <= 5
return card.color != prev.color


high prev -> higher rank; otherwise rank within 1

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.rank > prev.rank
return abs(card.rank - prev.rank) <= 1


if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.rank < prev.rank
return card.rank < prev.rank


even prev -> rank within 5; otherwise higher rank

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 5
return card.rank > prev.rank


even prev -> rank within 5; otherwise rank within 4

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 5
return abs(card.rank - prev.rank) <= 4


even prev -> nondecreasing; otherwise rank within 4

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.rank >= prev.rank
return abs(card.rank - prev.rank) <= 4


red -> opposite parity; otherwise rank within 4

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.rank % 2 != prev.rank % 2
return abs(card.rank - prev.rank) <= 4


high prev -> same suit; otherwise rank within 5

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.suit == prev.suit
return abs(card.rank - prev.rank) <= 5


even prev -> rank within 3; otherwise rank within 5

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 3
return abs(card.rank - prev.rank) <= 5


even prev -> opposite parity; otherwise same color

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.rank % 2 != prev.rank % 2
return card.color == prev.color


high prev -> rank within 5; otherwise opposite parity

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return abs(card.rank - prev.rank) <= 5
return card.rank % 2 != prev.rank % 2


high prev -> same suit; otherwise higher rank

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.suit == prev.suit
return card.rank > prev.rank


high prev -> rank within 1; otherwise different color

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return abs(card.rank - prev.rank) <= 1
return card.color != prev.color


high prev -> opposite parity; otherwise decreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.rank % 2 != prev.rank % 2
return card.rank < prev.rank


face prev -> rank within 4; otherwise rank within 6

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return abs(card.rank - prev.rank) <= 4
return abs(card.rank - prev.rank) <= 6


face prev -> rank within 1; otherwise rank within 3

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return abs(card.rank - prev.rank) <= 1
return abs(card.rank - prev.rank) <= 3


high prev -> nondecreasing; otherwise rank within 6

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.rank >= prev.rank
return abs(card.rank - prev.rank) <= 6


face prev -> different color; otherwise rank within 4

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.color != prev.color
return abs(card.rank - prev.rank) <= 4


even prev -> rank within 4; otherwise rank within 6

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 4
return abs(card.rank - prev.rank) <= 6


even prev -> opposite parity; otherwise same suit

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.rank % 2 != prev.rank % 2
return card.suit == prev.suit


red -> same suit; otherwise rank within 6

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.suit == prev.suit
return abs(card.rank - prev.rank) <= 6


high prev -> rank within 6; otherwise rank within 1

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return abs(card.rank - prev.rank) <= 6
return abs(card.rank - prev.rank) <= 1


high prev -> nondecreasing; otherwise same color

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.rank >= prev.rank
return card.color == prev.color


face prev -> rank within 5; otherwise opposite parity

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return abs(card.rank - prev.rank) <= 5
return card.rank % 2 != prev.rank % 2


face prev -> nondecreasing; otherwise rank within 1

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.rank >= prev.rank
return abs(card.rank - prev.rank) <= 1


red -> same parity; otherwise rank within 6

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.rank % 2 == prev.rank % 2
return abs(card.rank - prev.rank) <= 6


even prev -> rank within 1; otherwise same suit

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 1
return card.suit == prev.suit


red -> different suit; otherwise rank within 1

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.suit != prev.suit
return abs(card.rank - prev.rank) <= 1


face prev -> same suit; otherwise nondecreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.suit == prev.suit
return card.rank >= prev.rank


high prev -> decreasing; otherwise same suit

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.rank < prev.rank
return card.suit == prev.suit


even prev -> rank within 5; otherwise rank within 3

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 5
return abs(card.rank - prev.rank) <= 3


face prev -> opposite parity; otherwise nondecreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.rank % 2 != prev.rank % 2
return card.rank >= prev.rank


high prev -> higher rank; otherwise rank within 4

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.rank > prev.rank
return abs(card.rank - prev.rank) <= 4


red -> rank within 3; otherwise different suit

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 3
return card.suit != prev.suit


red -> rank within 1; otherwise rank within 3

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 1
return abs(card.rank - prev.rank) <= 3


red -> rank within 4; otherwise rank within 1

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 4
return abs(card.rank - prev.rank) <= 1


high prev -> same suit; otherwise rank within 3

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.suit == prev.suit
return abs(card.rank - prev.rank) <= 3


face prev -> rank within 4; otherwise rank within 2

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return abs(card.rank - prev.rank) <= 4
return abs(card.rank - prev.rank) <= 2


red -> rank within 6; otherwise different color

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 6
return card.color != prev.color


high prev -> same parity; otherwise different suit

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.rank % 2 == prev.rank % 2
return card.suit != prev.suit


high prev -> rank within 2; otherwise different suit

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return abs(card.rank - prev.rank) <= 2
return card.suit != prev.suit


high prev -> rank within 4; otherwise rank within 5

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return abs(card.rank - prev.rank) <= 4
return abs(card.rank - prev.rank) <= 5


high prev -> opposite parity; otherwise rank within 4

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.rank % 2 != prev.rank % 2
return abs(card.rank - prev.rank) <= 4


face prev -> different suit; otherwise nondecreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.suit != prev.suit
return card.rank >= prev.rank


red -> rank within 3; otherwise rank within 4

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 3
return abs(card.rank - prev.rank) <= 4


even prev -> rank within 3; otherwise same suit

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 3
return card.suit == prev.suit


high prev -> opposite parity; otherwise different suit

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.rank % 2 != prev.rank % 2
return card.suit != prev.suit


red -> same parity; otherwise rank within 2

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.rank % 2 == prev.rank % 2
return abs(card.rank - prev.rank) <= 2


face prev -> nondecreasing; otherwise different color

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.rank >= prev.rank
return card.color != prev.color


red -> same parity; otherwise rank within 4

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.rank % 2 == prev.rank % 2
return abs(card.rank - prev.rank) <= 4


high prev -> rank within 1; otherwise same color

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return abs(card.rank - prev.rank) <= 1
return card.color == prev.color


even prev -> same parity; otherwise rank within 2

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.rank % 2 == prev.rank % 2
return abs(card.rank - prev.rank) <= 2


red -> same suit; otherwise rank within 3

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.suit == prev.suit
return abs(card.rank - prev.rank) <= 3


red -> different color; otherwise rank within 5

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.color != prev.color
return abs(card.rank - prev.rank) <= 5


face prev -> rank within 4; otherwise same suit

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return abs(card.rank - prev.rank) <= 4
return card.suit == prev.suit


even prev -> higher rank; otherwise rank within 3

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.rank > prev.rank
return abs(card.rank - prev.rank) <= 3


even prev -> opposite parity; otherwise rank within 5

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.rank % 2 != prev.rank % 2
return abs(card.rank - prev.rank) <= 5


high prev -> same suit; otherwise same color

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.suit == prev.suit
return card.color == prev.color


high prev -> rank within 5; otherwise same parity

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return abs(card.rank - prev.rank) <= 5
return card.rank % 2 == prev.rank % 2


even prev -> rank within 3; otherwise decreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 3
return card.rank < prev.rank


even prev -> rank within 4; otherwise same parity

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 4
return card.rank % 2 == prev.rank % 2


even prev -> decreasing; otherwise same color

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.rank < prev.rank
return card.color == prev.color


high prev -> different suit; otherwise rank within 6

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.suit != prev.suit
return abs(card.rank - prev.rank) <= 6


high prev -> rank within 2; otherwise different color

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return abs(card.rank - prev.rank) <= 2
return card.color != prev.color


high prev -> same suit; otherwise opposite parity

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.suit == prev.suit
return card.rank % 2 != prev.rank % 2


red -> rank within 3; otherwise nondecreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 3
return card.rank >= prev.rank


even prev -> decreasing; otherwise rank within 6

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.rank < prev.rank
return abs(card.rank - prev.rank) <= 6


face prev -> rank within 3; otherwise rank within 6

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return abs(card.rank - prev.rank) <= 3
return abs(card.rank - prev.rank) <= 6


high prev -> rank within 3; otherwise rank within 5

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return abs(card.rank - prev.rank) <= 3
return abs(card.rank - prev.rank) <= 5


face prev -> same color; otherwise rank within 1

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.color == prev.color
return abs(card.rank - prev.rank) <= 1


red -> rank within 6; otherwise different suit

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 6
return card.suit != prev.suit


face prev -> decreasing; otherwise rank within 4

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.rank < prev.rank
return abs(card.rank - prev.rank) <= 4


high prev -> nondecreasing; otherwise opposite parity

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.rank >= prev.rank
return card.rank % 2 != prev.rank % 2


face prev -> rank within 5; otherwise rank within 6

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return abs(card.rank - prev.rank) <= 5
return abs(card.rank - prev.rank) <= 6


red -> rank within 2; otherwise rank within 3

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 2
return abs(card.rank - prev.rank) <= 3


even prev -> rank within 2; otherwise same color

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 2
return card.color == prev.color


high prev -> rank within 5; otherwise nondecreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return abs(card.rank - prev.rank) <= 5
return card.rank >= prev.rank


face prev -> rank within 5; otherwise nondecreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return abs(card.rank - prev.rank) <= 5
return card.rank >= prev.rank


red -> rank within 1; otherwise rank within 5

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 1
return abs(card.rank - prev.rank) <= 5


red -> different color; otherwise rank within 4

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.color != prev.color
return abs(card.rank - prev.rank) <= 4


even prev -> decreasing; otherwise rank within 3

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.rank < prev.rank
return abs(card.rank - prev.rank) <= 3


face prev -> rank within 2; otherwise nondecreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return abs(card.rank - prev.rank) <= 2
return card.rank >= prev.rank


face prev -> rank within 4; otherwise rank within 3

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return abs(card.rank - prev.rank) <= 4
return abs(card.rank - prev.rank) <= 3


red -> rank within 4; otherwise nondecreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 4
return card.rank >= prev.rank


even prev -> rank within 1; otherwise different suit

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 1
return card.suit != prev.suit


red -> rank within 4; otherwise opposite parity

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 4
return card.rank % 2 != prev.rank % 2


face prev -> same color; otherwise same suit

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.color == prev.color
return card.suit == prev.suit


even prev -> decreasing; otherwise nondecreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.rank < prev.rank
return card.rank >= prev.rank


face prev -> same parity; otherwise rank within 4

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.rank % 2 == prev.rank % 2
return abs(card.rank - prev.rank) <= 4


face prev -> decreasing; otherwise nondecreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.rank < prev.rank
return card.rank >= prev.rank


high prev -> rank within 2; otherwise nondecreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return abs(card.rank - prev.rank) <= 2
return card.rank >= prev.rank


even prev -> higher rank; otherwise different color

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.rank > prev.rank
return card.color != prev.color


high prev -> different color; otherwise higher rank

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.color != prev.color
return card.rank > prev.rank


even prev -> rank within 6; otherwise rank within 4

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 6
return abs(card.rank - prev.rank) <= 4


even prev -> rank within 2; otherwise nondecreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 2
return card.rank >= prev.rank


red -> rank within 2; otherwise nondecreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 2
return card.rank >= prev.rank


face prev -> same parity; otherwise nondecreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.rank % 2 == prev.rank % 2
return card.rank >= prev.rank


even prev -> rank within 2; otherwise same suit

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 2
return card.suit == prev.suit


high prev -> nondecreasing; otherwise higher rank

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.rank >= prev.rank
return card.rank > prev.rank


red -> rank within 2; otherwise different color

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 2
return card.color != prev.color


even prev -> rank within 1; otherwise nondecreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 1
return card.rank >= prev.rank


face prev -> rank within 4; otherwise different color

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return abs(card.rank - prev.rank) <= 4
return card.color != prev.color


even prev -> rank within 6; otherwise rank within 3

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 6
return abs(card.rank - prev.rank) <= 3


even prev -> rank within 1; otherwise rank within 5

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 1
return abs(card.rank - prev.rank) <= 5


even prev -> rank within 4; otherwise opposite parity

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 4
return card.rank % 2 != prev.rank % 2


even prev -> same suit; otherwise same parity

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.suit == prev.suit
return card.rank % 2 == prev.rank % 2


even prev -> rank within 2; otherwise higher rank

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 2
return card.rank > prev.rank


red -> rank within 5; otherwise rank within 2

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 5
return abs(card.rank - prev.rank) <= 2


high prev -> same suit; otherwise rank within 6

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.suit == prev.suit
return abs(card.rank - prev.rank) <= 6


red -> rank within 4; otherwise rank within 5

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 4
return abs(card.rank - prev.rank) <= 5


face prev -> nondecreasing; otherwise decreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.rank >= prev.rank
return card.rank < prev.rank


high prev -> opposite parity; otherwise same suit

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.rank % 2 != prev.rank % 2
return card.suit == prev.suit


face prev -> rank within 2; otherwise same parity

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return abs(card.rank - prev.rank) <= 2
return card.rank % 2 == prev.rank % 2


even prev -> same suit; otherwise opposite parity

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.suit == prev.suit
return card.rank % 2 != prev.rank % 2


face prev -> same parity; otherwise higher rank

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.rank % 2 == prev.rank % 2
return card.rank > prev.rank


even prev -> rank within 4; otherwise nondecreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 4
return card.rank >= prev.rank


high prev -> rank within 5; otherwise same color

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return abs(card.rank - prev.rank) <= 5
return card.color == prev.color


red -> rank within 5; otherwise rank within 4

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 5
return abs(card.rank - prev.rank) <= 4


high prev -> rank within 5; otherwise rank within 3

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return abs(card.rank - prev.rank) <= 5
return abs(card.rank - prev.rank) <= 3


face prev -> rank within 4; otherwise same color

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return abs(card.rank - prev.rank) <= 4
return card.color == prev.color


red -> different suit; otherwise nondecreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.suit != prev.suit
return card.rank >= prev.rank


red -> same suit; otherwise rank within 2

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.suit == prev.suit
return abs(card.rank - prev.rank) <= 2


red -> rank within 2; otherwise same suit

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 2
return card.suit == prev.suit


red -> rank within 4; otherwise same parity

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 4
return card.rank % 2 == prev.rank % 2


high prev -> higher rank; otherwise rank within 2

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.rank > prev.rank
return abs(card.rank - prev.rank) <= 2


high prev -> nondecreasing; otherwise rank within 4

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.rank >= prev.rank
return abs(card.rank - prev.rank) <= 4


high prev -> different suit; otherwise different color

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.suit != prev.suit
return card.color != prev.color


even prev -> rank within 4; otherwise rank within 2

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 4
return abs(card.rank - prev.rank) <= 2


high prev -> same parity; otherwise rank within 5

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.rank % 2 == prev.rank % 2
return abs(card.rank - prev.rank) <= 5


high prev -> rank within 5; otherwise rank within 4

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return abs(card.rank - prev.rank) <= 5
return abs(card.rank - prev.rank) <= 4


face prev -> same color; otherwise rank within 5

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.color == prev.color
return abs(card.rank - prev.rank) <= 5


high prev -> rank within 6; otherwise rank within 4

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return abs(card.rank - prev.rank) <= 6
return abs(card.rank - prev.rank) <= 4


even prev -> rank within 5; otherwise different suit

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 5
return card.suit != prev.suit


high prev -> different suit; otherwise opposite parity

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.suit != prev.suit
return card.rank % 2 != prev.rank % 2


red -> opposite parity; otherwise rank within 6

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.rank % 2 != prev.rank % 2
return abs(card.rank - prev.rank) <= 6


red -> different suit; otherwise same parity

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.suit != prev.suit
return card.rank % 2 == prev.rank % 2


face prev -> rank within 1; otherwise different suit

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return abs(card.rank - prev.rank) <= 1
return card.suit != prev.suit


red -> rank within 2; otherwise opposite parity

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 2
return card.rank % 2 != prev.rank % 2


face prev -> different color; otherwise rank within 6

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.color != prev.color
return abs(card.rank - prev.rank) <= 6


red -> different color; otherwise rank within 2

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.color != prev.color
return abs(card.rank - prev.rank) <= 2


face prev -> rank within 1; otherwise same parity

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return abs(card.rank - prev.rank) <= 1
return card.rank % 2 == prev.rank % 2


face prev -> rank within 5; otherwise different color

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return abs(card.rank - prev.rank) <= 5
return card.color != prev.color


red -> rank within 1; otherwise opposite parity

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 1
return card.rank % 2 != prev.rank % 2


high prev -> rank within 1; otherwise higher rank

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return abs(card.rank - prev.rank) <= 1
return card.rank > prev.rank


even prev -> same suit; otherwise nondecreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.suit == prev.suit
return card.rank >= prev.rank


high prev -> same parity; otherwise same color

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.rank % 2 == prev.rank % 2
return card.color == prev.color


red -> same color; otherwise rank within 4

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.color == prev.color
return abs(card.rank - prev.rank) <= 4


face prev -> different color; otherwise rank within 5

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.color != prev.color
return abs(card.rank - prev.rank) <= 5


red -> opposite parity; otherwise nondecreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.rank % 2 != prev.rank % 2
return card.rank >= prev.rank


even prev -> same parity; otherwise nondecreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.rank % 2 == prev.rank % 2
return card.rank >= prev.rank


even prev -> opposite parity; otherwise nondecreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.rank % 2 != prev.rank % 2
return card.rank >= prev.rank


high prev -> same color; otherwise rank within 6

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.color == prev.color
return abs(card.rank - prev.rank) <= 6


face prev -> rank within 1; otherwise decreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return abs(card.rank - prev.rank) <= 1
return card.rank < prev.rank


red -> same color; otherwise rank within 3

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.color == prev.color
return abs(card.rank - prev.rank) <= 3


high prev -> rank within 4; otherwise same color

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return abs(card.rank - prev.rank) <= 4
return card.color == prev.color


red -> same suit; otherwise different color

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.suit == prev.suit
return card.color != prev.color


red -> rank within 3; otherwise same parity

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 3
return card.rank % 2 == prev.rank % 2


high prev -> same color; otherwise same parity

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.color == prev.color
return card.rank % 2 == prev.rank % 2


face prev -> rank within 5; otherwise same color

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return abs(card.rank - prev.rank) <= 5
return card.color == prev.color


face prev -> rank within 6; otherwise different color

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return abs(card.rank - prev.rank) <= 6
return card.color != prev.color


high prev -> rank within 2; otherwise decreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return abs(card.rank - prev.rank) <= 2
return card.rank < prev.rank


high prev -> rank within 3; otherwise same suit

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return abs(card.rank - prev.rank) <= 3
return card.suit == prev.suit


face prev -> higher rank; otherwise rank within 3

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.rank > prev.rank
return abs(card.rank - prev.rank) <= 3


red -> rank within 6; otherwise higher rank

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 6
return card.rank > prev.rank


high prev -> higher rank; otherwise rank within 5

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.rank > prev.rank
return abs(card.rank - prev.rank) <= 5


even prev -> rank within 6; otherwise rank within 5

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 6
return abs(card.rank - prev.rank) <= 5


high prev -> same parity; otherwise same suit

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.rank % 2 == prev.rank % 2
return card.suit == prev.suit


face prev -> opposite parity; otherwise same suit

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.rank % 2 != prev.rank % 2
return card.suit == prev.suit


even prev -> opposite parity; otherwise rank within 2

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.rank % 2 != prev.rank % 2
return abs(card.rank - prev.rank) <= 2


high prev -> opposite parity; otherwise different color

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.rank % 2 != prev.rank % 2
return card.color != prev.color


red -> same parity; otherwise opposite parity

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.rank % 2 == prev.rank % 2
return card.rank % 2 != prev.rank % 2


red -> rank within 4; otherwise same suit

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 4
return card.suit == prev.suit


red -> rank within 1; otherwise higher rank

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 1
return card.rank > prev.rank


face prev -> decreasing; otherwise same parity

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.rank < prev.rank
return card.rank % 2 == prev.rank % 2


face prev -> rank within 2; otherwise rank within 6

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return abs(card.rank - prev.rank) <= 2
return abs(card.rank - prev.rank) <= 6


high prev -> rank within 3; otherwise rank within 1

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return abs(card.rank - prev.rank) <= 3
return abs(card.rank - prev.rank) <= 1


even prev -> rank within 5; otherwise rank within 6

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 5
return abs(card.rank - prev.rank) <= 6


face prev -> same color; otherwise rank within 2

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.color == prev.color
return abs(card.rank - prev.rank) <= 2


if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.color == prev.color
return card.rank < prev.rank


even prev -> rank within 5; otherwise same suit

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 5
return card.suit == prev.suit


even prev -> opposite parity; otherwise rank within 4

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.rank % 2 != prev.rank % 2
return abs(card.rank - prev.rank) <= 4


even prev -> opposite parity; otherwise same parity

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.rank % 2 != prev.rank % 2
return card.rank % 2 == prev.rank % 2


red -> decreasing; otherwise nondecreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.rank < prev.rank
return card.rank >= prev.rank


even prev -> different suit; otherwise rank within 3

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.suit != prev.suit
return abs(card.rank - prev.rank) <= 3


high prev -> different color; otherwise nondecreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.color != prev.color
return card.rank >= prev.rank


face prev -> same parity; otherwise different color

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.rank % 2 == prev.rank % 2
return card.color != prev.color


high prev -> rank within 6; otherwise nondecreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return abs(card.rank - prev.rank) <= 6
return card.rank >= prev.rank


red -> rank within 5; otherwise same suit

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 5
return card.suit == prev.suit


high prev -> nondecreasing; otherwise same suit

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.rank >= prev.rank
return card.suit == prev.suit


red -> rank within 5; otherwise rank within 3

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 5
return abs(card.rank - prev.rank) <= 3


face prev -> different suit; otherwise rank within 3

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.suit != prev.suit
return abs(card.rank - prev.rank) <= 3


even prev -> same parity; otherwise same color

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.rank % 2 == prev.rank % 2
return card.color == prev.color


high prev -> different color; otherwise same parity

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.color != prev.color
return card.rank % 2 == prev.rank % 2


high prev -> decreasing; otherwise rank within 2

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.rank < prev.rank
return abs(card.rank - prev.rank) <= 2


face prev -> rank within 2; otherwise opposite parity

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return abs(card.rank - prev.rank) <= 2
return card.rank % 2 != prev.rank % 2


high prev -> same parity; otherwise rank within 6

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.rank % 2 == prev.rank % 2
return abs(card.rank - prev.rank) <= 6


face prev -> same suit; otherwise rank within 1

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.suit == prev.suit
return abs(card.rank - prev.rank) <= 1


high prev -> opposite parity; otherwise rank within 5

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.rank % 2 != prev.rank % 2
return abs(card.rank - prev.rank) <= 5


face prev -> rank within 2; otherwise different color

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return abs(card.rank - prev.rank) <= 2
return card.color != prev.color


high prev -> decreasing; otherwise same parity

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.rank < prev.rank
return card.rank % 2 == prev.rank % 2


high prev -> rank within 6; otherwise decreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return abs(card.rank - prev.rank) <= 6
return card.rank < prev.rank


even prev -> same suit; otherwise rank within 4

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.suit == prev.suit
return abs(card.rank - prev.rank) <= 4


face prev -> same suit; otherwise different suit

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.suit == prev.suit
return card.suit != prev.suit


red -> different color; otherwise rank within 3

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.color != prev.color
return abs(card.rank - prev.rank) <= 3


high prev -> rank within 6; otherwise same color

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return abs(card.rank - prev.rank) <= 6
return card.color == prev.color


even prev -> rank within 3; otherwise rank within 1

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 3
return abs(card.rank - prev.rank) <= 1


red -> rank within 1; otherwise rank within 2

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 1
return abs(card.rank - prev.rank) <= 2


even prev -> same color; otherwise rank within 3

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.color == prev.color
return abs(card.rank - prev.rank) <= 3


even prev -> rank within 1; otherwise rank within 3

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 1
return abs(card.rank - prev.rank) <= 3


high prev -> different color; otherwise rank within 3

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.color != prev.color
return abs(card.rank - prev.rank) <= 3


high prev -> rank within 5; otherwise different suit

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return abs(card.rank - prev.rank) <= 5
return card.suit != prev.suit


face prev -> same parity; otherwise rank within 1

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.rank % 2 == prev.rank % 2
return abs(card.rank - prev.rank) <= 1


high prev -> same suit; otherwise nondecreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.suit == prev.suit
return card.rank >= prev.rank


face prev -> rank within 3; otherwise rank within 4

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return abs(card.rank - prev.rank) <= 3
return abs(card.rank - prev.rank) <= 4


even prev -> rank within 6; otherwise decreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 6
return card.rank < prev.rank


high prev -> rank within 3; otherwise rank within 4

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return abs(card.rank - prev.rank) <= 3
return abs(card.rank - prev.rank) <= 4


red -> different color; otherwise rank within 1

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.color != prev.color
return abs(card.rank - prev.rank) <= 1


even prev -> different suit; otherwise same suit

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.suit != prev.suit
return card.suit == prev.suit


face prev -> same color; otherwise rank within 3

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.color == prev.color
return abs(card.rank - prev.rank) <= 3


red -> same suit; otherwise rank within 5

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.suit == prev.suit
return abs(card.rank - prev.rank) <= 5


high prev -> different suit; otherwise rank within 4

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.suit != prev.suit
return abs(card.rank - prev.rank) <= 4


high prev -> rank within 2; otherwise rank within 4

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return abs(card.rank - prev.rank) <= 2
return abs(card.rank - prev.rank) <= 4


red -> rank within 3; otherwise opposite parity

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 3
return card.rank % 2 != prev.rank % 2


red -> rank within 5; otherwise rank within 6

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 5
return abs(card.rank - prev.rank) <= 6


red -> rank within 3; otherwise same suit

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 3
return card.suit == prev.suit


even prev -> rank within 3; otherwise rank within 4

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 3
return abs(card.rank - prev.rank) <= 4


red -> higher rank; otherwise decreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.rank > prev.rank
return card.rank < prev.rank


face prev -> same parity; otherwise different suit

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.rank % 2 == prev.rank % 2
return card.suit != prev.suit


high prev -> different color; otherwise rank within 2

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.color != prev.color
return abs(card.rank - prev.rank) <= 2


high prev -> rank within 3; otherwise decreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return abs(card.rank - prev.rank) <= 3
return card.rank < prev.rank


face prev -> higher rank; otherwise rank within 4

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.rank > prev.rank
return abs(card.rank - prev.rank) <= 4


if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.rank < prev.rank
return card.color == prev.color


face prev -> nondecreasing; otherwise different suit

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.rank >= prev.rank
return card.suit != prev.suit


high prev -> rank within 4; otherwise rank within 2

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return abs(card.rank - prev.rank) <= 4
return abs(card.rank - prev.rank) <= 2


red -> same parity; otherwise different suit

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.rank % 2 == prev.rank % 2
return card.suit != prev.suit


even prev -> rank within 3; otherwise opposite parity

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 3
return card.rank % 2 != prev.rank % 2


red -> higher rank; otherwise rank within 6

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.rank > prev.rank
return abs(card.rank - prev.rank) <= 6


red -> same suit; otherwise rank within 4

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.suit == prev.suit
return abs(card.rank - prev.rank) <= 4


red -> different suit; otherwise rank within 6

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.suit != prev.suit
return abs(card.rank - prev.rank) <= 6


face prev -> same suit; otherwise same color

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.suit == prev.suit
return card.color == prev.color


red -> rank within 5; otherwise nondecreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 5
return card.rank >= prev.rank


high prev -> rank within 2; otherwise same parity

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return abs(card.rank - prev.rank) <= 2
return card.rank % 2 == prev.rank % 2


high prev -> rank within 6; otherwise same parity

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return abs(card.rank - prev.rank) <= 6
return card.rank % 2 == prev.rank % 2


high prev -> higher rank; otherwise different color

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.rank > prev.rank
return card.color != prev.color


high prev -> rank within 1; otherwise same suit

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return abs(card.rank - prev.rank) <= 1
return card.suit == prev.suit


even prev -> higher rank; otherwise rank within 2

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.rank > prev.rank
return abs(card.rank - prev.rank) <= 2


high prev -> opposite parity; otherwise rank within 1

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.rank % 2 != prev.rank % 2
return abs(card.rank - prev.rank) <= 1


high prev -> rank within 2; otherwise rank within 1

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return abs(card.rank - prev.rank) <= 2
return abs(card.rank - prev.rank) <= 1


even prev -> rank within 6; otherwise opposite parity

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 6
return card.rank % 2 != prev.rank % 2


high prev -> rank within 1; otherwise rank within 5

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return abs(card.rank - prev.rank) <= 1
return abs(card.rank - prev.rank) <= 5


high prev -> rank within 5; otherwise decreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return abs(card.rank - prev.rank) <= 5
return card.rank < prev.rank


even prev -> same color; otherwise rank within 5

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.color == prev.color
return abs(card.rank - prev.rank) <= 5


red -> rank within 6; otherwise same color

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 6
return card.color == prev.color


red -> rank within 6; otherwise rank within 3

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 6
return abs(card.rank - prev.rank) <= 3


high prev -> decreasing; otherwise rank within 4

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.rank < prev.rank
return abs(card.rank - prev.rank) <= 4


face prev -> rank within 2; otherwise same suit

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return abs(card.rank - prev.rank) <= 2
return card.suit == prev.suit


high prev -> decreasing; otherwise rank within 1

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.rank < prev.rank
return abs(card.rank - prev.rank) <= 1


red -> different color; otherwise rank within 6

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.color != prev.color
return abs(card.rank - prev.rank) <= 6


red -> rank within 1; otherwise decreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 1
return card.rank < prev.rank


face prev -> rank within 3; otherwise different color

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return abs(card.rank - prev.rank) <= 3
return card.color != prev.color


face prev -> decreasing; otherwise rank within 1

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.rank < prev.rank
return abs(card.rank - prev.rank) <= 1


even prev -> rank within 1; otherwise same parity

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 1
return card.rank % 2 == prev.rank % 2


face prev -> different suit; otherwise rank within 1

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.suit != prev.suit
return abs(card.rank - prev.rank) <= 1


high prev -> rank within 6; otherwise different suit

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return abs(card.rank - prev.rank) <= 6
return card.suit != prev.suit


high prev -> rank within 6; otherwise rank within 2

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return abs(card.rank - prev.rank) <= 6
return abs(card.rank - prev.rank) <= 2


face prev -> rank within 4; otherwise higher rank

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return abs(card.rank - prev.rank) <= 4
return card.rank > prev.rank


high prev -> rank within 5; otherwise rank within 6

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return abs(card.rank - prev.rank) <= 5
return abs(card.rank - prev.rank) <= 6


face prev -> different color; otherwise opposite parity

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.color != prev.color
return card.rank % 2 != prev.rank % 2


even prev -> decreasing; otherwise rank within 5

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.rank < prev.rank
return abs(card.rank - prev.rank) <= 5


even prev -> different color; otherwise rank within 6

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.color != prev.color
return abs(card.rank - prev.rank) <= 6


face prev -> same parity; otherwise rank within 5

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.rank % 2 == prev.rank % 2
return abs(card.rank - prev.rank) <= 5


face prev -> higher rank; otherwise same suit

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.rank > prev.rank
return card.suit == prev.suit


face prev -> nondecreasing; otherwise same color

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.rank >= prev.rank
return card.color == prev.color


red -> nondecreasing; otherwise rank within 6

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.rank >= prev.rank
return abs(card.rank - prev.rank) <= 6


if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.suit == prev.suit
return card.rank % 2 == prev.rank % 2


even prev -> rank within 5; otherwise opposite parity

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 5
return card.rank % 2 != prev.rank % 2


even prev -> different color; otherwise decreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.color != prev.color
return card.rank < prev.rank


high prev -> rank within 3; otherwise same parity

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return abs(card.rank - prev.rank) <= 3
return card.rank % 2 == prev.rank % 2


red -> rank within 1; otherwise same color

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 1
return card.color == prev.color


high prev -> higher rank; otherwise different suit

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.rank > prev.rank
return card.suit != prev.suit


face prev -> same suit; otherwise rank within 2

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.suit == prev.suit
return abs(card.rank - prev.rank) <= 2


face prev -> rank within 5; otherwise same parity

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return abs(card.rank - prev.rank) <= 5
return card.rank % 2 == prev.rank % 2


high prev -> same color; otherwise higher rank

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.color == prev.color
return card.rank > prev.rank


red -> rank within 2; otherwise same parity

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 2
return card.rank % 2 == prev.rank % 2


even prev -> rank within 1; otherwise opposite parity

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 1
return card.rank % 2 != prev.rank % 2


high prev -> different suit; otherwise same parity

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.suit != prev.suit
return card.rank % 2 == prev.rank % 2


red -> different suit; otherwise rank within 3

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.suit != prev.suit
return abs(card.rank - prev.rank) <= 3


face prev -> rank within 4; otherwise nondecreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return abs(card.rank - prev.rank) <= 4
return card.rank >= prev.rank


high prev -> same suit; otherwise same parity

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.suit == prev.suit
return card.rank % 2 == prev.rank % 2


even prev -> rank within 3; otherwise rank within 6

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 3
return abs(card.rank - prev.rank) <= 6


high prev -> different suit; otherwise same color

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.suit != prev.suit
return card.color == prev.color


face prev -> different suit; otherwise same color

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.suit != prev.suit
return card.color == prev.color


even prev -> nondecreasing; otherwise same color

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.rank >= prev.rank
return card.color == prev.color


even prev -> different suit; otherwise nondecreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.suit != prev.suit
return card.rank >= prev.rank


face prev -> nondecreasing; otherwise higher rank

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.rank >= prev.rank
return card.rank > prev.rank


high prev -> different color; otherwise same suit

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.color != prev.color
return card.suit == prev.suit


face prev -> same suit; otherwise rank within 5

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.suit == prev.suit
return abs(card.rank - prev.rank) <= 5


face prev -> rank within 6; otherwise same parity

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return abs(card.rank - prev.rank) <= 6
return card.rank % 2 == prev.rank % 2


red -> decreasing; otherwise rank within 3

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.rank < prev.rank
return abs(card.rank - prev.rank) <= 3


red -> higher rank; otherwise rank within 4

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.rank > prev.rank
return abs(card.rank - prev.rank) <= 4


red -> same parity; otherwise rank within 3

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.rank % 2 == prev.rank % 2
return abs(card.rank - prev.rank) <= 3


face prev -> decreasing; otherwise rank within 3

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.rank < prev.rank
return abs(card.rank - prev.rank) <= 3


red -> higher rank; otherwise rank within 3

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.rank > prev.rank
return abs(card.rank - prev.rank) <= 3


red -> different suit; otherwise rank within 2

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.suit != prev.suit
return abs(card.rank - prev.rank) <= 2


high prev -> higher rank; otherwise same color

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.rank > prev.rank
return card.color == prev.color


even prev -> rank within 6; otherwise higher rank

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 6
return card.rank > prev.rank


face prev -> different suit; otherwise rank within 2

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.suit != prev.suit
return abs(card.rank - prev.rank) <= 2


face prev -> higher rank; otherwise same color

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.rank > prev.rank
return card.color == prev.color


high prev -> higher rank; otherwise opposite parity

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.rank > prev.rank
return card.rank % 2 != prev.rank % 2


face prev -> rank within 4; otherwise opposite parity

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return abs(card.rank - prev.rank) <= 4
return card.rank % 2 != prev.rank % 2


face prev -> rank within 1; otherwise rank within 6

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return abs(card.rank - prev.rank) <= 1
return abs(card.rank - prev.rank) <= 6


high prev -> higher rank; otherwise decreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.rank > prev.rank
return card.rank < prev.rank


red -> rank within 1; otherwise nondecreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 1
return card.rank >= prev.rank


face prev -> rank within 2; otherwise rank within 1

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return abs(card.rank - prev.rank) <= 2
return abs(card.rank - prev.rank) <= 1


high prev -> rank within 4; otherwise higher rank

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return abs(card.rank - prev.rank) <= 4
return card.rank > prev.rank


even prev -> rank within 4; otherwise same suit

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 4
return card.suit == prev.suit


red -> same parity; otherwise different color

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.rank % 2 == prev.rank % 2
return card.color != prev.color


face prev -> decreasing; otherwise rank within 6

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.rank < prev.rank
return abs(card.rank - prev.rank) <= 6


red -> rank within 5; otherwise same parity

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 5
return card.rank % 2 == prev.rank % 2


high prev -> decreasing; otherwise different color

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.rank < prev.rank
return card.color != prev.color


red -> decreasing; otherwise rank within 2

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.rank < prev.rank
return abs(card.rank - prev.rank) <= 2


high prev -> decreasing; otherwise rank within 3

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.rank < prev.rank
return abs(card.rank - prev.rank) <= 3


face prev -> same color; otherwise different color

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.color == prev.color
return card.color != prev.color


red -> nondecreasing; otherwise same parity

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.rank >= prev.rank
return card.rank % 2 == prev.rank % 2


red -> rank within 3; otherwise rank within 5

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 3
return abs(card.rank - prev.rank) <= 5


high prev -> different suit; otherwise higher rank

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.suit != prev.suit
return card.rank > prev.rank


even prev -> rank within 2; otherwise different color

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 2
return card.color != prev.color


red -> rank within 6; otherwise same parity

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 6
return card.rank % 2 == prev.rank % 2


even prev -> same suit; otherwise rank within 5

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.suit == prev.suit
return abs(card.rank - prev.rank) <= 5


face prev -> rank within 6; otherwise different suit

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return abs(card.rank - prev.rank) <= 6
return card.suit != prev.suit


even prev -> different color; otherwise rank within 3

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.color != prev.color
return abs(card.rank - prev.rank) <= 3


face prev -> opposite parity; otherwise rank within 6

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.rank % 2 != prev.rank % 2
return abs(card.rank - prev.rank) <= 6


red -> rank within 3; otherwise rank within 6

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 3
return abs(card.rank - prev.rank) <= 6


even prev -> same color; otherwise rank within 6

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.color == prev.color
return abs(card.rank - prev.rank) <= 6


high prev -> higher rank; otherwise rank within 3

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.rank > prev.rank
return abs(card.rank - prev.rank) <= 3


high prev -> same suit; otherwise rank within 4

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.suit == prev.suit
return abs(card.rank - prev.rank) <= 4


if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.rank > prev.rank
return card.suit == prev.suit


face prev -> decreasing; otherwise rank within 5

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.rank < prev.rank
return abs(card.rank - prev.rank) <= 5


red -> nondecreasing; otherwise opposite parity

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.rank >= prev.rank
return card.rank % 2 != prev.rank % 2


high prev -> rank within 1; otherwise decreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return abs(card.rank - prev.rank) <= 1
return card.rank < prev.rank


even prev -> rank within 1; otherwise same color

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 1
return card.color == prev.color


face prev -> different color; otherwise same suit

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.color != prev.color
return card.suit == prev.suit


high prev -> rank within 3; otherwise rank within 6

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return abs(card.rank - prev.rank) <= 3
return abs(card.rank - prev.rank) <= 6


red -> same suit; otherwise rank within 1

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.suit == prev.suit
return abs(card.rank - prev.rank) <= 1


high prev -> rank within 1; otherwise different suit

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return abs(card.rank - prev.rank) <= 1
return card.suit != prev.suit


high prev -> opposite parity; otherwise rank within 3

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.rank % 2 != prev.rank % 2
return abs(card.rank - prev.rank) <= 3


high prev -> opposite parity; otherwise same color

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.rank % 2 != prev.rank % 2
return card.color == prev.color


face prev -> rank within 6; otherwise opposite parity

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return abs(card.rank - prev.rank) <= 6
return card.rank % 2 != prev.rank % 2


high prev -> different suit; otherwise nondecreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.suit != prev.suit
return card.rank >= prev.rank


face prev -> rank within 3; otherwise rank within 5

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return abs(card.rank - prev.rank) <= 3
return abs(card.rank - prev.rank) <= 5


even prev -> rank within 1; otherwise rank within 4

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 1
return abs(card.rank - prev.rank) <= 4


high prev -> same color; otherwise rank within 2

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.color == prev.color
return abs(card.rank - prev.rank) <= 2


even prev -> decreasing; otherwise rank within 2

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.rank < prev.rank
return abs(card.rank - prev.rank) <= 2


red -> rank within 6; otherwise rank within 4

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 6
return abs(card.rank - prev.rank) <= 4


red -> rank within 6; otherwise rank within 5

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 6
return abs(card.rank - prev.rank) <= 5


face prev -> same color; otherwise nondecreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.color == prev.color
return card.rank >= prev.rank


high prev -> nondecreasing; otherwise decreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.rank >= prev.rank
return card.rank < prev.rank


high prev -> opposite parity; otherwise rank within 6

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.rank % 2 != prev.rank % 2
return abs(card.rank - prev.rank) <= 6


red -> rank within 2; otherwise rank within 5

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 2
return abs(card.rank - prev.rank) <= 5


red -> rank within 5; otherwise different suit

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 5
return card.suit != prev.suit


high prev -> same color; otherwise rank within 4

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.color == prev.color
return abs(card.rank - prev.rank) <= 4


face prev -> opposite parity; otherwise rank within 2

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.rank % 2 != prev.rank % 2
return abs(card.rank - prev.rank) <= 2


even prev -> rank within 6; otherwise same parity

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 6
return card.rank % 2 == prev.rank % 2


even prev -> higher rank; otherwise nondecreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.rank > prev.rank
return card.rank >= prev.rank


even prev -> rank within 3; otherwise same parity

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 3
return card.rank % 2 == prev.rank % 2


face prev -> different color; otherwise nondecreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.color != prev.color
return card.rank >= prev.rank


face prev -> rank within 6; otherwise rank within 2

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return abs(card.rank - prev.rank) <= 6
return abs(card.rank - prev.rank) <= 2


red -> rank within 6; otherwise decreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 6
return card.rank < prev.rank


even prev -> same color; otherwise nondecreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.color == prev.color
return card.rank >= prev.rank


even prev -> rank within 1; otherwise decreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 1
return card.rank < prev.rank


red -> rank within 4; otherwise different suit

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 4
return card.suit != prev.suit


even prev -> rank within 3; otherwise different color

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 3
return card.color != prev.color


face prev -> rank within 3; otherwise same parity

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return abs(card.rank - prev.rank) <= 3
return card.rank % 2 == prev.rank % 2


red -> nondecreasing; otherwise rank within 2

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.rank >= prev.rank
return abs(card.rank - prev.rank) <= 2


even prev -> nondecreasing; otherwise rank within 6

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.rank >= prev.rank
return abs(card.rank - prev.rank) <= 6


face prev -> rank within 3; otherwise rank within 2

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return abs(card.rank - prev.rank) <= 3
return abs(card.rank - prev.rank) <= 2


even prev -> same color; otherwise decreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.color == prev.color
return card.rank < prev.rank


red -> same parity; otherwise rank within 5

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.rank % 2 == prev.rank % 2
return abs(card.rank - prev.rank) <= 5


red -> opposite parity; otherwise rank within 2

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.rank % 2 != prev.rank % 2
return abs(card.rank - prev.rank) <= 2


high prev -> same parity; otherwise opposite parity

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.rank % 2 == prev.rank % 2
return card.rank % 2 != prev.rank % 2


face prev -> opposite parity; otherwise rank within 1

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.rank % 2 != prev.rank % 2
return abs(card.rank - prev.rank) <= 1


red -> opposite parity; otherwise same parity

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.rank % 2 != prev.rank % 2
return card.rank % 2 == prev.rank % 2


even prev -> opposite parity; otherwise rank within 6

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.rank % 2 != prev.rank % 2
return abs(card.rank - prev.rank) <= 6


even prev -> nondecreasing; otherwise decreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.rank >= prev.rank
return card.rank < prev.rank


red -> rank within 6; otherwise rank within 2

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 6
return abs(card.rank - prev.rank) <= 2


even prev -> different suit; otherwise rank within 2

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.suit != prev.suit
return abs(card.rank - prev.rank) <= 2


even prev -> decreasing; otherwise rank within 1

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.rank < prev.rank
return abs(card.rank - prev.rank) <= 1


face prev -> rank within 2; otherwise same color

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return abs(card.rank - prev.rank) <= 2
return card.color == prev.color


high prev -> different color; otherwise different suit

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.color != prev.color
return card.suit != prev.suit


face prev -> rank within 5; otherwise higher rank

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return abs(card.rank - prev.rank) <= 5
return card.rank > prev.rank


high prev -> different color; otherwise rank within 5

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.color != prev.color
return abs(card.rank - prev.rank) <= 5


face prev -> same suit; otherwise higher rank

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.suit == prev.suit
return card.rank > prev.rank


even prev -> nondecreasing; otherwise different suit

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.rank >= prev.rank
return card.suit != prev.suit


even prev -> same parity; otherwise rank within 6

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.rank % 2 == prev.rank % 2
return abs(card.rank - prev.rank) <= 6


even prev -> nondecreasing; otherwise rank within 1

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.rank >= prev.rank
return abs(card.rank - prev.rank) <= 1


red -> rank within 2; otherwise same color

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 2
return card.color == prev.color


red -> nondecreasing; otherwise rank within 5

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.rank >= prev.rank
return abs(card.rank - prev.rank) <= 5


even prev -> rank within 6; otherwise rank within 2

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 6
return abs(card.rank - prev.rank) <= 2


red -> rank within 4; otherwise different color

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 4
return card.color != prev.color


red -> nondecreasing; otherwise higher rank

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.rank >= prev.rank
return card.rank > prev.rank


face prev -> rank within 2; otherwise rank within 4

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return abs(card.rank - prev.rank) <= 2
return abs(card.rank - prev.rank) <= 4


red -> rank within 6; otherwise nondecreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 6
return card.rank >= prev.rank


even prev -> opposite parity; otherwise rank within 3

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.rank % 2 != prev.rank % 2
return abs(card.rank - prev.rank) <= 3


red -> rank within 3; otherwise higher rank

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 3
return card.rank > prev.rank


even prev -> same parity; otherwise higher rank

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.rank % 2 == prev.rank % 2
return card.rank > prev.rank


red -> rank within 2; otherwise different suit

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 2
return card.suit != prev.suit


even prev -> rank within 2; otherwise opposite parity

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 2
return card.rank % 2 != prev.rank % 2


face prev -> same suit; otherwise rank within 4

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.suit == prev.suit
return abs(card.rank - prev.rank) <= 4


face prev -> rank within 3; otherwise same color

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return abs(card.rank - prev.rank) <= 3
return card.color == prev.color


even prev -> nondecreasing; otherwise rank within 2

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.rank >= prev.rank
return abs(card.rank - prev.rank) <= 2


high prev -> nondecreasing; otherwise same parity

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.rank >= prev.rank
return card.rank % 2 == prev.rank % 2


high prev -> rank within 5; otherwise higher rank

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return abs(card.rank - prev.rank) <= 5
return card.rank > prev.rank


even prev -> same suit; otherwise same color

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.suit == prev.suit
return card.color == prev.color


even prev -> rank within 6; otherwise different suit

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 6
return card.suit != prev.suit


red -> rank within 6; otherwise rank within 1

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 6
return abs(card.rank - prev.rank) <= 1


even prev -> same parity; otherwise rank within 1

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.rank % 2 == prev.rank % 2
return abs(card.rank - prev.rank) <= 1


face prev -> nondecreasing; otherwise opposite parity

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.rank >= prev.rank
return card.rank % 2 != prev.rank % 2


face prev -> opposite parity; otherwise rank within 3

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.rank % 2 != prev.rank % 2
return abs(card.rank - prev.rank) <= 3


red -> different suit; otherwise same suit

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.suit != prev.suit
return card.suit == prev.suit


even prev -> rank within 3; otherwise nondecreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 3
return card.rank >= prev.rank


face prev -> different suit; otherwise higher rank

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.suit != prev.suit
return card.rank > prev.rank


high prev -> rank within 4; otherwise different color

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return abs(card.rank - prev.rank) <= 4
return card.color != prev.color


high prev -> rank within 4; otherwise same parity

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return abs(card.rank - prev.rank) <= 4
return card.rank % 2 == prev.rank % 2


red -> higher rank; otherwise nondecreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.rank > prev.rank
return card.rank >= prev.rank


high prev -> same color; otherwise rank within 1

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.color == prev.color
return abs(card.rank - prev.rank) <= 1


high prev -> rank within 3; otherwise higher rank

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return abs(card.rank - prev.rank) <= 3
return card.rank > prev.rank


face prev -> same parity; otherwise rank within 2

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.rank % 2 == prev.rank % 2
return abs(card.rank - prev.rank) <= 2


even prev -> higher rank; otherwise rank within 4

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.rank > prev.rank
return abs(card.rank - prev.rank) <= 4


face prev -> different suit; otherwise rank within 4

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.suit != prev.suit
return abs(card.rank - prev.rank) <= 4


high prev -> decreasing; otherwise opposite parity

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.rank < prev.rank
return card.rank % 2 != prev.rank % 2


even prev -> different suit; otherwise rank within 5

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.suit != prev.suit
return abs(card.rank - prev.rank) <= 5


high prev -> different suit; otherwise rank within 1

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.suit != prev.suit
return abs(card.rank - prev.rank) <= 1


even prev -> different color; otherwise rank within 1

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.color != prev.color
return abs(card.rank - prev.rank) <= 1


high prev -> rank within 1; otherwise rank within 6

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return abs(card.rank - prev.rank) <= 1
return abs(card.rank - prev.rank) <= 6


red -> rank within 3; otherwise decreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 3
return card.rank < prev.rank


face prev -> rank within 5; otherwise rank within 2

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return abs(card.rank - prev.rank) <= 5
return abs(card.rank - prev.rank) <= 2


face prev -> rank within 3; otherwise higher rank

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return abs(card.rank - prev.rank) <= 3
return card.rank > prev.rank


even prev -> rank within 6; otherwise nondecreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 6
return card.rank >= prev.rank


even prev -> rank within 5; otherwise same color

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 5
return card.color == prev.color


high prev -> rank within 1; otherwise rank within 2

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return abs(card.rank - prev.rank) <= 1
return abs(card.rank - prev.rank) <= 2


even prev -> rank within 5; otherwise rank within 1

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 5
return abs(card.rank - prev.rank) <= 1


high prev -> same color; otherwise same suit

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.color == prev.color
return card.suit == prev.suit


even prev -> rank within 1; otherwise rank within 6

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 1
return abs(card.rank - prev.rank) <= 6


high prev -> same suit; otherwise different suit

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.suit == prev.suit
return card.suit != prev.suit


face prev -> rank within 1; otherwise rank within 5

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return abs(card.rank - prev.rank) <= 1
return abs(card.rank - prev.rank) <= 5


face prev -> different color; otherwise rank within 2

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.color != prev.color
return abs(card.rank - prev.rank) <= 2


red -> decreasing; otherwise rank within 5

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.rank < prev.rank
return abs(card.rank - prev.rank) <= 5


high prev -> nondecreasing; otherwise different suit

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.rank >= prev.rank
return card.suit != prev.suit


red -> higher rank; otherwise rank within 1

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.rank > prev.rank
return abs(card.rank - prev.rank) <= 1


face prev -> rank within 1; otherwise higher rank

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return abs(card.rank - prev.rank) <= 1
return card.rank > prev.rank


high prev -> rank within 3; otherwise rank within 2

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return abs(card.rank - prev.rank) <= 3
return abs(card.rank - prev.rank) <= 2


red -> opposite parity; otherwise rank within 3

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.rank % 2 != prev.rank % 2
return abs(card.rank - prev.rank) <= 3


high prev -> decreasing; otherwise rank within 5

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.rank < prev.rank
return abs(card.rank - prev.rank) <= 5


red -> nondecreasing; otherwise decreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.rank >= prev.rank
return card.rank < prev.rank


even prev -> same color; otherwise rank within 2

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.color == prev.color
return abs(card.rank - prev.rank) <= 2


face prev -> rank within 5; otherwise rank within 3

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return abs(card.rank - prev.rank) <= 5
return abs(card.rank - prev.rank) <= 3


high prev -> decreasing; otherwise higher rank

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.rank < prev.rank
return card.rank > prev.rank


face prev -> rank within 4; otherwise decreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return abs(card.rank - prev.rank) <= 4
return card.rank < prev.rank


even prev -> different suit; otherwise rank within 4

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.suit != prev.suit
return abs(card.rank - prev.rank) <= 4


even prev -> different color; otherwise rank within 4

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.color != prev.color
return abs(card.rank - prev.rank) <= 4


high prev -> different color; otherwise rank within 6

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.color != prev.color
return abs(card.rank - prev.rank) <= 6


even prev -> nondecreasing; otherwise different color

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return card.rank >= prev.rank
return card.color != prev.color


high prev -> rank within 1; otherwise rank within 4

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return abs(card.rank - prev.rank) <= 1
return abs(card.rank - prev.rank) <= 4


high prev -> rank within 2; otherwise opposite parity

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return abs(card.rank - prev.rank) <= 2
return card.rank % 2 != prev.rank % 2


red -> rank within 5; otherwise same color

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 5
return card.color == prev.color


red -> rank within 5; otherwise different color

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 5
return card.color != prev.color


high prev -> same parity; otherwise rank within 2

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.rank % 2 == prev.rank % 2
return abs(card.rank - prev.rank) <= 2


face prev -> higher rank; otherwise same parity

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.rank > prev.rank
return card.rank % 2 == prev.rank % 2


face prev -> higher rank; otherwise nondecreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return card.rank > prev.rank
return card.rank >= prev.rank


even prev -> rank within 2; otherwise rank within 6

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 2
return abs(card.rank - prev.rank) <= 6


red -> rank within 6; otherwise opposite parity

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 6
return card.rank % 2 != prev.rank % 2


high prev -> same suit; otherwise rank within 2

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.suit == prev.suit
return abs(card.rank - prev.rank) <= 2


red -> rank within 5; otherwise rank within 1

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 5
return abs(card.rank - prev.rank) <= 1


red -> same color; otherwise rank within 1

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.color == prev.color
return abs(card.rank - prev.rank) <= 1


high prev -> rank within 1; otherwise nondecreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return abs(card.rank - prev.rank) <= 1
return card.rank >= prev.rank


red -> higher rank; otherwise rank within 2

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return card.rank > prev.rank
return abs(card.rank - prev.rank) <= 2


even prev -> rank within 1; otherwise different color

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 1
return card.color != prev.color


red -> rank within 4; otherwise rank within 3

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 4
return abs(card.rank - prev.rank) <= 3


face prev -> rank within 6; otherwise higher rank

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return abs(card.rank - prev.rank) <= 6
return card.rank > prev.rank


high prev -> different color; otherwise rank within 1

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.color != prev.color
return abs(card.rank - prev.rank) <= 1


high prev -> different suit; otherwise rank within 3

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.suit != prev.suit
return abs(card.rank - prev.rank) <= 3


high prev -> rank within 6; otherwise same suit

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return abs(card.rank - prev.rank) <= 6
return card.suit == prev.suit


red -> rank within 4; otherwise rank within 6

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 4
return abs(card.rank - prev.rank) <= 6


even prev -> rank within 2; otherwise rank within 4

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 2
return abs(card.rank - prev.rank) <= 4


red -> rank within 3; otherwise different color

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 3
return card.color != prev.color


even prev -> rank within 5; otherwise rank within 2

if not mainline:
    return True
prev = mainline[-1]
if prev.rank % 2 == 0:
    return abs(card.rank - prev.rank) <= 5
return abs(card.rank - prev.rank) <= 2


red -> rank within 1; otherwise rank within 6

if not mainline:
    return True
prev = mainline[-1]
if prev.color == "red":
    return abs(card.rank - prev.rank) <= 1
return abs(card.rank - prev.rank) <= 6


face prev -> rank within 4; otherwise same parity

if not mainline:
    return True
prev = mainline[-1]
if prev.is_face:
    return abs(card.rank - prev.rank) <= 4
return card.rank % 2 == prev.rank % 2


high prev -> same parity; otherwise nondecreasing

if not mainline:
    return True
prev = mainline[-1]
if prev.rank >= 9:
    return card.rank % 2 == prev.rank % 2
return card.rank >= prev.rank