114
\$\begingroup\$

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.

\$\endgroup\$
  • 29
    \$\begingroup\$ A bit disappointed my actual sticker doesn't look like yours. \$\endgroup\$ – Geobits Nov 8 '16 at 13:52
  • 39
    \$\begingroup\$ "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." :/ \$\endgroup\$ – Michael Yaeger Nov 8 '16 at 14:05
  • 41
    \$\begingroup\$ @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. \$\endgroup\$ – Calvin's Hobbies Nov 8 '16 at 14:13
  • 43
    \$\begingroup\$ If it helps anyone, vowels are red, consonants are blue. \$\endgroup\$ – mbomb007 Nov 8 '16 at 15:09
  • 34
    \$\begingroup\$ @mbomb007 Or more usefully, the letters with odd code points are red, and the letters with even code points are blue. \$\endgroup\$ – Sp3000 Nov 8 '16 at 15:15

55 Answers 55

6
\$\begingroup\$

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

\$\endgroup\$
6
\$\begingroup\$

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!

locked by Dennis Dec 7 '16 at 6:11
\$\endgroup\$

This post has been locked while disputes about its content are being resolved. You may discuss this on meta if you have concerns.

Read more about locked posts here.

  • 2
    \$\begingroup\$ Holy hell, this might be the craziest (as in crazy good) thing I've seen on PCCG. You got my upvote! \$\endgroup\$ – Ave Dec 5 '16 at 21:10
  • 3
    \$\begingroup\$ Welcome to PPCG! I think this is the best first post I've ever seen! \$\endgroup\$ – Rɪᴋᴇʀ Dec 5 '16 at 21:13
  • 2
    \$\begingroup\$ This is an invalid answer, so it will probably be nuked by the moderators, but wow, just freakin wow \$\endgroup\$ – TuxCrafting Dec 5 '16 at 21:22
  • 3
    \$\begingroup\$ @aleksusklim This challenge is a 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. \$\endgroup\$ – TuxCrafting Dec 5 '16 at 21:32
  • 1
    \$\begingroup\$ 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! \$\endgroup\$ – AdmBorkBork Dec 5 '16 at 21:43
5
\$\begingroup\$

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
\$\endgroup\$
  • \$\begingroup\$ Could you set the background to white, please? \$\endgroup\$ – Paŭlo Ebermann Nov 8 '16 at 20:23
  • \$\begingroup\$ @PaŭloEbermann , done \$\endgroup\$ – بارپابابا Nov 8 '16 at 20:39
  • \$\begingroup\$ oddly, in my terminal program (ROXTerm), the first one is on a white background, while the second one has a slightly light grey background. \$\endgroup\$ – trlkly Nov 9 '16 at 11:21
  • \$\begingroup\$ @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. \$\endgroup\$ – Paŭlo Ebermann Nov 9 '16 at 18:32
5
\$\begingroup\$

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

\$\endgroup\$
  • \$\begingroup\$ @sanchises I don't know how to fix it yet \$\endgroup\$ – Kritixi Lithos Nov 8 '16 at 14:21
  • \$\begingroup\$ @sanchises I tried it, but that just messes things up even more so \$\endgroup\$ – Kritixi Lithos Nov 8 '16 at 14:23
  • \$\begingroup\$ @sanchises Done! \$\endgroup\$ – Kritixi Lithos Nov 8 '16 at 14:41
  • \$\begingroup\$ Could you try tabs (\t) instead to try and save bytes? \$\endgroup\$ – Artyer Nov 8 '16 at 21:20
  • \$\begingroup\$ @Artyer The tabs don't help, I've tried. \$\endgroup\$ – Kritixi Lithos Nov 9 '16 at 5:25
5
\$\begingroup\$

Quake 3/Live Colour Codes (19 characters)

^1I ^4V^1o^4t^1e^4d
\$\endgroup\$
  • 6
    \$\begingroup\$ Add an image showing your output \$\endgroup\$ – Kritixi Lithos Nov 10 '16 at 14:37
4
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ That's a cool approach. Unfortunately, I don't think it counts. The OP specified that is not allowed \$\endgroup\$ – DJMcMayhem Nov 8 '16 at 21:14
  • \$\begingroup\$ I managed to miss that, removed links and added 13 bytes. \$\endgroup\$ – DecentM Nov 8 '16 at 21:24
  • \$\begingroup\$ OK, thanks. BTW, welcome to the site! \$\endgroup\$ – DJMcMayhem Nov 8 '16 at 21:25
  • 1
    \$\begingroup\$ I 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! \$\endgroup\$ – tuskiomi Nov 8 '16 at 21:37
  • \$\begingroup\$ 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. \$\endgroup\$ – DecentM Nov 8 '16 at 21:46
4
\$\begingroup\$

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"

\$\endgroup\$
4
\$\begingroup\$

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.)

\$\endgroup\$
  • \$\begingroup\$ My comment is valid for this one too. \$\endgroup\$ – manatwork Nov 10 '16 at 10:09
  • \$\begingroup\$ @manatwork, thanks! See any other way to reduce it down? \$\endgroup\$ – Wildcard Nov 10 '16 at 10:19
  • \$\begingroup\$ 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. \$\endgroup\$ – manatwork Nov 10 '16 at 10:28
  • \$\begingroup\$ @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! \$\endgroup\$ – Wildcard Nov 10 '16 at 11:01
4
\$\begingroup\$

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

\$\endgroup\$
3
\$\begingroup\$

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

\$\endgroup\$
3
\$\begingroup\$

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

\$\endgroup\$
3
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ 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. \$\endgroup\$ – Jonathan Frech Sep 6 '17 at 13:13
3
\$\begingroup\$

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

\$\endgroup\$
  • \$\begingroup\$ 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. \$\endgroup\$ – Link Ng Nov 11 '16 at 12:32
  • \$\begingroup\$ @LinkNg Managed to save even more thanks to that, a whole lot more now \$\endgroup\$ – TheLethalCoder Nov 11 '16 at 12:41
3
\$\begingroup\$

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

\$\endgroup\$
3
\$\begingroup\$

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).

\$\endgroup\$
  • \$\begingroup\$ How many bytes is this? Surely this level is saved somewhere as a file. \$\endgroup\$ – Jo King Aug 15 at 23:13
  • \$\begingroup\$ @JoKing Sure, I'll check. \$\endgroup\$ – MilkyWay90 Aug 15 at 23:16
  • \$\begingroup\$ @JoKing Updated. \$\endgroup\$ – MilkyWay90 Aug 15 at 23:28
  • \$\begingroup\$ I never expected to see this game on this SE. Very creative \$\endgroup\$ – Belhenix Aug 16 at 17:24
  • 1
    \$\begingroup\$ @Belhenix You can see other answers by typing in is:answer "Geometry Dash" into the search bar \$\endgroup\$ – MilkyWay90 Aug 16 at 17:57
2
\$\begingroup\$

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!)

\$\endgroup\$
  • \$\begingroup\$ @HelkaHomba I completely forgot, thank you! \$\endgroup\$ – nedla2004 Nov 9 '16 at 0:12
  • \$\begingroup\$ Could you use a printf-like syntax to reduce this? (don't do Python, just a thought, seeing all those +s). \$\endgroup\$ – Addison Crump Nov 9 '16 at 7:55
  • \$\begingroup\$ @mojimonster I don't think that exists in Python, though it might just be called something else, I am not sure. \$\endgroup\$ – nedla2004 Nov 9 '16 at 13:35
  • \$\begingroup\$ Are you sure the background is #FFFFFF? \$\endgroup\$ – MilkyWay90 Aug 15 at 23:23
2
\$\begingroup\$

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

\$\endgroup\$
2
\$\begingroup\$

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

\$\endgroup\$
2
\$\begingroup\$

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:

\$\endgroup\$
2
\$\begingroup\$

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.

\$\endgroup\$
1
\$\begingroup\$

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:

\$\endgroup\$
  • 4
    \$\begingroup\$ The challenge also includes “The background must be white (#FFFFFF).” \$\endgroup\$ – manatwork Nov 15 '16 at 15:29
  • \$\begingroup\$ @manatwork Whoops, thanks for mentioning; fixed it. \$\endgroup\$ – Erik Boesen Nov 16 '16 at 15:41
  • \$\begingroup\$ Uhm… .colorize(:background=>:white).on_white? \$\endgroup\$ – manatwork Nov 16 '16 at 15:45
  • \$\begingroup\$ 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. \$\endgroup\$ – manatwork Nov 16 '16 at 15:53
  • \$\begingroup\$ Welcome to PP&CG stack exchange! \$\endgroup\$ – tuskiomi Nov 17 '16 at 15:36
1
\$\begingroup\$

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.

\$\endgroup\$
0
\$\begingroup\$

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)
\$\endgroup\$
0
\$\begingroup\$

SmileBASIC 3, 57 bytes

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

In recognition of the upcoming US midterm elections.

\$\endgroup\$
0
\$\begingroup\$

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")}
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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