| Bytes | Lang | Time | Link |
|---|---|---|---|
| nan | 240828T054551Z | Keyboard | |
| 097 | C | 140615T065607Z | Franzzzz |
| nan | 140608T101440Z | Alireza | |
| 041 | Haskell | 140610T035406Z | YawarRaz |
| 006 | GolfScript | 140609T212506Z | Dennis |
| 070 | Perl | 140608T181711Z | Zaid |
| nan | 140608T130528Z | core1024 | |
| 011 | GolfScript | 140607T153235Z | Ry- |
| 009 | CJam | 140607T154719Z | aditsu q |
| nan | 140607T153817Z | ɐɔıʇǝɥʇu |
Keyboard Tester Instructions ➦ When you press any button on your keyboard, a clicking “Sound” will be come.
➦ In your virtual keyboard that pressed key will be Light Up.
➦ A single button will light up on the virtual keyboard when both “Shift” keys are pressed on your physical keyboard.
➦ “Delete” is not visible in the virtual keyboard.
➦ Windows start key is name as “Meta” on virtual keyboard.
➦ If your keyboard is not working properly you may purchase a new keyboard here.
C, 97 characters
main(long a,char**u){a=0xfb0000000750003d;for(u++;**u;a|=2L<<*(*u)++-39);a=48+!~a;write(1,&a,1);}
Need to call the program with argument containing at least the letters:
`1234567890-=AZERTYUIOPQSDFGHJKLMWXCVBN[]\;',./
and get answer 1 (true). The charset can be changed by changing the initialization value of a.
PHP
foreach (str_split("`1234567890-=qwertyuiop[]\asdfghjkl;'zxcvbnm,./") as $v) {
if (strpos($_GET['i'],$v)!==false)die(NO);
}
$_GET['i'] is the input
Haskell, 41 (two solutions)
interact(\y->show$all(`elem`y)[' '..'`'])
or (point-free style)
interact$show.(`all`[' '..'`']).flip elem
Need to input at least these characters:
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`
in any order, any number of times. Extra characters are allowed. Run in an interpreter. Must hit Enter when you are done, but if you hit Enter before you are done, you can keep entering characters, and press Enter again. Will print True if you have hit every character, otherwise it won't print anything.
GolfScript, 6 bytes
.&,94=
If all ASCII characters with codes between 33 and 127 are present, it prints 1. Otherwise, it prints 0.
This approach will fail if the input contains other characters (including a final newline), which has been allowed by the OP and is also true for the existing GolfScript solution.
Usage
$ echo -n '!"#$%&'"'"'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~' |
> golfscript <(echo '.&,94=')
1
How it works
.& # Compute the intersection of the input string with itself. This removes duplicates.
, # Compute the length of the resulting string.
94= # Push 1 if the length is 94, otherwise push 0.
Perl, 70 characters
say[sort grep!$s{$_}++,<>=~/\S/g]~~[sort"',-./;=[\]`"=~/./g,0..9,a..z]
Usage:
echo `134223423567890-=qwertyuiop[]\asdfghjkl;'zxcvbnm,./ | perl -E 'say[sort grep!$s{$_}++,pop=~/\S/g]~~[sort"',-./;=[\]`"=~/./g,0..9,a..z]'
Prints 1 if all keystrokes present, else prints nothing.
JavaScript - 62 70
alert(!(47-prompt().match(/([',-\/\d;=a-z\[-\]`]?)(?!.*\1)/g).length))
And a bit shorter:
alert(!!prompt().match(/([',-\/\d;=a-z\[-\]`])(?!.*\1)/g)[46])
GolfScript, 11
Printable ASCII isn’t that interesting…
127,32,-^,!
Ruby, 68
With flag -rset for 4 characters.
p Set.new(?`..?z)+(?,..?9)+%w{[ ] \\ ; '}==Set.new(gets.split'')
and
Python 3, 76
print(set("`1234567890-=qwertyuiop[]\\asdfghjkl;'zxcvbnm,./")==set(input()))
CJam - 9
',33>q-!
It checks for the "shifted" characters too (including uppercase letters).
Try it at http://cjam.aditsu.net/
Note: there is an invisible character (with code 127) after the apostrophe.
Python 72:
f=lambda x:set(x)==set("`1234567890-=qwertyuiop[]\asdfghjkl;'zxcvbnm,./")