GO OUT AND VOTE

114

16

Today is November 8th, 2016, Election Day in the United States of America.

If you are a U.S. citizen eligible to vote, then go out and vote if you haven't already before answering this challenge. Do not discuss who you voted for. It only matters that you voted.

If you are not a U.S. citizen or not eligible to vote, then, before answering this challenge, do the U.S. a favor by telling anyone you know who is an eligible citizen to go out and vote if they haven't already.

Challenge

Write a program that indicates that you voted, like a digital "I Voted" sticker.

It should take no input and must output in a reasonable way the phrase I Voted where the I, o, and e are red (#FF0000) and the V, t, and d are blue (#0000FF). The background must be white (#FFFFFF).

For example:

"I Voted" example graphic

These colors are of course representative of the American flag (though not the official colors). Red comes first simply because it comes first in the common idiom "red white and blue".

To be valid, an answer must:

  • Use the colors specified in the arrangement specified.

  • Use a single legible font and font size. The example uses 72pt Times New Roman bold but any common font above 6pt is probably fine.

  • Have just the phrase I Voted on a single line, capitalized correctly, with a clear space between the two words. It shouldn't look like IVoted.

  • Not indicate who the answerer voted for or supports for president or any down-ballot races. Let's not start any internet debates. This is about celebrating voting, not candidates.

Any reasonable way of displaying or producing the output is valid, such as:

  • Drawing the text to an image that is then displayed, saved, or output raw.

  • Writing the text to a console using color formatting. In this case you may approximate pure red and blue if necessary, and it's ok if only the area directly behind the text can be made white.

  • Displaying the text on a WPF/Windows form.

  • Outputting an HTML/RTF/PDF file with the text.

Please post an image of your output.

The shortest answer in bytes wins.

Calvin's Hobbies

Posted 2016-11-08T13:00:03.530

Reputation: 84 000

29

A bit disappointed my actual sticker doesn't look like yours.

– Geobits – 2016-11-08T13:52:32.333

39"It only matters that you voted." - @HelkaHomba ... That's like saying "it doesn't matter what code you write, as long as you wrote some code." :/ – Michael Yaeger – 2016-11-08T14:05:01.737

41@MichaelYaeger Well, writing some code is better than writing none. Voting is better than not voting. Chances are people will put some thought into coding and voting if they choose to do it. But really I said that to help avoid angry debates. – Calvin's Hobbies – 2016-11-08T14:13:57.820

44If it helps anyone, vowels are red, consonants are blue. – mbomb007 – 2016-11-08T15:09:10.587

35@mbomb007 Or more usefully, the letters with odd code points are red, and the letters with even code points are blue. – Sp3000 – 2016-11-08T15:15:11.447

Can red letters be one font and blue another, or red one size and blue another, or blue letters bold, etc.? – ETHproductions – 2016-11-08T16:12:38.797

@ETHproductions Also a stretch, so no. – Calvin's Hobbies – 2016-11-08T22:01:00.323

5@Calvin'sHobbies - not to attack the challenge - but the initial part of your post is very misleading: ...then go out and vote ... It only matters that you voted. - Yes, everyone SHOULD vote (esp. with how many people don't), but everyone who votes has the responsibility to vote informed, and opt out if you deem yourself uninformed, or better yet, ensure yourself to never be uninformed. Your vote matters, and should be treated as such. Study the ballot ahead of time for all the different elections, and know your choice well before election day. Don't throw away your vote with ignorance. – James Haug – 2016-11-14T05:15:06.233

3@James You make a fair point, but see the undeleted comments above. – Calvin's Hobbies – 2016-11-14T05:34:12.267

Ya know, seeing this in the HNQ on November 14th (2 hours away from the 15th) does make this a teensy weensy bit late... – Zizouz212 – 2016-11-14T23:42:29.407

Does the program have to exit, or can it just hang? – anonymous2 – 2016-11-21T12:45:21.580

@anonymous2 A window where the message is drawn that stays open is fine, but if there's no gui, it should end normally. – Calvin's Hobbies – 2016-11-22T00:43:29.170

@allthepeoplewhoarearguingaboutgoingoutandvoting, check out this link about what Mike Rowe says about it. It's definitely something you might want to think about... https://www.facebook.com/TheRealMikeRowe/posts/1254500967893377

– FantaC – 2017-05-30T23:11:47.143

Answers

117

Minecraft Chat (vanilla 1.10 client, spigot 1.10 server): 19 bytes

&4I &1V&4o&1t&4e&1d

or from the clientside:

§4I §1V§4o§1t§4e§1d

Minecraft uses a color coding system with these colors programmed in.

enter image description here

Mind the rules:

  • Writing the text to a console using color formatting. In this case you may approximate pure red and blue if necessary, and it's ok if only the area directly behind the text can be made white.

All of these are true, as:
the red and blue ARE approximations (though still very similar).
The background in Minecraft chat is transparent, meaning that it's possible to put this on a white background (such as an empty world or a world which is still generating).

tuskiomi

Posted 2016-11-08T13:00:03.530

Reputation: 3 113

10Wow. I'm speechless. That's a very clever answer! – James – 2016-11-08T17:58:01.093

28I don't think Minecraft Chat is Turing-complete or considered a programming language (although this may no longer be a requirement). Very creative though! :) – Kade – 2016-11-08T17:58:04.133

9

@Shebang http://gaming.stackexchange.com/questions/20219/is-minecraft-turing-complete Minecraft chat has (nearly) all the same commands as command blocks, and certainly all the commands from back when the question was asked :-)

– tuskiomi – 2016-11-08T17:59:54.433

@HelkaHomba I'll be home in 2 hours! count on it then! – tuskiomi – 2016-11-08T21:57:44.307

Wait I thought they removed the ability to do that I remember spending a whole day trying to get colors – Areeb – 2016-11-08T23:29:52.000

15Technically, in vanilla Minecraft, the &s should be §s – Oliver Ni – 2016-11-08T23:33:36.850

2Hmmm I think it can be done in Quake 3, too – Display Name – 2016-11-09T08:58:29.760

For what versions does this work? Certainly not for 1.10. – RudolfJelin – 2016-11-09T14:03:08.660

@Oliver thankyou, I've added that possible interpretation. In vanilla minecraft, the ampersand is filtered and escaped. In Spigot (a modified server), the ampersand is not filtered. – tuskiomi – 2016-11-09T14:28:53.533

2Note that this won't work on some Spigot (and other third-party servers) if the admin didn't decide to allow color-code formatting, which may very well be the case. – Kaz Wolfe – 2016-11-10T08:52:21.503

2Also, the server will kick the client any time it receives a § from a client, so a modded server is a requirement to use this exact code. – Justin Krejcha – 2016-11-11T06:21:15.240

@JustinKrejcha do you have a source for that? I've never had problems with the symbol before. – tuskiomi – 2016-11-11T06:25:56.783

2@tuskiomi According to the wiki, the section symbol can only be entered into a book and quill and command blocks. Additionally, I just tried it on a test server (with a client that allows me to enter the symbol) and I got kicked for "Illegal characters in chat". – Justin Krejcha – 2016-11-11T06:39:57.993

I must say very impressed. Never would have thought of using Minecraft Chat! – Jack – 2016-11-13T20:55:18.083

1& isn't valid on spigot without plugins; if you allow it then you should count the code of the plugin that's translating it. However, it is valid on unmodified Minecraft Classic (though getting a classic server to work is somewhat difficult nowadays). – Pokechu22 – 2016-11-14T15:50:47.337

@Pokechu22 It works on my pluginless spigot server. – tuskiomi – 2016-11-14T15:55:07.930

107

C, 82 80 78 74 54 bytes

Thanks to @WillihamTotland and @criptych for saving 2 bytes each!

f(){puts("␛[47;31mI␛[34m V␛[31mo␛[34mt␛[31me␛[34md");}

Where the ␛s represent 0x1B bytes (escape key). As this code contains unprintable control characters, here is a reversible hexdump:

00000000: 6628 297b 7075 7473 2822 1b5b 3437 3b33  f(){puts(".[47;3
00000010: 316d 491b 5b33 346d 2056 1b5b 3331 6d6f  1mI.[34m V.[31mo
00000020: 1b5b 3334 6d74 1b5b 3331 6d65 1b5b 3334  .[34mt.[31me.[34
00000030: 6d64 2229 3b7d                           md");}

Output on my phone:

betseg

Posted 2016-11-08T13:00:03.530

Reputation: 8 493

What does the a"\x1B[%dm" do? – user41805 – 2016-11-08T13:43:52.460

3@KritixiLithos that line defines a as "\x1B[%dm", which is an ANSI escape sequence for coloring, with a placeholder. The numbers in printf() fill those placeholders. – betseg – 2016-11-08T13:49:05.443

1Two bytes can be shaved off by replacing a with "\x1B[47;31m" and defining b to "\x1B[34m", then using puts with alternating a and b prefixes. – Williham Totland – 2016-11-09T12:35:40.490

However, if you want to clean up the output stream with a final a and ,0 (which you should when doing it live, but this is codegolf ;), the solution as stated is shorter by two bytes. – Williham Totland – 2016-11-09T12:38:14.430

3You can save another 2 bytes with "\33" instead of "\x1B". – criptych stands with Monica – 2016-11-09T16:46:28.470

1Extending what criptych said, I don't know if this is allowed, but you'd save another four bytes by using a literal escape character instead of \33. Not sure what the C standard thinks of that... – None – 2016-11-10T06:41:14.160

@yellowantphil I've thought that too, but it would be hard to test on mobile :) – betseg – 2016-11-10T07:02:54.827

I have an ssh app and keyboard that lets me type control characters, so I could do it if I wanted to. :) It works fine on my computer. – None – 2016-11-10T07:06:10.530

1@yellowantphil I tried making an hexdump but it didn't work, can you please post a dump with 0x1B (escape character)? – betseg – 2016-11-10T07:30:15.973

@betseg I tried, but the edit reviewers said I was a spammer. I can't fit the hexdump in a comment, so never mind. – None – 2016-11-10T16:49:28.303

1This is truly unreadable. a should be r so as to have meaningful variable names :-) More seriously though, it's not a program, missing main as it is. – None – 2016-11-11T03:46:19.147

3

@paxdiablo according to this meta thread, functions are OK for code golf.

– betseg – 2016-11-11T04:57:15.643

I stand corrected :-) – None – 2016-11-11T05:00:55.123

73

Google Blockly, 10 14 blocks, 28 41 35 blytes

Code

enter image description here

Output

enter image description here

Try it here

Not counting the hide turtle block because it's just aesthetics.

A blyte is a combination of a block and a byte, there's no meta post yet as how to count this, but I'll create one later. As for now, this is how I count:

  • I o e, 8 blytes
  • V t d, 10 blytes (2 leading spaces here)
  • Colours, 1 blyte each, 2 total
  • 90, 2 blytes
  • 999, 3 blytes
  • 0, 1 blyte
  • turn right, 2 blytes
  • move forward, 2 blytes
  • normal blocks, 1 blyte each, 5 total

Since Google Blockly is rarely used for golfing and I'm thinking waaay outside of the box for this challenge, I hope this is a valid submission.

Bassdrop Cumberwubwubwub

Posted 2016-11-08T13:00:03.530

Reputation: 5 707

20For the record this is valid. It's nice to see unique languages. Though, unless there's a meta concensus on byte-counting in Google Blockly, I may ignore it when selecting a winner. – Calvin's Hobbies – 2016-11-08T14:47:08.780

2

You may find discussion here relevant. CC @HelkaHomba.

– Scimonster – 2016-11-08T21:45:51.260

Have you though about replacing those three spaces in I o with two em spaces? – Andrea Lazzarotto – 2016-11-11T17:21:29.643

Google Blockly will be translated to JavaScript and then run. You need to Inspect Element and run code in Blockly API to get the real JavaScript code. – None – 2016-11-13T14:27:53.170

1Wait so could Scratch be used? – Adamawesome4 – 2016-11-15T22:30:51.507

48

HTML, 52 bytes

I <c>V<e>o<c>t<e>e<c>d<style>*{color:red}c{color:0ff

noɥʇʎԀʎzɐɹƆ

Posted 2016-11-08T13:00:03.530

Reputation: 1 316

Remove spaces to save bytes – user41805 – 2016-11-08T13:19:02.487

@KritixiLithos you mean space (singular) instead of spaces (plural). The first can indeed be removed, the second however would change the text to Ivoted. – Kevin Cruijssen – 2016-11-08T13:21:16.490

Mind adding an image? (Or stack snippet.) – Calvin's Hobbies – 2016-11-08T13:21:32.950

2Also, I think that #FF0000 -> #F00 and #0000FF -> #00F works – Conor O'Brien – 2016-11-08T13:22:57.233

1Actually there is a constant for #F00: red. – manatwork – 2016-11-08T13:24:25.900

Also IMO blue instead of #00F looks nicer – ASCII-only – 2016-11-08T13:25:43.797

If you replace b with c you lose the boldness and if you nest, you can save 14 bytes <style>r{color:red}c{color:blue}</style><r>I</r> <c>v<r>o</r>t<r>e</r>d</c> – James Long – 2016-11-08T13:29:18.107

Also leaving out the last closing tag should work: <style>r{color:red}c{color:blue}</style><r>I</r> <c>v<r>o</r>t<r>e</r>d (please test before editing) – ASCII-only – 2016-11-08T13:30:21.240

1Also you can move style to the end to remove the closing tag for style and the last closing brace. – betseg – 2016-11-08T13:31:17.917

<r>I</r> <c>v<r>o</r>t<r>e</r>d</c><style>r{color:red}c{color:blue67 bytes - credit @betseg – James Long – 2016-11-08T13:32:31.743

also, you don't need the closing tags. – Conor O'Brien – 2016-11-08T13:33:50.880

46Why not turn this into a Stack Snippet? – Neil – 2016-11-08T13:35:02.303

3<r>I <c>V<r>o<c>t<r>e<c>d<style>r{color:red}c{color:blue works – ASCII-only – 2016-11-08T13:35:13.360

1If you style *, you don't need r tags and save some bytes. You can also continue the "don't close the final tags" mentality and get an answer of 56 bytes: I <c>v</c>o<c>t</c>e<c>d<style>*{color:red}c{color:blue – James Long – 2016-11-08T13:43:57.013

7actually you can just keep nesting without closing I <c>V<e>o<c>t<e>e<c>d<style>*{color:red}c{color:0ffand note change to blue 0ff – None – 2016-11-08T14:17:40.167

@tolos color:0ff doesn't do anything for me in Firefox 49. What browser are you using? – ETHproductions – 2016-11-08T16:18:12.790

chrome 54, and other characters to reach the minimum required to post. – None – 2016-11-08T17:07:05.570

@tolos It does indeed work in Chrome! But why? – ETHproductions – 2016-11-08T17:45:12.623

@ETHproductions see http://stackoverflow.com/questions/8318911/why-does-html-think-chucknorris-is-a-color

– None – 2016-11-08T17:58:16.303

@tolos The technique described there applies to e.g. <c color="chucknorris">, but not c { color: chucknorris; }. I would expect c { color: 0ff; } to be cyan anyway, so I wonder what's really going on here... – ETHproductions – 2016-11-08T19:21:31.303

@Neil feel free to edit the question. – noɥʇʎԀʎzɐɹƆ – 2016-11-08T20:59:53.640

@tolos it fails in Chrome. – noɥʇʎԀʎzɐɹƆ – 2016-11-08T21:15:01.660

2Sadly the current version doesn't seem to work as a Stack Snippet, the latest version that works for me is the c{color:blue} version. – Neil – 2016-11-09T09:39:18.480

2@Neil Stack snippets automatically insert a doctype. Omitting the # before the color value is only supported in quirks mode. – user2428118 – 2016-11-11T12:38:37.443

0ff is invalid. It should be #0ff. Actually it should be #00f. – Qwertiy – 2016-11-16T15:23:35.957

39

LaTeX, 147 126 bytes

\documentclass{proc}\input color\begin{document}\def\z{\color{red}}\def\y{\color{blue}}\z I \y V\z o\y t\z e\y d\end{document}

Saved 21 bytes and got better kerning thanks to @AndreïKostyrka.

This prints an a4 page with this on the first line (note that this also prints page 1 on the bottom):

enter image description here

Fatalize

Posted 2016-11-08T13:00:03.530

Reputation: 32 976

13I would have thought LaTeX would typeset the Vo kerning prettier... But apparently it considers each letter separately due to the colours. – Sanchises – 2016-11-08T17:21:38.240

@sanchises Since each letter is in a separate command, I think it destroys proper kerning. – Fatalize – 2016-11-08T18:30:19.990

Yeah exactly. Although I'm sure it would be possible somehow if golfing was not a requirement. – Sanchises – 2016-11-08T19:09:33.753

@sanchises this is definitely possible, but this is indeed longer than this ugly solution.

– Fatalize – 2016-11-08T19:12:50.817

\documentclass{proc}\input color\begin{document}\def\z{\color{red}}\def\y{\color{blue}}\z I \y V\z o\y t\z e\y d\end{document} saves 21 bytes and results in 126 bytes of pure typographical beauty. – Andreï Kostyrka – 2016-11-09T09:39:39.513

@AndreïKostyrka Thanks! – Fatalize – 2016-11-09T09:46:07.887

\documentclass{proc}\input color\begin{document}\def\y{\color{blue}}\color{red}{I{\y~V}o{\y t}e{\y d}\enddocument saves 13 more bytes. By the way, \input color doesn't work for me (\usepackage{color} does). What version of pdflatex are you using (pdflatex --version)? I'm using 3.14159265-2.6-1.40.17 (TeX Live 2016). – None – 2016-11-11T10:21:56.220

34

Windows 10 Batch, 51 50 bytes

@color fc&echo I ␛[94mV␛[91mo␛[94mt␛[91me␛[94md␛[m

Where ␛ represents the ANSI Escape 0x1B character. Outputs using colour formatting. Edit: Saved 1 byte thanks to @brianush1. I tried writing the code to generate this but it took 97 bytes. Output:

I voted

Neil

Posted 2016-11-08T13:00:03.530

Reputation: 95 035

1You can golf it down by 1 byte if you use @color fc&echo I... – brianush1 – 2016-11-09T02:51:03.730

1interesting, I didn't realise Windows terminal supported ANSI escape sequences – Mark K Cowan – 2016-11-09T15:40:51.967

3@MarkKCowan It's only Windows 10, and (I think!) post Redstone Update. It's one of the few things that stop me from just installing XP over it. – wizzwizz4 – 2016-11-09T19:16:55.797

@wizzwizz4 ConEmu supports these too :) Indeed this is from Windows 10 anniversary (ie redstone 1) – Asu – 2019-01-24T07:43:07.023

@Asu I installed XP over it. – wizzwizz4 – 2019-01-24T07:43:50.173

28

JavaScript, 71 bytes

console.log('%cI %cV%co%ct%ce%cd',r='color:red',b='color:blue',r,b,r,b)

Makes use of console.log's ability to print in color. Doesn't work in a stack snippet so you should paste this answer to the console to test it.

enter image description here

Picture credits to @Mast

Bassdrop Cumberwubwubwub

Posted 2016-11-08T13:00:03.530

Reputation: 5 707

That's exactly what I just came up with, haha. I think the shortest alternative would be console.log([...' I Voted'].join`%c`,r='color:red',r,b='color:blue',r,b,r,b) – ETHproductions – 2016-11-08T15:33:43.070

Doesn't work in Node.js either. :( – Jordan – 2016-11-08T17:02:56.267

I was surprised this actually works, but it does.

– Mast – 2016-11-08T19:58:04.613

23

R, 113 85 81 74 73 55 bytes

Edit: Saved a bunch of bytes thanks to @rturnbull and @JDL

plot(8:1,0:7*0,pc=el(strsplit("detoV  I","")),co=2:1*2)

The size of the output (and spacing etc) depends on the resolution of the currently open graphics device. Tested in RGui and RStudio on my monitor and produces:

enter image description here

Billywob

Posted 2016-11-08T13:00:03.530

Reputation: 3 363

4Oh, I've never seen el() before. Thanks for helping me learn more R! Since text is vectorized, you can skip the for-loop and just write: text(seq(.3,.6,.05),.5,s,col=c("red","blue")). (I modified your x positions for golfier code, although the spacing may be a little less neat.) – rturnbull – 2016-11-08T15:03:02.360

1Also, thanks to partial argument matching you can use co= rather than col=. And finally, 6:12*.05 is several bytes shorter than seq(.3,.6,.05). – rturnbull – 2016-11-08T15:17:23.270

1Good catch! And now I realize that 6:12/20 is of course 1 byte shorter than 6:12*.05, apologies for leading you astray and suggesting suboptimal edits. – rturnbull – 2016-11-08T15:26:59.443

1Aren't the colours off? Shouldn't the "I" and "V" be different colours? – JDL – 2016-11-08T15:37:09.113

If the colours aren't wrong, then plot(7:1,0:6/Inf,pc=el(strsplit("detoV I","")),co=1:2*2) is 56 bytes. – JDL – 2016-11-08T15:40:07.043

Fair enough: add a space, plot(8:1,0:7*0,pc=el(strsplit("detoV I","")),co=1:2*2) is 55 bytes. (Edit: SO automatically reduces a double space to one space, but there should be two in the quoted string! Also saved two bytes by replacing \Inf with *0) – JDL – 2016-11-08T15:47:59.530

Did you correct for the SO auto-correct? (I.e. the string should be "d-e-t-o-V-space-space-I") – JDL – 2016-11-08T15:55:50.777

@JDL I must be stupid somehow. Updated the answer, thanks! – Billywob – 2016-11-08T15:59:53.820

2I'm pretty sure el() improves 99% of all previous strsplit answers by 1 byte. – Vlo – 2016-11-08T20:44:04.737

Brings it back up to 60, but gets the colors correct as specified: plot(c(1,3:7),0:5*0,pc=c("I","V","o","t","e","d"),co=c(2,4)) (red I, blue V). – Jonathan Carroll – 2016-11-09T02:25:03.777

@JonathanCarroll I just changed 1:2*2 to 2:1*2 instead. Thanks, didn't notice the colors were still wrong though. – Billywob – 2016-11-09T07:50:41.880

21

LÖVE, 152 142 136 bytes

Let's show some löve for a fun little prototyping language! It's not perfect for the task of golfing (c'mon, it's LUA based), but it's easy to write.

function love.draw()l=love.graphics
a=255
l.setBackgroundColor(a,a,a)s=l.setColor
p=l.print
s(a,0,0)p('I   o e')s(0,0,a)p('  V  t d')end

Screenshot:

screenshot


Fully ungolfed version:

function love.draw()
    love.graphics.setBackgroundColor(255,255,255)
    love.graphics.setColor(255,0,0)
    love.graphics.print('I   o e')
    love.graphics.setColor(0,0,255)
    love.graphics.print('  V  t d')
end

Geobits

Posted 2016-11-08T13:00:03.530

Reputation: 19 061

12I löve that you used something other than Java. – AdmBorkBork – 2016-11-08T14:24:40.580

5So many 255… A variable for them? – manatwork – 2016-11-08T15:46:55.023

@manatwork Yep. Not sure how that slipped by. Thanks! – Geobits – 2016-11-08T15:49:18.163

I don't know the language--what would a full program look like? – Conor O'Brien – 2016-11-08T15:58:45.357

1

@ConorO'Brien This is a full program. love.draw() is a built-in function that you override, which runs on the draw step. There's also things like love.update() and love.load() for various parts of the render loop, but they're optional. It's a nice language, and you can get started with it very easily. I sometimes use it to prototype game ideas.

– Geobits – 2016-11-08T16:01:59.237

@Geobits Whoa, that's pretty nifty. – Conor O'Brien – 2016-11-08T16:30:26.287

does lua support hexnumber literals? if so, you could change a=255 to a=FF. – tuskiomi – 2016-11-08T21:32:29.473

Not as a bare FF, no :/ – Geobits – 2016-11-08T21:36:18.110

How come the spaces in the second print don't overwrite the chars in the first? – cat – 2016-11-09T02:47:45.587

2@cat They just don't. It's not like I'm overprinting them on a console, it's a graphical print. So a space here is just "paint nothing in this area", not "paint this area background colored". – Geobits – 2016-11-09T02:50:51.680

1Can't you remove the alpha parameter while setting the colour, like l.setBackgroundColor(a,a,a)? – user41805 – 2016-11-09T12:21:23.040

@KritixiLithos Huh. I didn't even check that since there wasn't an overload listed like that for setColor(), but it appears it works for both. Thanks! – Geobits – 2016-11-09T15:16:34.827

And also, can you not shorten the setBackgroundColor by calling it with just one parameter setBackgroundColor(a) like my Processing answer? – user41805 – 2016-11-09T15:43:28.740

No, there is a one-arg variant, but it expects an rgb packed-int, so it ends up being longer that way. – Geobits – 2016-11-09T15:45:11.677

1ever since I'm reading this site, this is the first LÖVE answer I see. I'm honestly touched – Zoltán Schmidt – 2016-11-11T15:16:50.753

2

@ZoltánSchmidt Thanks! There are a few other LÖVE answers, if you want to take a look through them :D

– Geobits – 2016-11-12T21:46:40.783

18

MATLAB, 74 bytes

We create a white 50x50 (one column for each state) background using imshow of an array of ones. We then display a text, using my trick of shortening property names to get the colours. Since the default font is not fixed width, the text is padded with spaces.

imshow(ones(50))
text(2,9,'I   o e','Co','r')
text(8,9,'V  t  d','Co','b')

enter image description here

MATLAB, 99 bytes, fixed width font

The first version uses fiddling with spaces and coordinates to get a proper kerning on the default font, and might not display properly on your computer. Instead, we can use a fixed width font, like Courier (or, for some more bytes, FixedWidth which works on any system that has a fixed width font installed). This does come at the cost of quite a few extra bytes. We can mitigate this slightly by using a for loop to print the text. The text and corresponding colours are stored in a cell array. The background needs to be a little bit larger.

imshow(ones(80))
for y={'I  o e ','  V t d';'r','b'}
text(9,9,y{1},'Co',y{2},'FontN','Courier')
end

enter image description here

Matlab, 80 bytes bonus edition

Sadly, underlined blue text is not allowed. Otherwise, this answer would have highlighted some interesting behaviour in MATLAB. You can print red text using fprintf(2,txt), and you can print blue underlined text with fprintf('<a href="">txt</a>'). Combining this works... sometimes. Completely at random, it may also create red underlined text. You can issue drawnow between consecutive f calls if this is the case on your system.

f=@(p)fprintf(2,'%s<a href>%s</a>',p(1:end-1),p(end));f('I V');f('ot');f('ed');fprintf('\n')

enter image description here

Sanchises

Posted 2016-11-08T13:00:03.530

Reputation: 8 530

You can write <a href> instead of <a href="">. If you don't like it, you can use <a href=#>. – Ismael Miguel – 2016-11-10T19:28:19.573

@IsmaelMiguel Clever. <a> didn't work. – Sanchises – 2016-11-10T21:37:41.827

Using only <a> isn't considered a clickable link. to get it's blue color, it has to be considered as one. In CSS, the selector may be a[href]. As long as the attribute href is there, it is a clickable link. That's why using only <a> won't work. – Ismael Miguel – 2016-11-11T08:58:11.777

18

Hot Soup Processor, 48 bytes

color 255
mes"I  o e
pos,0
color,,-1
mes"  V t d

The ungolfed version is:

color 255,0,0
mes "I  o e"
pos 0,0
color 0,0,255
mes "  V t d"

If you bear in mind that mes (message) is HSP's echo, I think this is fairly readable.

Weirdly, if you try to do pos or pos,, the blue line doesn't overwrite the red line and appears beneath it. Even weirder, color is only meant to take values in 0-255, but 0,0,-1 works for blue, 0,-1,0 works for green and -1,0,0 works for... black? (-257,0,0 and 511,0,0 work for red though, so something's funky about the mod 256 going on)

enter image description here

Sp3000

Posted 2016-11-08T13:00:03.530

Reputation: 58 729

Why don't the spaces in the second mes overwrite the first? – cat – 2016-11-09T02:51:09.253

@cat Spaces don't actually draw anything, it just advances the cursor position in a sense – Sp3000 – 2016-11-09T03:41:43.033

1Clever using -1 for 255. Have a +1 – Cyoce – 2016-11-10T01:44:12.563

@Cyoce Or maybe it's actually -255? – sagiksp – 2017-05-25T12:02:13.580

18

ImageMagick, 102 bytes

magick xc:[x60] -fill red -draw 'text 5,30 "I     o  e"' -fill blue -draw 'text 15,30 "V   t   d"' x:

Ungolfed:

magick convert canvas:white[60x60!] \
       -fill red  -draw 'text 5,30   "I     o  e"' \
       -fill blue -draw 'text 15,30      "V   t   d"' \
       show:

enter image description here

Golfing the full ImageMagick command consisted of

  • not explicitly calling the default convert utility

  • using xc: instead of canvas: (xc: is an old synonym for canvas:; I don't foresee ImageMagick ever eliminating it)

  • not specifying the canvas color but relying on ImageMagick's default, which happens to be white

  • removing the width 60 from the geometry (when it's omitted, width==height)

  • removing the "!" from the geometry which is only needed to produce a non-square canvas, like canvas:white[60x30!]

  • using the older x: instead of show: as the output file (assumes that ImageMagick was built with X support)

  • removing some whitespace that I had used to line up the text strings

  • joining the multiple lines of the command (removed the backslash-CR between lines)

If you are so inclined after the election, add 12 bytes -rotate 180 preceding the show: directive:

enter image description here

Glenn Randers-Pehrson

Posted 2016-11-08T13:00:03.530

Reputation: 1 877

4I love how the ungolfed version drastically differs from the golfed one. – Andreï Kostyrka – 2016-11-11T13:25:12.527

15

Mathematica (REPL image output), 65 49 bytes

Overlay@{"I  o e"~Style~Red,"  V t d"~Style~Blue}

Graphical REPL expression.

LegionMammal978

Posted 2016-11-08T13:00:03.530

Reputation: 15 731

3"Private use?" What is that? – Conor O'Brien – 2016-11-08T13:14:40.413

2

@ConorO'Brien http://enwp.org/Private_Use_Areas

– LegionMammal978 – 2016-11-08T13:15:58.417

This is 49 bytes: Overlay@{"I o e"~Style~Red," V t d"~Style~Blue} (there are supposed to be two spaces between I and o and before V) – Gerli – 2016-11-11T10:01:26.500

15

Bash, 35 bytes

My script looks like this

echo "^[[47;31mI hope^[[34md^H^H^Ht^H^H^Hv"

xxd of script file:

0000000: 6563 686f 2022 1b5b 3437 3b33 316d 4920  echo ".[47;31mI 
0000010: 686f 7065 1b5b 3334 6d64 0808 0874 0808  hope.[34md...t..
0000020: 0876 22                                  .v"

Typing it: ctrl-v-esc and ctrl-v-h will insert the escapes and backspaces (^[ and ^H).

enter image description here

Lofty Withers

Posted 2016-11-08T13:00:03.530

Reputation: 251

How does this work? An explanation would be super – cat – 2016-11-09T19:16:09.610

2@cat it appears to write all the red letters (with "h" and "p" as stand-ins), then sets the colour to blue and writes "d" at the end. Finally it moves the cursor left to add the "t" and "V" over the earlier stand-ins (ascii 0x08, represented by "^H" in the display above, moves left 1 character). Clever way of avoiding lots of escape sequences for colour changes. It also uses a literal escape character (0x1B, represented as "^[") which saves some space compared to similar answers like mine. – Dave – 2016-11-09T22:29:36.463

Also: could save 3 bytes by assuming the terminal is set to a white background by default (most other terminal answers already assume this). – Dave – 2016-11-09T22:31:19.323

You can save a byte by removing the two quotes and adding a backslash (escape character) before the semicolon. Also your script has a lower case v (your command line one is fine). – None – 2016-11-11T05:08:07.480

14

Java, 322 319 318 309 304 229 217 bytes

-9 Bytes thanks to kevin.
-75 Bytes thanks to Angzuril, nice callout on the old awt classes, always forget those exist.
-12 Bytes thanks to user902383.

import java.awt.*;
void n(){new Frame(){{add(new Panel(){public void paint(Graphics g){int i=0;for(String c:"IVoted".split("")){g.setColor(i%2<1?Color.RED:Color.BLUE);g.drawString(c,i++*8,10);}}});setVisible(0<1);}};}

Output:

enter image description here

Magic Octopus Urn

Posted 2016-11-08T13:00:03.530

Reputation: 19 422

1JFrame j= can be golfed to Frame j=; (c==' '||i++%2==0)? can be golfed to c<33|i++%2<1? and true can be golfed to 1>0. Also, @HelkaHomba, is this a valid output? Since it also has spaces between the V o t e d? Oh, and why 0,0,999,99? 0,0,99,99 is large enough for the text on my screen. – Kevin Cruijssen – 2016-11-08T14:46:47.973

@KevinCruijssen 99 covers the text, but not the min size of the panel. Also, it doesn't have spaces; if you change the font to something where the characters are guaranteed to be the same width, it'd look better. – Magic Octopus Urn – 2016-11-08T14:57:44.027

Your byte count was wrong because you separated the imports from the rest of the code. You have to have it all together, because you need to count the newline between them. – mbomb007 – 2016-11-08T15:24:20.800

1(c<33||i++%2<1)? can stil be golfed by three bytes by removing the parenthesis and change || to | – Kevin Cruijssen – 2016-11-08T15:25:33.727

1I found some more things to golf: new JComponent to new Container (-1); remove char c="IVoted".charAt(i); and change g.drawString(c+"" to g.drawString("IVoted".charAt(i)+""(-8). – Kevin Cruijssen – 2016-11-09T12:52:46.427

I also tried to golf the colors but couldn't find anything useful. Changing Color.WHITE;Color.RED;Color.BLUE; to Color x=null;x.WHITE;x.RED;x.BLUE; or Color x;x=Color.WHITE;x.RED;x.BLUE; is both longer, and changing i%2<1?Color.RED:Color.BLUE to new Color(i%2<1?255<<16:255) or new Color(255<<(i%2<1?16:1)); is also both slightly longer.. :( – Kevin Cruijssen – 2016-11-09T12:53:38.290

Oh, two more things to golf xD for(int i=0;i<6;){g.setColor(i%2<1?Color.RED:Color.BLUE);g.drawString("IVoted".charAt(i)+"",i++*8,10);} to for(int i=0;i<6;g.setColor(i%2<1?Color.RED:Color.BLUE),g.drawString("IVoted".charAt(i)+"",i++*8,10)); (-2); and new JFrame(); to new Frame(); (-1) – Kevin Cruijssen – 2016-11-09T12:57:47.793

1First improvement, change Frame j=new JFrame();j.add(new JComponent() to Frame j=new Frame();j.add(new Container() and you can also drop the import import javax.swing.*; and g.setColor(Color.WHITE);g.fillRect(0,0,99,99) as a result (-63) – Angzuril – 2016-11-10T17:20:10.173

Another, change for(int i=0;i<6;){char c="IVoted".charAt(i); and g.drawString(c+"", to int i=0;for(String c:"IVoted".split("")) and g.drawString(c, gives (-7) – Angzuril – 2016-11-10T17:27:09.973

1void n(){new Frame(){{add(new Panel(){public void paint(Graphics g){int i=0;for(String c:"IVoted".split("")){g.setColor(i%2<1?Color.RED:Color.BLUE);g.drawString(c,i++*8,10);}}});setVisible(0<1);}};} allows you to reduce by 12 bytes – user902383 – 2016-11-11T22:26:43.187

1@KevinCruijssen damn you've been helping my answers for 3 years now?! Didn't realize we went this far back ;). – Magic Octopus Urn – 2019-05-15T20:24:28.503

@MagicOctopusUrn Hehe. :) I joined this stackexchange in March 2016, although I doubt I've made many suggestions in the first few months. I mainly received suggestions back then, haha. Now I'm making suggestions myself pretty often (although I still receive them as well of course ;p) – Kevin Cruijssen – 2019-05-15T21:11:24.647

1You can replace setVisible(0<1) by show(), saving 9 bytes. – Thomas Fritsch – 2019-05-15T21:15:55.713

13

PowerShell v2+, 71 59 57 55 bytes

"I Voted"[0..6]|%{Write-Host -b w -n -f (9,12)[$_%2]$_}

Saved two bytes thanks to @flashbang ... saved two more thanks to @ConnorLSW

Takes "I Voted" and turns it into a char-array, then loops |%{...}. Each letter, we execute Write-Host with the -background color to White, -noNewLine, and the -foreground color to be the appropriate index. This leverages the fact that odd ASCII values are Red, while even ASCII values are Blue via $_%2 as the index.

Console colors in PowerShell are very limited, so this is the closest approximation I could get. It would be golfier to use 4 (DarkRed) for the red, but it doesn't look right, so I'm sacrificing a couple bytes for the sake of color accuracy.

Below is the output, followed by the 16 available colors the console can display. Note that the background isn't truly white, since Microsoft in their wisdom opted to have the background colors ever-so-slightly-off from the foreground colors.

Console Output

AdmBorkBork

Posted 2016-11-08T13:00:03.530

Reputation: 41 581

IIRC, in ancient stuff, you had 4 bits for the foreground and 3 bits for the background, so backgrounds could only be the 'dark' colors 0-7. Is the console still following that? – None – 2016-11-08T14:39:49.330

@Hurkyl Kinda. It appears to be based on the EGA color palette, but I'm not sure the historical reasons for PowerShell keeping that scheme. Likely something buried in the Win32 API backwards-compatibility that forced them to only use those 16 colors.

– AdmBorkBork – 2016-11-08T15:03:45.857

It doesn't work if you set the background color to 15? – Random832 – 2016-11-09T07:21:04.543

@Random832 it is for the sake of the white background of the sticker. – geisterfurz007 – 2016-11-09T09:43:22.667

@geisterfurz007, TimmyD, I was asking if you could set the background to "15" rather than "white" [since the actual background in your image appears to be #7] to get a brighter white. But on looking at it more, your whole display looks strange - the borders between the lines in your example and the gray line between "I" and the following space don't make sense if PowerShell is being run in the console - are you using some other tool like ConEmu? If so it doesn't make sense to blame Microsoft for this. – Random832 – 2016-11-09T14:39:42.903

@Random832 Ah. In the code, the background is set to 15. I used white in the 0..15 example just to show the colors. I think this is at least one of the (many) differences between the console and the ISE, as running this in the console is more white, though it's still not 255,255,255 on my computer. – AdmBorkBork – 2016-11-09T15:04:25.757

saved 2 bytes using a nice little loop hack on the string. "I Voted"[0..6]|%{Write-Host -b w -n -f (9,12)[$_%2]$_} – colsw – 2016-11-14T14:40:12.597

13

Bubblegum, 28 bytes

0000000: 938e 3636 ccf5 0492 e6b9 0a40 d224 370c  ..66.......@.$7.
0000010: 2c92 0f66 9780 d9a9 6076 0a00            ,..f....`v..

enter image description here

Does not work online since it uses ANSI color codes for coloring.

a spaghetto

Posted 2016-11-08T13:00:03.530

Reputation: 10 647

Is this a straight-up encoding, or is does it employ some other clever trick? – Conor O'Brien – 2016-11-08T15:56:30.933

2@ConorO'Brien There is no such thing as clever tricks in Bubblegum. To be honest, this answer was mostly a side-effect of the actual answer I'm working on. – a spaghetto – 2016-11-08T15:57:24.207

11

Python, 91 bytes + termcolor

Not gonna win, but posted it for fun.

from termcolor import*
for c in'I Voted':cprint(c,'brleude'[ord(c)%2::2],'on_white',end='')

Half the credit goes to Sp3000.

noɥʇʎԀʎzɐɹƆ

Posted 2016-11-08T13:00:03.530

Reputation: 1 316

2Using ANSI codes should be shorter – TuxCrafting – 2016-11-08T13:32:42.620

@TùxCräftîñg It isn't supported on all platforms, i.e. Windows. – Kade – 2016-11-08T13:34:18.053

3Mind adding an image? – Calvin's Hobbies – 2016-11-08T13:36:53.930

9You can save 5 bytes by changing 'blue' if c else 'red' to 'brleude'[c^1::2]. – Kade – 2016-11-08T13:37:01.577

@Shebang It's even available on DOS, come on... – TuxCrafting – 2016-11-08T13:43:35.147

2You should probably put + termcolor in the title since it's not a standard module. Also: from termcolor import*\nfor c in'I Voted':cprint(c,'brleude'[ord(c)%2::2],'on_white',end='') – Sp3000 – 2016-11-08T13:45:35.357

I assume this is working on other OS than Windows 7. – Kade – 2016-11-08T13:46:47.103

@Shebang It work on Windows 10 at least, and the problem is from the terminal emulator – TuxCrafting – 2016-11-08T13:47:23.873

I think you could save some bytes by changing from termcolor import* to import termcolor as t. I haven't check it on your code, but it usually helps me – Alissa – 2016-11-17T12:10:55.263

8

Python IDLE, 97 96 78 69 bytes

Thanks to DrMcMoylex for shaving off some bytes!

EDIT: Figured out that a direct .write() was 9 bytes shorter

Not really a proper answer, more abuse of a standard theme. IDLE is Python's IDE, and unless it's customized, STDOUT is blue, STDERR is red, and the background is white. So, the following code:

from sys import*
for i in'I Voted':[stdout,stderr][ord(i)%2].write(i)

Prints this:

enter image description here

This works because ord(i)%2 checks the parity of the letter's code point and prints it to ERR/OUT accordingly.

FlipTack

Posted 2016-11-08T13:00:03.530

Reputation: 13 242

8

Jolf, 53 bytes

"<z>I <w>V<z>o<w>t<z>e<w>d<style>w{ΞΩ4blue}z{ΞΩ4red

There are unprintables. Try it here!

Jolf's output is HTML capable. I tried doing something clever like modulus 2 to decide color, but that only wound up longer (around 69 bytes). So, the output is in HTML.

Output:

regular "I Voted"

(larger version)

large "I Voted"

Conor O'Brien

Posted 2016-11-08T13:00:03.530

Reputation: 36 228

8This is terrible you've only saved three bytes over HTML :P – ASCII-only – 2016-11-08T13:41:37.963

@EriktheGolfer It really only works in firefox. – Conor O'Brien – 2016-11-08T15:28:13.180

@ConorO'Brien Oh, I use Chrome. Thanks. – Erik the Outgolfer – 2016-11-08T15:32:32.593

1...aand the HTML answer outgolfed this. – betseg – 2016-11-08T21:05:35.803

Can't blue be written as 00f? – Ismael Miguel – 2016-11-10T19:20:47.723

@IsmaelMiguel No, it would need to be written as #00f. – Conor O'Brien – 2016-11-10T19:46:04.063

8

sh, 61 49 bytes

echo "[47;31;1mI [34mV[31mo[34mt[31me[34md"

Because this contains unprintables, here is a reversible xxd hexdump:

00000000: 6563 686f 2022 1b5b 3437 3b33 313b 316d  echo ".[47;31;1m
00000010: 4920 1b5b 3334 6d56 1b5b 3331 6d6f 1b5b  I .[34mV.[31mo.[
00000020: 3334 6d74 1b5b 3331 6d65 1b5b 3334 6d64  34mt.[31me.[34md
00000030: 22                                       "
I Voted
Xterm(322)

Thanks to 4198 (manatwork) for -12 bytes.

Erik the Outgolfer

Posted 2016-11-08T13:00:03.530

Reputation: 38 134

Why setting the background and foreground colors separately? Start it with [47;31;1m. And the 1 for bold persists until a 0, so no need to set it again and again for each letter. – manatwork – 2016-11-08T15:56:47.973

@manatwork Oh god, I thought you have to re-set it! – Erik the Outgolfer – 2016-11-08T16:00:51.750

If that sh is anything more modern than the old Bourne shell, some parameter expansion may help: s=":1;47;1mI :4mV:1mo:4mt:1me:4md";echo ${s//:/^[[3}. – manatwork – 2016-11-08T16:06:18.263

@manatwork It does not work. It seems it's not more modern. – Erik the Outgolfer – 2016-11-08T16:07:27.220

@manatwork ${VAR/FROM/TO} requires ksh93, bash or zsh, not just “anything more modern than the old Bourne shell”. POSIX requires the # and % parameter expansion modifiers but not /…/ or :…: – Gilles 'SO- stop being evil' – 2016-11-08T21:05:55.213

In a unibyte terminal (i.e. in a non-UTF8 locale), you can use the byte 0x9b instead of the two-byte sequence 0x1b 0x5b (^[ with the high bit set instead of ESC [, likewise ^Z for ESC Z etc.). – Gilles 'SO- stop being evil' – 2016-11-08T21:08:22.487

@Gilles, or yash. Or more. Just tried to use a description instead of enumeration. – manatwork – 2016-11-08T21:13:35.560

8

Python, 99 87 bytes

from turtle import*
up()
for c in"I Voted":color("brleude"[ord(c)%2::2]);write(c);fd(7)

Try it online

mbomb007

Posted 2016-11-08T13:00:03.530

Reputation: 21 944

Mind adding an image? – Calvin's Hobbies – 2016-11-08T22:32:47.323

@HelkaHomba All you need to do it click the link. – mbomb007 – 2016-11-08T22:56:55.267

8

REBOL, 100 90 95 bytes (-7 bytes with REPL for 88)

REBOL[]view layout[style b tt blue white space 0 across b"I"red b b"V"b"o"red b"t"b"e"red b"d"]

In REPL, the initial REBOL[] is not required. That's 7 bytes.

The ungolfed version is:

REBOL[]
view layout[
  ; by default, tt (text) has a grey background and a 2x2 padding
  style b tt blue white space 0
  ; this one doesn't appear in the golfed version as it's slightly shorter to just manually set red everywhere needed
  style r b red

  ; by default, vertical stack panel
  across
  r "I"
  r 
  b "V"
  r "o"
  b "t"
  r "e"
  b "d"
]

On the left, with "space 0x0" added to each text block, on the right, with the default 2x2 padding.

REBOL I Voted
(source: canardpc.com)

Le Canard fou

Posted 2016-11-08T13:00:03.530

Reputation: 711

8

SVG + bzip2, 1807 bytes

A vectorized version of the example image, then compressed with bzip2 to about half (4385 -> 1807 bytes). You can download it here. (direct GitHub Pages link)

BZh91AY&SY!�l�ß�x��>�ߠ/���`    0����Ҁ�D�5��ޠII�T�O!45J??��i�@JzH���
.�M�&�Q�vا����bB���� �쾾�4AV�8�8���)Z�ޣ�j�q}�����?�t�/
�±%��"A����B�X�(␌�[⎺;Z/┐├*��%�␤�       I���Uƒ�Y�9ǝK���B��┤�=���±?�W���
            ��ڰj�?�H��\����^��m�=X�d���>�!C�@�.���9�" DZ+��V1+�;�����58Q���-:�5,HDQŧ`A>����W�+h��>m��G�m�uWv�&�U�|mq�u���?=S�\{(��Z�a�I��G{Cd��;Bz���qX7��?P�@�Jt[w�]����%W���37f���-�iԳ]c��|�;i�k�H��
    sHz��Y�$�.�*�?�ڐ��Us=\뫅6%�Ud�9w���D
                                          ��H��^�Q��P��%n�O����l��+*q�U�"F%��*�     *b�� 
                                         @mP���Z�(ZL`
  bIv⦳�~�F=��>H�Ti����0@≠R≥��T�E��┴��D����␍│��2*◆=└6&⎽M�◆␊?�/�U�����r�.�`gƅ���E'��^��ILPz@���zR&u$��l^�U�n�'O\�Xj+چ�o�*�O�w��JP8���]���r��k=��N�b�ƵpM�8|���=7���N��W�M(����*�E�DݐT��Zi�v"���49�J�0}�F�*x�K���P��⎼*�������6[G,4� ү)UUT␍��%4D��Թ␉��⎻�8�CZ_3ɷwW�9��-&�Ov�a՜
�'ӥtߢ�>��^�m-������c�]:��*��2��촄Ujr�?"�J�"���DE�f?┴⎻��␍3·└���Ԉ��? ׌�5|ᫎ���|DO���%�4Ư`W�ƐV/=�]V`gˇ��^Z��cP������.{������6   o.*�sɽ���U?E.3�,�H$�{�?
             �%�0��2    ��n�C!%�>��]��
#߽v�E��K��?X|���5�ΰ@>A;#J���,��Q��$���ݨ��^����7�g�Xn�k����d욒�`fQ/7��vh|�ȥ*^M
                            �[����׈���i�I��    $��4��
  Y��`V.��ح��?�eT����5K˱~�瞯r�fL^I �#b�@�pBƞ���V`5��a��qH���Ş�t�V3��┌���T���1␉�␍$5��@T␤$�>$����π���S�[۸£�[ȟ␋CO≥�ގ^��>��]E�A��┘���I(�㴨Z�J'��:�-_┤±�K␌�ۓ#:�?m��^�Z�+�����G
�k�t�O��SD�4����^o��Z�n���6M�)!��r��w�3\�R����
�X6<#����.��p� Cj"�2�ĭ�*h�S�`}�L���C?�� �چZc'kG��

Not gonna win, but posted it for fun.

noɥʇʎԀʎzɐɹƆ

Posted 2016-11-08T13:00:03.530

Reputation: 1 316

1bzip2 is not a programming language. – Peter Taylor – 2016-11-08T20:55:33.460

3

@PeterTaylor Per meta rules, it doesn't have to be a programming language. (http://meta.codegolf.stackexchange.com/a/10426/41088

– noɥʇʎԀʎzɐɹƆ – 2016-11-08T20:56:08.803

1should post a reversible xxd of the file – cat – 2016-11-08T22:04:48.893

try using brotli for even more compression – Display Name – 2016-11-09T09:03:12.443

4If you're really interested in golfing this, it would probably make more sense to just create the SVG by hand with a couple text elements set to the right colors. Here's a starting point: <svg xmlns="http://www.w3.org/2000/svg"><text fill="blue"><tspan fill="red">I</tspan> V<tspan fill="red">o</tspan>t<tspan fill="red">e</tspan>d</text></svg> Note that this actually renders it outside the printable area and has no background color. Like I said, it's just a start. – trlkly – 2016-11-09T11:45:27.253

Are compression algorithms allowed? Certainly, it is not allowed to compress the source code in other languages. – SE - stop firing the good guys – 2016-11-11T13:32:26.993

8

C, 65 bytes

i;main(c){for(;c="I Voted"[i++];printf("\33[3%dm%c",c&1?1:4,c));}

or, more accurately:

i;main(c){for(i=90;c="\0.noitcele ym saw ti fi enod evah dluow I sseug I tuB .hsitirB ma I esuaceb ,etov ton did I"[i--];printf("\33[3%dm%c",c&1?1:4,c));}

Uses the same bash colour technique used by betseg, but with the octal escape sequence instead of hex, and with Sp3000's observation that all odd codepoints are red.

Leaves the terminal in blue. Reset with:

printf "\33[0m";

Dave

Posted 2016-11-08T13:00:03.530

Reputation: 7 519

If || works in C like it does in JavaScript (x||y -> x?x:y), you could do c&1||4 to save a byte. – ETHproductions – 2016-11-08T21:45:33.460

1@ETHproductions doesn't work that way in C. While || and && are short-circuiting, they always return 1 or 0, regardless of the values involved. – Dave – 2016-11-08T21:50:25.413

@Dave I learned something today... – cat – 2016-11-09T02:56:33.517

This doesn't set the background color. Also, you could use a literal escape character instead of \33 to save two bytes, if that isn't against the rules somehow. – None – 2016-11-10T06:51:33.157

@yellowantphil this assumes the default terminal background is set to white (since the challenge says it just needs to be possible to have it on a white background). In fact in OS X, the terminal is black-on-white out-of-the-box. – Dave – 2016-11-10T08:15:05.393

8

Node, 57 55 41 bytes

console.log("q47;91mI  o eHHHHq94mV t d")

Replace each q with the literal byte 1B and H with byte 08 before running.

Here's how it looks in the ConEmu terminal emulator on my Windows computer (zoomed in):

enter image description here

ETHproductions

Posted 2016-11-08T13:00:03.530

Reputation: 47 880

What terminal emulator is that!? – cat – 2016-11-09T19:05:31.177

1

@cat ConEmu: https://conemu.github.io/

– ETHproductions – 2016-11-09T20:20:03.713

7

Perl, 57 + 17 = 74 bytes

Run with -MTerm::ANSIColor

sub c{color$a++%2?blue:red}say c,"I ",c,V,c,o,c,t,c,e,c,d

Your terminal may be blue at the end (append ,c("reset") at the end of the code to restore it to normal).

By default, terminals are usually black background, but they can be optionally changed to white, which I personally don't think is cheating.

With picture: enter image description here

Gabriel Benamy

Posted 2016-11-08T13:00:03.530

Reputation: 2 827

7

PHP, 199 201 151 bytes

This script outputs image to standard output. Updated thanks to manatwork

imagefill($i=imagecreatetruecolor(99,99),0,0,2**24-1);foreach([I,' ',V,o,t,e,d]as$k=>$e)imagestring($i,2,$k*9,0,$e,!$k|$k&1?0xFF0000:255);imagepng($i);

Run it in the command line like this:

php -d error_reporting=0 -r "imagefill($i=imagecreatetruecolor(99,99),0,0,2**24-1);foreach([I,' ',V,o,t,e,d]as$k=>$e)imagestring($i,2,$k*9,0,$e,!$k|$k&1?0xFF0000:255);imagepng($i);" > output.png

Output:

enter image description here

Kodos Johnson

Posted 2016-11-08T13:00:03.530

Reputation: 776

2

Skip the header() call. Your code works fine run from command line too. As error_reporting's default value not shows notices, is generally acceptable to not quote your string literals. Or if you not like that, str_split("I Voted") is still shorter than enumerating the characters separately. And move the assignment to $i to its first usage.

– manatwork – 2016-11-09T09:08:55.817

1~2**24 seems to work instead of 0xFFFFFF. Not sure if this is valid for all architectures. If not, 2**24-1 should be portable. – manatwork – 2016-11-09T09:19:12.440

@manatwork awesome thanks. That got it down to 152. I tried ~2**24 and 2**24-1 but I got errors. I don't even know how those work. – Kodos Johnson – 2016-11-09T18:49:42.910

Probably your PHP is older than 5.6.0: “Added an exponentiation operator (**).” – PHP changelog. Same as pow(), but handier for golfing. http://pastebin.com/jFn6ahFk

– manatwork – 2016-11-09T18:57:19.773

Oh I see. Well since php 5.5 seems to be unsupported, I'll use your solution. Now it's 150. Thanks again. – Kodos Johnson – 2016-11-09T19:06:45.447

~2**24 is not valid for x64 builds. 2**24-1 works correctly. – Quolonel Questions – 2016-11-11T13:54:44.320

7

Xamarin.Forms C#, 317 313 bytes

using Xamarin.Forms;public class A:Application{public A(){var s=new StackLayout{BackgroundColor=Color.White,Orientation=(StackOrientation)1,VerticalOptions=LayoutOptions.End};foreach(var c in"I Voted")s.Children.Add(new Label{Text=c+"",TextColor=c%2<1?Color.Blue:Color.Red});MainPage=new ContentPage{Content=s};}}

VerticalOptions=LayoutOptions.End is needed for iOS, otherwise the text will be overlayed by status bar. No problem on Android so can save 34 bytes including comma.

Edit: 2016-11-14: -4 bytes

Ungolfed

using Xamarin.Forms;
public class A : Application
{
    public A()
    {
        // Make a horizontal StackLayout for labels
        var s = new StackLayout
        {
            BackgroundColor = Color.White,
            Orientation = (StackOrientation)1,   // StackOrientation.Horizontal
            VerticalOptions = LayoutOptions.End
        };
        foreach(var c in "I Voted")
            // Make a new label for each letter, then add to StackLayout
            s.Children.Add(new Label
                {
                    // Cast char to string
                    Text = c + "",
                    // Happens that 'I', 'o', and 'e' are all odd in ASCII, and 'V', 't', and 'd' are all even :)
                    TextColor = c%2<1 ? Color.Blue : Color.Red   
                }
            );
        // Set app MainPage to be a new ContentPage, where the content is the StackLayout above
        MainPage = new ContentPage { Content = s };
    }
}

Link Ng

Posted 2016-11-08T13:00:03.530

Reputation: 593

1Well that's a new kind of idea. +1 – Addison Crump – 2016-11-09T07:54:27.097

7

x86 machine code + DOS + BIOS, 25 bytes

Hexdump:

b8 02 13 b1 07 bd 0b 01 cd 10 c3 49 74 20 74 56
71 6f 74 74 71 65 74 64 71

Assembly code (suitable as input to debug.com, so all numbers are hexadecimal):

mov ax, 1302
mov cl, 7
mov bp, 10b
int 10
ret
db 'It tVqottqetdq'

It uses a BIOS routine to output the string to the display memory. The string will appear at a "random" position on screen (see below), like this:

screenshot

The string contains the letters I V o t e d, interleaved with "attributes"

74 74 71 74 71 74 71

that specify the colour of the letters. Here 7 as the most significant digit means "white background", and the least significant digit specifies the foreground (1=blue; 4=red).

The display position of the string is specified by the dx register. As mentioned here, the initial value of this register is equal to the value of the cs register. And the value of that one is the first available address in memory, after DOS is loaded.

The size of DOS is typically less than 64K, that is, the segment address of the loaded user's program is less than hexadecimal 1000. So the output will appear somewhere around the first 16 lines of text on the display. In my example, it appeared at line 8 (the upper half of dx, called dh, is equal to 8).

The low half of dx, called dl, contains the column at which the text is output. Experiments show that BIOS doesn't check overflow, so it doesn't matter if dx asks for output at e.g. column 100.

anatolyg

Posted 2016-11-08T13:00:03.530

Reputation: 10 719

clever, short, and really intuitive. – tuskiomi – 2016-11-14T21:46:54.000

6

BASIC (zx spectrum), <30 bytes

All right, for those who wanna golf and see my most BASIC program – just read from here, but if VOTING is what take you here, like me – scroll down for a bit.


Well… I thought that VOTING is more important than anything, but sadly moderators (and community) still think that the most important thing is GOLFING. So, I’m not disappointed, and made for you a really small line of BASIC code that works on Sinclair ZX Spectrum, my very first personal computer and my first programming language!

Here is the program:

1 PRINT "{BRIGHT 1}{INK 2}I {INK 1}V{INK 2}o{INK 1}t{INK 2}e{INK 1}d"

But it’s not a real spectrum code, it is just a text that should be feed to BAS2TAP compiler.

70 ASCII-chars (including the end of line).

Actually, it produces a .TAP file. To easily run it, I give you the encoded version:

data:text/cmd;base64,EwAAAFZPVEUgICAgICAdAAAAHQAIHwD/AAEZAPUiEwEQAkkgEAFWEAJvEAF0EAJlEAFkIg0r

This URI is 93 characters in Base64, but the real TAP file size is 54 bytes.

Visit this online emulator and press “Open file” (4-th button, «folder»), flip “Spectrum 128K” to “Spectrum 48K”, paste that "data:text…" to “Load from web:” field and finally hit “Open URL”!

But my program is even smaller. You see, Spectrum uses one byte for language keywords and control codes.

So PRINT (and spaces around it) is just one “char” from ZX’s point of view. If I will not count line number “1” (piece of code could be executed directly) and final ENTER, then program dump looks like this:

Offset   |  0  1  2  3  4  5  6  7   8  9 10 11 12 13 14 15 |
---------+--------------------------------------------------+-----------------
00000000 | F5 22 13 01 10 02 49 20  10 01 56 10 02 6F 10 01 | х"....I ..V..o..
00000016 | 74 10 02 65 10 01 64 22                          | t..e..d"

24 bytes

Color codes are represented as two byte sequences. But they could be written as one logical character from the keyboard!

Since we don’t need to restore colors after line, my logical length is this: “1” as line number; keyword “PRINT” (typed with only one keypress); quote char. Then comes BRIGHT mode (to make background pure white) and BLUE ink. Then type all letters with according color (can switch to RED directly). And a final quote. That way, I got 18.

Also we can count actual keystrokes that are needed to write this program to Spectrum! Go here.

Ctrl key stand for SYMBOL SHIFT and Shift stand for CAPS SHIFT. The combination “Ctrl+Shift” will put the cursor in "E" mode and back, so don’t hold it for long.

To type my golfing, press this key sequence:

1 P CTRL+P CTRL+SHIFT 9 CTRL+SHIFT SHIFT+2 SHIFT+I SPACE CTRL+SHIFT SHIFT+1 SHIFT+V CTRL+SHIFT SHIFT+2 O CTRL+SHIFT SHIFT+1 T CTRL+SHIFT SHIFT+2 E CTRL+SHIFT SHIFT+1 D CTRL+P ENTER R ENTER

We have as much as 28 keystrokes!

0 OK, 1:1


VOTING!

Yesterday (two days ago, actually…) was December 4th, 2016, Election Day in the Republic of Uzbekistan.

Since I am an Uzbekistan citizen eligible to vote, then I went out and voted before answering this challenge.

Than I returned home and wrote this absolutely regular C code, that has nothing special:

///\\ http://codegolf.stackexchange.com/questions/98968 //\\\
program{:} GoOutAndVote;{&call:vote - %~nx0 & goto:eof
/*}{$apptype console} uses windows;
var c,i,k,r,l:integer;(*/
#include<windows.h>//#echo off
#include<stdio.h>//#cls
typedef struct{int z;} Z;
#define chr//#call:vote f 0 113 202 140 255 0
#define dec//#call:vote 8 0 0 0
#define then//#call:vote a 0 255 192 192 255 0 127 72 48
#define And &//#call:vote f 0 62 65 62
#define div / //#call:vote a 0 127 64 64
#define Or |1|//#call:vote f 0 62 65 62 0
#define cardinal//#call:vote a 3 62 96 63 0
#define inc(a) a++//#call:vote f 62 65 62 0
#define p(n,v) n=v//#call:vote a 62 97 65 0
#define repeat do{//#call:vote f 62 65 62 0
#define Not(c) (!c)//#call:vote a 127 89 103 0
#define write(t) putc(t,stdout)//#call:vote f 63 68 68 63
#define begin int main(){//#call:vote a 0 3 62 96 63 0
#define until(x) }while(!(x))//#call:vote - -
#define end }int z(Z z){z//#goto:eof
int c,i,k,r,l,a[]={13,25,5,-15,-1,-100,0};/*)
var a:array[0..15] of integer=
(24,9,-78,47,39,-7,11,-90,34,35,13,-14,5,4,-109,0);
procedure p(var n:Integer;v:Integer);begin n:=v;end;//*/
begin p(i,0);p(c,0);p(r,73);p(k,249);p(l,6);
dec(c,1);dec(r,-4);repeat
dec(l,-(c And 2)div 2);
if((i<3)Or(i>3)And(i<12)Or(i>12))then inc(c);
SetConsoleTextAttribute(
GetStdHandle(cardinal(-11)),k+(c And 1)*3);
write(chr(r));if Not(i>0)then write(' ');
if Not(c>0)then write(chr(8));
p(r,r+a[i]);if Not(r>0)then p(k,4);
inc(i);until(i-l>0);end. z=0;}/*
:vote
if %1==- set d="%temp%\GoOutAndVote\"
if %1==- rmdir /s /q %d% 1>nul 2>nul
if "%2"=="-" goto:eof
if %1==- mkdir %d% 1>nul 2>nul
if %1==- for /f "tokens=2 delims=#" %%i in (%2) do %%i
pushd %d% & set f=%1
:shift
shift & set a=%2
if "%1"=="" popd & goto :eof
set /a i=8 & set s=!
:goto
set /a "b=a&1,a>>=1" & set c=#
if %b%==0 set c=-
set /a i-=1 & set s=%s%%c%
if not %i%==0 goto:goto
echo. >%s%
findstr /v /a:0%f% ! !*
del %s% & goto:shift
\\\*alekuskslim*///

I followed this unofficial rule, vowels are red, consonants are blue. This thing should compile with BCC32 or, maybe MS Visual Studio (VC 2008 tested). Also, online C compiler did the work, just make sure to target Windows OS.

But you know what? Here, “I Voted” really means nothing, because it must be in Uzbek. So, let’s take a chance and compile it under Delphi with DCC32:

I Voted / Men Ovoz Berdim Great, isn’t it? (again, possible online; but, just like previous, it will not show the output, encourages you to download and test .exe manually instead)

…not as quite as it can be. Thing is, I’m Russian, and that “Men Ovoz Berdim” (like «I gave my vote») does not fully express my exciteness about it. Wait, this code little reminds… a WinCmd Batch script!? Why, let’s try this too:

Я Проголосовал YAY! That’s what I call the VOTE. “Я Проголосовал” (read as «ya progolosoval») is printed vertically as kinda ACSII art, in white+green – which also are colors from Uzbekistan’s Flag (background is black intentional: I thought, enough of negative!)

OK, if someone is interested, I can explain how it works. This polyglot is based on:

  • //……\ C-comment, which makes next line to be a comment too. Delphi will see only first line commented. Moreover, it will happily ignore everything after the final end.
  • {…} is multiline comment in Delphi, but /*…*/ in C. Also, (*…*) – this is a Delphi comment too, easy allowing ninjas with …(*/…/*)…(*/….
  • Batch will ignore errors with wrong filenames and everything, but execute command after `&`. It can jump to a label located at the end of file and it is possible to read and parse the source code as strings to execute only some parts of it.

If I replace and shrink C code comments to "_", the program will look like this:

//_\
_
/*_
_*/
#include<windows.h>//_
#include<stdio.h>//_
typedef struct{int z;} Z;
#define chr//_
#define dec//_
#define then//_
#define And &//_
#define div / //_
#define Or |1|//_
#define cardinal//_
#define inc(a) a++//_
#define p(n,v) n=v//_
#define repeat do{//_
#define Not(c) (!c)//_
#define write(t) putc(t,stdout)//_
#define begin int main(){//_
#define until(x) }while(!(x))//_
#define end }int z(Z z){z//_
int c,i,k,r,l,a[]={13,25,5,-15,-1,-100,0};/*_
_*/
begin p(i,0);p(c,0);p(r,73);p(k,249);p(l,6);
dec(c,1);dec(r,-4);repeat
dec(l,-(c And 2)div 2);
if((i<3)Or(i>3)And(i<12)Or(i>12))then inc(c);
SetConsoleTextAttribute(
GetStdHandle(cardinal(-11)),k+(c And 1)*3);
write(chr(r));if Not(i>0)then write(' ');
if Not(c>0)then write(chr(8));
p(r,r+a[i]);if Not(r>0)then p(k,4);
inc(i);until(i-l>0);end. z=0;}/*
_
_*///_

After #define substitution we got:

#include<windows.h>
#include<stdio.h>
typedef struct{int z;} Z;
int c,i,k,r,l,a[]={13,25,5,-15,-1,-100,0};
int main(){ i=0;c=0;r=73;k=249;l=6;
do{
if((i<3)|1|(i>3)&(i<12)|1|(i>12))c++;
SetConsoleTextAttribute(
GetStdHandle(-11),k+(c&1)*3);
putc(r,stdout);if(!i>0)putc(' ',stdout);
if(!c>0)putc(8,stdout);
r=r+a[i];if(!r>0)k=4;
i++;}while(!(i-l>0));}int z(Z z){z . z=0;}

My a[] array is a difference between code points for characters in target string. First condition (and Char#8) is for Delphi and always evaluates to true. Param to SetConsoleTextAttribute is flipped after every iteration, but immediately following the first letter one space is printed. After last iteration the sum of array will be zero, and color is changed back to black+gray before returning control out of the program. Last sleepy “ZZZ” hacking is there to get rid of the dot after Delphi’s "end.".

Now, Delphi sees this:

//_
program{:} GoOutAndVote;{_
_}{$apptype console} uses windows;
var c,i,k,r,l:integer;(*_
_*)
var a:array[0..15] of integer=
(24,9,-78,47,39,-7,11,-90,34,35,13,-14,5,4,-109,0);
procedure p(var n:Integer;v:Integer);begin n:=v;end;//_
begin p(i,0);p(c,0);p(r,73);p(k,249);p(l,6);
dec(c,1);dec(r,-4);repeat
dec(l,-(c And 2)div 2);
if((i<3)Or(i>3)And(i<12)Or(i>12))then inc(c);
SetConsoleTextAttribute(
GetStdHandle(cardinal(-11)),k+(c And 1)*3);
write(chr(r));if Not(i>0)then write(' ');
if Not(c>0)then write(chr(8));
p(r,r+a[i]);if Not(r>0)then p(k,4);
inc(i);until(i-l>0);end. _

"{:}" after "program" parsed as comment, but potentially needed for Batch. Here I have another a:array of char-code differences. Function p(name,value) is to do name:=value, since I couldn’t figure it out how to make C to eat all those := ("#define :" didn’t work out). Algorithm is the same, but here all spaces are hardcoded as characters (I mean, numbers), and two color changes at vowels _O («red» space + red O) and consonants rd are combined in that first long condition. Length "l" is calculated somewhat tricky… Actually I just changed and compiled stuff at random until it worked! (Hey, isn’t my chr(8) there only for sake of cancelling the space that is printed just a line ago!? Oh, I might do that better..)

All right, here comes batch!

Firstly, it tries to run ///\\.exe, but it’s impossible. Then it find out that program{:} is a forbidden name for an application, but sees &call:vote - %~nx0 & goto:eof and transfers control to ":vote" label with %1 = "-", %2 = "(name of current script)". Wow, %~snx0 might be better… anyway, DON’T EVEN TRY to execute this file with spaces in the name, or path that has something except letters and digits…

Then, beginning from :vote there is just pure batch code:

if %1==- set d="%temp%\GoOutAndVote\"
if %1==- rmdir /s /q %d% 1>nul 2>nul
if "%2"=="-" goto:eof
if %1==- mkdir %d% 1>nul 2>nul
if %1==- for /f "tokens=2 delims=#" %%i in (%2) do %%i
pushd %d% & set f=%1
:shift
shift & set a=%2
if "%1"=="" popd & goto :eof
set /a i=8 & set s=!
:goto
set /a "b=a&1,a>>=1" & set c=#
if %b%==0 set c=-
set /a i-=1 & set s=%s%%c%
if not %i%==0 goto:goto
echo. >%s%
findstr /v /a:0%f% ! !*
del %s% & goto:shift

It needs empty temp directory to create files with special name, so to make it sure, I must recursively delete stuff… But don’t worry, it will not touch anything that does not belong to it. Main script loop is the parsing of script itself with FOR loop. It looks for strings with two "#" (it C’s defines and includes) and executes everything past those. So there are several other calls to voting:

echo off
cls
call:vote f 0 113 202 140 255 0
call:vote 8 0 0 0
call:vote a 0 255 192 192 255 0 127 72 48
call:vote f 0 62 65 62
call:vote a 0 127 64 64
call:vote f 0 62 65 62 0
call:vote a 3 62 96 63 0
call:vote f 62 65 62 0
call:vote a 62 97 65 0
call:vote f 62 65 62 0
call:vote a 127 89 103 0
call:vote f 63 68 68 63
call:vote a 0 3 62 96 63 0
call:vote - -
goto:eof

Firstly, we disable echoing and clear screen (there were several error messages!) and then execute a bunch of commands. Last one "- -" is to delete temp folder and exit script. But others have in %1 color code, and next arguments – bytes that represent numerical rows. Each row is a byte and consists of eight "-" (zero bit) or "#" (one bit). All rows will be printed with the same color, allowing grouping. Previous code has a bit-parser that converts numbers to printable rows strings. Then I put that string as a name of new file, and point findstr.exe to it, which will print that name in chosen color (with ":" at the end).

Well. The last thing I can do is to give you the full build script. With all required compilers and stuff… If you really want to execute it yourself and make sure that everything will work perfectly, here is my challenge! Download these three small files:

They are just regular archives, again nothing unusual. But, to make it more rar-compatible, you should open each one in MSPaint and save as 24-bit Bitmap. Then rename all three as I showed (.part0*.rar) and unpack the first one with WinRar, do not use spaces and other weird characters in file/directory names. I believe, soon you will have BUILD.CMD that makes everything, just run it!

Oh, hope I didn’t mess up anything. Also successfully edited this answer after I got enough reputation, thank you guys!

aleksusklim

Posted 2016-11-08T13:00:03.530

Reputation: 69

2Holy hell, this might be the craziest (as in crazy good) thing I've seen on PCCG. You got my upvote! – Ave – 2016-12-05T21:10:12.183

3Welcome to PPCG! I think this is the best first post I've ever seen! – Rɪᴋᴇʀ – 2016-12-05T21:13:23.030

2This is an invalid answer, so it will probably be nuked by the moderators, but wow, just freakin wow – TuxCrafting – 2016-12-05T21:22:29.563

This is an invalid answer – why? C-part is perfectly followed the rules of challenge. Maybe It’s just… not so short ^^ – aleksusklim – 2016-12-05T21:30:11.873

3@aleksusklim This challenge is a [tag:code-golf], so the goal is to make the shortest code in a language. Here, there is no need to make a polyglot, so this answer is considered not golfed, so invalid. – TuxCrafting – 2016-12-05T21:32:03.970

1

I upvoted this to support clever golfing, even though this answer pushes the boundaries of what's asked for in the challenge. Welcome to PPCG!

– AdmBorkBork – 2016-12-05T21:43:58.940

This would make for a great blog post, but answers to a challenge must make effort to meet the winning criterion, so this doesn't make a good answer. – trichoplax – 2016-12-05T22:42:11.897

Relevant meta discussion: What additional information should be allowed in a submission?

– Dennis – 2016-12-07T06:12:41.860

6

Qbasic, 137, 126, 124, 122, 115, 114, 113 bytes

a$="I m C n d a ":b$=" '   a a i n"
FOR i=1TO 12
c$=MID$(a$,i,1)
IF c$<>" "THEN
COLOR 4,7:?c$;
ELSE
COLOR 7,4:?MID$(b$,i,1);
ENDIF
NEXT

:) And the real program

a$="I  o e":b$="  V t d"
FOR i=1TO 7
c$=MID$(b$,i,1)
IF c$=" "THEN COLOR 4,7:?MID$(a$,i,1);ELSE COLOR 1:?c$;
NEXT

Output:

enter image description here

anonymous2

Posted 2016-11-08T13:00:03.530

Reputation: 421

5

Processing, 83 85 83 bytes

Had to increase byte count to include spaces to avoid overlapping letters

Then I reduced byte count by changing the positions and removing spaces

Processing is basically Java, but more artistic and less verbose (emphasis on less verbose).

background(255);fill(#ff0000);text("I   o e",2,9);fill(#0000ff);text("V  t d",9,9);

Explanation:

background(255); //sets background colour to white
fill(#ff0000); //setting the text colour to red
text("I   o e",2,9); //Display text "I   o e" (in red) at position (2,9) [Origin is top left]
fill(#0000ff); //set the text colour to blue
text("V  t d"); //Display text "  V  t d" (in blue) at position (9,9)

enter image description here

user41805

Posted 2016-11-08T13:00:03.530

Reputation: 16 320

@sanchises I don't know how to fix it yet – user41805 – 2016-11-08T14:21:36.003

@sanchises I tried it, but that just messes things up even more so – user41805 – 2016-11-08T14:23:06.597

@sanchises Done! – user41805 – 2016-11-08T14:41:25.687

Could you try tabs (\t) instead to try and save bytes? – Artyer – 2016-11-08T21:20:34.033

@Artyer The tabs don't help, I've tried. – user41805 – 2016-11-09T05:25:54.140

5

Bash, 61 bytes

b="\e[34m";r=${b/4/1};echo -e ${r}I ${b}V${r}o${b}t${r}e${b}d

enter image description here

with white background 61 + 9 byte:

b="\e[34m";r=${b/4/1};echo -e "\e[107m"${r}I ${b}V${r}o${b}t${r}e${b}d

بارپابابا

Posted 2016-11-08T13:00:03.530

Reputation: 159

Could you set the background to white, please? – Paŭlo Ebermann – 2016-11-08T20:23:14.637

@PaŭloEbermann , done – بارپابابا – 2016-11-08T20:39:17.013

oddly, in my terminal program (ROXTerm), the first one is on a white background, while the second one has a slightly light grey background. – trlkly – 2016-11-09T11:21:02.563

@trlkly the first one doesn't set any background, so it will show with the default background. (Which would be a light green for me, and seemingly a white for you.) The second one selects the "white" background from the palette, which looks white here, but can be configured in most terminals. – Paŭlo Ebermann – 2016-11-09T18:32:03.200

5

Quake 3/Live Colour Codes (19 characters)

^1I ^4V^1o^4t^1e^4d

Thomas Jones

Posted 2016-11-08T13:00:03.530

Reputation: 151

6Add an image showing your output – user41805 – 2016-11-10T14:37:45.687

4

Emmet, 49 62 61 68 bytes

a{I}+r{V}+a{o}+r{t}+a{e}+r{d}+style{r{color:red}}
r{I&nbsp;}+w{V}+r{o}+w{t}+r{e}+w{d}+style{r{color:red}w{color:#00f}}

Running this will generate the following HTML code:

<w>I</w> <r>V</r> <w>o</w> <r>t</r> <w>e</w> <r>d</r> <style>r{color:red}w{color:00f}</style>

And it looks like this:
1

It's using the blue of links, so the only color that needs to be set is red, saving us some bytes.

DecentM

Posted 2016-11-08T13:00:03.530

Reputation: 41

That's a cool approach. Unfortunately, I don't think it counts. The OP specified that is not allowed

– James – 2016-11-08T21:14:08.000

I managed to miss that, removed links and added 13 bytes. – DecentM – 2016-11-08T21:24:49.167

OK, thanks. BTW, welcome to the site! – James – 2016-11-08T21:25:25.677

1I like the answer, and I would let it slide, but you may want to add a space between the I and V. you can also change 'blue' to 0ffto save a byte! – tuskiomi – 2016-11-08T21:37:36.817

I did have a space in there at first, but Emmet adds a newline after every element. Because of this, adding a space would not increase the distance between the two letters. – DecentM – 2016-11-08T21:46:40.330

Sorry but the words should be distinct. You don't need a space char necessarily, but make it clear there are two words. – Calvin's Hobbies – 2016-11-08T22:29:19.453

Also, the colors are reversed. – Calvin's Hobbies – 2016-11-08T22:31:18.360

Thanks, I suppose I can just add a non-breaking space, fattening it to 68 bytes. – DecentM – 2016-11-08T22:56:43.770

@DecentM you could replace &nbsp; with an Alt+255 character code if you wanted to, right? – tuskiomi – 2016-11-08T23:01:26.697

Unfortunately, no. Emmet replaces it with a regular space – DecentM – 2016-11-08T23:03:23.673

4

Encapsulated Postscript, 103 bytes

Copy-paste and save as .eps to display it:

%!PS
/run{100 500 moveto setrgbcolor show}def/Courier 60 selectfont(I  o e)1 0 0 run(  V t d)0 0 1 run

Explanation:

/run{100 500 moveto setrgbcolor show}def 

Declares a procedure "run" that expects to have in the stack a string and 3 rgb values. The procedure moves the cursor to 100 500, takes the 3 rgb values from the stack to set the color, then takes the string from the stack and displays it,

/Courier 60 selectfont

Sets the Courier font with size 60

(I  o e)1 0 0 run

Puts the string and the 3 rgb componets in the stack and calls "run"

yms

Posted 2016-11-08T13:00:03.530

Reputation: 141

4

Printf (in sh), 49 44 bytes

Sad to see no one has used printf, only echo. (See Why is printf better than echo?)

:)

printf '\e[47;1;31m%s\e[34m%s' I\  V o t e d

enter image description here

Thanks to matatwork for helping shave off five bytes. :)


As noted in the comments, two more bytes could be shaved off by using literal escape characters rather than \e in both places where that appears.

(I've chosen not to update the screenshot, and of course can't include literal escape characters in the code anyway. I don't know if I should reduce the byte count to 42 bytes, since I didn't make those updates.)

Wildcard

Posted 2016-11-08T13:00:03.530

Reputation: 153

My comment is valid for this one too.

– manatwork – 2016-11-10T10:09:28.707

@manatwork, thanks! See any other way to reduce it down? – Wildcard – 2016-11-10T10:19:55.923

Only the usual one of using literal escape character instead of \e. In terminal press Ctrl-V, Esc – will appear ^[ but is a single character. – manatwork – 2016-11-10T10:28:53.563

@manatwork, ah, that would be codegolf indeed. I think I'll pass on updating the screenshot and code, but I'll include a note. Thanks! – Wildcard – 2016-11-10T11:01:24.990

4

IRC - 19 bytes

4I 2V4o2t4e2d

Here it is with the nonprintables escaped, UNIX style:

^C4I ^C2V^C4o^C2t^C4e^C2d

xxd output:

00000000: 0334 4920 0332 5603 346f 0332 7403 3465  .4I .2V.4o.2t.4e
00000010: 0332 64                                  .2d

This makes use of IRC coloring, which uses ASCII character 03 and a colour palette.

I didn't vote though, being a non-USAian

detuur

Posted 2016-11-08T13:00:03.530

Reputation: 141

3

Geometry Dash, 2 objects/276 bytes

Raw text that the level is stored as:

H4sIAAAAAAAAE6WPzQrCMBCEX2iFnc1PU8RDexGPUvC66EWkvoDgw5tkKyJYtHjIDJlhPpJxcImgEoJKVVcVFsEyWOh1BY0KZtZGoQhFkrImxR3ZJZfyGwL_I9qPiIVfES37TyDIC8TfMGEWw0teE2cwNHZwxMWCWTTzlDVSLseusWiyVGxwbb1JVSPUovNVrQWbgXgNajNUCDGQI3CgNuPJo0gGHHEsB-RAw9CdT7f--hqlZhoJ8vU5WkHedodLz7vtfrN-APfUD_t-AgAA

Level editor

enter image description here

Object count in the top-left

enter image description here

This is made by converting RGB to Geometry Dash's version of HSL (in Geometry Dash its hue, saturation, and brightness), and coloring "V t d" blue (hue -120, saturation 1, and brightness 0) and "I o e" red (hue 0, saturation 1, and brightness 0).

MilkyWay90

Posted 2016-11-08T13:00:03.530

Reputation: 2 264

How many bytes is this? Surely this level is saved somewhere as a file. – Jo King – 2019-08-15T23:13:13.093

@JoKing Sure, I'll check. – MilkyWay90 – 2019-08-15T23:16:28.947

@JoKing Updated. – MilkyWay90 – 2019-08-15T23:28:23.043

I never expected to see this game on this SE. Very creative – Belhenix – 2019-08-16T17:24:56.093

@Belhenix I have other submissions in Geometry Dash – MilkyWay90 – 2019-08-16T17:55:15.473

1@Belhenix You can see other answers by typing in is:answer "Geometry Dash" into the search bar – MilkyWay90 – 2019-08-16T17:57:37.530

3

Mouse2002, 84 bytes

"[47;31;1mI "#B,86;#R,111;#B,116;#R,101;#B,100;$B1%c:"[34m"c.!'@$R1%c:"[31m"c.!'@

Ungolfed:

"[47;31;1mI " #B,86; #R,111; #B,116; #R,101; #B,100;


$B 1% c: "[34m" c. !' @
$R 1% c: "[31m" c. !' @

A hexdump of the golfed code (note the unprintables), reversible with xxd -r:

00000000: 221b 5b34 373b 3331 3b31 6d49 2223 422c  ".[47;31;1mI"#B,
00000010: 3836 3b23 522c 3131 313b 2342 2c31 3136  86;#R,111;#B,116
00000020: 3b23 522c 3130 313b 2342 2c31 3030 3b0a  ;#R,101;#B,100;.
00000030: 0a0a 2442 3125 633a 221b 5b33 346d 2263  ..$B1%c:".[34m"c
00000040: 2e21 2740 0a24 5231 2563 3a22 1b5b 3331  .!'@.$R1%c:".[31
00000050: 6d22 632e 2127 40                        m"c.!'@

enter image description here

cat

Posted 2016-11-08T13:00:03.530

Reputation: 4 989

3

SVG, 71 bytes

This may not parse as an .svg file, but it works if you save it as html.

<svg letter-spacing=8><text y=20 fill=red>I oe<tspan x=16 fill=blue>Vtd

y6nH

Posted 2016-11-08T13:00:03.530

Reputation: 31

3

Python 2 (or 3), (75 bytes)

I Voted

a="\033[3%sm"
r,b=a%"1;47",a%4
print(r+"I "+b+"V"+r+"o"+b+"t"+r+"e"+b+"d")

Resized my terminal font size to 72 for a bigger picture, outputs in colour in most terminals.

thesketh

Posted 2016-11-08T13:00:03.530

Reputation: 31

If you allow Python 2, you can save a byte by replacing print(...) with print ...; you can save another byte by replacing \033 with \33. – Jonathan Frech – 2017-09-06T13:13:21.973

3

C#, 262 201 180 170 166 bytes

using c=System.Console;using o=System.ConsoleColor;static void M(){c.BackgroundColor=(o)15;foreach(var a in "I Voted"){c.ForegroundColor=(o)(a%2<1?9:12);c.Write(a);}}

Saved 46 bytes thanks to Link Ng

Outputs the following to console:

Output

TheLethalCoder

Posted 2016-11-08T13:00:03.530

Reputation: 6 930

Modify M() to be {o r=o.Red,b=o.Blue;c.BackgroundColor=o.White;foreach(var a in"I Voted"){if(a%2<1)f(b);else f(r);c.Write(a);}} to save 46 bytes. If you can make if-else into ternary operator you may save more. – Link Ng – 2016-11-11T12:32:57.340

@LinkNg Managed to save even more thanks to that, a whole lot more now – TheLethalCoder – 2016-11-11T12:41:12.567

3

Befunge, 47 bytes

41+:+"detoV I":v:,,,\<
93"[47;3m"g0%2:_@>,,,^#*

Try it online - you'll need to Compile then Execute

enter image description here

James Holderness

Posted 2016-11-08T13:00:03.530

Reputation: 8 298

2

PHP, 132 bytes

imagefill($i=imagecreatetruecolor(62,13),0,0,~0);($s=imageString)($i,6,0,0,"I Vote",255<<16);$s($i,6,18,0,"V t d",255);imagepng($i);

Based on Kodos Johnson´s answer (prints image data to stdout)

create image with full alpha background, add I Vote in red, add V t d in blue, output image.

I Voted

Titus

Posted 2016-11-08T13:00:03.530

Reputation: 13 814

2

SVG - 205 bytes

(167 bytes bzip2, for comparison's sake)

Yes, I know this is old and been over for a while, but I finally had time to do what I said in my comment on the SVG + bzip2 example.

Here's just plain SVG, golfed down by hand as much as I can. UTF-8 is the default, which means this each character is one byte:

<svg xmlns="http://www.w3.org/2000/svg"><rect fill="#fff" width="99" height="99"/><text fill="blue" y="99"><tspan fill="red">I</tspan> V<tspan fill="red">o</tspan>t<tspan fill="red">e</tspan>d</text></svg>

Problem is, there is no default font or text size for SVG, so I had to just guess a reasonable number for other elements. The background white rectangle is 99x99 (and the text bottom at y=99) just because that's the largest 2 digit number, and every default font I've seen is at most 2 digits high.

And, while SVG is already an image format, here's a PNG from Wikimedia Commons:

trlkly

Posted 2016-11-08T13:00:03.530

Reputation: 178

2

Bash, 51 bytes

GREP_COLORS='sl=34;47' grep [Ioe] --col<<<I\ Voted

enter image description here

Without the white background (who says terminals have to be black??), it is even shorter: 46 bytes.

GREP_COLORS=sl=34 grep [Ioe] --col<<<I\ Voted

But it looks like OP wouldn't accept the latter.

grep highlights any of letters I, o or e red (default coloring). I don't think there is a regex for vowels in general which could shorten the syntax. For blue color and white background, instead of stating the complicated bash color codes, you can let grep do that when defining GREP_COLORS:

grep takes care of assembling the result into a complete SGR sequence (\33[...m).

Looks like the syntax highlighting on Codegolf is a bit based though.

phil294

Posted 2016-11-08T13:00:03.530

Reputation: 169

2

Python 2, 77 bytes

r='\033[91m'
b='\033[94m'
print r+'\033[47mI '+b+'V'+r+'o'+b+'t'+r+'e'+b+'d'

I don't know about other platforms, and it does not work online but on Windows 10 this works just fine with the command line, it looks like this:

I tried this:

e='\033[9
r=e+'1m'
b=e+'4m'
print r+'\033[47mI '+b+'V'+r+'o'+b+'t'+r+'e'+b+'d'

And this:

r='\033[91m'
b='\033[94m'
v,o,t,e,d='Voted'
print r+'\033[47mI '+b+v+r+o+b+t+r+e+b+d

But they did not actually help (but they are much cooler!)

nedla2004

Posted 2016-11-08T13:00:03.530

Reputation: 521

@HelkaHomba I completely forgot, thank you! – nedla2004 – 2016-11-09T00:12:42.873

Could you use a printf-like syntax to reduce this? (don't do Python, just a thought, seeing all those +s). – Addison Crump – 2016-11-09T07:55:41.867

@mojimonster I don't think that exists in Python, though it might just be called something else, I am not sure. – nedla2004 – 2016-11-09T13:35:21.873

Are you sure the background is #FFFFFF? – MilkyWay90 – 2019-08-15T23:23:51.197

2

Ruby - 46 45 bytes

puts"1I 4V1o4t1e4d".gsub(/\d/){"\e[47;3#$&m"}

The digits are placeholders for colors. They are injected into escape sequences via '#$&' (interpolation of the last match).

enter image description here

Janosch

Posted 2016-11-08T13:00:03.530

Reputation: 121

1

OCL 2, 96 bytes

ShowCanvas
setFillColor 255 0 0
DrawText 0 9 "I  o e"
setFillColor 0 0 255
DrawText 4 9 "V t  d"

I'm a bit late for this, but I think I did alright. I've tried optimizing it, but I literally can not find any way of making it shorter, despite it looking very optimizable.

Tux1

Posted 2016-11-08T13:00:03.530

Reputation: 41

1

Trackmania Nations Forever, 31 bytes

Uses colour codes for in-game nickname. When selecting profile on startup, the background is white.

Code

$f00I $00fV$f00o$00ft$f00e$00fd

Output

"Output"

William Fluck

Posted 2016-11-08T13:00:03.530

Reputation: 11

1

Ruby, 85 Bytes

UPDATE: Forgot the white background

require"colorize";puts ("I".red+"V".blue+"o".red+"t".blue+"e".red+"d".blue).on_white

Output:

Erik Boesen

Posted 2016-11-08T13:00:03.530

Reputation: 11

4The challenge also includes “The background must be white (#FFFFFF).” – manatwork – 2016-11-15T15:29:36.947

@manatwork Whoops, thanks for mentioning; fixed it. – Erik Boesen – 2016-11-16T15:41:01.287

Uhm… .colorize(:background=>:white).on_white? – manatwork – 2016-11-16T15:45:07.447

By the way, if you count 61 byte code $><<("I ".red+?V.blue+?o.red+?t.blue+?e.red+?d.blue).on_white + 11 byte command line option -rcolorize, it looks less lengthy. – manatwork – 2016-11-16T15:53:52.857

Welcome to PP&CG stack exchange! – tuskiomi – 2016-11-17T15:36:59.110

0

Decimal, 108 88 bytes

Saved 20 bytes by reusing resources (manipulating stack instead of pushing ANSI colors repeatedly)

13027091051049109D13027091051052109D00D301I12032D301201D301V00D301o01D301t00D301e01D301d

Try it online! Be warned that the online version displays raw ANSI escape sequences and not the actual colors. Ungolfed and commented:

13027091051049109D     ; push STRING "ESC[31m" (idx 0)
13027091051052109D     ; push STRING "ESC[34m" (idx 1)
00D301I                ; set DSI to 0, print, print I
12032D3012             ; push CHAR ' ', print, pop
01D301V                ; set DSI to 1, print, print V
00D301o                ; set DSI to 0, print, print o
01D301t                ; set DSI to 1, print, print t
00D301e                ; set DSI to 0, print, print e
01D301d                ; set DSI to 1, print, print d

How it works:

  • ESC[31m is the ANSI color code to set the foreground output color to red.
  • ESC[34m is the ANSI color code to set the foreground output color to blue.
  • Decimal automatically prints every non-Decimal character in the source (I,V,o,t,e,d)

MD XF

Posted 2016-11-08T13:00:03.530

Reputation: 11 605

0

SmileBASIC 3, 57 bytes

GCLS-1GPUTCHR.,.,"I  o e",#RED
GPUTCHR.,.,"  V t d",#BLUE

In recognition of the upcoming US midterm elections.

snail_

Posted 2016-11-08T13:00:03.530

Reputation: 1 982

0

Rust, 61 bytes

fn main(){print!("[47;31mI[34m V[31mo[34mt[31me[34md")}

Since the code above contains unprintable bytes, here's a reversible hexdump:

00000000: 666e 206d 6169 6e28 297b 7072 696e 7421  fn main(){print!
00000010: 2822 1b5b 3437 3b33 316d 491b 5b33 346d  (".[47;31mI.[34m
00000020: 2056 1b5b 3331 6d6f 1b5b 3334 6d74 1b5b   V.[31mo.[34mt.[
00000030: 3331 6d65 1b5b 3334 6d64 2229 7d         31me.[34md")}

NieDzejkob

Posted 2016-11-08T13:00:03.530

Reputation: 4 630