Derived from this, now deleted, post.

Given a string, answer (truthy/falsy or two consistent values) if it constitutes a good Bishop password, which is when all the following conditions are met:

1. it has at least 10 characters

2. it has at least 3 digits ([0-9])

3. it is not a palindrome (identical to itself when reversed)

You get 0 bytes bonus if your code is a good Bishop password.

Warning: Do not use Bishop goodness as a measure of actual password strength!

## Examples

PPCG123GCPP
PPCG123PPCG
PPCG123gcpp
0123456789
Tr0ub4dor&3

PPCG123 (too short)
correct horse battery staple (not enough digits)
PPCG121GCPP (palindrome)
(too short and not enough digits)
abc121cba (too short and palindrome)
aaaaaaaaaaaa (palindrome and not enough digits)
abc99cba (everything wrong)

• @KrystosTheOverlord The term is defined in this challenge itself. ;-P Commented Feb 13, 2019 at 13:36
• Aw, I was expecting some chess logic password rules… Commented Feb 13, 2019 at 17:29
• I read through all the answers and not one claimed the bonus. Commented Feb 13, 2019 at 21:29
• @JDL you really get to substract 0 bytes from your score if you qualify for this very real bonus! What are you waiting for? Commented Feb 14, 2019 at 10:24
• One of your criteria is actually the reverse of what Bishop (2013) proposed. He proposed that passwords must be 10 characters or less, not more. Commented Feb 17, 2019 at 3:39

# Python 2, 615954 51 bytes

lambda s:sum(map(str.isdigit,s))>2<s[:9]<s<>s[::-1]


Try it online!

-5 bytes, thanks to Erik the Outgolfer
-3 bytes, thanks to xnor

• Choo choo! Commented Feb 13, 2019 at 14:08
• @EriktheOutgolfer Thanks:) Commented Feb 13, 2019 at 15:52
• You can do the length check as s[:9]<s, which combines well with the non-palindrome check: s[:9]<s!=s[::-1]
– xnor
Commented Feb 14, 2019 at 1:18

# 05AB1E, 12 bytes

gT@Iþg3@IÂÊP


Explanation:

g      # Get the length of the (implicit) input
T@    # Check if this length >= 10
Iþ     # Get the input and only leave the digits
g    # Then get the length (amount of digits)
3@  # And check if the amount of digits >= 3
IÂ     # Get the input and the input reversed
Ê    # Check if they are not equal (so not a palindrome)
P      # Check if all three above are truthy (and output implicitly)


# Japt, 17 14 bytes

Ê¨A&U¦Ô&3§Uè\d


-3 bytes rearranged by @Shaggy

Try it online!

# Japt, 15 bytes (0 Bytes Bonus :v)

Ê¨10&U¦Ô&3§Uè\d


Try it online!

• Dang! Should've checked the solutions before starting my own! 14 bytes Commented Feb 13, 2019 at 14:47

# R, 80706264 63 bytes

any(rev(U<-utf8ToInt(scan(,'')))<U)&sum(U>47&U<58)>2&sum(U|1)>9


Try it online!

From digEmAll, and some rearranging too

sum((s<-el(strsplit(scan(,''),"")))%in%0:9)>2&!all(s==rev(s))&s[10]>''


Try it online!

Pretty straightforward, no real amazing tricks here. After user inputs string:

• Separates and searches the string for more than 2 numbers. (3 or more digits)
• Checks if not all elements are equal to the reversed version of the string (palindrome)
• Checks that length is greater than 9 (10 or more characters)
• I think you can replace !all(s==rev(s)) with any(s!=rev(s)) which will save one byte. I feel like the length check can be reduced too, but not sure how (either nchar or some kind of sum(x|1) hack)
– JDL
Commented Feb 14, 2019 at 9:05
• actually, I think any(s>rev(s)) will work --- if a character is less than its palindromic counterpart, then at the other end of the password the converse will be true. That saves another byte.
– JDL
Commented Feb 14, 2019 at 9:08
• 62 bytes using utf8ToInt Commented Feb 14, 2019 at 18:58
• @digEmAll your example returns true when there is only one number, you will need to include a >2 Commented Feb 15, 2019 at 9:46
• 64 but correct ;) Commented Feb 15, 2019 at 9:52

# APL+WIN, 36, 30 29 bytes

7 bytes saved thank to Adám

Index origin = 0

Prompts for input string

(10≤⍴v)×(3≤+/v∊∊⍕¨⍳10)>v≡⌽v←⎕


Try it online! Courtesy of Dyalog Classic

Explanation:

(10≤⍴v) Length test pass 1 fail 0

(3≤+/v∊∊⍕¨⍳10) Number of digits test

>v≡⌽v Palindrome test


The code also qualifies for the bonus as it is a good Bishop password.

• @Adám. Thanks for saving 6 bytes. On ⎕IO agreed. v≡⌽v works fine if I prepend ~. As to use of x I tend to use it when stringing together boolean tests. Same result same number of bytes. Commented Feb 14, 2019 at 10:47
• Do you have ≢ which is ~≡? And even if you don't, you can merge ×~ into >
Commented Feb 14, 2019 at 11:25
• @Adám No I do not have ≢. I can merge ×~ into > for one more byte. Thanks. I am afraid my "putting game" still needs more practice ;) Commented Feb 14, 2019 at 13:03

# Brachylog, 18 12 bytes

Thanks for the tips, Kroppeb and Fatalize!

¬↔?l>9&ịˢl>2


Try it online!

### Explanation

The program is a single predicate, composed of two parts that are chained with &.

First:

¬       The following assertion must fail:
↔        The input reversed
?       can be unified with the input
Also, the input's
l    length
>9  must be greater than 9


Second:

 ˢ     Get all outputs from applying the following to each character in the input:
ị        Convert to number
This gives an integer for a digit character and fails for a non-digit, so
we now have a list containing one integer for each digit in the password
l    Its length
>2  must be greater than 2

• {∋.∈Ị∧}ᶜ can be {∋ị}ᶜ Commented Feb 14, 2019 at 0:07
• Putting the "not palindrome" clause first, and changing the way to select digits, you can save 6 bytes: ¬↔?l>9&ịˢl>2 Commented Feb 14, 2019 at 8:03
• @Kroppeb Oh, interesting! I didn't consider ị, but it makes sense that it would succeed iff the character is a digit. Thanks! Commented Feb 14, 2019 at 19:09
• @Fatalize Aha--reusing the ? like that is neat. Thanks! Commented Feb 14, 2019 at 19:11

# Jelly, 12 bytes

~Tṫ3ȧL9<Ɗ>ṚƑ


Try it online!

[] if not enough digits (empty list, falsy), 0 if otherwise bad (zero, falsy), 1 if good (nonzero, truthy).

# Java 8, 92 bytes

s->s.length()>9&s.replaceAll("\\D","").length()>2&!s.contains(new StringBuffer(s).reverse())


Try it online.

Explanation:

s->                        // Method with String parameter and boolean return-type
s.length()>9             //  Check if the length of the input-String is more than 9
&s.replaceAll("\\D","")  //  AND: remove all non-digits from the input-String
.length()>2            //       and check if the amount of digits is more than 2
&!s.contains(new StringBuffer(s).reverse())
//  AND: check if the input-String does NOT have the reversed
//       input-String as substring (and thus is not a palindrome)


# JavaScript, 6056 46 bytes

Takes input as an array of characters. Outputs 1 for truthy and 0 for falsey.

s=>/(\d.*){3}/.test(s[9]&&s)&s+!=s.reverse()


Try It Online!

Saved 10 bytes(!) thanks to Arnauld.

# Racket, 122 bytes

(define(d s)(let([t(string->list s)])(and(< 2(length(filter char-numeric? t)))(< 9(length t))(not(equal? t(reverse t))))))


Try it online!

# APL (Dyalog Unicode), 25 bytesSBCS

{∧/(9<≢⍵)(3≤+/⍵∊⎕D),⍵≢⌽⍵}


Try it online!

• Good. Now you can golf it by making it into a train: (9<≢)∧(3≤1⊥∊∘⎕D)∧⊢≢⌽ and then save one more byte by rearranging to avoid parens: (9<≢)∧≢∘⌽⍨∧3≤1⊥∊∘⎕D Let em know if you need explanation of these steps.
Commented Feb 15, 2019 at 9:32

# Perl 5 -p, 33 bytes

$_=/.{10}/&y/0-9//>2&reverse ne$_


TIO

# Clean, 66 bytes

import StdEnv
$s=s<>reverse s&&s%(0,8)<s&&sum[1\\c<-s|isDigit c]>2  Try it online! • s<>reverse s: s is not a palindrome • s%%(0,8)<s: the first 9 characters of s are less than all of s • sum[1\\c<-s|isDigit c]>2: s has more than two digits # Retina 0.8.2, 40 bytes G.{10} G(\d.*){3} +^(.)(.*)\1$
$2 ^..  Try it online! Link includes test cases. Explanation: G.{10}  Checks for at least 10 characters. G(\d.*){3}  Checks for at least 3 digits. +^(.)(.*)\1$
$2  Remove the first and last character if they match. ^..  If there are at least 2 characters then it wasn't a palindrome. .NET's balancing groups mean that this can be done in a single regular expression, but that takes 47 bytes: ^(?!(.)*.?(?<-1>\1)*$(?(1).))(?=.{10})(.*\d){3}


Try it online! Link includes test cases.

# Red, 117 111 bytes

func[s][d: charset"0123456789"n: 0 parse s[any[d(n: n + 1)|
skip]]all[n > 2 9 < length? s s <> reverse copy s]]


Try it online!

# Python 3, 7472 64 bytes

Thanks Neil A. for -2 bytes!
Thanks Jo King for -8 bytes!

lambda s:s[9:]and re.findall('\d',s)[2:]and s[::-1]!=s
import re


Explanation:

lambda s: # Create lambda
s[9:] # Check if the string is at least 10 characters long
and re.findall('\d',s)[2:] #Check for at least 3 matches of the regex \d (which matches all digits)
and s[::-1] != s # Check if the string reversed is equal to the string (palindrome test)
import re  # Import regex module


Try it online!

# Perl 6, 32 bytes

{$_ ne.flip&&m:g/\d/>2&&.comb>9}  Try it online! Anonymous code block that simply enforces that all the rules are complied with. ### Explanation: { && && } # Anonymous code block$_ ne.flip                       # Input is not equal to its reverse
m:g/\d/>2            # There are more than two digits
.comb>9   # There are more than 9 characters


# K (oK), 31 28 bytes

-3 bytes thanks to ngn!

{(x~|x)<(2<#x^x^/$!10)*9<#x}  Try it online! • you could use +// (sum until convergence) instead of +/+/ (sum sum) – ngn Commented Feb 20, 2019 at 21:54 • alternatively, you could use x^x^y to find the intersection between two lists: #x^x^,/!10. this can be shortened to #x^x^/!10 (^ is "without", x^/... is ^-reduction with initial value x) – ngn Commented Feb 20, 2019 at 22:04 • one more thing, > (or <) can be used as "and not": {(x~|x)<(2<#x^x^/$!10)*9<#x}
– ngn
Commented Feb 20, 2019 at 22:09
• @ngn Thank you! Nice way to find the intersection! Commented Feb 21, 2019 at 7:42

# JavaScript (Node.js), 70 bytes

a=>a.length>9&(a.match(/\d/g)||[]).length>2&a!=[...a].reverse().join


Try it online!

Returns 1 for true and 0 for false

# C# (Visual C# Interactive Compiler), 67 bytes

n=>n.Count(char.IsDigit)>2&!n.Reverse().SequenceEqual(n)&n.Length>9


Try it online!

# Pip, 19 bytes

#a>9&XD Na>2&aNERVa


Try it online! (all test cases)

### Explanation

With a being the first command-line argument:

#a > 9      Length of a is greater than 9
&           and
XD N a > 2  Number of matches of regex [0-9] iN a is greater than 2
&           and
a NE RV a   a is not (string-)equal to reverse of a


# Stax, 14 bytes

ûc╖»¬ë⌂╓âó╗cCé


Run and debug it

# Pyth, 17 bytes

&&<2l@MTQ<9lQ!_I


Try it online here, or verify all the test cases at once here.

&&<2l@MTQ<9lQ!_IQ   Implicit: Q=eval(input()), T=10
Trailing Q inferred
MT            [0-10), as strings
@   Q           Take characters from input which are in the above
l                Length
<2                 Is the above greater than 2?
lQ       Length of Q
<9         Is the above greater than 9?
_IQ   Is Q unchanged after reversal?
!      Logical NOT
&&                   Logical AND the three results together


# Groovy, (47 bytes)

{p->p=~/.{10}/&&p=~/(\d.*){3}/&&p!=p.reverse()}
`

(Bonus inclusion is left as an exercise to the reader)