title: Build a Markdown bomb

text:
# Question
Title: Build a Markdown bomb
I'm sure most of us have heard of zip bombs and similar decompression bomb tricks, where a maliciously crafted input creates a massively disproportionate output. We even had a question on here to do that to a compiler at one point.

Well, it occurs to me that Markdown is a compression format of sorts, replacing bulky HTML tags with "compressed" MD tokens. Therefore, might it be possible to build a compression bomb in Markdown?

# Challenge rules:

* The submission should be a piece of markdown text, between 50 and 256 characters in length. (Imposing a minimum to head off some smart-aleck posting a 3-character response or similar.)
* The submission will be processed by StackExchange's Markdown processor as implemented in this site.
* Your score will be the ratio of character count in the resulting HTML to the character count of your Markdown text.
* Highest score wins.

# Answer
> 105 votes
# Blockquotes, 137,469/256 = 536.99

*6,908 characters, 511 new lines, 130,050 spaces*

Markdown sure handles nested block-quotes oddly. Each `>` character gets turned into `<blockquote></blockquote>` so a solid 1 to 25 ratio. But wait! When rendering the HTML it also adds two spaces per nesting! Having this try to render causes my browser some grief, and I will keep it in the code-cage for now. Feel free to unlock it yourself!

The code input consists of 255 `>` followed by ~~`&` as the last character doesn't transform, but it does get escaped. *Thanks BWO*~~ `!` as the last character which gives the last blockquote the spoiler class with an empty p tag inside. *Thanks bta, 11 extra characters*

Input: `>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>!`

Output HTML:

```
...
  <blockquote>
    <blockquote class="spoiler">
      <p></p>
    </blockquote>
  </blockquote>
...

```

Here is what it looks like in the editor view!

Plotting the results as the number of `>` increase as suggested by LambdaBeta:

# Answer
> 63 votes
# MathJax, 529\\$\\,\\$252\\$\\,\\$640ish / 256 ≈ 2\\$\\,\\$067\\$\\,\\$393

A good old thousand-laughs-style code

`$$\def\a{}\def\b{\a\a\a\a\a\a\a\a\a\a\a\a\a}\def\c{\b\b\b\b\b\b\b\b\b\b\b}\def\d{\c\c\c\c\c\c\c\c}\d\d\d\d\d\d\d\d$$`

multiplies the gross inefficiency of representing exotic characters in MathJax by a considerable factor.

The StackExchange MathJax configuration limitation of 10\\$\\,\\$000 macro expansions is being honored, while the limitations of the client’s browser, which are highly likely to cause problems expanding the macros, are not. (My browser is uncooperative as well, so the figure is an estimate.)

# Answer
> 26 votes
# Shorthand links: 68,960 / 256 = 269.375

ASCII only: 10,114 / 256 = 39.508

```
[][1][][1][][1][][1][][1][][1][][1][][1][][1][][1][][1][][1][][1][][1][][1][][1][][1][][1][][1][][1][][1][][1][][1][][1][][1][][1]
[1]:ftp://^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

```

Output is a sequence of elements that each look like:

```
<a href="ftp://%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E%5E" rel="nofollow noreferrer"></a>

```

After the fixed overhead for creating the URL reference, each 5-character link expands into `42+strlen(url)` characters output. Craft the URL to have the maximum number of characters that need escaping, and this grows to `47+3*strlen(url)` characters per link. A little experimentation showed that the optimal output involved 26 links, with 114 carets per link.

**Update**: If you interpret the "256 character" limit to include Unicode characters, you can squeeze out more chaos. Replacing the carets with the Unicode bathtub character (, codepoint U+1F6C1) results in `47+18*strlen(url)` output characters per input character for a total of 54,574 68,960 (thanks to jimmy23013's even-shorter link notation).

Unicode input:

```
[1],[1],[1],[1],[1],[1],[1],[1],[1],[1],[1],[1],[1],[1],[1],[1],[1],[1],[1],[1],[1],[1],[1],[1],[1],[1],[1],[1],[1],[1],[1],[1]
[1]:ftp://

```

Output is a series of:

```
<a href="ftp://%EF%BF%BD%EF%BF%BD...per character...%EF%BF%BD%EF%BF%BD" rel="nofollow noreferrer">1</a>,

```

# Answer
> 15 votes
# 15888/50 = 317.76: Abuse of MathJaX

This is the code:

```
$$&$$$$&$$$$&$$$$&$$$$&$$$$&$$$$&$$$$&$$$$&$$$$&$$

```

This is what it looks like:

$$&$$$$&$$$$&$$$$&$$$$&$$$$&$$$$&$$$$&$$$$&$$$$&$$

The resulting HTML is:

```
<p><span class="MathJax_Preview" style="display: none;"></span><div class="MathJax_Display" style="text-align: center;"><span class="MathJax" id="MathJax-Element-618-Frame" tabindex="0" style="text-align: center; position: relative;" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><merror><mtext>Misplaced &amp;</mtext></merror></math>" role="presentation"><nobr aria-hidden="true"><span class="math" id="MathJax-Span-3081" style="width: 5.447em; display: inline-block;"><span style="display: inline-block; position: relative; width: 4.503em; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(1.114em, 1004.5em, 2.614em, -999.997em); top: -2.164em; left: 0em;"><span class="mrow" id="MathJax-Span-3082"><span id="MathJax-Span-3083" style="display: inline-block;"><span class="merror" id="null"><span class="mrow" id="MathJax-Span-3084"><span class="mtext" id="MathJax-Span-3085" style=""><span style="font-size: 83%;">Misplaced &</span></span></span></span></span></span><span style="display: inline-block; width: 0px; height: 2.169em;"></span></span></span><span style="display: inline-block; overflow: hidden; vertical-align: -0.397em; border-left: 0px solid; width: 0px; height: 1.537em;"></span></span></nobr><span class="MJX_Assistive_MathML MJX_Assistive_MathML_Block" role="presentation"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><merror><mtext>Misplaced &</mtext></merror></math></span></span></div><script type="math/tex; mode=display" id="MathJax-Element-618">&</script><span class="MathJax_Preview" style="display: none;"></span><div class="MathJax_Display" style="text-align: center;"><span class="MathJax" id="MathJax-Element-619-Frame" tabindex="0" style="text-align: center; position: relative;" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><merror><mtext>Misplaced &amp;</mtext></merror></math>" role="presentation"><nobr aria-hidden="true"><span class="math" id="MathJax-Span-3086" style="width: 5.447em; display: inline-block;"><span style="display: inline-block; position: relative; width: 4.503em; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(1.114em, 1004.5em, 2.614em, -999.997em); top: -2.164em; left: 0em;"><span class="mrow" id="MathJax-Span-3087"><span id="MathJax-Span-3088" style="display: inline-block;"><span class="merror" id="null"><span class="mrow" id="MathJax-Span-3089"><span class="mtext" id="MathJax-Span-3090" style=""><span style="font-size: 83%;">Misplaced &</span></span></span></span></span></span><span style="display: inline-block; width: 0px; height: 2.169em;"></span></span></span><span style="display: inline-block; overflow: hidden; vertical-align: -0.397em; border-left: 0px solid; width: 0px; height: 1.537em;"></span></span></nobr><span class="MJX_Assistive_MathML MJX_Assistive_MathML_Block" role="presentation"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><merror><mtext>Misplaced &</mtext></merror></math></span></span></div><script type="math/tex; mode=display" id="MathJax-Element-619">&</script><span class="MathJax_Preview" style="display: none;"></span><div class="MathJax_Display" style="text-align: center;"><span class="MathJax" id="MathJax-Element-620-Frame" tabindex="0" style="text-align: center; position: relative;" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><merror><mtext>Misplaced &amp;</mtext></merror></math>" role="presentation"><nobr aria-hidden="true"><span class="math" id="MathJax-Span-3091" style="width: 5.447em; display: inline-block;"><span style="display: inline-block; position: relative; width: 4.503em; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(1.114em, 1004.5em, 2.614em, -999.997em); top: -2.164em; left: 0em;"><span class="mrow" id="MathJax-Span-3092"><span id="MathJax-Span-3093" style="display: inline-block;"><span class="merror" id="null"><span class="mrow" id="MathJax-Span-3094"><span class="mtext" id="MathJax-Span-3095" style=""><span style="font-size: 83%;">Misplaced &</span></span></span></span></span></span><span style="display: inline-block; width: 0px; height: 2.169em;"></span></span></span><span style="display: inline-block; overflow: hidden; vertical-align: -0.397em; border-left: 0px solid; width: 0px; height: 1.537em;"></span></span></nobr><span class="MJX_Assistive_MathML MJX_Assistive_MathML_Block" role="presentation"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><merror><mtext>Misplaced &</mtext></merror></math></span></span></div><script type="math/tex; mode=display" id="MathJax-Element-620">&</script><span class="MathJax_Preview" style="display: none;"></span><div class="MathJax_Display" style="text-align: center;"><span class="MathJax" id="MathJax-Element-621-Frame" tabindex="0" style="text-align: center; position: relative;" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><merror><mtext>Misplaced &amp;</mtext></merror></math>" role="presentation"><nobr aria-hidden="true"><span class="math" id="MathJax-Span-3096" style="width: 5.447em; display: inline-block;"><span style="display: inline-block; position: relative; width: 4.503em; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(1.114em, 1004.5em, 2.614em, -999.997em); top: -2.164em; left: 0em;"><span class="mrow" id="MathJax-Span-3097"><span id="MathJax-Span-3098" style="display: inline-block;"><span class="merror" id="null"><span class="mrow" id="MathJax-Span-3099"><span class="mtext" id="MathJax-Span-3100" style=""><span style="font-size: 83%;">Misplaced &</span></span></span></span></span></span><span style="display: inline-block; width: 0px; height: 2.169em;"></span></span></span><span style="display: inline-block; overflow: hidden; vertical-align: -0.397em; border-left: 0px solid; width: 0px; height: 1.537em;"></span></span></nobr><span class="MJX_Assistive_MathML MJX_Assistive_MathML_Block" role="presentation"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><merror><mtext>Misplaced &</mtext></merror></math></span></span></div><script type="math/tex; mode=display" id="MathJax-Element-621">&</script><span class="MathJax_Preview" style="display: none;"></span><div class="MathJax_Display" style="text-align: center;"><span class="MathJax" id="MathJax-Element-622-Frame" tabindex="0" style="text-align: center; position: relative;" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><merror><mtext>Misplaced &amp;</mtext></merror></math>" role="presentation"><nobr aria-hidden="true"><span class="math" id="MathJax-Span-3101" style="width: 5.447em; display: inline-block;"><span style="display: inline-block; position: relative; width: 4.503em; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(1.114em, 1004.5em, 2.614em, -999.997em); top: -2.164em; left: 0em;"><span class="mrow" id="MathJax-Span-3102"><span id="MathJax-Span-3103" style="display: inline-block;"><span class="merror" id="null"><span class="mrow" id="MathJax-Span-3104"><span class="mtext" id="MathJax-Span-3105" style=""><span style="font-size: 83%;">Misplaced &</span></span></span></span></span></span><span style="display: inline-block; width: 0px; height: 2.169em;"></span></span></span><span style="display: inline-block; overflow: hidden; vertical-align: -0.397em; border-left: 0px solid; width: 0px; height: 1.537em;"></span></span></nobr><span class="MJX_Assistive_MathML MJX_Assistive_MathML_Block" role="presentation"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><merror><mtext>Misplaced &</mtext></merror></math></span></span></div><script type="math/tex; mode=display" id="MathJax-Element-622">&</script><span class="MathJax_Preview" style="display: none;"></span><div class="MathJax_Display" style="text-align: center;"><span class="MathJax" id="MathJax-Element-623-Frame" tabindex="0" style="text-align: center; position: relative;" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><merror><mtext>Misplaced &amp;</mtext></merror></math>" role="presentation"><nobr aria-hidden="true"><span class="math" id="MathJax-Span-3106" style="width: 5.447em; display: inline-block;"><span style="display: inline-block; position: relative; width: 4.503em; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(1.114em, 1004.5em, 2.614em, -999.997em); top: -2.164em; left: 0em;"><span class="mrow" id="MathJax-Span-3107"><span id="MathJax-Span-3108" style="display: inline-block;"><span class="merror" id="null"><span class="mrow" id="MathJax-Span-3109"><span class="mtext" id="MathJax-Span-3110" style=""><span style="font-size: 83%;">Misplaced &</span></span></span></span></span></span><span style="display: inline-block; width: 0px; height: 2.169em;"></span></span></span><span style="display: inline-block; overflow: hidden; vertical-align: -0.397em; border-left: 0px solid; width: 0px; height: 1.537em;"></span></span></nobr><span class="MJX_Assistive_MathML MJX_Assistive_MathML_Block" role="presentation"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><merror><mtext>Misplaced &</mtext></merror></math></span></span></div><script type="math/tex; mode=display" id="MathJax-Element-623">&</script><span class="MathJax_Preview" style="display: none;"></span><div class="MathJax_Display" style="text-align: center;"><span class="MathJax" id="MathJax-Element-624-Frame" tabindex="0" style="text-align: center; position: relative;" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><merror><mtext>Misplaced &amp;</mtext></merror></math>" role="presentation"><nobr aria-hidden="true"><span class="math" id="MathJax-Span-3111" style="width: 5.447em; display: inline-block;"><span style="display: inline-block; position: relative; width: 4.503em; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(1.114em, 1004.5em, 2.614em, -999.997em); top: -2.164em; left: 0em;"><span class="mrow" id="MathJax-Span-3112"><span id="MathJax-Span-3113" style="display: inline-block;"><span class="merror" id="null"><span class="mrow" id="MathJax-Span-3114"><span class="mtext" id="MathJax-Span-3115" style=""><span style="font-size: 83%;">Misplaced &</span></span></span></span></span></span><span style="display: inline-block; width: 0px; height: 2.169em;"></span></span></span><span style="display: inline-block; overflow: hidden; vertical-align: -0.397em; border-left: 0px solid; width: 0px; height: 1.537em;"></span></span></nobr><span class="MJX_Assistive_MathML MJX_Assistive_MathML_Block" role="presentation"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><merror><mtext>Misplaced &</mtext></merror></math></span></span></div><script type="math/tex; mode=display" id="MathJax-Element-624">&</script><span class="MathJax_Preview" style="display: none;"></span><div class="MathJax_Display" style="text-align: center;"><span class="MathJax" id="MathJax-Element-625-Frame" tabindex="0" style="text-align: center; position: relative;" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><merror><mtext>Misplaced &amp;</mtext></merror></math>" role="presentation"><nobr aria-hidden="true"><span class="math" id="MathJax-Span-3116" style="width: 5.447em; display: inline-block;"><span style="display: inline-block; position: relative; width: 4.503em; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(1.114em, 1004.5em, 2.614em, -999.997em); top: -2.164em; left: 0em;"><span class="mrow" id="MathJax-Span-3117"><span id="MathJax-Span-3118" style="display: inline-block;"><span class="merror" id="null"><span class="mrow" id="MathJax-Span-3119"><span class="mtext" id="MathJax-Span-3120" style=""><span style="font-size: 83%;">Misplaced &</span></span></span></span></span></span><span style="display: inline-block; width: 0px; height: 2.169em;"></span></span></span><span style="display: inline-block; overflow: hidden; vertical-align: -0.397em; border-left: 0px solid; width: 0px; height: 1.537em;"></span></span></nobr><span class="MJX_Assistive_MathML MJX_Assistive_MathML_Block" role="presentation"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><merror><mtext>Misplaced &</mtext></merror></math></span></span></div><script type="math/tex; mode=display" id="MathJax-Element-625">&</script><span class="MathJax_Preview" style="display: none;"></span><div class="MathJax_Display" style="text-align: center;"><span class="MathJax" id="MathJax-Element-626-Frame" tabindex="0" style="text-align: center; position: relative;" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><merror><mtext>Misplaced &amp;</mtext></merror></math>" role="presentation"><nobr aria-hidden="true"><span class="math" id="MathJax-Span-3121" style="width: 5.447em; display: inline-block;"><span style="display: inline-block; position: relative; width: 4.503em; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(1.114em, 1004.5em, 2.614em, -999.997em); top: -2.164em; left: 0em;"><span class="mrow" id="MathJax-Span-3122"><span id="MathJax-Span-3123" style="display: inline-block;"><span class="merror" id="null"><span class="mrow" id="MathJax-Span-3124"><span class="mtext" id="MathJax-Span-3125" style=""><span style="font-size: 83%;">Misplaced &</span></span></span></span></span></span><span style="display: inline-block; width: 0px; height: 2.169em;"></span></span></span><span style="display: inline-block; overflow: hidden; vertical-align: -0.397em; border-left: 0px solid; width: 0px; height: 1.537em;"></span></span></nobr><span class="MJX_Assistive_MathML MJX_Assistive_MathML_Block" role="presentation"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><merror><mtext>Misplaced &</mtext></merror></math></span></span></div><script type="math/tex; mode=display" id="MathJax-Element-626">&</script><span class="MathJax_Preview" style="display: none;"></span><div class="MathJax_Display" style="text-align: center;"><span class="MathJax" id="MathJax-Element-627-Frame" tabindex="0" style="text-align: center; position: relative;" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><merror><mtext>Misplaced &amp;</mtext></merror></math>" role="presentation"><nobr aria-hidden="true"><span class="math" id="MathJax-Span-3126" style="width: 5.447em; display: inline-block;"><span style="display: inline-block; position: relative; width: 4.503em; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(1.114em, 1004.5em, 2.614em, -999.997em); top: -2.164em; left: 0em;"><span class="mrow" id="MathJax-Span-3127"><span id="MathJax-Span-3128" style="display: inline-block;"><span class="merror" id="null"><span class="mrow" id="MathJax-Span-3129"><span class="mtext" id="MathJax-Span-3130" style=""><span style="font-size: 83%;">Misplaced &</span></span></span></span></span></span><span style="display: inline-block; width: 0px; height: 2.169em;"></span></span></span><span style="display: inline-block; overflow: hidden; vertical-align: -0.397em; border-left: 0px solid; width: 0px; height: 1.537em;"></span></span></nobr><span class="MJX_Assistive_MathML MJX_Assistive_MathML_Block" role="presentation"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><merror><mtext>Misplaced &</mtext></merror></math></span></span></div><script type="math/tex; mode=display" id="MathJax-Element-627">&</script></p>

```

Don't forget your MathJax folks.

Caveat: The MathJaX only shows the error during editing, so you have to view it in the editor. This is still a markdown implementation on this site, so should be valid. Once posted the `Misplaced &` warnings turn into normal &'s.

# Answer
> 14 votes
# Syntax highlighting, ~~6376~~ 6464/256 ≈ 25.25

+0.34375 thanks to Ismael Miguel (using a tab instead of 4 spaces)!

This uses the shortest (unfortunately spaces seem to matter) annotation to get syntax-highlighting `lang-c`, opens a code block and fills it with `&` and `0`:

```
<!-- language: lang-c -->

    &0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0

```

We start with `&` because it expands to `&` and use `0` next, alternating these constantly creates new `<span>` elements with a `class` attribute. Unfortunately we can't use only `&` or `&<&<...` since they stay in the same `pun`-`<div>`

It produces:

```
<pre class="lang-c prettyprint prettyprinted" style=""><code><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span><span class="pun">&</span><span class="lit">0</span></code></pre></div>

```

And rendered by your browser it results in:

```
&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0

```

# Answer
> 5 votes
# 190/50 = 3.8: Italics

As it turns out, your 3-character worry is true. `*q*` generates `<em>q</em>` giving a ratio of 10/3. Two carriage returns give `<p>...</p>\n\n` (the two carriage returns aren't necessary, but do appear to be produced) and a resulting ratio of 9/2. Total ratio, 19/5.

```
*q*

*q*

*q*

*q*

*q*

*q*

*q*

*q*

*q*

*q*

```

Resulting html:

```
<p><em>q</em></p>

<p><em>q</em></p>

<p><em>q</em></p>

<p><em>q</em></p>

<p><em>q</em></p>

<p><em>q</em></p>

<p><em>q</em></p>

<p><em>q</em></p>

<p><em>q</em></p>

<p><em>q</em></p>

```

In action:

*q*

*q*

*q*

*q*

*q*

*q*

*q*

*q*

*q*

*q*

# Answer
> 5 votes
# 222/53 = \<4.2: Nasty escapes in an image inclusion.

```
> ![&](https://&)

![&](https://&)
> ![&](https://&)

```

Results in:

>

>

Resulting HTML should be approximately:

```
<blockquote>
  <p><img src="https://&" alt="&" title=""></p>
</blockquote>

<p><img src="https://&" alt="&" title=""></p>

<blockquote>
  <p><img src="https://&" alt="&" title=""></p>
</blockquote>

```

This abuses image inclusion and having to escape things.

It used to be much better, but apparently SE's markdown is sufficiently non-standard to ruin it.

My previous submission (which wasn't how SE rendered it) was:

# ~~428/50 = 8.56: Nasty escapes in an image inclusion.~~

`![&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&](&)`

Resulting HTML should be approximately:

```
<p><img src="&" alt="&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;"></p>

```

This abuses the fact that most markdown editors will replace the ampersands in the alt text with doubly-escaped ampersands in order for it to show up correctly. Meanwhile a single ampersand is tossed into the src section so that the parser will actually see it as an image.

# Answer
> 4 votes
# MathJax: 13,579 / 52 = 261.13

```
\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$

```

Just creates a bunch of empty in-line MathJax:

\\$\\$\\$\\$\\$\\$\\$\\$\\$\\$\\$\\$\\$\\$\\$\\$\\$\\$\\$\\$\\$\\$\\$\\$\\$\\$

HTML Code (can inspect on the empty space above):

```
<p><span class="MathJax_Preview" style="display: none;"></span><span class="MathJax" id="MathJax-Element-1064-Frame" tabindex="0" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML" />" role="presentation" style="position: relative;"><nobr aria-hidden="true"><span class="math" id="MathJax-Span-2127" style="width: 0em; display: inline-block;"><span style="display: inline-block; position: relative; width: 0em; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(3.785em, 1000em, 4.17em, -999.997em); top: -3.971em; left: 0em;"><span class="mrow" id="MathJax-Span-2128"></span><span style="display: inline-block; width: 0px; height: 3.978em;"></span></span></span><span style="display: inline-block; overflow: hidden; vertical-align: -0.073em; border-left: 0px solid; width: 0px; height: 0.158em;"></span></span></nobr><span class="MJX_Assistive_MathML" role="presentation"><math xmlns="http://www.w3.org/1998/Math/MathML"></math></span></span><script type="math/tex" id="MathJax-Element-1064"></script><span class="MathJax_Preview" style="display: none;"></span><span class="MathJax" id="MathJax-Element-1065-Frame" tabindex="0" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML" />" role="presentation" style="position: relative;"><nobr aria-hidden="true"><span class="math" id="MathJax-Span-2129" style="width: 0em; display: inline-block;"><span style="display: inline-block; position: relative; width: 0em; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(3.785em, 1000em, 4.17em, -999.997em); top: -3.971em; left: 0em;"><span class="mrow" id="MathJax-Span-2130"></span><span style="display: inline-block; width: 0px; height: 3.978em;"></span></span></span><span style="display: inline-block; overflow: hidden; vertical-align: -0.073em; border-left: 0px solid; width: 0px; height: 0.158em;"></span></span></nobr><span class="MJX_Assistive_MathML" role="presentation"><math xmlns="http://www.w3.org/1998/Math/MathML"></math></span></span><script type="math/tex" id="MathJax-Element-1065"></script><span class="MathJax_Preview" style="display: none;"></span><span class="MathJax" id="MathJax-Element-1066-Frame" tabindex="0" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML" />" role="presentation" style="position: relative;"><nobr aria-hidden="true"><span class="math" id="MathJax-Span-2131" style="width: 0em; display: inline-block;"><span style="display: inline-block; position: relative; width: 0em; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(3.785em, 1000em, 4.17em, -999.997em); top: -3.971em; left: 0em;"><span class="mrow" id="MathJax-Span-2132"></span><span style="display: inline-block; width: 0px; height: 3.978em;"></span></span></span><span style="display: inline-block; overflow: hidden; vertical-align: -0.073em; border-left: 0px solid; width: 0px; height: 0.158em;"></span></span></nobr><span class="MJX_Assistive_MathML" role="presentation"><math xmlns="http://www.w3.org/1998/Math/MathML"></math></span></span><script type="math/tex" id="MathJax-Element-1066"></script><span class="MathJax_Preview" style="display: none;"></span><span class="MathJax" id="MathJax-Element-1067-Frame" tabindex="0" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML" />" role="presentation" style="position: relative;"><nobr aria-hidden="true"><span class="math" id="MathJax-Span-2133" style="width: 0em; display: inline-block;"><span style="display: inline-block; position: relative; width: 0em; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(3.785em, 1000em, 4.17em, -999.997em); top: -3.971em; left: 0em;"><span class="mrow" id="MathJax-Span-2134"></span><span style="display: inline-block; width: 0px; height: 3.978em;"></span></span></span><span style="display: inline-block; overflow: hidden; vertical-align: -0.073em; border-left: 0px solid; width: 0px; height: 0.158em;"></span></span></nobr><span class="MJX_Assistive_MathML" role="presentation"><math xmlns="http://www.w3.org/1998/Math/MathML"></math></span></span><script type="math/tex" id="MathJax-Element-1067"></script><span class="MathJax_Preview" style="display: none;"></span><span class="MathJax" id="MathJax-Element-1068-Frame" tabindex="0" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML" />" role="presentation" style="position: relative;"><nobr aria-hidden="true"><span class="math" id="MathJax-Span-2135" style="width: 0em; display: inline-block;"><span style="display: inline-block; position: relative; width: 0em; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(3.785em, 1000em, 4.17em, -999.997em); top: -3.971em; left: 0em;"><span class="mrow" id="MathJax-Span-2136"></span><span style="display: inline-block; width: 0px; height: 3.978em;"></span></span></span><span style="display: inline-block; overflow: hidden; vertical-align: -0.073em; border-left: 0px solid; width: 0px; height: 0.158em;"></span></span></nobr><span class="MJX_Assistive_MathML" role="presentation"><math xmlns="http://www.w3.org/1998/Math/MathML"></math></span></span><script type="math/tex" id="MathJax-Element-1068"></script><span class="MathJax_Preview" style="display: none;"></span><span class="MathJax" id="MathJax-Element-1069-Frame" tabindex="0" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML" />" role="presentation" style="position: relative;"><nobr aria-hidden="true"><span class="math" id="MathJax-Span-2137" style="width: 0em; display: inline-block;"><span style="display: inline-block; position: relative; width: 0em; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(3.785em, 1000em, 4.17em, -999.997em); top: -3.971em; left: 0em;"><span class="mrow" id="MathJax-Span-2138"></span><span style="display: inline-block; width: 0px; height: 3.978em;"></span></span></span><span style="display: inline-block; overflow: hidden; vertical-align: -0.073em; border-left: 0px solid; width: 0px; height: 0.158em;"></span></span></nobr><span class="MJX_Assistive_MathML" role="presentation"><math xmlns="http://www.w3.org/1998/Math/MathML"></math></span></span><script type="math/tex" id="MathJax-Element-1069"></script><span class="MathJax_Preview" style="display: none;"></span><span class="MathJax" id="MathJax-Element-1070-Frame" tabindex="0" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML" />" role="presentation" style="position: relative;"><nobr aria-hidden="true"><span class="math" id="MathJax-Span-2139" style="width: 0em; display: inline-block;"><span style="display: inline-block; position: relative; width: 0em; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(3.785em, 1000em, 4.17em, -999.997em); top: -3.971em; left: 0em;"><span class="mrow" id="MathJax-Span-2140"></span><span style="display: inline-block; width: 0px; height: 3.978em;"></span></span></span><span style="display: inline-block; overflow: hidden; vertical-align: -0.073em; border-left: 0px solid; width: 0px; height: 0.158em;"></span></span></nobr><span class="MJX_Assistive_MathML" role="presentation"><math xmlns="http://www.w3.org/1998/Math/MathML"></math></span></span><script type="math/tex" id="MathJax-Element-1070"></script><span class="MathJax_Preview" style="display: none;"></span><span class="MathJax" id="MathJax-Element-1071-Frame" tabindex="0" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML" />" role="presentation" style="position: relative;"><nobr aria-hidden="true"><span class="math" id="MathJax-Span-2141" style="width: 0em; display: inline-block;"><span style="display: inline-block; position: relative; width: 0em; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(3.785em, 1000em, 4.17em, -999.997em); top: -3.971em; left: 0em;"><span class="mrow" id="MathJax-Span-2142"></span><span style="display: inline-block; width: 0px; height: 3.978em;"></span></span></span><span style="display: inline-block; overflow: hidden; vertical-align: -0.073em; border-left: 0px solid; width: 0px; height: 0.158em;"></span></span></nobr><span class="MJX_Assistive_MathML" role="presentation"><math xmlns="http://www.w3.org/1998/Math/MathML"></math></span></span><script type="math/tex" id="MathJax-Element-1071"></script><span class="MathJax_Preview" style="display: none;"></span><span class="MathJax" id="MathJax-Element-1072-Frame" tabindex="0" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML" />" role="presentation" style="position: relative;"><nobr aria-hidden="true"><span class="math" id="MathJax-Span-2143" style="width: 0em; display: inline-block;"><span style="display: inline-block; position: relative; width: 0em; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(3.785em, 1000em, 4.17em, -999.997em); top: -3.971em; left: 0em;"><span class="mrow" id="MathJax-Span-2144"></span><span style="display: inline-block; width: 0px; height: 3.978em;"></span></span></span><span style="display: inline-block; overflow: hidden; vertical-align: -0.073em; border-left: 0px solid; width: 0px; height: 0.158em;"></span></span></nobr><span class="MJX_Assistive_MathML" role="presentation"><math xmlns="http://www.w3.org/1998/Math/MathML"></math></span></span><script type="math/tex" id="MathJax-Element-1072"></script><span class="MathJax_Preview" style="display: none;"></span><span class="MathJax" id="MathJax-Element-1073-Frame" tabindex="0" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML" />" role="presentation" style="position: relative;"><nobr aria-hidden="true"><span class="math" id="MathJax-Span-2145" style="width: 0em; display: inline-block;"><span style="display: inline-block; position: relative; width: 0em; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(3.785em, 1000em, 4.17em, -999.997em); top: -3.971em; left: 0em;"><span class="mrow" id="MathJax-Span-2146"></span><span style="display: inline-block; width: 0px; height: 3.978em;"></span></span></span><span style="display: inline-block; overflow: hidden; vertical-align: -0.073em; border-left: 0px solid; width: 0px; height: 0.158em;"></span></span></nobr><span class="MJX_Assistive_MathML" role="presentation"><math xmlns="http://www.w3.org/1998/Math/MathML"></math></span></span><script type="math/tex" id="MathJax-Element-1073"></script><span class="MathJax_Preview" style="display: none;"></span><span class="MathJax" id="MathJax-Element-1074-Frame" tabindex="0" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML" />" role="presentation" style="position: relative;"><nobr aria-hidden="true"><span class="math" id="MathJax-Span-2147" style="width: 0em; display: inline-block;"><span style="display: inline-block; position: relative; width: 0em; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(3.785em, 1000em, 4.17em, -999.997em); top: -3.971em; left: 0em;"><span class="mrow" id="MathJax-Span-2148"></span><span style="display: inline-block; width: 0px; height: 3.978em;"></span></span></span><span style="display: inline-block; overflow: hidden; vertical-align: -0.073em; border-left: 0px solid; width: 0px; height: 0.158em;"></span></span></nobr><span class="MJX_Assistive_MathML" role="presentation"><math xmlns="http://www.w3.org/1998/Math/MathML"></math></span></span><script type="math/tex" id="MathJax-Element-1074"></script><span class="MathJax_Preview" style="display: none;"></span><span class="MathJax" id="MathJax-Element-1075-Frame" tabindex="0" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML" />" role="presentation" style="position: relative;"><nobr aria-hidden="true"><span class="math" id="MathJax-Span-2149" style="width: 0em; display: inline-block;"><span style="display: inline-block; position: relative; width: 0em; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(3.785em, 1000em, 4.17em, -999.997em); top: -3.971em; left: 0em;"><span class="mrow" id="MathJax-Span-2150"></span><span style="display: inline-block; width: 0px; height: 3.978em;"></span></span></span><span style="display: inline-block; overflow: hidden; vertical-align: -0.073em; border-left: 0px solid; width: 0px; height: 0.158em;"></span></span></nobr><span class="MJX_Assistive_MathML" role="presentation"><math xmlns="http://www.w3.org/1998/Math/MathML"></math></span></span><script type="math/tex" id="MathJax-Element-1075"></script><span class="MathJax_Preview" style="display: none;"></span><span class="MathJax" id="MathJax-Element-1076-Frame" tabindex="0" data-mathml="<math xmlns="http://www.w3.org/1998/Math/MathML" />" role="presentation" style="position: relative;"><nobr aria-hidden="true"><span class="math" id="MathJax-Span-2151" style="width: 0em; display: inline-block;"><span style="display: inline-block; position: relative; width: 0em; height: 0px; font-size: 120%;"><span style="position: absolute; clip: rect(3.785em, 1000em, 4.17em, -999.997em); top: -3.971em; left: 0em;"><span class="mrow" id="MathJax-Span-2152"></span><span style="display: inline-block; width: 0px; height: 3.978em;"></span></span></span><span style="display: inline-block; overflow: hidden; vertical-align: -0.073em; border-left: 0px solid; width: 0px; height: 0.158em;"></span></span></nobr><span class="MJX_Assistive_MathML" role="presentation"><math xmlns="http://www.w3.org/1998/Math/MathML"></math></span></span><script type="math/tex" id="MathJax-Element-1076"></script></p>

```

# Answer
> 3 votes
# 4830 / 256 = 18.87

```
[1<p>1<p>1<p>1<p>1<p>1<p>1<p>1<p>1<p>1<p>1<p>1<p>1<p>1<p>1<p>1<p>1<p>1<p>1<p>1<p>1<p>1<p>1<p>1<p>1<p>1<p>1<p>1<p>1<p>1<p>1<p>1<p>1<p>1<p>1](http://localhost:8080/welcome-to-my-fantastic-amazing-homepage-and-why-not-share-it-to-your-facebook-right-now.html)

```

An idea based on HTML autocorrect. Not quite high score though.

# Answer
> 2 votes
# 421 / 56 = 7.518

```
>&

&
>&

&
>&

&
>&

&
>&

&
>&

&
>&

```

Which produces the following HTML on SE:

```
<blockquote>
  <p>&</p>
</blockquote>

<p>&</p>

<blockquote>
  <p>&</p>
</blockquote>

<p>&</p>

<blockquote>
  <p>&</p>
</blockquote>

<p>&</p>

<blockquote>
  <p>&</p>
</blockquote>

<p>&</p>

<blockquote>
  <p>&</p>
</blockquote>

<p>&</p>

<blockquote>
  <p>&</p>
</blockquote>

<p>&</p>

<blockquote>
  <p>&</p>
</blockquote>

```

... and the following output:

---

> &

&

> &

&

> &

&

> &

&

> &

&

> &

&

> &

# Answer
> 1 votes
# 11190 / 255 = ~43.88

I was inspired by this top answer, but am too dumb to beat it and reached the max character count so, I guess I'll have to be satisfied with what I have ¯\\\_(ツ)\_/¯. There's actually two spaces after the last blockquote, but the formatting does not show it.

`> - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - > - >`

**HTML:**

```
<blockquote>
  <ul>
  <li><blockquote>
    <ul><li><blockquote>
      <ul><li><blockquote>
        <ul><li><blockquote>
          <ul><li><blockquote>
            <ul><li><blockquote>
              <ul><li><blockquote>
                <ul><li><blockquote>
                  <ul><li><blockquote>
                    <ul><li><blockquote>
                      <ul><li><blockquote>
                        <ul><li><blockquote>
                          <ul><li><blockquote>
                            <ul><li><blockquote>
                              <ul><li><blockquote>
                                <ul><li><blockquote>
                                  <ul><li><blockquote>
                                    <ul><li><blockquote>
                                      <ul><li><blockquote>
                                        <ul><li><blockquote>
                                          <ul><li><blockquote>
                                            <ul><li><blockquote>
                                              <ul><li><blockquote>
                                                <ul><li><blockquote>
                                                  <ul><li><blockquote>
                                                    <ul><li><blockquote>
                                                      <ul><li><blockquote>
                                                        <ul><li><blockquote>
                                                          <ul><li><blockquote>
                                                            <ul><li><blockquote>
                                                              <ul><li><blockquote>
                                                                <ul><li><blockquote>
                                                                  <ul><li><blockquote>
                                                                    <ul><li><blockquote>
                                                                      <ul><li><blockquote>
                                                                        <ul><li><blockquote>
                                                                          <ul><li><blockquote>
                                                                            <ul><li><blockquote>
                                                                              <ul><li><blockquote>
                                                                                <ul><li><blockquote>
                                                                                <ul><li><blockquote>
                                                                                <ul><li><blockquote>
                                                                                <ul><li><blockquote>
                                                                                <ul><li><blockquote>
                                                                                <ul><li><blockquote>
                                                                                <ul><li><blockquote>
                                                                                <ul><li><blockquote>
                                                                                <ul><li><blockquote>
                                                                                <ul><li><blockquote>
                                                                                <ul><li><blockquote>
                                                                                <ul><li><blockquote>
                                                                                <ul><li><blockquote>
                                                                                <ul><li><blockquote>
                                                                                <ul><li><blockquote>
                                                                                <ul><li><blockquote>
                                                                                <ul><li><blockquote>
                                                                                <ul><li><blockquote>
                                                                                <ul><li><blockquote>
                                                                                <ul><li><blockquote>
                                                                                <ul><li><blockquote>
                                                                                <ul><li><blockquote>
                                                                                <ul><li><blockquote>
                                                                                <ul><li><blockquote>

                                                                                </blockquote></li></ul>
                                                                                </blockquote></li></ul>
                                                                                </blockquote></li></ul>
                                                                                </blockquote></li></ul>
                                                                                </blockquote></li></ul>
                                                                                </blockquote></li></ul>
                                                                                </blockquote></li></ul>
                                                                                </blockquote></li></ul>
                                                                                </blockquote></li></ul>
                                                                                </blockquote></li></ul>
                                                                                </blockquote></li></ul>
                                                                                </blockquote></li></ul>
                                                                                </blockquote></li></ul>
                                                                                </blockquote></li></ul>
                                                                                </blockquote></li></ul>
                                                                                </blockquote></li></ul>
                                                                                </blockquote></li></ul>
                                                                                </blockquote></li></ul>
                                                                                </blockquote></li></ul>
                                                                                </blockquote></li></ul>
                                                                                </blockquote></li></ul>
                                                                                </blockquote></li></ul>
                                                                                </blockquote></li></ul>
                                                                                </blockquote></li></ul>
                                                                              </blockquote></li></ul>
                                                                            </blockquote></li></ul>
                                                                          </blockquote></li></ul>
                                                                        </blockquote></li></ul>
                                                                      </blockquote></li></ul>
                                                                    </blockquote></li></ul>
                                                                  </blockquote></li></ul>
                                                                </blockquote></li></ul>
                                                              </blockquote></li></ul>
                                                            </blockquote></li></ul>
                                                          </blockquote></li></ul>
                                                        </blockquote></li></ul>
                                                      </blockquote></li></ul>
                                                    </blockquote></li></ul>
                                                  </blockquote></li></ul>
                                                </blockquote></li></ul>
                                              </blockquote></li></ul>
                                            </blockquote></li></ul>
                                          </blockquote></li></ul>
                                        </blockquote></li></ul>
                                      </blockquote></li></ul>
                                    </blockquote></li></ul>
                                  </blockquote></li></ul>
                                </blockquote></li></ul>
                              </blockquote></li></ul>
                            </blockquote></li></ul>
                          </blockquote></li></ul>
                        </blockquote></li></ul>
                      </blockquote></li></ul>
                    </blockquote></li></ul>
                  </blockquote></li></ul>
                </blockquote></li></ul>
              </blockquote></li></ul>
            </blockquote></li></ul>
          </blockquote></li></ul>
        </blockquote></li></ul>
      </blockquote></li></ul>
    </blockquote></li></ul>
  </blockquote></li>
  </ul>
</blockquote>

```

---
Tags: code-challenge, busy-beaver
---


title: I won't not use no double negatives

text:
# Question
Title: I won't not use no double negatives
The goal is to simplify sentences containing multiple negatives.
Like with multiplying negative numbers, two negative words annihilate each other until at most one is left (doesn't matter which one). While some words disappear without a trace, other leave behind a positive part

The affected words are:

```
no
not
couldn't    could
wouldn't    would
shouldn't   should
don't       do
doesn't     does
didn't      did
isn't       is
aren't      are
weren't     were

```

You will notice that I conveniently forgot to include some rules like shan't/shall, won't/will, nothing/something, impossible/possible. Hunting down all the exceptions is a nightmare and would make it yet another string compression challenge.
But if including some additional rules that are not listed, yet are in the spirit of the challenge would make your code shorter (looking at you, Mathematica built-ins), by all means, go for it.

## Examples

### Input

```
Move along
Nothing to see here
This sentence will stay the same
You dont put Nosferatu's donut knot in the cantaloupe cannon without an apostrophe.

Don't change this sentence.
This one will also not change
So far no inputs were changed

We don't need no education!
No, don't say that!
Wouldn't it be nice if people weren't fighting?

I don't not use no double negatives.
This isn't not the usual way to not express yourself not
We don't not have no time to not don't solve this
I don't not even know if this isn't not making no sense anymore, it wouldn't be so bad if it weren't for not all these not words which not shouldn't be not there in the first place

```

### Output (either of the elements is valid)

```
["Move along"]
["Nothing to see here"]
["This sentence will stay the same"]
["You dont put Nosferatu's donut knot in the cantaloupe cannon without an apostrophe."]

["Don't change this sentence."]
["This one will also not change"]
["So far no inputs were changed"]

["We do need education!"]
[", do say that!", "do say that!", "Do say that!"]
["Would it be nice if people were fighting?"]

["I don't use double negatives.", "I do not use double negatives.", "I do use no double negatives."]
["This is the usual way to express yourself"]
["We don't have time to do solve this", "We do not have time to do solve this", "We do have no time to do solve this", "We do have time to not do solve this", "We do have time to don't solve this"]
["I do even know if this is making sense anymore, it would be so bad if it were for all these words which should be there in the first place"]

```

# Answer
# Retina 0.8.2, 44 bytes

```
i`(\bnot?\W+|n't\b)(.*?)(\bnot?\W+|n't\b)
$2

```

Try it online! Link includes test cases.
> 1 votes

---
Tags: code-golf, string, natural-language
---


title: Build a Board of Napier's Bones

text:
# Question
Title: Build a Board of Napier's Bones
> This proposal had few attention for 8 months (though an answer was posted in the sandbox at that time), so I decided to post it anyway.

## Introduction

Napier's bones is a calculation tool, which helps speeding up the calculation of multiplication, division and digit-by-digit square root extraction by turning n-digit-by-1-digit multiplications into table look-ups. Napier's bones consists of rods marked with the multiples of a single-digit number, and a board with a set of numbers on the left, on which the rods can be arranged. The board and the rods look like this (All appearances of the rods are in the **Sample** section):

```
Rod    Board
       +-----------------------------------------------+
       |   +------------------------------------------+|
+---+  |   |                                          ||
| 4 |  |   |                                          ||
+---+  |   |                                          ||
|0 /|  |   |                                          ||
| / |  | 1 |                                          ||
|/ 4|  |   |                                          ||
+---+  |   |                                          ||
|0 /|  |   |                                          ||
| / |  | 2 |                                          ||
|/ 8|  |   |                                          ||
+---+  |   |                                          ||
|1 /|  |   |                                          ||
| / |  | 3 |                                          ||
|/ 2|  |   |                                          ||
+---+  |   |                                          ||
|1 /|  |   |                                          ||
| / |  | 4 |                                          ||
|/ 6|  |   |                                          ||
+---+  |   |                                          ||
|2 /|  |   |                                          ||
| / |  | 5 |                                          ||
|/ 0|  |   |                                          ||
+---+  |   |                                          ||
|2 /|  |   |                                          ||
| / |  | 6 |                                          ||
|/ 4|  |   |                                          ||
+---+  |   |                                          ||
|2 /|  |   |                                          ||
| / |  | 7 |                                          ||
|/ 8|  |   |                                          ||
+---+  |   |                                          ||
|3 /|  |   |                                          ||
| / |  | 8 |                                          ||
|/ 2|  |   |                                          ||
+---+  |   |                                          ||
|3 /|  |   |                                          ||
| / |  | 9 |                                          ||
|/ 6|  |   |                                          ||
+---+  |   |                                          ||
       |   +------------------------------------------+|
       +-----------------------------------------------+

```

## Challenge

This challenge is to write a function or program which receives a natural number as input, and outputs the arrangement of the rods, as if a calculation were in progress, on the board as an ASCII art, according to the input, having the code as short as possible. The top row of the rods will assemble that number you have inputted.

## Requirements

* The input can be an argument of the function or program, or an input from STDIN. Please indicate your choice of input format. Accepted formats are as follows:

+ An integer representing the number;
    + A string representing the number; or
    + A list of characters representing the digits of the number.
* The output can be directly printed to STDOUT, or returned from the function as a string. Please refer to the **Sample** section.
* You can assume that the input will always be a valid representation of the number, i.e. the number matches the regex `[1-9][0-9]*`.
* You must support all valid inputs in the range `[1, 2147483648)`. Larger ranges are absolutely welcomed.
* You must leave no space around the rods.
* Standard loopholes apply.

## Sample Input/Output

Input: `1234567890`

Output:

```
+-------------------------------------------------------+
|   +--------------------------------------------------+|
|   |+---++---++---++---++---++---++---++---++---++---+||
|   || 1 || 2 || 3 || 4 || 5 || 6 || 7 || 8 || 9 || 0 |||
|   |+---++---++---++---++---++---++---++---++---++---+||
|   ||0 /||0 /||0 /||0 /||0 /||0 /||0 /||0 /||0 /||0 /|||
| 1 || / || / || / || / || / || / || / || / || / || / |||
|   ||/ 1||/ 2||/ 3||/ 4||/ 5||/ 6||/ 7||/ 8||/ 9||/ 0|||
|   |+---++---++---++---++---++---++---++---++---++---+||
|   ||0 /||0 /||0 /||0 /||1 /||1 /||1 /||1 /||1 /||0 /|||
| 2 || / || / || / || / || / || / || / || / || / || / |||
|   ||/ 2||/ 4||/ 6||/ 8||/ 0||/ 2||/ 4||/ 6||/ 8||/ 0|||
|   |+---++---++---++---++---++---++---++---++---++---+||
|   ||0 /||0 /||0 /||1 /||1 /||1 /||2 /||2 /||2 /||0 /|||
| 3 || / || / || / || / || / || / || / || / || / || / |||
|   ||/ 3||/ 6||/ 9||/ 2||/ 5||/ 8||/ 1||/ 4||/ 7||/ 0|||
|   |+---++---++---++---++---++---++---++---++---++---+||
|   ||0 /||0 /||1 /||1 /||2 /||2 /||2 /||3 /||3 /||0 /|||
| 4 || / || / || / || / || / || / || / || / || / || / |||
|   ||/ 4||/ 8||/ 2||/ 6||/ 0||/ 4||/ 8||/ 2||/ 6||/ 0|||
|   |+---++---++---++---++---++---++---++---++---++---+||
|   ||0 /||1 /||1 /||2 /||2 /||3 /||3 /||4 /||4 /||0 /|||
| 5 || / || / || / || / || / || / || / || / || / || / |||
|   ||/ 5||/ 0||/ 5||/ 0||/ 5||/ 0||/ 5||/ 0||/ 5||/ 0|||
|   |+---++---++---++---++---++---++---++---++---++---+||
|   ||0 /||1 /||1 /||2 /||3 /||3 /||4 /||4 /||5 /||0 /|||
| 6 || / || / || / || / || / || / || / || / || / || / |||
|   ||/ 6||/ 2||/ 8||/ 4||/ 0||/ 6||/ 2||/ 8||/ 4||/ 0|||
|   |+---++---++---++---++---++---++---++---++---++---+||
|   ||0 /||1 /||2 /||2 /||3 /||4 /||4 /||5 /||6 /||0 /|||
| 7 || / || / || / || / || / || / || / || / || / || / |||
|   ||/ 7||/ 4||/ 1||/ 8||/ 5||/ 2||/ 9||/ 6||/ 3||/ 0|||
|   |+---++---++---++---++---++---++---++---++---++---+||
|   ||0 /||1 /||2 /||3 /||4 /||4 /||5 /||6 /||7 /||0 /|||
| 8 || / || / || / || / || / || / || / || / || / || / |||
|   ||/ 8||/ 6||/ 4||/ 2||/ 0||/ 8||/ 6||/ 4||/ 2||/ 0|||
|   |+---++---++---++---++---++---++---++---++---++---+||
|   ||0 /||1 /||2 /||3 /||4 /||5 /||6 /||7 /||8 /||0 /|||
| 9 || / || / || / || / || / || / || / || / || / || / |||
|   ||/ 9||/ 8||/ 7||/ 6||/ 5||/ 4||/ 3||/ 2||/ 1||/ 0|||
|   |+---++---++---++---++---++---++---++---++---++---+||
|   +--------------------------------------------------+|
+-------------------------------------------------------+

```

## Victory Condition

This is a , so the shortest code wins.

# Answer
# Python 2, ~~424~~ ~~314~~ ~~304~~ ~~305~~ ~~303~~ 298 bytes

```
n=map(int,input());l=len(n)
a,b='+'+'-'*5*-~l+'+','|   +'+'-'*5*l+'+|'
x='+---+'*l
y='|   |%s||\n'
j=''.join
print'\n'.join([a,b,j([(y+'| %s |%s||\n'+y+y)%(j('|%d /|'%(c*i/10)for c in n),i,'| / |'*l,j('|/ %d|'%(c*i%10)for c in n),x),3*y%(x,j('| %s |'%c for c in n),x)][i<1]for i in range(10))+b,a])

```

Try it online!

<sub>-2 bytes, thanks to Kevin Cruijssen</sub>
> 2 votes

# Answer
# Java 11, ~~352~~ ~~344~~ ~~340~~ 309 bytes

```
a->{int l=a.length,i=0;String Z="+"+"-".repeat(l*5),A=Z+"-----+\n",Y="|   ",B=Y+Z+"+|\n",X="||\n",D=Y+="|",C=Y+"+---+".repeat(l)+X,r=A+B+C,t,u,v;for(int d:a)D+="| "+d+" |";for(r+=D+X;i++<9;r+=C+t+X+u+X+v+X){t=v=Y;u="| "+i+" |";for(int d:a){d*=i;t+="|"+d/10+" /|";u+="| / |";v+="|/ "+d%10+"|";}}return r+B+A;}

```

-4 bytes thanks to *@ShieruAsakoto*
-32 bytes thanks to *@ceilingcat*.

Try it online.

**Explanation:**

```
a->{                 // Method with digit-array as parameter and String return-type
  int l=a.length     //  Amount of digits in the input
      i=0;           //  Index-integer
  String
    Z="+"+"-".repeat(l*5),
                     //  String `Z` for the "+------..." of the four lines
    A=Z+"-----+\n",  //  String `A` for the "+---...---+" of the first and last lines
    Y="|   ",        //  String `Y` for "|   "
    B=Y+Z+"+|\n",    //  String `B` for the second and next to last lines
    X="||\n",        //  String `X` for "||" + newline
    D=Y+="|",        //  String `D` starting with "|   |"
                     //  (and change `Y` to this as well now)
    C=Y+"+---+".repeat(l)+X,
                     //  String `C` for the third and fifth lines
    r=A+B+C,         //  Result-String, starting at the first three lines
    t,u,v;           //  Three temp Strings, uninitialized for now
  for(int d:a)       //  Loop over the input-digits
    D+="| "+d+" |";  //   Append `D` with "| d |" where `d` is the digit
  for(r+=D+X;        //  Append `X` to `D`, and then `D` to the result-String
      i++<9;         //  Loop `i` in the range [1, 9]
      r+=            //    After every iteration, append the result-String with:
         C           //     line `C`
         +t+X        //     and line `t` with a trailing `X`
         +u+X        //     and line `u` with a trailing `X`
         +v+X){      //     and line `v` with a trailing `X`
    t=v=Y;           //   Reset `t` and `v` to `Y`
    u="| "+i+" |";   //   and `u` to "| i |" where `i` is the `i` from the loop
    for(int d:a){    //   Inner loop over the input-digits
      d*=i;          //    Multiply the current digit with `i`
      t+="|"         //    Append `t` with "|"
         +d/10       //     and the first of two digits for the multiplication result
         +" /|";     //     and " /|"
      u+="| / |";    //    Append `u` with "| / |"
      v+="|/ "       //    Append `v` with "|/ "
         +d%10       //    and the second of two digits for the multiplication result
         +"|";}}     //    and "|"
  return r           //  And finally return the result-String,
         +B+A;}      //   appended with lines `B` and `A`

```
> 2 votes

# Answer
# Charcoal, 78 bytes

```
Ｂ⁺⁷×⁵Ｌθ⁴³↓↘↘Ｐ↓⭆⁹◧Ｉ⊕ι⁴↗↗Ｂ⁺²×⁵Ｌθ⁴¹↘Ｆθ«Ｂ⁵¦³↘→←ι↙ＦＥ⁹×Ｉι⊕κ«ＵＲ⁵↘↘Ｉ÷κχ↘↑Ｉ﹪κχ↑↙³»Ｍ⁵±³⁸

```

Try it online! Link is to verbose version of code. Explanation:

```
Ｂ⁺⁷×⁵Ｌθ⁴³↓↘↘

```

Draw the outer box.

```
Ｐ↓⭆⁹◧Ｉ⊕ι⁴↗↗

```

Pad the digits `1-9` and print them vertically.

```
Ｂ⁺²×⁵Ｌθ⁴¹↘

```

Draw the inner box.

```
Ｆθ«

```

Loop over the bones.

```
Ｂ⁵¦³↘→←ι↙

```

Draw the small box at the top of the bone with the current digit.

```
ＦＥ⁹×Ｉι⊕κ«

```

Multiply the current digit with the digits `1-9` and loop over the result.

```
ＵＲ⁵↘↘Ｉ÷κχ↘↑Ｉ﹪κχ↑↙³»

```

Draw a square and insert the digits of the product and the diagonal line.

```
Ｍ⁵±³⁸

```

Move to the start of the next bone.
> 2 votes

# Answer
# JavaScript (ES8), ~~250~~ 241 bytes

Takes input as an array of digit characters of any size.

```
s=>[...'0123'.padEnd(40,2456)+210].map((v,y)=>`+----0-+,|   +0+|,71||,72||,73||,| 6 |4||,75||`.split`,`[v].replace(/\d/g,n=>[Y=y>>2,'|   |'][n-6]||s.map(X=>`-----+---+| ${X} ||${X*Y/10|0} /|| / ||/ ${X*Y%10}|`.substr(n*5,5)).join``)).join`
`

```

Try it online!

### How?

The board consists of 43 rows of 7 distinct types, which are represented below with an ID in \\$\[0..6\]\\$:

```
00: +---------------+ --> 0 >--- outer board header
01: |   +----------+| --> 1 >--- inner board header
02: |   |+---++---+|| --> 2 \___ rod header
03: |   || X || X ||| --> 3 /
04: |   |+---++---+|| --> 2 \
05: |   ||X /||X /||| --> 4  \__ first row
06: | X || / || / ||| --> 5  /
07: |   ||/ X||/ X||| --> 6 /
..  .               .
..  .               .
36: |   |+---++---+|| --> 2 \
37: |   ||X /||X /||| --> 4  \__ last row
38: | X || / || / ||| --> 5  /
39: |   ||/ X||/ X||| --> 6 /
40: |   |+---++---+|| --> 2 >--- rod footer
41: |   +----------+| --> 1 >--- inner board footer
42: +---------------+ --> 0 >--- outer board footer

```

The code `'0123'.padEnd(40,2456)+210` (see this tip) generates the following string of 43 row IDs over which we are going to iterate:

```
"0123245624562456245624562456245624562456210"

```

Each ID is replaced with a temporary encoded string which, in turn, contains other IDs in \\$\[0..7\]\\$:

```
 ID | String
----+------------
  0 | "+----0-+"
  1 | "|   +0+|"
  2 | "71||"
  3 | "72||"
  4 | "73||"
  5 | "| 6 |4||"
  6 | "75||"

```

Finally, each new ID is replaced with a 5-character string which is appended as many times as there are digits in the input array, except the last two ones which are just inserted as-is:

```
 ID | String            | Repeated
----+-------------------+----------
  0 | `-----`           |   Yes          where:
  1 | `+---+`           |   Yes            X = horizontal digit
  2 | `| ${X} |`        |   Yes            Y = vertical digit
  3 | `|${X*Y/10|0} /|` |   Yes
  4 | `| / |`           |   Yes
  5 | `|/ ${X*Y%10}|`   |   Yes
  6 | Y                 |   No
  7 | `|   |`           |   No

```
> 2 votes

---
Tags: code-golf, ascii-art
---


# Question
Title: Every positive integer can be written as the sum of 3 palindrome integers. Wha'ts the largest possible palindrome integer for each integer n?
Let `n` be a positive integer then n = a + b + c for some a, b, and c that are palindrome integers. What is the largest possible integer `a` for `k` = 1 to 1\_000\_000?

Golf this or have the fastest running time.

NOTE: it's NOT the same as this question as I am asking for the largest palindrome component. The question just asks for ANY combination.

# Answer
> 0 votes
My Julia solution

```
using Base.Iterators

is_palindrome(n) = begin
    dn = digits(n)
    all(dn .== reverse(dn))
end

lim  = Int64(1e6)
res = filter(is_palindrome,lim:-1:0)

using DataFrames
lp = DataFrame(k = 1:1_000_000, largest_palindrome = Array{Int64,1}(lim))

# found stores the integers backwardds
ok(lim, res, lp) = begin
    found = BitArray(lim)
    found .= false
    tot = Int128(0)

    cap = lim
    r = res[1]

    for r in res[1:end-1]
        bs = res[res .<= (cap - r)]
        cs = res[res .<= ceil((cap - r)/2)]

        res1 = vec([r + b + c for (b,  c) in product(bs,cs)])

        res1 = res1[res1 .<= cap]

        for rr in res1
            if !found[rr]
                lp[rr,:largest_palindrome] = r
                tot = tot + r
                found[rr] = true
            end
        end

        for i in lim:-1:1
            if !found[i]
                cap = i
                break
            end
        end
    end

    (tot, found, lp)
end

```

---
Tags: integer, palindrome
---


# Question
Title: Russian BS - Submissions accepted until October 13th
The ChatRoom is here

I love playing the card game BS, but sometimes, it just doesn't have enough **oomph** for my short attention span. Instead, let's play some Russian BS.

# Rules

Here is a quick guide to the rules.

* The game begins with a random player declaring the card type of the round (out of 14 options: `A,2,3...10,J,Q,K,j` where the `j` stands for joker)
* The same player starts the round, placing down as many cards as he or she wants, which all have to be of the declared card type.
* Any player can call BS on the play. If multiple players call BS, the player closest to the player who put down the cards to the right will be the one to call BS
* If BS is called on the play, then the cards played there are checked by the moderator. If the cards were indeed valid (i.e., all of the declared type or jokers), the player who called BS will take all of the cards played in the round. Otherwise, the player who played the invalid cards will take all of them.
* If no BS is called, the next player is up to play, and must also play the declared card type.
* We also allow players to pass their turn if they don't wish to play. However, if they pass, they are not allowed to play for the rest of the round (although they can call BS)
* If every player passes, then the round ends, and the player who played the last cards will start the next round by declaring the card type.
* If BS is called, the player who played the cards will start the next round and declare if he played valid cards, else the player who called BS will start.
* The player who has no cards at the end of the game wins.

I like these rules because they don't force you to lie, but usually, players tend to lie more than in the original version of BS

# Challenge

This challenge will be a challenge, with submissions providing bots to play the game. The bots will be written in **Python 3**, although I'll try my best to accommodate all submissions.

The submissions should consist of the following three functions:

```
CallBS - determines whether you seek to call BS or not on a play
PlayCards - determines what cards you want to play
StartRound - determines what the declared type of the round is, if you are chosen to pick it.

```

The submitted functions should be named such that their names are `***_CallBS`, `***_PlayCards`, and `***_StartRound`, where `***` is the name of your bot.

Below are example functions that describe the inputs and outputs:

```
def example_CallBS(self,pos,player,handSize,currCard,numCards,numPile):
    '''This function will output True if the bot seeks to call BS on the
       current move, or False if not. The parameters are
       - self: class variable
       - pos: int - how many positions away you are to the right of the player (Note: if
         your function got called, that means everyone to your left before the player decided
         not to call BS)
       - player: str - holds the name of the bot who just played cards
       - handSize: int - how many cards playing bot holds
       - currCard: str - current card in play (One of A,2,3,4,5,6,7,8,9,10,J,Q,K,j)
       - numCards: int - number of cards just played by player
       - numPile: int - number of cards in the pile (not including played cards this turn)
    '''
    return True
def example_PlayCards(self,currCard,numPile,stillPlaying):
    '''This function will output a sublist of the hand of the bot to play this turn, or None to pass.
       The parameters are
       - self: class variable
       - currCard: str - current card in play (One of A,2,3,4,5,6,7,8,9,10,J,Q,K,j)
       - numPile: int - number of cards in the pile
       - stillPlaying: list of str - players who haven't passed this round
    '''
    return self.hand[:]
def example_StartRound(self):
    '''This function will output a string representing the card that will be played for the coming round (One of A,2,3,4,5,6,7,8,9,10,J,Q,K,j)
       The parameters are
       - self: class variable
    '''
    return 'A'

```

In addition, you will be provided with the following utilities

```
self.obj - A blank object for your usage to store knowledge between calls
self.hand: list of card objects - Your current hand in card objects (calling card.val gives you the str value of the card)
self.numBots: int - number of competitors you have
self.getRandom(): function - outputs a random number from 0 to 1.

```

If you want to use any sort of randomness, you **must** use the `self.getRandom()` function provided. You may not edit any of these objects except for `self.obj`

# Parameters and more Rules

* The cards in this game (you'll see the class that the cards belong to in the controller below) don't have a suit since suits don't matter to this game.
* The number of cards in the game will be `14*number of bots` (numBots of each type of card)
* In the output of PlayCards, you **must** output cards that are in your hand. The program will not like you otherwise. You also must output card objects, not strings.
* You may take at most 10 ms on average over 5 turns for `StartRound`, 50 ms averaged over 5 turns for `PlayCards`, and 20 ms averaged over 5 turns for `CallBS`.

# Controller

In this Controller, you add your functions to the top of the program, then add a tuple of all three functions, in the order of `(CallBS, PlayCards, StartRound)` to the list `BotParams`. The Controller should take it from there.

Below is the controller with the example bot from earlier. This bot will **not** be participating, nor will any bots that obviously aren't aiming the win the competition.

```
import random as rn
rn.seed(12321)#Subject to change

def example_CallBS(self,pos,player,handSize,currCard,numCards,numPile):
    return True
def example_PlayCards(self,currCard,numPile,stillPlaying):
    return self.hand[:]
def example_StartRound(self):
    return 'A'

#This is how you add your bot to the competition. Add the tuple of all three of your functions to BotParams
BotParams = [(example_CallBS,example_PlayCards,example_StartRound)]

#This is the controller
class Obj:
    pass
class card:
    def __init__(self, val):
        self.val=val
    def __eq__(self,other):
        return (self.val==other or self.val=='j')
    def __str__(self):
        return self.val
class BSgame:
    def __init__(self,BotParams):
        self.numBots = len(BotParams)
        self.AllCards = ['A','J','Q','K','j']+[str(i) for i in range(2,11)]
        x=[card(j) for j in self.AllCards*self.numBots]
        rn.shuffle(x)
        self.hands = [x[14*i:14*i+14] for i in range(self.numBots)]
        rn.shuffle(BotParams)
        self.BotList = [BSBot(self.hands[i],len(BotParams),*BotParams[i]) for i in range(self.numBots)]
        self.play = []
        self.pile = []
        self.isRound = False
        self.isTurn = 0
        self.currCard = None
        self.winner=None
        self.GameSummary = [str(i) for i in self.BotList]
    def results(self):
        print("The winner is "+self.winner)
        print("Final Standings:")
        for i in self.BotList:
            print(i)
    def checkBS(self, caller):
        if min([i==self.currCard for i in self.play]):
            self.BotList[caller].hand.extend(self.pile)
            self.BotList[caller].hand.extend(self.play)
            self.GameSummary.append(self.BotList[caller].name+" called BS but was wrong!")
            if self.BotList[self.isTurn].hand==[]:
                self.winner=self.BotList[self.isTurn].name
                self.GameSummary.append(self.BotList[self.isTurn].name+" has won the game!")
        else:
            self.BotList[self.isTurn].hand.extend(self.pile)
            self.BotList[self.isTurn].hand.extend(self.play)
            self.GameSummary.append(self.BotList[caller].name+" called BS and was right!")
            self.isTurn=caller
        self.isRound=False
        self.pile=[]
    def isBS(self):
        for i in range(1,self.numBots):
            if self.BotList[(i+self.isTurn)%self.numBots].callBS(i,self.BotList[self.isTurn].name,len(self.BotList[self.isTurn].hand),self.currCard,len(self.play),len(self.pile)):
                self.checkBS(i)
                break
        if self.isRound:
            if self.BotList[self.isTurn].hand==[]:
                self.winner=self.BotList[self.isTurn].name
                self.GameSummary.append(self.BotList[self.isTurn].name+" has won the game!")
            self.pile.extend(self.play)
    def startRound(self):
        self.currCard = self.BotList[self.isTurn].startRound()
        for i in self.BotList:
            i.inRound = True
        self.isRound=True
        self.GameSummary.append(self.BotList[self.isTurn].name+" started the round by picking "+self.currCard+" for the round.")
    def __iter__(self):
        return self
    def __next__(self):
        if not self.isRound:
            self.startRound()
        passList = [i.name for i in self.BotList if i.inRound]
        self.play =self.BotList[self.isTurn].playCards(self.currCard,len(self.pile),passList)
        if self.play == None:
            self.BotList[self.isTurn].inRound=False
            self.GameSummary.append(self.BotList[self.isTurn].name+" passed its turn.")
        else:
            try:
                for i in self.play:
                   self.BotList[self.isTurn].hand.remove(i)
            except:
                raise Exception("You can't play a card you don't have, you dimwit")
            self.GameSummary.append(self.BotList[self.isTurn].name+" played "+",".join(i.val for i in self.play)+".")
            self.isBS()
        if self.winner!=None:
            raise StopIteration
        if set(passList)!={False}:
            while True:
                self.isTurn=(self.isTurn+1)%self.numBots
                if self.BotList[self.isTurn].inRound:
                    break
        else:
            self.GameSummary.append("Everyone passed. "+self.BotList[self.isTurn].name+" starts the next round.")
            self.isRound=False
        return(None)
class BSBot:
    def __init__(self,myHand,numBots,CallBS,PlayCards,StartRound):
        self.obj=Obj()
        self.hand = myHand
        self.numBots = numBots
        self.name = CallBS.__name__.split('_')[0]
        self.callBS = lambda pos, player, handSize, currCard, numCards, numPile: CallBS(self,pos,player, handSize, currCard, numCards, numPile)
        self.playCards = lambda currCard, numPile, stillPlaying: PlayCards(self,currCard, numPile, stillPlaying)
        self.startRound= lambda:StartRound(self)
    def __str__(self):
        if self.hand==[]:
            return(self.name+': WINNER!')
        return(self.name+": "+", ".join(str(i) for i in self.hand))
    def getRandom(self):
        return rn.random()
Mod = BSgame(BotParams)
for i in Mod:
    pass
Mod.results()

```

Additionally, if you want to see a summary of the game, type in the following command at the end of the program:

```
print("\n".join(Mod.GameSummary))

```

# Answer
> 4 votes
# Naive Bot

```
def naive_CallBS(self,pos,player,handSize,currCard,numCards,numPile):
    return False
def naive_PlayCards(self,currCard,numPile,stillPlaying):
    return [card(currCard)] * self.hand.count(currCard)
def naive_StartRound(self):
    return self.hand[0].val

```

Never calls BS, never lies, and lets the game play out, while trying its best to win. Will always play all of the current card, and will start the round with the first card in its hand.

# Answer
> 4 votes
# Asshole

```
def asshole_CallBS(self,pos,player,handSize,currCard,numCards,numPile):

    if not hasattr(self.obj, "flag"):
        self.obj.flag2 = False
        self.obj.flag = False
    if len(self.hand) < self.numBots * 14 * 1.5 / 4 and self.obj.flag:
        self.obj.flag = False
        if len(set(self.hand)) * self.numBots * 3.0 / 4 < len(self.hand):
            self.obj.flag2 = True
    if len(self.hand) < self.numBots * 14 * 3.0 / 4:
        if not self.obj.flag:
            self.obj.flag = True
        return False
    else:
        return self.hand.count(currCard) * 1.0 / self.numBots > 0.75
def asshole_PlayCards(self,currCard,numPile,stillPlaying):
    if not hasattr(self.obj, "flag"):
        self.obj.flag2 = False
        self.obj.flag = False
    if not self.obj.flag:
        return [card(currCard)] * self.hand.count(currCard) if len(self.hand) > self.numBots * 14 * 3.0 / 4 else self.hand
    else:
        if self.obj.flag2 and len(self.hand) < 3:
            return self.hand
        return [card(currCard)] * self.hand.count(currCard)
def asshole_StartRound(self):
    if not hasattr(self.obj, "flag"):
        self.obj.flag2 = False
        self.obj.flag = False
    card = ""
    max_cards = 0
    for i in "A,2,3,4,5,6,7,8,9,10,J,Q,K,j".split(","):
        if self.hand.count(i) > max_cards:
            max_cards = self.hand.count(i)
            card = i
    return card

```

Have you ever been that one player in BS who tries to get all the cards? No? Just me? Well, let me tell you it's just as fun. Trust me, this is a legitimate winning strategy.

# Answer
> 3 votes
# Moniathan

```
def moniathan_CallBS(self, pos, player, handSize, currCard, numCards, numPile):
    if numCards > self.numBots * 0.5:
        return True
    if self.hand.count(currCard) == self.numBots:
        return True
    if self.hand.count(currCard) + numCards > self.numBots * 0.5:
        return True
    if numPile > self.numBots * 2:
        return True
    return False

def moniathan_PlayCards(self, currCard, numPile, stillPlaying):
    cards = [c.val for c in self.hand]

    if cards.count(currCard) > 1:
        return cards.count(currCard) * [card(currCard)]

    if cards.count(currCard) == 1:
        if len(self.hand) > 1:
            add_more = self.getRandom() > 0.75
            if add_more:
                return [card(currCard), [c for c in self.hand if c.val != currCard][0]]
            else:
                return [card(currCard)]
        else:
            return [card(currCard)]
    else:
        if self.getRandom() > 0.5:
            if self.getRandom() > 0.5 and len(self.hand) > 1:
                return [self.hand[0], self.hand[1]]
            else:
                return [self.hand[0]]
        else:
            return []

def moniathan_StartRound(self):
    return max(self.hand, key=lambda x: self.hand.count(x.val)).val

```

It mostly tries to play safe but sometimes it will take small risks to get ahead.

# Answer
> 2 votes
# Halfwit

```
def halfwit_CallBS(self,pos,player,handSize,currCard,numCards,numPile):
    # Call if I know he's lying
    if numCards + self.hand.count(currCard) > self.numBots:
        return True
    # Call if he'd win otherwise
    if handSize == 0:
        return True
    # Call if that would be more than half of the remaining cards, more than 3, and he's got lots of cards
    if handSize > 14 and numCards > 3 and numCards + self.hand.count(currCard) > (self.numBots - numPile) / 2:
        return True
    return False
def halfwit_PlayCards(self,currCard,numPile,stillPlaying):
    # If I have this card, play all that I've got.
    if self.hand.count(currCard) > 0:
        return [card(currCard)] * self.hand.count(currCard)
    # If more than half of the cards of this value are allegedly already out, play nothing
    if numPile * 2 >= self.numBots:
        return
    # Play the smallest stack I've got.
    counts = [self.hand.count(i) for i in "A,2,3,4,5,6,7,8,9,10,J,Q,K,j".split(",")]
    choice = "A,2,3,4,5,6,7,8,9,10,J,Q,K,j".split(",")[counts.index(min([x if x != 0 else 100 for x in counts]))]
    return [card(choice)] * min([x for x in counts if x != 0])
def halfwit_StartRound(self):
    # Play the card I have the most of
    return max(self.hand, key=lambda x: self.hand.count(x.val)).val

```

Halfwit always plays something - and he cheats if he doesn't have any of the right cards to play. Right now there's a few issues with the controller and with the bot and I'm not sure which is which, so I'll have to come back and fix some bugs later.

---
Tags: king-of-the-hill, python, card-games
---