text:
Play the word chain
When I was younger, I use to play a word game called Word chain. It was very simple. The first player chooses a word; the next player says another word that starts with the same letter the previous word ended with. This goes on forever until somebody gives up! Trick is, you cannot use the same word twice (unless everybody forgot that word was even used!). Usually we play with a certain topic to make it harder. But now, I want you to make a program to do this for me.
Challenge
Write a full program or function to find all longest possible word chains using a given set of words and start word.
This is code-golf, so the shortest code wins!
Input
There are two inputs: a list and a start word. The start word will not be in the list. The inputs are all lowercase ASCII, and the list will not contain duplicate words.
Output
All sequences of words from the list such that:

The start word is the first word in the sequence.

Each subsequent word starts with the same letter as the last letter of the previous word.

The length of the sequence is the longest possible.

If there are multiple longest sequences, output all of them.
The sequence does not necessarily need to contain all of the list words. Sometimes that is not possible (see testcases). Again, no word can be used twice!
Testcases
In: [hello, turtle, eat, cat, people] artistic
Out:  [artistic, cat, turtle, eat]
In: [lemonade, meatball, egg, grape] ham
Out: [ham, meatball, lemonade, egg, grape]
In: [cat, cute, ewok] attic
Out: [attic, cute, ewok]
In:[cat, cute, ewok, kilo, to, otter] attic
Out: [attic, cute, ewok, kilo, otter]
In:[cat, today, yoda, attic] ferret
Out: [ferret, today, yoda, attic, cat]
In: [cancel, loitering, gnocchi, improv, vivic, child, despair, rat, tragic, chimney, rex, xylophone] attic
Out: [[attic, child, despair, rat, tragic, cancel, loitering, gnocchi, improv, vivic, chimney], [attic, cancel, loitering, gnocchi, improv, vivic, child, despair, ra', tragic, chimney]]
In: [cat, today, yoda, artistic, cute, ewok, kilo, to, otter] attic
Out: [attic, cat, today, yoda, artistic, cute, ewok, kilo, otter]

@downvoters can you please explain how I can improve my question?

@user81655 sure

Can you add a test case with multiple output sequences?

@isaacg Sure! working on it

@isaacg Added! (15 character limit fulfilled...)

I am sorry for the misunderstanding. The testcases are fixed now.

Pyth, 25 23 bytes
.MlZfqhMtTeMPT+Lzs.pMyQ

Test suite
A brute force solution. Far too slow for some of the larger test cases.
Input in the form:
attic
["cat", "today", "yoda", "to", "otter"]

Output in the form:
[['attic', 'cat', 'today', 'yoda'], ['attic', 'cat', 'to', 'otter']]

Explanation:
.MlZfqhMtTeMPT+Lzs.pMyQ
                           Q = eval(input()) (The list of words)
                           z = input()       (The starting word)
                     yQ    All subsets of the input.
                  .pM      All permutations of the subsets.
                 s         Flatten.
              +Lz          Add the starting word to the front of each list.
                           This is all possible sequences.
    f                      Filter on
     q                     The equality of
      hMtT                 The first character of each word but the first
          eMPT             The last character of each word but the last
.MlZ                       Take only the lists of maximal length.

Can you add an explanation?

Your code runs forever for the multiple output sequence example

@TanMath no it's just exponential time, so it's very slow.

Nobody said it has to be fast... +1

@RikerW sure, but I thought it was going on forever and not working.

Code golf: The art of making an otherwise fast program run in exponential time just to save a few bytes :P

@Ampora so true. +1 the comment too.

@RikerW I think it's also worth recalling Martin's "Code Review: Making code slightly less wrong / Code Golf: Making code slightly less long" comment from chat here.

JavaScript (ES6), 164 bytes
f=(l,s,r=[[]])=>l.map((w,i)=>w[0]==s.slice(-1)&&(x=l.slice(),x.splice(i,1),o=f(x,w),a=o[0].length,b=r[0].length,r=a>b?o:a[s].concat(q))

Explanation
A recursive function that checks how long the output list will for all possible choices.
Returns an array of arrays of words.
f=(l,s,r=[[]])=>            // l = list, s = starting word, r is not passed (it is
                            //     here so that it is not defined globally)
  l.map((w,i)=>             // for each word w at index i
    w[0]==s.slice(-1)&&(    // if the first letter is the same as the last letter:
      x=l.slice(),          // x = clone of the list of words
      x.splice(i,1),        // remove the current word
      o=f(x,w),             // get the list of words starting from the current word
      a=o[0].length,
      b=r[0].length,
      r=a>b?o:              // if o is longer, set r to o
        a[s].concat(q)) // return a list of longest lists with the starting word

Test
Default parameter not used in test to make it more cross-browser compatible.

f=(l,s,r)=>l.map((w,i)=>w[0]==s.slice(-1)&&(x=l.slice(),x.splice(i,1),o=f(x,w),a=o[0].length,b=r[0].length,r=a>b?o:a[s].concat(q))
Word list (space separated) = <input type="text" id="list" value="cancel loitering gnocchi improv vivic child despair rat tragic chimney rex xylophone" />

Starting word = <input type="text" id="word" value="attic" />

<button onclick="result.textContent=f(list.value.split(' '),word.value).join('\n')">Go</button>

I think you could use pop instead of splice and o[r.length]? instead of o.length>r.length?.

@grc Thanks, I really like the o[r.length] tip! I don't know how I could use pop though.

Ah nvm - I thought pop could take an index as its first argument like in python.

This solution is invalid for multiple output sequences

@TanMath Fixed, although it breaks one of the test cases.

Python, 104
def f(d,w):
 a=[[w]]
 while a:b=a;a=[x+[y]for x in a for y in set(d)-set(x)if x[-1][-1]==y[0]]
 return b

I think it should work now...
Try it online.

Perl 5 , 275 bytes
Probably not golfed as much as it can be, but, hey, it's nonwinning anyway, right?
use List::Util max;use List::MoreUtils uniq,before;use Algorithm::Permute permute;$i=pop;permute{push@c,[@ARGV]}@ARGV;for$c(@c){unshift@$c,$i;push @{$d{before{(substr$c->[$_],-1)ne(substr$c->[1+$_],0,1)}keys$c}},$c}for$m(max keys%d){say for uniq map{"@$_[0..$m+1]"}@{$d{$m}}}

Use it thus:
$ perl -M5.010 chain.pl cat tin cot arc
arc cat tin
arc cot tin

Warning! Use of this script on a long list requires lots of memory! It worked great for me on seven (six plus the extra one) but not on thirteen (twelve plus one).
It removes the final input, generates an array of arrayrefs, where the arrayrefs are all the permutations, and adds the initial word back on at the start. Then it pushes each such permutation onto another arrayref which is the value of a hash with key the amount of the array that has the chaining property desired. It then finds the maximum such key and prints out all the arrays.

C, 373 bytes
g(char*y){printf("%s, ",y);}z(char*w){int i,k=-1,v=0,j=sizeof(c)/sizeof(c[0]);int m[j],b=0;for(i=0;i<j;i++){m[v++]=c[i][0]==w[strlen(w)-1]?2:1;if(u[i]==6)m[v-1]=1;if(strcmp(w,c[i]))k=i;}printf("%s",w);for(i=0;i<j;i++){if(m[i]!=1){if(v+i!=j){g(s);for(;b<j;b++){if(u[b]==6)g(c[b]);}}else printf(", ");u[i]=6;z(c[i]);u[i]=1;}else v+=-1;}if(k!=-1)u[k]=1;if(v==0)printf(" ; ");}

I believe there is probably a lot more golfing I could do here so I will probably update it.
De-golf
char *c[9]={"cat","today","yoda","artistic","cute","ewok","kilo","to","otter"};
u[9]={-1};
char *s="attic";

g(char*y){printf("%s, ",y);}
z(char*w){
   int i,k=-1,v=0,j=sizeof(c)/sizeof(c[0]);
   int m[j],b=0;
   for(i=0;i<j;i++){
      m[v++]=c[i][0]==w[strlen(w)-1]?i:-1;
      if(u[i]==6)m[v-1]=-1;
      if(strcmp(w,c[i]))k=i;
   }
   printf("%s",w);
   for(i=0;i<j;i++){
      if(m[i]!=-1){
         if(v+i!=j){
            g(s);
            for(;b<j;b++){
                if(u[b]==6)g(c[b]);
             }
         }else printf(", ");
         u[i]=6;
         z(c[i]);
         u[i]=-1;
      } else v+=-1;
   }
   if(k!=-1)u[k]=-1;
   if(v==0)printf(" ; ");
}

main(){
   z(s);
   printf("\n");
   return 0;
}

Ideone link - If I didn't do this right just let me know :D

could you add an ideone link for testing?

Yeah I will update my answer with it @TanMath

The link should contain the golfed code, not the ungolfed version. That way, we can confirm the golfed version which you are submitting for the challenge works.


text:
Which Row is the Key On?
Given any of the following characters (or a newline):
`1234567890-=~!@#$%^&*()_+qwertyuiop[]\QWERTYUIOP{}|asdfghjkl;'ASDFGHJKL:"zxcvbnm,./ZXCVBNM<>?

Your program must output the row that it is on the keyboard

Because my keyboard is (almost) out of battery, your code must be as short as possible

The keyboard your program should use (for the row lookup), should look like:

Row 1:~` !1@2 #3$4 %5^6 &7*8 (9)0 _-+=
Row 2:                         Q W E R T Y U I O P {[ }]    |\   Row 3:                              A S D F G H J K L :; "' ↵ return  Row 4:                                 Z X C V B N M <, >. ?/                 Row 5:                                                    space

Where ↵  return is a newline. Empty keys don't mean anything.
Examples
"$"
1

"R"
2

"a"
3

"?"
4

"\n"
3

" "
5

where \n is a newline character.
Specifications

Your program should be case insensitive
Your program only needs to handle the characters on the keyboard shown

Perhaps [tag:classification]?

Is that a double-nested kbd?

I remember years ago using some language that returned keypresses as as 100×row+position... Would have been perfect for this, but unfortunately I don't remember what it was. Maybe some form of BASIC...

@NBZ Is it Blitz Basic?

@wizzwizz4 No, sorry.

@NBZ Do you by any chance have a working copy of Blitz Basic? I have a trial that it is legal to distribute, but it has no debugger etc. and it deletes it's executables after it is executed etc.

@wizzwizz4 No. I used to use various BASIC flavours as a kid, but now I exclusively program in APL (it's my job), and a little JavaScript when I have no choice.

@NBZ That comment just makes me sad. You don't have a copy of the now discontinued Blitz Basic, and you only use JavaScript when you have no choice?!? :-(

@wizzwizz4 Have you ever used an APL language (J, K, Q...)? Once you get into it, using any other language feels very limiting.

ewww, QWERTY!  :-(

@wizzwizz4 Have you tried BlitzPlus? it's free and looks like it's what you want.

@HolyBlackCat Yes!!! Yes yes yes!!! Unfortunately, the original Blitz Basic software no longer exists, but BlitzPlus looks like the same programming language. Thank you!

Related: A keyboard so real you can almost TASTE it

can we return the row 0-indexed?

Pyth, 62 66 65 bytes
?zh@+,4Zmid2c.Bi."0fÀÓ¸[9Ñ¶¤KïLäHÉðbÀ`]ü©¬vS"16 2-CzCd3

Try it online.
Uses a packed string representing a number in hex which, when chopped into two-bit chunks, represents the row of every character except  and ! as a value from 0 to 3. We leave out  and ! so we don't have to store 4 or have a 0 at the start of this number, then add their row values using +,4Z. Once we've turned the string into row values, all we have to do is use the character code of the input to index into the array of values, and then add 1.
Newline is handled separately because it's interpreted by Pyth as an empty string and so has a character code of 0.
This would be shorter if I could figure out how to use base 256 in Pyth, but I can't quite make it work.

o.0 starts squeezing Japt

this puts me to shame

:( I forgot about newline! @nicael you're back to being on top.

Now we're dead even!

You need to escape null bytes in Pyth.

@ThomasKwa do you mean to use base 256? Maybe we can discuss in Pyth chat.

Yes. I think it would be shorter to subtract each from 5 so you don't have null bytes--that saves you the h so it only costs one byte. Also Cd is shorter than 32 .

JavaScript (ES6), 105 102 101 bytes
c=>/[~`0-9!@#-&^(-+_=-]/.test(c)+/[asdfghjkl;:'"\n]/i.test(c)*3+/[zxcvbnm,<.>/?]/i.test(c)*4||++c*7^2

Explanation
In JavaScript test returns a boolean which acts the same as 1 or 0 so I multiply them by their row. Testing for row 2 took the most bytes so I used that one as the default if no others matched.
c=>
  /[~`0-9!@#-&^(-+_=-]/.test(c)   // row 1 regex
  +/[asdfghjkl;:'"\n]/i.test(c)*3 // row 3 regex
  +/[zxcvbnm,<.>/?]/i.test(c)*4   // row 4 regex
  ||++c                           // space ++ = 1, any character on row 2 ++ = NaN
    *7^2                          // 7 XOR 2 = 5, NaN XOR 2 = 2

Test

var solution = c=>/[~`0-9!@#-&^(-+_=-]/.test(c)+/[asdfghjkl;:'"\n]/i.test(c)*3+/[zxcvbnm,<.>/?]/i.test(c)*4||++c*7^2
<textarea id="input">-</textarea>

<button onclick="result.textContent=solution(input.value)">Go</button>

NaN XOR 2 = 2 — ???

@ThomasKwa That's just how JS works lol. If c="q", ++c = NaN, NaN*7 = NaN, NaN^2 converts the operands to integers (uncastables like NaN become 0) then does 0 XOR 2 which is 2.

Glava 1.5, 164 bytes
Glava is a dialect of Java that makes Java code shorter. This code is unfortunately non-competitive as the commit (2 hours late...) used was made after this challenge, which fixed some vital bugs that would not allow this program to work.
p(A[0].matches("[`0-9-=~!@#$%^&*()_+]")?1:A[0].replace("\\n","\n").matches("(?i)[asdfghjkl;':\"\n]")?3:A[0].matches("(?i)[zxcvbnm,.\\/<>?]")?4:A[0].matches(" ")?5:2

This is a full program that takes input via command-line arguments. Works by simply testing for which row regex it matches, then outputs the corresponding number.

Glava = Guava + Java?

@Doᴡɴɢᴏᴀᴛ Glava = Golf + Java ( it was Conor's idea)

Indeed! @Doᴡɴɢᴏᴀᴛ

Python 3, 142
print(int(("~`!1@2#3$4%5^6&7*8(9)0_-+=""qwertyuiop{[}\|"+"]"*11+'asdfghjkl;:"\n'"'"*13+"zxcvbnm,<.>/""?"*14+" ").index(input().lower())/26)+1)

There is probably a shorter way that I am overlooking ¯\_(ツ)_/¯

Pyth, 98
|+++l:"~`0123456789!@#$%^&*()_-=+"z1*l:"asdfghjkl;:'\"\n"rz0 1 3*l:"zxcvbnm,<.>/? "rz0 1 4 l:dz1 2

not sure how to get the 0-9 range working for some reason :|, inspired by user81655's answer

You can use jkUT for the string with the range 0 to 9, not sure if there's a shorter way. You can also used packed strings to save a few bytes, e.g. ."!~WÏù¹_(<]úÝ" for "~\!@#$%^&*()_-=+"`.

From @benstopics, this does fail for regex metacharacters

Japt, 73 70 66 bytes
2+`qØÆyuiop\{}[]|\\1dfghjkl;:
'1zxcvbnm,.<>?/\"1 `q1 ®bUv)<0} b!1

Try it online! (in the example, the input is literally a newline)

Nice, shortest so far!

@Eth yup, at least once I should post something short :D

A couple bytes shorter

@Eth Heh, !1 is something that matches "false", finally I know how to do it, thanks :)

@Eth halp, needs 5 bytes to beat Pyth.

This fails on input \\ , but this works for 66: 2+`qØÆyuiop\{}[]|\\1dfghjkl;: '1zxcvbnm,.<>?/\"1 `q1 ®bUv)<0} b!1

@Eth Wait, in the fixed code it does work for "\", what do you mean?

I'm not sure... nvm. If it works, it's good.

But thanks for the trick with splitting with a number, that's interesting.

I thought I had implemented a function to return the first item that returns truthily, which would have saved a byte. But I guess the docs were updated wrongly, so this may be the shortest it can get with the latest version.

@Eth btw, on-site-docs don't work (they never worked actually, at least for me)

Let us continue this discussion in chat.

I count 65 bytes, and the current version of the code was posted an hour before the current version of the Pyth code... which means this is the rightful winner :-)

Bash, 108
No Bash answer?
Bash answer. grep -Fin is definitely the right tool for this job.
This program is in two files.
k, 73 bytes
`1234567890-=~!@#$%^&*()_+
qwertyuiop[]\{}|
asdfghjkl;':"
zxcvbnm,./<>?

There are 5 lines, the last one is a space. If you have trouble reproducing the file, the base64 is:
YDEyMzQ1Njc4OTAtPX4hQCMkJV4mKigpXysKcXdlcnR5dWlvcFtdXHt9fAphc2RmZ2hqa2w7JzoiCnp4Y3Zibm0sLi88Pj8KIA==

b, 34 bytes
This is the program itself, it takes input as the only command line argument.
grep -Fin "$1" k|tail -n3|head -c1

Score: 34 + 73 + 1 (for k's filename) = 108 bytes
Ungolfed
grep --fixed-strings --ignore-case --line-number "$1" k|tail --lines=3|head --bytes=1

Explanation

grep - search a file for lines matching a string or regular expression, output only those lines
-F aka --fixed-strings - disable regular expressions so [ etc. are handled correctly
-i aka -y aka --ignore-case - case-insensitive matching
-n aka --line-number - show the line number and : before every line (e.g. 4:zxcvbnm,./<>?)
"$1" - search for the script's first command-line argument, the quotes are necessary to handle newline and space
k - search in file k
This grep command will match all five lines if the input is a newline, and only one line otherwise.
| - pipe, send standard output of one command to standard input of the next
tail - output the last N lines or characters of standard input
-n3 aka --lines=3 - output the last 3 lines
If the input wasn't a newline, there is only one line to process, which starts with the row number because of the -n flag on grep. Otherwise, this command takes only lines 3, 4 and 5 (the last 3 lines).
| - pipe
head - output the first N lines or characters of standard input
-c1 aka --bytes=1 - output the first character
If the input wasn't a newline, this takes the first character, which is the line number where the input is found. If the input is a newline, it takes the first character of lines 3, 4 and 5 combined, which is 3, which happens to be the correct row number for newline.

Java, 300 bytes
import java.util.Scanner;public class A{public static void main(String[] args){String g="~`!1@2#3$4%5^6&7*8(9)0_-+=qQwWeErRtTyYuUiIoOpP[{]}\\|aAsSdDfFgGhHjJkKlL;:\'\"\r";Scanner i=new Scanner(System.in);int f=g.indexOf((i.nextLine().charAt(0)));System.out.print(f<0?4:(f<26?1:(f<53?2:(f<76?3:5))));}}

I'm not an expert, and this is my first attempt at golfing, but I figured, what the hell, why not? Above is the full program version, the actual code that goes into it would most likely take a decent amount of characters off.

just noticed it crashes with an empty input(new line/carriage return). will fix when I can

Welcome to the community!

Welcome (bit late since you posted in January xD). You can golf it quite a bit without changing your current approach like this: class A{public static void main(String[]a){int f="~'!1@2#3$4%5^6&7*8(9)0_-+=qQwWeErRtTyYuUiIoOpP[{]}\\|aAsSdDfFgGhHjJkKlL;:\'\"\r".indexOf(new java.util.Scanner(System.in).nextLine().charAt(0));System.out.print(f<0?4:f<26?1:f<53?2:f<76?3:5);}} (243 bytes) I removed some unnecessary parenthesis; shortened args; removed public ; directly used the String and Scanner; and removed the import now that java.util.Scanner is used once.

219 bytes you don't need to use Scanner for this

Pyth, 105 bytes
J?<l-c".^$*+?{}[]\|()"1]z14+\\zrz0?qJd5?:"qwertyuiop[]\|"J)2?:"asdfghjkl;':\"\n"J)3?:"zxcvbnm,./<>?"J)4 1

Explanation:
J?<l-c".^$*+?{}[]\|()"1]z14+\\zrz0     # Escape input if regex metachar
?qJd5                                  # Check space
?:"qwertyuiop[]\|"J)2                  # Check second row
?:"asdfghjkl;':\"\n"J)3                # Check third row
?:"zxcvbnm,./<>?"J)4                   # Check fourth row
1                                      # If none of these, must be on first row.

I decided to choose the first row as the "must be if nothing else" row because it required the most bytes to represent even after golfing.

Welcome to Programming Puzzles and Code Golf! Use comments to make @JuanPotato get it. However, that needs 50 rep. So you need to work.

Perl 6, 128 bytes
say 1+(/<[-\d=~!@#$%^&*()_+/`]>/,/<[qwertyuiop[\]\\{}|]>/,/<[asdfghjkl;':"\n]>/,/<[zxcvbnm,./<>?]>/,' ').first: @*ARGS.lc~~*,:k

I make a list of regexes containing character classes along with a string literal space. I then call the first method on the list (which is just the method version of the first higher order function), using smartmatch to compare the argument passed to the program against the current item in the list. Note that smartmatch does "the right thing" for both regexes and a string literal. The :k optional parameter to first causes the method to return the index of the matching item in the list, which I then add 1 to and output via say.
Note that when using this program you will have to properly escape certain characters like ` and space in your shell. For instance: perl6 keyboard.p6 \`

Since nobody said it yet, welcome to Programming Puzzles & Code Golf!

Python 3, 89 bytes
print("qwertyuiop{}[]\\|asdfghjkl;:\"\n'''zxcvbnm,.<>/???? ".find(input().lower())//16+2)

As I can't comment yet, I'm posting the improvement for the current Python 3 answer separately.
Edit: All code in print now and further tweaked.

This is merely a snippet and therefore not a valid answer, you need to wrap it in a print statement (making it a full program) or turn it into a function.

@FlipTack: You're right. I've incorporated your suggestion.

Welcome to PPCG!

@MartinEnder: Thank you! :-)

Perl, 96 77 76 bytes
Run using perl -p.  Make sure you're feeding it just single characters; for example, to run it from a file key.pl (to avoid mucking around with shell escape sequences) echo -n q|perl -p key.pl.
$_=/[\d~`!@#-&(-+_=-]/+/[adfghjkls"':;
]/i*3+/[bcnmvxz<>,.?\/]/i*4+/ /*5||2

Abusing the regex range functionality is fun.

To me this doesn't work, running it I get the index of the row + 3 (i.e. 3 instead of 0, 7 instead of 4, etc.).

It's sensitive to how you provide the input.  You're probably providing a character followed by a newline.  I use echo to precisely control the input -- eg. echo -n q|perl -n key.pl, which correctly produces 2.

Oh, I see. Well, that also explains why you don't chomp the input.

If I chomped the input, I wouldn't be able to return '3' for the return key.

Hey @Mark, you don't need the $_=~ for the matches, m// (which is what /.../ is) works on $_ automatically! Also if you use -p instead of -n you can use $_= instead of print to save a couple more bytes. Using a literal newline instead of \n can save you another byte too! That should reduce your code quite a bit! Might be worth adding an example usage as well so anyone testing knows you need to use echo -n :)

@DomHastings, thanks.  I can never remember what does and doesn't take automatic arguments, since using them tends to be bad form if you're writing code you expect someone else to read a few years later.

@randomra, the second and third regexes (detecting the third and fourth rows) have the /i modifier making them case-insensitive.  The first and fourth regexes (first and fifth rows) don't need to be, and the second row is detected by the process of elimination.

I see, somehow I missed the i's.

JavaScript ES6, 114 bytes
n=>[`qwertyuiop{}[]|\\`,`asdfghjkl;:
'`,`zxcvbnm,.<>?/"`,` `].map(x=>+(x.indexOf(n.toLowerCase())<0)).indexOf(0)+2

Another JavaScript solution. The principle is to return the index of the input char in the array of rows plus 2 (so as the 0-9 row returns -1, i.e. not exists, -1+2=1. q is in the first string of the array, so it returns 0+2=2nd row).

PHP, 173 bytes
The idea here was to use the regex capturing group number as the row index. Probably some more optimizations in the regex itself.
$i=$argv[1];preg_match("%([!#-&\(-+-0-9=@^-`~])|([EIO-RT-UWY[-]eio-rt-uwy{-}])|([\"':-;ADF-HJ-LSadf-hj-ls])|([,.-/<>-?B-CM-NVXZb-cm-nvxz])%",$i,$m);echo array_flip($m)[$i];

The preg_match() call will create an array $m of matches, and if we were to print that, it'd look something like this (assuming z was the input):
Array ( [0] => 'z', [1] => '', [2] => '', [3] => '', [4] => 'z' )

Flipping that array, by swapping keys and values, moves left to right and only keeps the last distinct key, so we end up with:
Array ( 'z' => 4, '' => 3 )

Then we use the input character as the index in the array to get our result.
Try it out here.

C, 145 143 136 132 127 106 104 bytes
#define c"\x7ea6a6f8\x5777595"
f(a){return a-32?L"\x200000\0\xf3008020\xf2a00000"c c[a>>4]>>a%16*2&3:4;}

Try it online!
This uses index() from POSIX.1-2001 and is deprecated in POSIX.1-2008.
This assumes ASCII and 32 bit ints.

Ruby, 82 bytes
->i{1+((0>r=i.ord-33)?r%5:"bc7xdutvz4ind3bwqf6mcu5vxiahnmlfs93c".to_i(36)>>2*r&3)}

Try it online!

C#6, 201 bytes
Nothing special here.  I found it cheaper to just write both cases rather than use ToUpper() due to the string's fixed width.
using C=System.Console;class P{static void Main(string[]a)=>C.Write("`1234567890-=~!@#$%^&*()_+qwertyuiop[]\\QWERTYUIOP{}|asdfghjkl;'\raASDFGHJKL:\"\nazxcvbnm,./zzzZXCVBNM<>?zzz ".IndexOf(a[0])/26+1);}

Indented:
using C=System.Console;
class P{
    static void Main(string[]a)=>
        C.Write("`1234567890-=~!@#$%^&*()_+qwertyuiop[]\\QWERTYUIOP{}|asdfghjkl;'\raASDFGHJKL:\"\nazxcvbnm,./zzzZXCVBNM<>?zzz ".IndexOf(a[0])/26+1);
}

I can't see this working for ~ or `?

@AshBurlaczenko, thanks!  I missed that key.  Fixed with no change to my score.

CJam, 125 bytes
q_" "={;5}{"`1234567890-=~!@#$%^&*()_+qwertyuiop[]\QWERTYUIOP{}|asdfghjkl;'ASDFGHJKL:\"    zxcvbnm,./ZXCVBNM<>?    "\#26/1+}?

Explanation
q                          e# read input
 _" "=                     e# decide if the input is a space
      {;5}                 e# if it is, push 5
          {"..."\#26/1+}?  e# if it isn't, push the correct row

SpecBAS - 178 bytes
1 a$="~`!1@2#3$4%5^6&7*8(9)0-_+=qQwWeErRtTyYuUiIoOpP{[}]|\aaaaAsSdDfFgGhHjJkKlL:;'"#34#13"zzzzzzzZxXcCvVbBnNmM<,>.?/"+" "*26
2 INPUT k$: IF k$="" THEN k$=#13
3  ?CEIL(POS(k$,a$)/26)

I used a long string where each row is 26 characters long (#34 is code for double quote and #13 is code for return).
Then print the result of rounding position/26.

Python 2, 146 bytes
e="\n";lambda x:("`1234567890-=~!@#$%^&*()_+qwertyuiop[]\\QWERTYUIOP{}|asdfghjkl;'ASDFGHJKL:\""+e*4+"zxcvbnm,./ZXCVBNM<>?"+e*13+" ").index(x)/26+1

Excel, 132 bytes
=INT((FIND(A1,"`1234567890-=~!@#$%^&*()_+qwertyuiop[]\QWERTYUIOP{}|asdfghjkl;'ASDFGHJKL:""aaa
zxcvbnm,./ZXCVBNM<>?zzzzzz ")-1)/26)+1
Attempts to use the case in-sensitive SEARCH() instead of FIND() revealed that Excel matches ~, * and ? to (tick).  The matching of?means we can't useSEARCH()`, which would have shaved a massive 5 bytes...

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Find the sequence
The purpose of this challenge is to find the general term of a given arithmetic or geometric sequence.
Explanation
The formula for an arithmetic sequence is as follows
an = a1 + (n-1)d
where a1 is the first term of the sequence, n is the index of the term, and d is the common difference between the terms. For a geometric sequence, the formula for the general term is
an = a1rn-1
where r is the common ratio between the terms of the sequence.
Challenge
The objective of this challenge is to accept an input of a sequence of numbers, determine whether the sequence is arithmetic or geometric, and then output the formula for the general term. The rules are

The input will be either a geometric sequence or an arithmetic sequence, nothing else
The formula can either be returned from a function, or printed to STDOUT or an equivalent
The input can be taken in any form that is convenient; for example, it could be an argument, taken from STDIN, or hardcoded if the language offers no other way of accepting input
The input will always be in the format [3, 4, 5, 6], with brackets surrounding comma-separated terms. The spaces separating the terms and the commas are optional. The input will always contain three or more terms.
The shortest code in bytes wins

Test cases
Input                      Output
[-2, 0, 2, 4, 6, 8]        -2 + 2(n-1) or an equivalent expression
[27, 9, 3, 1, 1/3]              27(1/3)^n-1 or an equivalent expression
[200, 240, 280, 320]       200 + 40(n-1) or an equivalent expression
[2, 6, 18]             2(3)^n-1 or an equivalent expression

Bonus
-20%
If your answer outputs a simplified version of the formula; for example, it prints
6n-2

rather than
4 + 6(n-1)

-30 bytes
If your answer prints the 20th term of the sequence, in addition to the general term.
If your answer satisfies both of these conditions, the 20% is removed first, and then the 30 bytes are removed.

Near-duplicate (not quite, though): http://codegolf.stackexchange.com/q/37928/3808

Will the input always have four terms?

Not necessarily, I'll make that clearer in the question.

Related: http://codegolf.stackexchange.com/q/65664/42545

Also related (but much more complicated)

Should "The input will be either a geometric sequence or an arithmetic sequence, nothing else" be taken to mean that the input is never both a geometric and an arithmetic sequence (i.e. a constant sequence)? What type are the input elements? The test cases imply that they should be a built-in rational type, but for languages which don't have (i.e. most of them), can they substitute e.g. a two-element array of [numerator denominator]?

 2, 38 chars / 57 bytes
î+(x=ì-í≔í-î?`+⟮(n-1)`⟯+(í-î):`(⦃í/î})^Ⅰ

Try it here (Firefox only).
First answer! I'm still working on bonuses.
Explanation
î+(ì-í≔í-î?`+⟮(n-1)`⟯+(í-î):`(⦃í/î})^Ⅰ // implicit: î=input1, í=input2, ì=input3
î+                                    // Prepend a1
  (ì-í≔í-î                            // Is rate of change constant from term to term?
          ?`+⟮(n-1)`⟯+(í-î)            // arithmetic mean template
                          :`(⦃í/î})^Ⅰ // geometric mean template
                                      // implicit output

NOTE: ⟮ and ⟯ are copy-paste blocks; anything within those blocks is stored to be called for later pasting (using Ⅰ).

It should be ^(n-1).

@LegionMammal978 Fixed.

Mathematica, 75 * 0.8 - 30 = 30 bytes
f=Simplify[FindSequenceFunction@{If[2#2==#+#3,2#-#2,#^2/#2],##}/@{n+1,21}]&

Test cases:
f[-2, 0, 2, 4, 6, 8]
(* {2 (-2 + n), 36} *)

f[27, 9, 3, 1, 1/3]
(* {3^(4 - n), 1/43046721} *)

f[1, 1, 1]
(* {1, 1} *)

In Mathematica, FindSequenceFunction is a very interesting function.
FindSequenceFunction[{1, 1, 2, 3, 5, 8, 13}, n]
(* Fibonacci[n] *)

FindSequenceFunction[{1+a, 1+a^2, 1+a^3, 1+a^4}, n]  (* symbolic! *)
(* 1 + a^n *)

Python, 130* 0.8 - 30 = 74 bytes
Been a while since I last answer a question and this one has been sitting in my favourites for some time!
Started at 188
def m(t):s=str;a=t[0];b=t[1];r=b/a;q=b-a;return((s(q)+'n'+'+'*(0<a-q)+s(a-q),a+q*19),(s(b/r)+'('+s(r)+')^n-1',b*r**18))[t[2]/b==r])
Uses school maths to determine the coeffs and sticks them together and returns the 20th term.
Sample output: 3n-1 59, where 59 is the 20th term.

Which Python version is this? Also, it looks like you assume that the variable t exists prior to calling this? You must either take it as input or use a function (lambda).

@StewieGriffin python 3.6, its now a function that takes a list and returns the string

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Separate my integers
Introduction
In the field of mathematics known as topology, there are things called separation axioms.
Intuitively, you have a set X and a collection of subsets of X, which we can think of as properties.
The system is well separated, if one can distinguish between all items of X based on their properties.
The separation axioms formalize this idea.
In this challenge, your task is to check three separation axioms, given X and the list of properties.
Input
Your inputs are an integer n ≥ 2, and a list of lists T of integers.
The integers in T are drawn from X = [0, 1, ..., n-1].
The lists in T may be empty and unsorted, but they will not contain duplicates.
Output
Your output is one of four strings, determined by three separation axioms, each stronger than the last.
There are other axioms, but we stick with these for simplicity.

Suppose that for all distinct x and y in X, there exists a list in T containing exactly one of them.
Then X and T satisfy axiom T0.
Suppose that for all distinct x and y in X, there exist two lists in T, one of which contains x but not y, and the other contains y but not x.
Then X and T satisfy axiom T1.
Suppose that the two lists above also contain no common elements.
Then X and T satisfy axiom T2.

Your output is one of T2, T1, T0 or TS, depending on which of the above conditions holds (TS means none of them do).
Note that T2 is stronger than T1, which is stronger than T0, and you should always output the strongest possible axiom.
Rules and scoring
You can write a full program or a function.
The lowest byte count wins, and standard loopholes are disallowed.
Test cases
2 [] -> TS
2 [[],[1]] -> T0
2 [[0],[1]] -> T2
3 [[0],[0,1,2],[1,2]] -> TS
3 [[],[0],[0,1],[2]] -> T0
3 [[0],[0,1],[2,1],[0,1,2]] -> T0
3 [[0],[0,1],[2,1],[2,0]] -> T1
6 [[0,2,4],[0,3,5],[1,2],[3,4,5]] -> TS
6 [[0,2,4],[0,3,5],[1,2],[2,5],[3,4,5]] -> T0
6 [[0,2,4],[0,3,5],[1,2],[2,5],[3,1],[3,4,5]] -> T1
6 [[0,1],[0,2,3],[1,4],[2,4],[2,3,5],[1,3],[4,5]] -> T2

Is the input n superfluous? In the rest of the challenge, I'm not seeing it used beyond defining what elements can be in T, so is it just a provided shortcut for T.Maximum()?

@TimmyD, no. See the first test case. 0 [] should give T2.

@PeterTaylor Aaaahhhhhhhh. Thanks, that helps tremendously.

Great explanation of what separability means!

@LuisMendo Weird terminology alert: These are separation axioms, and a topological spaces that satisfies T2 is sometimes called separated, but separability is something else entirely.

@Dennis Hm you're right, I mixed those up

Haskell, 317 209 174 168 bytes
The function f does the job.
(#)=elem
x?y=[1|a<-x,b<-y,not$any(#a)b]
f n l|t(++)="TS"|t zip="T0"|t(?)="T1"|1>0="T2"where
    t p=any null[p(x%y)(y%x)|x<-[0..n-1],y<-[0..x-1]]
    x%y=[z|z<-l,x#z,not$y#z]

tests :
main=do
    putStrLn $ f 2 []
    putStrLn $ f 2 [[],[1]]
    putStrLn $ f 2 [[0],[1]]
    putStrLn $ f 3 [[0],[0,1,2],[1,2]]
    putStrLn $ f 3 [[],[0],[0,1],[2]]
    putStrLn $ f 3 [[0],[0,1],[2,1],[0,1,2]]
    putStrLn $ f 3 [[0],[0,1],[2,1],[2,0]]
    putStrLn $ f 6 [[0,2,4],[0,3,5],[1,2],[3,4,5]]
    putStrLn $ f 6 [[0,2,4],[0,3,5],[1,2],[2,5],[3,4,5]]
    putStrLn $ f 6 [[0,2,4],[0,3,5],[1,2],[2,5],[3,1],[3,4,5]]
    putStrLn $ f 6 [[0,1],[0,2,3],[1,4],[2,4],[2,3,5],[1,3],[4,5]]

output:
TS
T0
T2
TS
T0
T0
T1
TS
T0
T1
T2

Giving t a function as input is a clever trick!

In absence of competition, this bounty goes to your answer. Congratulations!

some free bytes - replace f by an operator name, and replace p(x%y)(x%y) by p(x%y)$x%y. and by the way, nice work!


text:
Can the king catch the pawn?
Given an input of four integers x1, y1,
x2, and y2, output whether a white king in chess
(with coordinates (x1,  y1)) could catch a black pawn
(with coordinates (x2,  y2)) and capture it if the
pawn is moving to promote to a queen as fast as possible.
The coordinates of the board are as follows:
       first coordinate (x)
             12345678

           1 .#.#.#.#
           2 #.#.#.#.
           3 .#.#.#.#
  second   4 #.#.#.#.
coordinate 5 .#.#.#.#
    (y)    6 #.#.#.#.
           7 .#.#.#.#
           8 #.#.#.#.

Assume it is white to move (the king's turn) and that both players play
optimally (the king will move as fast as possible to catch the pawn, and the
pawn will move as fast as possible to promote). The input coordinates will
always be distinct, and the pawn will never start with a y-coordinate of 8.
The king moves one square in any direction every turn (it can move diagonally),
and the pawn can only move one space forwards (decrease its y-coordinate),
unless it's at its initial position (with our coordinate system, y-coordinate
of 7), in which case it can move two spaces forwards.
The input can be given as a whitespace-/comma-separated string, an array of
strings/integers, or four function/command line/etc arguments. The coordinates
can be given in whichever order is most convenient/golfy (so, accepting input
as [y2, y1, x1, y2] is okay as long
as it's consistent). The output must be a truthy or falsy
value.
Since this is code-golf, the shortest code in bytes wins.
Truthy test cases:
5 3 3 2

6 1 1 7

3 3 3 2

4 1 4 7

7 7 1 7

1 8 1 7

Falsy test cases:
6 4 3 2

8 8 1 7

3 4 3 2

Can we chose the order of the coordinates or does it have to be x1 y1 x2 y2?

@Dennis I suppose whichever order is most convenient (i.e. golfiest) is okay. I'll edit the quesiton.

The write-up says that the pawn's starting position is in row 2, which suggests it's moving down the board, but the pictures have it moving up. Which is correct?  (In other words, is the pawn's goal to reach 1 or 8?)

@JackBrounstein That was an oversight on my part. Thanks, I'll fix that.

Can we assume that the king and pawn have distinct coordinates, and the the pawn does not start at row 8?

I suggest the test case 1 8 1 7, where the king captures before the pawn can move two spaces. I think all of the answers now get it wrong. This situation makes the problem a lot harder.

@xnor Nice catch. Added that test case into the post.

@LegionMammal978 This problem only involves a single pawn, so en passant could not be relevant.

Why couldn't this have used actual chess notation e.g. c7, e6 etc.

@Neil because the conversion to numbers is just boring and does not add nothing

@edc65 well it could have at least used the Chess row numbers...

@Neil There are already plenty of posts here involving algebraic notation, and I wanted to focus on the actual challenge.

Doesn't the king need to avoid capture by the pawn? (Not according to 7717)

@kaine The pawn doesn't pose a significant threat to the king unless the king can't take it on or before the move it promotes. The king doesn't have to move into check because there is always an equally good move that it can make.

Jelly, 33 bytes
‘»Ɠ_2<®
Ɠ©<7
:5+Ɠ>7$¤<1.4
Ɠ_ƓA2£Ŀ

This program reads the coordinates as x2\nx1\ny2\ny1 from STDIN. Try it online!
Non-competing version
Unfortunately, the Jelly interpreter had a bug when this question was posted. Said bug prevented it from accepting more than two command-line arguments. The newest version of Jelly can solve the given task in 23 bytes.
⁶>7×5
_A+⁵>6$¤+¢’»⁶_2<⁵

Try it online!

Python 2, 53 40
lambda x,y,p,q:y-2<q>=abs(x-p)+q/7+y/8*5

The king has coordinates (x, y) and the pawn (p, q).
There are three significant cases:

The pawn is on rank 7 and the king on rank 8. To capture the pawn, the king must be on the same file or an adjacent one.
Result: q = 7  ⋀  y = 8  →  |x - p| ≤ 1

The pawn is on rank 7. To capture the pawn, the king must be within six files.
Result: q = 7  →  |x - p| ≤ 6

The pawn is on a lower rank. To capture the pawn, the king must be able to reach the promotion square at most one move after the pawn.
Result: q < 7  →  |x - p| ≤ q  ⋀  y - 1 ≤ q

My solution is just these conditions golfed down. Hopefully there aren't mistakes this time.

How about cutting the abs with max(y-1,x-p,p-x)?

Shouldn't f(1,8,1,7) be True because the king immediately captures the pawn? I think there's a subtlety where pawn row 7 cannot be treated as row 6 if the king captures immediately.

@xnor I think it's fixed now (in a badly golfed way).

If you reversed the last condition, you can remove the space between the or and -2.

@xsot thanks for the tip. I've changed my approach and got it down a bit more now.

+1 - Nice, ported to javascript this would be 48 (x,y,p,q)=>q>y-2&q>=(x>p?x-p:p-x)+(q>6)+(y>>3)*5 while my answer is 52 :(

Prolog, 48 42 bytes
Code:
p(X,Y,P,Q):-Y-2<Q,Q>=abs(X-P)+Q//7+Y//8*5.

Examples:
p(1,8,1,7).
true

p(3,4,3,2).
false

Not a bad challenge for Prolog compared to most.
Edit: Saved 6 bytes by switching to the formula used in grc's Python 2 answer.
Unfortunately Prolog can't chain comparisons as python can and integer division is 1 byte longer than float division.
Try it online here

JavaScript (ES6), 52
(x,y,u,t,d=x>u?x-u:u-x)=>(d>=y?d:y-1)<=(d<2|t<7?t:6)

I hope to have saved bytes not using Math.abs, Math.min, Math.max
The pawn at row seven can escape moving 2 spaces, if and only if the king is not in a near column - that's why there is a check on d before substituting 7 with 6.
Test case to run in console:

;[f(5,3,3,2),f(6,1,1,7),f(3,3,3,2),f(1,8,1,7),f(6,4,3,2),f(8,8,1,7),f(3,4,3,2)]

Result: [true, true, true, true, false, false, false]

Ruby, 50 bytes
def f(a,b,c,d)(a-c).abs<=(d==7?6-b/8*5:d)&&b-d<2;end

Arguments are (king x, king y, pawn x, pawn y), all integers.


text:
Atbash Self Palindromes
Consider the Atbash transformation:
A|B|C|D|E|F|G|H|I|J|K|L|M
Z|Y|X|W|V|U|T|S|R|Q|P|O|N

Where A ⇔ Z and L ⇔ O, e.g. There is an interesting property that some words share. When some strings are translated to their atbash-equivalent, said translation is the original word reversed. I call these Atbash Self Palindromes.
As an example, let's translate WIZARD:
W → D
I → R
Z → A
A → Z
R → I
D → W
The result is DRAZIW, which is WIZARD reversed. Thus, WIZARD is an atbash self palindrome.
Objective Given a string of printable ASCII characters, output or return a truthy value if that string is an atbash self palindrome, and a falsey value otherwise. (This is done through STDIN, closest equivalent, functional input, etc. If your language cannot do any of these, consider choosing a different language you may hardcode the input.) You should do this case-insensitively. If the input is a palindrome and is unaffected by the atbash seqeunce, you should still output true, since a palindrome + itself is a palindrome. This is a code-golf, so the shortest program in bytes wins.
Test cases
"Input" => true, false

"WIZARD" => true
"Wizard" => true // case doesn't matter
"wIzArD" => true
"W I Z A R D" => true
"W IZ ARD" => false // the atbash of this is D RA ZIW, which is not a palindrome of W IZ ARD
"ABCXYZ" => true // ZYXCBA
"345 09%" => false // is not a palindrome
"ev" => true // ve
"AZGDFSSF IJHSDFIU HFIA" => false
"Zyba" => true
"-AZ" => false // -ZA is not a reverse of -AZ
"Tree vvig" => true // Givv eert
"$%%$" => true // palindrome
"A$&$z" => true // z$&$A

Leaderboard
The Stack Snippet at the bottom of this post generates the catalog from the answers a) as a list of shortest solution per language and b) as an overall leaderboard.
To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:
## Language Name, N bytes

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:
## Ruby, <s>104</s> <s>101</s> 96 bytes

If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the last number in the header:
## Perl, 43 + 2 (-p flag) = 45 bytes

You can also make the language name a link which will then show up in the snippet:
## [><>](http://esolangs.org/wiki/Fish), 121 bytes

var QUESTION_ID=68757,OVERRIDE_USER=44713;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="
"+e.body.replace(OVERRIDE_REG,"")+"
")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;
body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}
 <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

Related: Swap the Alphabet.

AtBash is actually not a new thing. It is the Kabala (Jewish Mysticism) Hebrew letter transformation equivalent to this. Since Hebrew is written only with with wovels, any letter string can be read by inserting random wovels. A-T-B(a)SH is a mnemonic for transforming Alef (first Hebrew letter) to Tav (last), Beis (second) to SHin (next-to-last).

Testcase : A$%$z --> true ?

Consider giving -1000000 points if someone's solution code is itself an atbash self palindrome? :p

@edc65 yes, that is true.

@kojiro I might offer a bounty for the shortest nontrivial solution that is an atbash palindrome

@kojiro Non-trivial as opposed to code {Comment-symbol}{Atbash'ed Comment-symbol} Atbash'ed code...

@NBZ That is correct. Fortunately, since it's a bounty, I'm the final judge of nontriviality.

Darn. I thought this challenge was going to require the source program to be an atbash self palindrome as well.

@mbomb007 I said I may offer a bounty if such a nontrivial program is found

RX, 9 8 bytes
Heavily inspired by Retina, I made this a few days ago. Code:
prR`w$rM

Explanation:
prR`w$rM

p         # Start pattern
 r        # Reversed lowercase alphabet
  R       # Reversed uppercase alphabet
   `      # Next pattern
    w     # Equivalent to a-zA-Z_0-9 (word pattern)
     $    # End pattern and compute regex
      r   # Reverse input
       M  # Change mode to Match mode, compares the atbash string with the reversed string.

Try it here!

So how does the language itself actually work? Is it some sort of stack-based string processing language? This is really impressive, but as far as I can tell there is no way to loop in the language yet which means it's highly unlikely that this meets our standards of a programming language at this stage.

@MartinBüttner This language is primarily based on the processing of the input using a stack model. It does not use integers (and probably never will). I do have implemented a loop, but that version has not been released yet.

@Martin Regexes are capable of primality testing on their own, so I'm pretty sure this is valid.

@ThomasKwa As far as I can see, the interpreter does not use any actual regular expressions.

@Martin Hmm, you're right.

Pyth, 10 9 bytes
qJrz0_XJG

Try this fiddle online or verify all test cases at once.
Explanation
qJrz0_XJG
  rz0      Lowercase input
 J         Store a copy in J
     _XJG  Translate J with the reverse alphabet and reverse
q          Compare

Since you're using rz0 twice, isn't it shorter to save it to a variable?

Like @xnor suggests, q_Jrz0XJG is one byte shorter.

Julia, 96 bytes
s->join([get(Dict(zip([u=map(Char,65:90);],reverse(u))),c,c)for c=(S=uppercase(s))])==reverse(S)

This is a lambda function that accepts a string and returns a string. To call it, assign it to a variable.
Ungolfed:
function f(s::AbstractString)
    # Get all of the uppercase letters A-Z
    u = map(Char, 65:90)

    # Create a dictionary for the transformation
    D = Dict(zip(u, reverse(u)))

    # Uppercase the input
    S = uppercase(s)

    return join([get(D, c, c) for c in S]) == reverse(S)
end

GNU Sed, 105
s/.*/\l&/
h
y/abcdefghijklmnopqrstuvwxyz/zyxwvutsrqponmlkjihgfedcba/
G
:
s/\(.\)\n\1/\n/
t
/^.$/{c1
q}
c0

Outputs 1 for truthy and 0 for falsey.
I tried to do this in Retina, but couldn't figure out how to save the string before Atbash transliteration for reverse comparison with after.  Perhaps there is a better way.
Sed's y transliteration command leaves a lot to be desired.

Yeah, "storing" things is still cumbersome in Retina. You'd have to duplicate the string and then transliterate and reverse only one copy. I want to add some sort of branching/forking feature in the future, but I'm not quite sure yet about the details.

Ah, I think I see - I tried doing something similar by separating the before and after strings with a colon.  I fell down with the regex at the end of the T - I was assuming it applied to each character in turn, but it if my understanding is right, it applies to the whole pattern space, which is much more useful

The regex in T is applied to the input string. The transliteration is the only performed within the matches of that regex and everything unmatched is left unchanged. The regex defaults to [\s\S]+ so by omitting it, you're transliterating everything.

As you wish. :)

Since it's GNU sed, you can save a byte by trading -r flag for the backslashes in \( and \).  I agree with you on the y command!

Bash + Linux utils, 56
tr a-z `printf %s {z..a}`<<<${1,,}|cmp - <(rev<<<${1,,})

Outputs the empty string for Truthy and something like - /dev/fd/63 differ: byte 1, line 1 for Falsey.  If this is not acceptable then we can add -s for an extra 3 bytes and use the standard Unix return codes of 0 for Success (Truthy) and 1 for Failure (Falsey).

Retina, 44 bytes
$
¶$_
T`lL`Ro`.+$
+`(¶.*)(.)
$2$1
i`^(.+)\1$

Prints 1 or 0. The byte count assumes that the file is encoded as ISO 8859-1.
Try it online!
This answer was largely inspired by DigitalTrauma's sed answer but then again I guess there aren't that many approaches to this challenge in the first place.
Explanation
Whenever you see a ¶, the first thing Retina does after splitting the code into lines is to replace all of those pilcrows with linefeeds. This allows the inclusion of linefeeds for a single byte even though linefeeds are Retina's stage separator.
$
¶$_

We start by duplicating the input. We match the end of the input with $ and insert a linefeed along with the input itself (using $_).
T`lL`Ro`.+$

A transliteration stage. Let's start with the regex: .+$. It matches the second copy of the input (by ensuring the match goes until the end of the string). So only characters in the second copy will be transliterated. The transliteration itself makes use of some very recent features. l and L are character classes for lower and upper case letters, respectively. o refers to the other character set of the transliteration and R reverses it. So the two character sets expand to:
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
ZYXWVUTSRQPONMLKJIHGFEDCBAzyxwvutsrqponmlkjihgfedcba

You'll notice that this swaps the case while doing the Atbash cypher, but we'll do the final comparison case-insensitively anyway.
+`(¶.*)(.)
$2$1

Now we reverse the second copy. Unfortunately, Retina doesn't have a convenient way for doing that yet, so we'll have to move one character from the end to the front at a time. This is done by repurposing the linefeed separator as a marker of which part hasn't been reversed yet. We match that part but capture the last character separately. That character goes in front, and the remainder is unchanged. The + tells Retina to do this repeatedly until it's no longer possible (because ¶ is at the end of the string).
i`^(.+)\1$

Finally, we check whether the two strings are the same. The i makes the pattern case-insensitive - conveniently, in .NET, this means that backreferences are also case-insensitive. You might notice that we no longer have a separator between the original input and the modified copy. We don't need one though, because they are the same length, and if the string now consists exactly of the same string twice (up to case), then those must be the original and the modified string. If you're wondering what happened to the trailing linefeed that we used as a marker, it's still there, but in many regex flavours $ also matches before the last character of the string if that character is a linefeed.
Since this stage only consists of a single line, it is taken to be a match stage, which counts the number of matches. If the input is an Atbash palindrome, we'll get exactly one match and the output is 1. If not, then this regex won't match and the output will be 0.

I guess it's better to have linefeeds be the stage separators and pilcrows be the literal than vice versa.

@CᴏɴᴏʀO'Bʀɪᴇɴ For convenience, you can also insert linefeeds by escape sequences, \n  in regex and $n in substitution, but that's wasted bytes for golfing. ;)

, 15 chars / 30 bytes
ïþ)Ī(ᶐ,ᶐᴙ)ᴙ≔ïþ)

Try it here (Firefox only).
Explanation
ïþ)Ī(ᶐ,ᶐᴙ)ᴙ≔ïþ) // implicit: ï=input, ᶐ=A-Z
ïþ)             // ï.toUpperCase()
   Ī(ᶐ,ᶐᴙ)ᴙ     // transliterate input from A-Z to Z-A, then reverse
           ≔ïþ) // check if that's still equal to ï.toUpperCase()
                // implicit output

Parenthetic, 658 bytes
((()()())(()(((()))))((()()((())))))((()()())(()(((())))()()())((())()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()))((()()())(()(((())))())((()())((()(((())))()()))((()()()())((()(())(()))(()(((())))()())(()((()))))(()((())))((()((()))())((()(())(())())((()(()))(()(((())))()()())((()(()()))((())()()()()()()()()()()()()()()()()()()()()()()()()())((()(()()))((()(()())())((()((()))(()))(()(((())))()())))(()(((())))()()())))))((()(((())))())((()((()))()())(()(((())))()())))))))((()(())(()))((()()()(()))((()()()()())(()(((()))))))((()(((())))())((()()()()())(()(((())))))))

Only works for all caps without whitespace right now, using this modified version of the script so that it supports reading from stdin:
#!/usr/bin/env python
from collections import defaultdict
from itertools import izip
import copy
import operator
import os
import sys

# map from paren strings to english names
# for the predefined symbols (lambda, etc)
to_english = defaultdict(lambda:None,\
    {'()': 'lambda',
     '()()': 'define',
     '(())': 'plus',
     '(()())': 'minus',
     '()(())': 'mult',
     '(())()': 'div',
     '()()()': 'if',
     '((()))': 'empty',
     '()()()()': 'charsof',
     '()()(())': 'reverse',
     '()(())()': 'LE',
     '()(()())': 'not',
     '(()())()': 'intofchar',
     '()((()))': 'readline',
     '((()))()': 'cons',
     '(())(())': 'equal',
     '((()))(())': 'car',
     '((()))()()': 'cdr',
     '(())(())()': 'char',
     '(())()(())': 'string'})

# map from english to parenthetic
to_scheme = defaultdict(lambda:None)
for k,v in to_english.iteritems():
    to_scheme[v] = k

def Error(errorString = 'unmatched parens', debug_mode = True):
    if debug_mode:
        print "Error: " + errorString
        sys.exit()
    else:
        raise Exception('paren mismatch')

def bracketsMatch(chars):
    """Returns False if any parentheses in `chars` are not matched
    properly. Returns True otherwise.
    """
    level = 0
    for p in chars:
        if p == '(':
            level += 1
        elif p == ')':
            level -= 1
        if level < 0:
            return False
    return level == 0

def get_exprs(chars):
    """Returns a list of character sequences such that for each sequence,
    the first and last parenthesis match.
    For example, "(())()()" would be split into ["(())", "()", "()"]
    """
    level = 0
    current = []
    for p in chars:
        if p == '(' or p == ')':
            current.append(p)
        if p == '(':
            level += 1
        elif p == ')':
            level -= 1
        if level == 0:
            yield current
            current = []

## built-in functions ##
def builtin_accumulate(init, accumulate, environment, params):
    """Helper function that handles common logic for builtin functions.
    Given an initial value, and a two-parameter function, the environment, and
    a list of params to reduce, this function will reduce [init] + params using
    the accumulate function and finally returns the resulting value.
    """
    result = init
    for param in params:
        value = interpret(param, environment)
        try: result = accumulate(result, value)
        except: Error(str(value) + ' is not the correct type')
    return result

def builtin_plus(environment, params):
    if len(params) >= 1:
        return builtin_accumulate(interpret(params[0], environment), operator.add, environment, params[1:])
    else:
        return 0.0

def builtin_minus(environment, params):
    if len(params) == 0:
        Error('subtraction requires at least 1 param')
    return builtin_accumulate(interpret(params[0], environment), operator.sub, environment, params[1:])

def builtin_mult(environment, params):
    return builtin_accumulate(1.0, operator.mul, environment, params)

def builtin_div(environment, params):
    if len(params) == 0:
        Error('division requires at least 1 param')
    return builtin_accumulate(interpret(params[0], environment), operator.div, environment, params[1:])

def builtin_LE(environment, params):
    return interpret(params[0], environment) <= interpret(params[1], environment)

def builtin_lambda(environment, params):
    bodies = [body for body in params[1:]]
    params = params[0][1]
    if len(bodies) == 0:
        Error("a function had no body")
    for kind, name in params:
        if kind != 'symbol':
            Error('lambda must have only symbols as arguments')
    def ret(old_environment, arguments):
        #print bodies
        try:
            # create new environment based on args
            environment = copy.copy(old_environment)
            for param, arg in izip(params, arguments):
                environment[param[1]] = interpret(arg, old_environment)
            # evaluate the function bodies using the new environment
            return interpret_trees(bodies, environment, False)
        except:
            Error("Error evaluating a function")
    return ret

def builtin_equal(environment, params):
    for param1, param2 in izip(params[:-1], params[1:]):
        if interpret(param1, environment) != interpret(param2, environment):
            return False
    return True

def builtin_if(environment, params):
    if len(params) != 3:
        Error("'if' takes in exactly 3 params")
    if interpret(params[0], environment):
        return interpret(params[1], environment)
    return interpret(params[2], environment)

def builtin_not(environment, params):
    return False if interpret(params[0], environment) else True

def builtin_cons(environment, params):
    return (interpret(params[0], environment), interpret(params[1], environment))

def builtin_car(environment, params):
    result = interpret(params[0], environment)
    if not isinstance(result, tuple):
        Error("car must only be called on tuples")
    return result[0]

def builtin_cdr(environment, params):
    result = interpret(params[0], environment)
    if not isinstance(result, tuple):
        Error("cdr must only be called on tuples")
    return result[1]

def builtin_char(environment, params):
    result = interpret(params[0], environment)
    if result != int(result):
        Error("char must only be called on integers")
    return chr(int(result))

def builtin_intofchar(environment, params):
    result = interpret(params[0], environment)
    result = ord(result)
    return result

def builtin_string(environment, params):
    result = ''
    cur = interpret(params[0], environment)
    while cur != ():
        if not isinstance(cur, tuple) or not isinstance(cur[1], tuple):
            Error("string only works on linked lists")
        result += cur[0]
        cur = cur[1]
    return result

def unmakelinked(llist):
    result = ()
    while llist != ():
        if not isinstance(llist, tuple) or not isinstance(llist[1], tuple):
            Error("only works on linked lists")
        result += (llist[0],)
        llist = llist[1]
    return result

def makelinked(tup):
    result = ()
    while tup != ():
        result = (tup[-1],result)
        tup = tup[:-1]
    return result

def builtin_reverse(environment, params):
    result = interpret(params[0], environment)
    result = makelinked(unmakelinked(result)[::-1])
    return result

def builtin_charsof(environment, params):
    result = interpret(params[0], environment)
    result = makelinked(tuple(result))
    return result

def builtin_readline(environment, params):
    result = raw_input()
    return result

# define the default (top-level) scope
default_environment = \
    {to_scheme['plus']: builtin_plus,
     to_scheme['minus']: builtin_minus,
     to_scheme['mult']: builtin_mult,
     to_scheme['div']: builtin_div,
     to_scheme['lambda']: builtin_lambda,
     to_scheme['if']: builtin_if,
     to_scheme['equal']: builtin_equal,
     to_scheme['LE']: builtin_LE,
     to_scheme['not']: builtin_not,
     to_scheme['empty']: (),
     to_scheme['car']: builtin_car,
     to_scheme['cdr']: builtin_cdr,
     to_scheme['cons']: builtin_cons,
     to_scheme['char']: builtin_char,
     to_scheme['string']: builtin_string,
     to_scheme['readline']: builtin_readline,
     to_scheme['charsof']: builtin_charsof,
     to_scheme['reverse']: builtin_reverse,
     to_scheme['intofchar']: builtin_intofchar}

# parse the tokens into an AST
def parse(tokens):
    """Accepts a list of parentheses and returns a list of ASTs.
    Each AST is a pair (type, value).
    If type is 'symbol', value will be the paren sequence corresponding
    to the symbol.
    If type is 'int', value will be a float that is equal to an int.
    If type is expr, value will be a list of ASTs.
    """
    # check for errors
    if not bracketsMatch(tokens):
        Error('paren mismatch')
    # to return - a list of exprs
    exprs = []
    for expr in get_exprs(tokens):
        # check for errors
        if len(expr) < 2:
            Error('too few tokens in: ' + ''.join(expr))
        elif expr[0] != '(' or expr[-1] != ')':
            Error('expression found without () as wrapper')
        # pop off starting and ending ()s
        expr = expr[1:-1]
        # symbol
        if expr[:2] == ['(', ')'] and len(expr) > 2:
            exprs.append(('symbol', ''.join(expr[2:])))
        # integer
        elif expr[:4] == ['(', '(', ')', ')'] and len(expr) >= 4:
            exprs.append(('num', expr[4:].count('(')))
        # expr
        else:
            exprs.append(('expr', parse(expr)))
    return exprs

def interpret(tree, environment):
    """Interpret a single tree (may not be a define) and return the result"""
    kind, value = tree
    if kind == 'num':
        return float(value)
    elif kind == 'symbol':
        if value in environment:
            return environment[value]
        else:
            Error('Unresolved symbol - ' + value)
    elif kind == 'expr':
        function = interpret(value[0], environment)
        if not hasattr(function, '__call__'):
            Error('Symbol "'+value[0]+'" is not a function.')
        return function(environment, value[1:])
    else:
        Error("Unknown tree kind")

def interpret_trees(trees, environment, doprint = True):
    """Interpret a sequence of trees (may contain defines)
    and output the result.
    The trees passed in should be ASTs as returned by parse().
    If doprint is true, the post-interpretation value of each tree is printed.
    """
    environment = copy.copy(environment)
    # hoist define statements (note: trees.sort is stable)
    #trees.sort(key = lambda x: 0 if x[0] == 'expr' and x[1][0][1] == to_scheme['define'] else 1)
    ret = None
    for tree in trees:
        if tree[0] == 'expr' and tree[1][0][0] == 'symbol' and tree[1][0][1] == to_scheme['define']:
            try:
                symbol = tree[1][1]
                if symbol[0] != 'symbol':
                    Error('first argument to define must be a symbol')
                symbol = symbol[1]
                value = tree[1][2]
                environment[symbol] = interpret(value, environment)
            except:
                Error('error evaluating define statement')
        else:
            ret = interpret(tree, environment)
            if doprint:
                print ret,
    return ret

# read in the code ignoring all characters but '(' and ')'
f = open(sys.argv[1],'r')
code = []
for line in f.readlines():
    code += [c for c in line if c in '()']

# parse and interpret the code. print 'Parenthesis Mismatch'
# if an error occured.
#try:
syntax_trees = parse(code)
interpret_trees(syntax_trees, default_environment)
#except:
#    print 'Parenthesis Mismatch'

Explanation
(
  define
  (() ()())
  input [[[[]]]]
  (() (((()))))
  exec readline
  ( (() ()((()))) )
)
(
  define
  (() ()())
  value of 'A' [[[[]]]] [][][]
  (() (((())))()()())
  65
  ((()) ()()()()()()()()()()
        ()()()()()()()()()()
        ()()()()()()()()()()
        ()()()()()()()()()()
        ()()()()()()()()()()
        ()()()()()()()()()()
        ()()()()())
)
(
  define
  (() ()())
  atbash [[[[]]]] []
  (() (((())))())
  (
    lambda
    (() ())
    (
      list [[[[]]]] [][]
      (() (((())))()())
    )
    (
      if
      (() ()()())
      (
        equal
        (() (())(()))
        list
        (() (((())))()())
        empty
        (() ((())))
      )
      then return empty
      (() ((())))
      else
      (
        cons
        (() ((()))())
        (
          char
          (() (())(())())
          (
            plus
            (() (()))
            value of 'A' 65
            (() (((())))()()())
            (
              minus
              (() (()()))
              25
              ((()) ()()()()()()()()()()
                    ()()()()()()()()()()
                    ()()()()())
              (
                minus
                (() (()()))
                (
                  intofchar
                  (() (()())())
                  (
                    car
                    (() ((()))(()))
                    list
                    (() (((())))()())
                  )
                )
                value of 'A' 65
                (() (((())))()()())
              )
            )
          )
        )
        (
          atbash
          (() (((())))())
          (
            cdr
            (() ((()))()())
            list
            (() (((())))()())
          )
        )
      )
    )
  )
)

(
  equals
  (() (())(()))
  (
    reverse
    (() ()()(()))
    (
      charsof
      (() ()()()())
      input
      (() (((()))))
    )
  )
  (
    atbash
    (() (((())))())
    (
      charsof
      (() ()()()())
      input
      (() (((()))))
    )
  )
)

Do you want your code to be the longest? :P

Kerf, 73 bytes
Kerf is a proprietary language in the same general family as APL, J and K. It's possible to write cryptic, compact oneliners and avoid the use of explicit loops:
{[s]s:_ s;n:?isnull i:s search\<a:char 97+^26;f:(/a)[i];s match/f[n]:s[n]}

However, using the spelled-out aliases for commands instead of the shorthand symbols and using meaningful identifiers makes the program much clearer, and fairly easy to follow even if you aren't familiar with Kerf:
def atbash_palindrome(str) {
  str:       tolower str
  alpha:     char range(97, 123)
  indices:   str search mapleft alpha
  encoded:   (reverse alpha)[indices]
  notfound:  which isnull indices
  return     str match reverse encoded[notfound]:str[notfound]
}

In action:
KeRF> p: {[s]s:_ s;n:?isnull i:s search\ p mapdown ["WIZARD","Wizard","W I Z A R D","ABCXYZ","345 09%","ev","Zyba","$%%$","-AZ"]
  [1, 1, 1, 1, 0, 1, 1, 1, 0]

Kerf probably isn't going to win a ton of codegolf competitions, especially against purpose-built languages, but it might be worth tinkering with if you like the idea of APL-family languages but find the syntax too weird. (Disclaimer: I'm the author of the reference manual for Kerf.)

Python 3, 90 85 bytes
s=input().upper()
print(s[::-1]==''.join(chr([o,155-o][64<o<91])for o in map(ord,s)))

We convert the input to uppercase, and then calculate the Atbashed string by subtracting all ordinals from 155 if they're in the uppercase alphabet range.

Perl 5, 70 bytes
A subroutine:
{$"='';reverse(map/[A-Z]/?chr(155-ord):$_,(@_=split'',uc$_[0]))eq"@_"}

See it in use:
print sub{...}->("W i z a r d")

Prolog, 121 bytes
a(W):-upcase_atom(W,X),atom_codes(X,C),b(C,Z),!,reverse(Z,C).
b([A|T],[R|S]):-(A>64,A<91,R is 77-A+78;R=A),(b(T,S);S=[]).

This is called with an atom as input, e.g. a('WIZARD')..

JavaScript (ES6), 91
x=>(x=[...x.toLowerCase()]).every(c=>((v=parseInt(c,36))>9?(45-v).toString(36):c)==x.pop())

TEST

F=x=>(x=[...x.toLowerCase()]).every(c=>((v=parseInt(c,36))>9?(45-v).toString(36):c)==x.pop())

console.log=x=>O.textContent+=x+'\n'

;[
 ["WIZARD", true]
,["Wizard", true] // case doesn't matter
,["wIzArD", true]
,["W I Z A R D", true]
,["W IZ ARD", false] // the atbash of this is D RA ZIW, which is not a palindrome of W IZ ARD
,["ABCXYZ", true] // ZYXCBA
,["345 09%", false] // is not a palindrome
,["ev", true] // ve
,["AZGDFSSF IJHSDFIU HFIA", false]
,["Zyba", true]
,["-AZ", false] // -ZA is not a reverse of -AZ
,["Tree vvig", true] // Givv eert
,["$%%$", true] // palindrome
,["$%ZA%$", true]
].forEach(t=>{var i=t[0],x=t[1],r=F(i);
              console.log(i+' -> '+r+(x==r?' OK':' Fail (expected:'+x+')'))})

C, 101 97 bytes
As the question specified ASCII characters, this doesn't handle any other encodings.

f(char*s){char*p=s+strlen(s);while(*s&&!(isalpha(*--p)?*s<64||*s+*p-27&31:*s-*p))++s;return s>p;}

Explanation
int f(char*s)
{
    char *p = s + strlen(s);
    while (*s && !(isalpha(*--p) ? *s<64||*s+*p-27&31 : *s-*p))
        ++s;
    return s > p;
}

We make a pointer p that begins at the end of the string.  We then loop, moving both s and p towards each other s reaches the end.  This means that every pair of characters will be checked twice, but this saves a couple of bytes compared to stopping as soon as the pointers cross over.
At each iteration, we check whether *p is a letter.  If so, check that *s is in the range of letters (ASCII 64 upward), and that *p and *s add up to 27 (mod 32).  Non-letters over 64 will fail that test, so we don't need to check isalpha(*s).
If *p is not a letter, then we simply test whether it is equal to *s.  In either case, we terminate the loop before s and p cross over.
If s and p have crossed, then every pair of letters matched correctly, so we return true; otherwise we return false.
Test program
Pass the strings to be tested as command-line arguments.  This produces correct output for all the test cases.  There is no supplied requirement for the empty string; my implementation returns false for that input.
#include <stdio.h>

int main(int argc, char **argv)
{
    while (*++argv)
        printf("\"%s\" => %s\n", *argv, f(*argv)?"true":"false");
    return 0;
}

you can drop f's type declaration for a K&R style prototype: f(char*s)

Vyxal, 7 bytes
⇩ḂkaḂĿ=

Try it Online!
⇩       # Lowercase input
 Ḃ      # Duplicate and reverse
     Ŀ  # Transliterate by...
  kaḂ   # lowercase alphabet and backwards lowercase alphabet
      = # is it equal to the original?

Still new in using this lang but using Ḃ allows to save 2 bytes: ⇩ḂkaḂĿ=

@u-ndefined Thanks!

MATL, 23 bytes
Uses current release.
jkt"@@2Y2m?_219+]h]tP=A

Examples
>> matl
 > jkt"@@2Y2m?_219+]h]tP=A
 >
> Tree vvig
1

>> matl
 > jkt"@@2Y2m?_219+]h]tP=A
 >
> W IZ ARD
0

Japt, 30 27 bytes
U=Uv)w ¥Ur"[a-z]"_c +4^31 d

Try it online!
How it works
This is based largely on my Japt answer on Swap the Alphabet.
U=Uv)w ¥Ur"[a-z]"_c +4^31 d
U=Uv)      // Set U to U.toLowerCase().
w ¥        // Reverse it, and check if it is equal to:
Ur"[a-z]"  //  Take the input and replace each letter with:
 _c +4     //   Take its char code and add 4. This results in
           //   the string      "abc...xyz"
           //   becoming        "efg...|}~".
 ^31       //   XOR the result by 31. This flips its last five 5 bits.
           //   We now have     "zyx...cba".
 d         //   Convert back from a char code.
           // Implicit: output last expression

CJam, 18 bytes
qeu_'[,65>_W%erW%=

Try it online
Works by converting input to uppercase, performing the translation of letters, flips the string, and checks for equality.

Ruby, 56 bytes
->s{s.upcase!;s==s.tr(x=[*?A..?Z]*'',x.reverse).reverse}

It's an anonymous function which takes a string and returns true or false. It's rather clumsy: In order to save some bytes, it uses the destructive variant of upcase (with a ! after it). upcase! unfortunately returns nil if nothing is changed (like all numeric input), so some bytes are lost trying to deal with that. Still works tho :)

Python 3.8 (pre-release), 73 bytes / 76 bytes
Lambda version: (73 bytes)
lambda x:(a:=[*map(ord,x.upper())])==[[c,155-c][64<c<91]for c in a][::-1]

Try it online!
Code version: (76 bytes)
a=[*map(ord,input().upper())];print(a==[[c,155-c][64<c<91]for c in a][::-1])

Try it online!
How it works:

.upper() Upper all the char of the input
a=[*map(ord,input().upper())] In both program we store in a the list containing the ascii value of each character.
[... for c in a] We iterate through this list
[c,155-c][64<c<91] If our ascii value is beetween 64 and 91 (if the char is uppercase) we "flip" it.
a==[...][::-1] We compare our list with the new formed list reversed

Note:
If we used Python2, we could save 1 byte on the second program because :

-3 bytes: map() returns a list so we don't need the [*map()] syntax anymore
-2 bytes (and a little adjustment): print doesn't need parenthesis
but +4 bytes because we have to use raw_input()instead of input

Fig, \$8\log_{256}(96)\approx\$ 6.585 bytes
s$Pcacza

Try it online!
s        # Are the following equal, ignoring case:
         # Implicit input
 $       # Reverse of...
       a # Lowercased (implicit) input
  P      # Transliterated from
   ca    # Alphabet
     cz  # To reversed alphabet

Python, 156 112 bytes
a=map(chr,range(65,91))
s=raw_input().upper()
print ''.join([dict(zip(a,a[::-1])).get(i,i) for i in s])==s[::-1]

Basically, it makes a dictionary of the translation with uppercase letters and the input is capitalized (if everything were lowercase instead, that would add 5 bytes). Then, for each character in the capitalized input, do the translation and append to a list unless the character is not in the alphabet, in which case append the character as is. Join the entire list and compare to the reversed list.
Shout-out to @Artyer for posting almost exactly as I was going to post before me. But I need to confirm, this is my work and I did this independently.
Based on the Julia answer by Alex A. Try it here

There is an unnecessary whitespace after .get(i,i). +1.

Ruby, 79 77 bytes
s=$*[0].upcase
exit(s==s.reverse.tr('A-Z','ZYXWVUTSRQPONMLKJIHGFEDCBA'))?0:1

Accepts the word to test as a command-line argument.  Exits with code 0 (which is truthy to the shell) if the argument is an atbash self palindrome, or with code 1 otherwise.

Wouldn't putsing the result be shorter than exit with a ternary?

FYI $* is an alias for ARGV.

05AB1E, 8 bytes
Code:
lDAAR‡RQ

Explanation:
l         # Lowercase the implicit input
 D        # Duplicate top of the stack
  AAR     # Push the lowercase alphabet (A) and the lowercase alphabet reversed (AR)
     ‡    # Transliterate a -> b
      R   # Reverse this string
       Q  # Compare with the input string

Try it online!

Factor, 118 113 bytes
This is an anonymous function.
[ >upper dup >array [ 1string 65 90 [a,b] [ 1string ] map dup reverse zip >hashtable at ] map "" join reverse = ]

I don't know of a shorter way to generate an associative array of the alphabet :c

Clojure, 100 bytes
(defn x[b](let[a(.toUpperCase b)c(reverse a)](=(map #(char(if(<= 65(int %)90)(- 155(int %))%))a)c)))

It should be possible to cut it down to a single anonymous function, cutting around 10 more bytes (of declarations) but I did not find a way yet.

MATLAB, 61 bytes
Not the shortest solution, but still interesting
f=@(a)~any(changem(upper(a),90:-1:65,65:90)-fliplr(upper(a)))

Japt v2.0a0, 13 bytes
Note the unprintable (charcode 155) at the end of the second line.
u
ÔøUr\l_cn#

Try it

Factor + spelling, 60 bytes
[ >lower dup ALPHABET dup reverse zip substitute reverse = ]

Try it online!
Explanation:

>lower Convert to lowercase.
Stack: (e.g.) "wizard"

dup Duplicate.
Stack: "wizard" "wizard"

ALPHABET Place the lowercase alphabet on the stack.
Stack: "wizard" "wizard" "abcdefghijklmnopqrstuvwxyz"

dup Duplicate.
Stack: "wizard" "wizard" "abcdefghijklmnopqrstuvwxyz" "abcdefghijklmnopqrstuvwxyz"

reverse Reverse.
Stack: "wizard" "wizard" "abcdefghijklmnopqrstuvwxyz" "zyxwvutsrqponmlkjihgfedcba"

zip Make an associative array from two sequences.
Stack: "wizard" "wizard" { { 97 122 } { 98 121 } { 99 120 } { 100 119 } { 101 118 } { 102 117 } { 103 116 } { 104 115 } { 105 114 } { 106 113 } { 107 112 } { 108 111 } { 109 110 } { 110 109 } { 111 108 } { 112 107 } { 113 106 } { 114 105 } { 115 104 } { 116 103 } { 117 102 } { 118 101 } { 119 100 } { 120 99 } { 121 98 } { 122 97 } }

substitute Substitute elements in a sequence that have keys in an assoc with their values.
Stack: "wizard" "draziw"

reverse Reverse.
Stack: "wizard" "wizard"

= Are they equal?
Stack: t


text:
Use what you know: Your take on Diceware
If you're not familiar, Diceware is a method for creating passwords using an ordinary die from a pair of dice as a hardware random number generator.
For the sake of fun, let's ignore anything about the security of computer's random number generators.
Write a function or program that prints or returns a single five-character string containing a random selection of the numbers 1 through 6. These should be chosen with equal probability.
Example valid outputs:
21321
14654
53552
63641

No standard loopholes! This is code-golf, so shortest code in bytes wins.

Like this?

@PeterTaylor - the question you marked this a duplicate of is not  even close to the same. Please unmark the question as a duplicate.

It's replacing an is-zero test with a loop. That's a trivial change, and by the standards of this site qualifies as a duplicate.

Dyalog APL, 7 bytes
10⊥?5⍴6

Try it online on TryAPL.
How it works
    5⍴6  Yield (6 6 6 6)
   ?     Roll; turn each 6 into a random integer between 1 and 6.
10⊥      Decode with base 10.

Julia, 24 bytes
print(join(rand(1:6,5)))

We use rand to get an array of length five consisting of elements randomly chosen from the range 1:6. We join it into a string using join then print it to STDOUT using print.

J, 11 bytes
a.{~49+?5$6

Explanation:
        5$6    NB. repeat 6 five times      output: 6 6 6 6 6
       ?5$6    NB. 5 random integers < 6    output: 4 5 1 0 2
    49+?5$6    NB. add 49 ('1') to them     output: 53 54 50 49 51
a.{~49+?5$6    NB. convert them to ASCII    output: 56213

TeaScript, 11 bytes
r6)ΣN6))j(u

Try it online

Pyth, 9 8 bytes
jkO^S6 5

Try it online.
Get list of numbers 1 to 6, Cartesian 5th power, pick random element, join by empty string.

CJam, 8 bytes
{6mr)}5*

Test it here.
Explanation
{       e# Run this block 5 times.
   6mr  e# Get a random integer in [0,5] with uniform distribution.
   )    e# Increment.
}5*

Mathematica, 36 bytes
""<>ToString/@{1,6}~RandomInteger~5&

cough cough string formatting cough cough

MATLAB / Octave, 12 bytes
[49+6*rand(1,6),'']
ans = 153361

rand(x,y) creates a random array with dimensions (x-by-y) with numbers between 0 and 1. Multiply this by 6 to get values between 0 and 6. Add 49 to get a value 49 < n < 55 (the random number will never be exactly 0 or 1). [...,''] converts this to strings with the floored values of n (integers [49 54] corresponding to [1 6] in ASCII.


text:
Spell out the Revu'a
Actually not inspired neither by Atbash Self Palindromes nor by Generalized Gematria Calculator.
Given a string s of length n, output the Revu'a sequence, which is the first character of s, the first two characters of s, ... the first n–2 characters of s, the first n–1 characters of s, the entire s.
The string will only consist of Unicode (any encoding you want) characters that have strong directionality and are found in the range 0x0000 through 0xFFFF. However, no directionality control characters will occur. All characters in any given string will have the same directionality.
You may return in array notation ["t","te","tes","test"], as a space-separated string "t te tes test", as multi-line textttetestest, a pre-formatted arrayt
te
tes
test, or anything similar. Amounts of leading, separating, and trailing spacing is not important, and neither are trailing newline. Ask if in doubt.
Right-to-Left input must result in Right-to-Left output in proper order:

Input: "נחמן"

Output: "נ  נח  נחמ  נחמן" orנ
נח
נחמ
נחמן
, or ["נ","נח","נחמ","נחמן"]. Among invalid results are "נחמן  נחמ  נח  נ" ,"ן  מן  חמן  נחמן", and "נחמן  חמן  מן  ן".

shouldn't it be ["ן", "נח", "נחם", "נחמן"]? (2) bonus points if when given that particular string, you finish off with "מאומן".

@NoLongerBreathedIn I didn't want to bother people with converting letterforms. And sure, if you implement "m'uman" you'll get cookies ;-)

05AB1E, 1 byte
η

Builtins ftw ¯\_(ツ)_/¯
Outputs as a list of prefixes.
Try it online or verify all test cases.
Explanation:
η  # Push a list of prefixes of the (implicit) input-string
   # (and output this list implicitly as result)

Dyalog APL, 2 bytes
,\

Cumulative reduce by concatenate. Try it here.
The formatting of the output is nicer when you prefix a ⍕, but it clearly shows the correct order without.

Exactly the same solution works for the same reason in K.

@JohnE Does K handle Unicode?

JavaScript (ES6), 27 26 25 bytes
Saved one byte thanks to @nicael and @MartinBüttner, one thanks to @Neil
x=>x.replace(/.?/g,"$` ")

Takes advantage of some built-in features of JS's .replace function. Specifically, in the replacement, $`  becomes everything preceding the matched character. Using the regex /.?/g rather than /./g means it also matches the empty string at the end.

I saved another byte: f=x=>x.replace(/.?/g,"$ ")`. You get an extra leading space but that's allowed.

@Neil Thanks, I had no clue that would work!

Ugh, I forgot to quote my ` properly, but I see you worked out what I meant.

Japt, 10 4 bytes
I didn't realize that a cumulative reduce would be so useful in this case. :-)
U¬å+

Outputs as an array, comma-separated by default. If this is not allowed, use this 6-byte code instead:
U¬å+ ·

Try it online!
How it works
      // Implicit: U = input string
U¬    // Split U into chars.
  å+  // Cumulative reduce: loop through each item in the array, concatenating it to the total.
      // ["t","e","s","t"] => ["t","te","tes","test"].
      // Implicit: output last expression

Is using the phrase "Try it online!" and not linking to Try it online! morally acceptable? :P

@MartinBüttner I'd been using that phrase in Japt answers for about a month before Dennis trademarked it. I feel I should have some moral right to keep using it :P

Retina, 11 7 bytes
.
 $`$0

Output is space-separated, with a leading space and a trailing linefeed.
Try it online!

For posterity, it's portable to Perl for 5 more bytes : perl -pE 's/./$$&\n/g'`. (I'm 11 months late, I know)

Brainfuck, 40 bytes
My console doesn't support Right-to-Left characters, but I don't think it will work :c
++++++++++>,[>,]<[<]>[[<+>-]<[<]>[.>]>]

Ungolfed:
++++++++++> # Store 10 (Newline)
,[>,]       # Store input
<[<]>       # Goto first character
[           # While next character
  [<+>-]    # Copy character to the left
  <[<]>     # Goto first character
  [.>]      # Print all charaters
  >         # Go to next character
]

You can post them as separate answers.

You should post them as separate answers.

You must post them as separate answers.

You WILL post them as separate answers.

You CONVINCED me to post them as separate answers.

People on the interwebs CONVINCED me to improve my post by creating seperate answers.
SO asked me if I was sure. They said I could use the edit link to improve my answer.
I told SO I was sure.
SO asked me again.
I told SO I was still sure.
SO told me they didn't allow robots.

Discrimination against robots, SO is getting sued!

Prolog (SWI), 60 49 bytes
Code:
p(X):-findall(S,atom_prefix(X,S),[_|R]),write(R).

Explained:
atom_prefix with X set to input and S as a variable gives 1 prefix of the atom X starting with the empty atom.
findall gets all solutions and puts them in a list.
[_|R] throws away the head (the empty atom) and stores the tail in R
Examples:
p('נחמן').
[נ, נח, נחמ, נחמן]

p('test').
[t, te, tes, test]

Try it online here
Edit: saved 11 bytes by only storing the tail in R.

Python, 35
f=lambda s:f(s[:-1])+[s]if s else[]

Couldn't find a way to use and/or to simplify the recursion because [] is falsy.
Recursive solution, returns a list of strings.
Try it online

Pyth, 3
._z

Prefix builtin does the trick.
Test Suite

GNU Sed, 21
Score includes +1 for -E option to sed:
:
s/^(\S+)\S/\1 &/
t

Works for LTR, but not RTL - I missed that bit..  Actually it does work, the RTL was just not rendering correctly in my terminal.  It works fine with IO viewed in a sensible text editor (e.g. emacs).  It also works in Ideone:
Try it online.

Brachylog, 5 bytes
@[@w\

Try it online!
Explanation
@[       Take a prefix of the input
  @w     Write this prefix to STDOUT followed by a linebreak
    \    False: try another prefix

Right-to-left strings seem to work properly, even though I never even considered them.

Why non-competing?

@Adám @[ and @w were implemented necessarily after April/May 2016. One could find the exact date on the Github commits but it surely isn't before this challenge was submitted.

CJam, 9 bytes
l{N2$@+}*

Output is linefeed-separated.
Test it here.
Explanation
l     e# Read input.
{     e# Fold this block over the input, which is effectively a foreach-loop which skips
      e# the first character...
  N   e#   Push a linefeed.
  2$  e#   Copy the previous string.
  @   e#   Pull up the current character.
  +   e#   Concatenate.
}*

I totally expected CJam to be shorter than that.

@Timwi There is neither a "get all prefixes/suffixes" built-in nor a higher-order function for generalised accumulation, so even if this isn't optimal I doubt it can be beaten significantly.

Ll{+_p}/; is same length, posting because I'm not sure if someone with more experience might be able to golf it more, and also maybe fix the quotes thing :P

JavaScript, 36 bytes
x=>[...x].map((c,i)=>x.slice(0,i+1))

Demo:

a=x=>[...x].map((c,i)=>x.slice(0,i+1));
document.write(
  a("test")+"<br>"+
  a("נחמן")
)

The principle is to map and output the slice of string from the first char to the every char in the word. Surprisingly, this works perfectly for the RTL strings too, no optimization needed.

TI-BASIC, 18 bytes
For(X,1,10^(9
Disp sub(Ans,1,X
End

Not technically valid: TI-BASIC doesn't support Unicode.
Name this prgmA, and input using Ans.
Program recursion would be shorter, but there would be no way to initialize the variables. Therefore, we display a substring of the input at each iteration. The input is never overwritten, since Disp doesn't return a value.
Eventually, the program terminates with an error after printing the whole string.

My console doesn't support Right-to-Left characters, but I don't think it will work :c
C, 74 bytes (2nd entry)
char m[2<<9];i;main(){do{m[i]=getchar();printf("%s ",m);}while(m[i++]>0);}

Ungolfed:
#include <stdio.h>

// char, because `printf("%s", str);` expects a array of characters.
char str[2<<9];
int  str_len = 0;
int main(void) {
    do {
        str[str_len]=getchar();
        printf("%s ", str);
    } while(m[i++]>0);
    return 0;
}

My console doesn't support Right-to-Left characters, but I don't think it will work :c
C, 105 bytes (3th entry)
m[2<<9];i;j;k;main(){while((m[i++]=getchar())<0);for(;j<i;j++,putchar(10))for(k=0;k<j;k++)putchar(m[k]);}

Ungolfed:
#include <stdio.h>

int str[2<<9];
int str_len = 0;
int main(void) {
    do {
        str[str_len] = getchar();
    } while(str[str_len++] != EOF);
    int i;
    for(i=0; i<str_len; i++) {
        int j;
        for(j=0; j<i; j++) {
          putchar(str[j]);
        }
        putchar(10);
    }
}

Python, 54 Bytes
b='';y=input()
for a in range(len(y)):b+=y[a];print(b)

Java 8, 95 92 58 bytes
s->{for(int i=0;;)System.out.println(s.substring(0,++i));}

Try it online.
Explanation:
s->{                        // Method with String parameter and no return-type
  for(int i=0;              //  Index-integer, starting at 0
      ;)                    //  Loop indefinitely:
    System.out.println(     //   Print with trailing newline:
      s.substring(0,++i     //    Increase the index by 1 first with `++i`
                       ));} //    And print an input-substring in the range [0,i)

Stops the infinite loop with a StringIndexOutOfBoundsException after everything has been printed to STDOUT already, which is allowed according to the meta.

MATL, 8 bytes
Uses current version (8.0.0) of language/compiler
jtn1X"YR

Example
>> matl
 > jtn1X"YR
 >
> test
t
te
tes
test

Explanation
j           % input string
tn          % duplicate and get length, say "N"
1X"         % repeat string N times vertically. Gives a char matrix
YR          % lower triangular part of matrix. Implicitly print

Mathematica, 29 bytes
#<>#2&~FoldList~Characters@#&

TODO: explanation

, 7 chars / 16 bytes
ᴉⓜᵖ ᵴ˖$

Try it here (Firefox only).
There's probably a builtin for this somewhere - I just haven't found it.
Explanation
ᴉⓜᵖ ᵴ˖$ // implicit: ᴉ=split input, ᵴ=empty string
ᴉⓜ      // map over ᴉ
   ᵖ ᵴ˖$ // push ᵴ+=(mapped item char)
         // implicit stack output, separated by newlines

Javascript ES6, 29 bytes
(a,b='')=>[...a].map(x=>b+=x)

This ain't winning anything, but it's a simple solution.

Pyth, 11 Bytes
Vlz=k+k@zNk

Try It Out
Explanation
(z=input)
(k="")
V        for N in Range(
lz       length of z):
=k+k@zN     k=k+z[N]
k           print(k)

Python, 32 bytes
f=lambda s:s and f(s[:-1])+" "+s

Recursive function that outputs a space-separated string with a leading space.
A 34-byte program (Python 2):
s=""
for c in input():s+=c;print s

V, 5 bytes
òÄ$xh

Try it online!
Explanation:
ò       " Recursively:
 Ä      "   Duplicate this line
  $     "   Move to the end of this line
   x    "   Delete one character
    h   "   Move one character to the right, which will throw an error when the line is one character long

PowerShell v2+, 28 bytes
[char[]]$args[0]|%{($o+=$_)}

Takes input $args[0], casts it as a char-array, pipes the characters into a loop |%{...}. Each iteration, we accumulate onto $o via += the current character $_. That expression is encapsulated in parens so a copy is placed on the pipeline. At end of execution, the pipeline is flushed via Write-Output which puts a newline between elements.
PS C:\Tools\Scripts\golfing> .\spell-out-the-revua "נחמן"
נ
נח
נחמ
נחמן

PS C:\Tools\Scripts\golfing> .\spell-out-the-revua "PPCG"
P
PP
PPC
PPCG

jq, 17 bytes
.[:range(length)]

Try it online!
-10 from ovs.

.[:range(length)] works for 17 bytes. There is a way to save 2 more bytes, but I'll leave that to you ;)

PHP, 59 Bytes
for(;$i++<mb_strlen($argn);)echo"\n".mb_substr($argn,0,$i);

Online Version

Unwanted, Unnecessary, Opportunistic, 9 bytes
E<+S0;*P

.+?, 18 bytes
^((.+).)
\2\n\1
$

Explanation
^((.+).)   Replace the first line with
\2         The first line missing the last character
  \n       A newline
    \1     The first line
$          Repeat until the regex doesn't match (when first line has 1 character)

Try it online! (The second command line argument is input)

Burlesque, 2 bytes
iT

Try it online!
iT # Generate inits

GolfScript, 10 bytes
Courtesy to a'_' for saving two bytes by removing redundant bits!
:i,,{)i<}/

Nice short and cute response :)
:i,,{)i>}% #Revu'a Sequence
:i           #Remember the input as i
  ,,         #Array from 0 to i-1
    {   }% #Block, for each element, map this
    {)  }% #Increment the number by 1
    { i }% #Move i to the top of the stack
    {  >}% #Print the characters less than the index i

Try it online!

GolfScript, 10 bytes. Explanation. (Because < isn't order-sensitive, and you can return as a list.)

Oh, durr! Didn't even think about doing listwise comparisons - mental slip there, good find!

Vyxal, 1 byte
¦

Try it Online!
But that's boring, so here's something a bit more interesting:
6 bytes
żƛw?$i

Try it Online!
Explained
żƛw?$i
        # Implicit input of string
żƛ      # Over each integer n in range(1, len(input) + 1):
   ?    #   input[
  w $i  #         :n] (python indexing)
        # Implicitly print the result of the above.

Thunno 2, 1 byte
ƒ

Try it online!
ṡ

Try it online!
Built-ins for prefixes.