76
\$\begingroup\$

Your task is to display the letter "A" alone, without anything else, except any form of trailing newlines if you cannot avoid them, doing so in a program and/or snippet. Code that returns (instead of printing) is allowed.

Both the lowercase and uppercase versions of the letter "A" are acceptable (that is, unicode U+0061 or unicode U+0041. Other character encodings that aren't Unicode are allowed, but either way, the resulting output of your code must be the latin letter "A", and not any lookalikes or homoglyphs)

You must not use any of the below characters in your code, regardless of the character encoding that you pick:

  • "A", whether uppercase or lowercase.

  • "U", whether lowercase or uppercase.

  • X, whether uppercase or lowercase.

  • +

  • &

  • #

  • 0

  • 1

  • 4

  • 5

  • 6

  • 7

  • 9

Cheating, loopholes, etc, are not allowed.

Since this is , the shortest solution, in bytes, that follows all the rules, is the winner.


Validity Checker

This Stack Snippet checks to make sure your code doesn't use the restricted characters. It might not work properly for some character encodings.

var t = prompt("Input your code.");

if (/[AaUuXx+&#0145679]/.test(t)) {
  alert("Contains a disallowed character!");
} else {
  alert("No disallowed characters");
}

This Stack Snippet that makes sure you don't have a disallowed character is also available on JSFiddle.

Leaderboard

var QUESTION_ID=90349,OVERRIDE_USER=58717;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="<h1>"+e.body.replace(OVERRIDE_REG,"")+"</h1>")});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;/<a/.test(o)&&(o=jQuery(o).text()),s[o]=s[o]||{lang:e.language,user:e.user,size:e.size,link:e.link}});var t=[];for(var o in s)s.hasOwnProperty(o)&&t.push(s[o]);t.sort(function(e,s){return e.lang>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}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b"> <div id="answer-list"> <h2>Leaderboard</h2> <table class="answer-list"> <thead> <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr></thead> <tbody id="answers"> </tbody> </table> </div><div id="language-list"> <h2>Winners by Language</h2> <table class="language-list"> <thead> <tr><td>Language</td><td>User</td><td>Score</td></tr></thead> <tbody id="languages"> </tbody> </table> </div><table style="display: none"> <tbody id="answer-template"> <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr></tbody> </table> <table style="display: none"> <tbody id="language-template"> <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr></tbody> </table>

\$\endgroup\$
  • 7
    \$\begingroup\$ @ColdGolf You seem to be saying "yes" to functions, but functions don't display, they usually return. \$\endgroup\$ – xnor Aug 19 '16 at 23:06
  • 2
    \$\begingroup\$ Is ending up with a variable that contains just a also good enough ? \$\endgroup\$ – Ton Hospel Aug 19 '16 at 23:17
  • 1
    \$\begingroup\$ That's not what I meant. The supposed code doing a variable assignment would not contain any of the forbidden characters. I'm just trying to understand what is covered by "display by means other than printing". If "return from a function" is OK, what about "assign to a variable" ? \$\endgroup\$ – Ton Hospel Aug 20 '16 at 0:05
  • 1
    \$\begingroup\$ Why those particular characters? \$\endgroup\$ – user253751 Aug 22 '16 at 1:32
  • 7
    \$\begingroup\$ @immibis A for obvious reasons. U for Unicode escape strings (\u0041 is A), X for hex escape strings (\x41), + for Unicode ordinals (U+0041), & for HTML entities, # for I actually don't know, 65 is the decimal ordinal of A, 41 is the hex ordinal of A, 97 is the decimal ordinal of a, and 0 for a few of the previous reasons. \$\endgroup\$ – user45941 Aug 22 '16 at 6:26

183 Answers 183

1
3 4 5 6
7
0
\$\begingroup\$

Whispers v2, 190* 108 bytes

> e
> 8
>> 2²
> e
> e
> e
> e
>> ≻3
> e
> e
> e
> e
> e
> e
> e
> e
> e
> e
> e
> e
> e
>> '8
>> Error 22

Try it online!

Outputs A to STDERR, which is an accepted method of output

*82 bytes saved by golfing formula from \$65 = (3 - (-2)) - (-2 \times 3) \times (8 - (-2))\$ to \$65 = 8^2+1\$

How it works

Whispers is different to most languages, in that numbers (0123456789) don't always represent their numerical values. A Whispers program is a series of lines, each of which matches (at least) one of a series of regexes. All the regexes require a line to begin with either > or >> (note the space).

Lines that begin with > are nilad lines, and return a constant value each time. on these lines, digits do represent their respective numerical values. For example, line 2 (> 8) returns the integer \$8\$.

However, lines beginning with >> treat numbers as line references, rather than numerical values. This means that >> 2² doesn't actually return \$2^2 = 4\$. Rather, it retrieves the value on line 2 and returns its square. Execution works by starting on the last line, and getting values passed along through other lines, similar to a game of Chinese Whispers (hence the name).

Now, as we can't use any of 0145679, we have to construct either \$65\$ or \$97\$ using only \$2\$, \$3\$ and \$8\$. Furthermore, we can't refer to any lines aside from 2, 3, 8, 22, 23, etc. which is why we have so many lines that are just > e. These are all unexecuted, and just serve to pad the important lines to line numbers that we can use.

We use the formula \$65 = 8^2 + 1\$ in order to build \$65\$ (the char code of A). Luckily, Whispers has an increment command (), so we don't have to deal with addition or calculating the number \$1\$. So, we start execution on the last line:

>> Error 22

This calls line 22, outputs its value to STDERR, then exits. Line 22, directly above, is

>> '8

' is the to character command, equivalent to Python's chr builtin, so here, we take the value on line 8 and convert it to a Unicode character. Now, we can see lines 2, 3 and 8, in order:

> 8
>> 2²
>> ≻3

Kind of counter intuitively, these lines are executed in reverse order: first line 8 increments the value on line 3, then line 3 squares the value on line 2 i.e. \$8\$. Ultimately, line 8 returns \$8^2 + 1 = 65\$ which is then cast to character and outputted to STDERR.

| improve this answer | |
\$\endgroup\$
0
\$\begingroup\$

MAWP, 5 bytes

88WM;

Creates ASCII code for \$8*8+1(existing)=65\$ and outputs it.

Try it!

| improve this answer | |
\$\endgroup\$
-1
\$\begingroup\$

Python 3, 60 bytes

No disallowed characters

'%c'%-~((''=='')<<((''=='')-~(''==''))*((''=='')--(''=='')))

Try it online!

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ You should mark this as a REPL, since it doesn't actually output the letter. You can also shorten this severely by using digits, for example: '%c'%-~(-~3)**3 \$\endgroup\$ – Jo King Sep 30 '19 at 4:38
1
3 4 5 6
7

Not the answer you're looking for? Browse other questions tagged or ask your own question.