14
\$\begingroup\$

Like the title says:

from itertools import permutations

def number_of_clicks(l):
    bets = list(l)
    clicks = 0
    state = [[False, None], [False, None], [False, None], [False, None], [False, None]]
    while bets:
        next = bets.pop(0)
        for s, n in zip(state, next):
            if s[0] != n[0]:
                clicks += 1 # checkbox
                s[0] = n[0]
            if s[1] != n[1] and n[1] is not None:
                clicks += 2 # dropdown
                s[1] = n[1]

    return clicks

bets = map(lambda l: map(lambda p: [bool(p), p], l), input())

result = min(permutations(bets), key=number_of_clicks)

for l in result: print map(lambda e: e[1], l)
print number_of_clicks(result)

(taken from this Sandbox post)

<!-- language: lang-python -->

Has no effect.

Syntax highlighting would be very useful for the Sandbox. It works on Meta.SO, so why not here?

\$\endgroup\$
4
  • \$\begingroup\$ Interestingly, it works in the Android app. \$\endgroup\$ Nov 21 '15 at 7:51
  • 11
    \$\begingroup\$ @MartinBüttner This becomes less interesting when you realize that the Android app uses the "default" syntax highlighting colors for every single code block (i.e. it completely ignores syntax highlighting comments and never uses language-specific highlighting). :P \$\endgroup\$
    – Doorknob Mod
    Nov 21 '15 at 16:30
  • \$\begingroup\$ Blame the fact that meta still has MathJax? ¯\_(ツ)_/¯ \$\endgroup\$
    – Alex A.
    Nov 21 '15 at 20:34
  • 2
    \$\begingroup\$ Now that meta no longer has MathJax, this bug still exists. Can anyone confirm whether syntax highlighting is switched on for meta? \$\endgroup\$
    – trichoplax
    Jun 22 '16 at 18:09
14
\$\begingroup\$

No idea why this wasn't on already; guessing we just forgot.

\$\endgroup\$
1
  • \$\begingroup\$ Thanks for fixing this! \$\endgroup\$
    – user45941
    Mar 30 '17 at 12:34
9
\$\begingroup\$

I assume everyone is in favour of syntax highlighting being possible on meta, but I'm adding an answer just so people can indicate either way with voting.

MathJax was mentioned as a potential cause of syntax highlighting not working, but MathJax has since been removed from meta, ruling this out as the cause. I suspect that syntax highlighting is simply switched off on meta. If so, I'd like to see it switched back on.

\$\endgroup\$

You must log in to answer this question.