text:
Animate the text in your terminal
Animate the text in your terminal
The goal
The goal is to "animate" the string "Hello world" in your output so that each character gets capitalised after each other.
Your program can exit after each letter has been capitalised.
For example;
# Iteration 1
Hello world

# Iteration 2
hEllo world

# Iteration 3
heLlo world

# Iteration 4
helLo world

# Iteration 5
hellO world

# Iteration 6 (note: it should capitilize the space char (ie: a break between iteration 5 and iteration 7)
hello world

# Iteration 7
hello World

# Iteration 8
hello wOrld

# Iteration 9
hello woRld

# Iteration 10
hello worLd

# Iteration 11
hello worlD

It should only animate the string once and between each state there should be a 1 second delay.
Input
No input is required, but "Hello world" must be the string that is "animated".
Output
The string "Hello world" must be animated. The output must be as 1 line to create a sort of wave animation. An empty trailing new line is allowed. Example gif;

I saw this on a metasploit youtube video and thought the effect was pretty cool, which is where I recorded the gif from, so it's a little laggy, but I hope it illustrates the output fine
This is code-golf, lowest byte-count will be deemed the winner.
Sandbox Link

Can it exit and stop with an error?

@StewieGriffin as long as the animation is viewable, sure.

I don't think the 1 second delay adds to the challenge. We've had a bunch like that and each time it seems like the same boilerplate is added.

@xnor Do you mean the duration of the delay being 1 second explicitly, or do you mean any delay at all? Latter wouldn't make any sense since it's an animation after all..

@Metoniem Any fixed-time delay.

Oh, in that case I agree for sure. Writing 1000 instead of 1 costs me 3 bytes already >:( @xnor

@ʰᵈˑAre additional leading iterations allowed?

@Metoniem No, only the ones described in the goal. Unless I've misunderstood. Each letter must be capitalised once from left to right once only, starting with "H" in "hello" and ending with "D" in "world"

@ʰᵈˑYou understood! Okay then, thanks.

For a better view of this effect as seen when starting the Metasploit Framework: Metasploit For Beginners - #1 @~5:50

Vim 26 bytes
ihello world<ESC>qq~gsul@qq0@q

Explanation (no .gif yet):
First, we must enter the 'hello world' text. This is pretty straightforward. It's just:
ihello world<ESC>

At this point, the cursor is on the 'd' in 'world'. Next:
qq              " Start recording into register 'q'
  ~             " Swap the case of the character underneath the cursor, and move the cursor to the right
   gs           " Sleep for one second
     u          " Undo the last change (of swapping case).
      l         " Move one character to the right (Get it? 'l' == 'Right' because vim is intuitive!)
                " This will cause the error to break on the last character of the input.
       @q       " Call register 'q'
         q      " Stop recording
          0     " Move to the first character
           @q   " Call the recursive macro

There are also two other 26 byte versions I found:
ihello world<ESC>qq~gsulq011@q
ihello world<ESC>011@='~gsul'<cr>

Man that's cool! Here's the output: https://i.gyazo.com/52d0b9268446aed36ce7eb641c40ff6c.gif (half of it anyway, Gyazo stopped recording)

I don't think ~  breaks the loop. I believe it's the l that does the hard work

@KritixiLithos Ah, after testing it, it seems you're right. Good point, I'll edit that out

Can confirm -- This works.

Python 2, 98 94 90 bytes
for x in range(11):s='hello world';print'\r'+s[:x]+s[x:].capitalize(),;[1for y in' '*8**8]

-9 -4 bytes thanks to @ElPedro
-4 bytes thanks to @JonathanAllan and @Rod

Welcome to PPCG, nice first post c:

Nice post! This seems to have a capital "H" and "W" at the same time though https://repl.it/Fhii - It seems to not lowercase the "H"

About the printing problem, you can pass -u argument and use print"\t"+s[:x]+s[x:].title(),; (note the trailing comma). And this won't change your byte count (because the argument would add +2 bytes)

Isn't each flag only one byte? Or am I confusing two different topics? @Rod

@Timtech hmm, I couldn't find any meta topic about, but other answers count as 2

@Rod Strange I can't either, maybe I am missing something.

@Rod The flag would count as one byte because an acceptable invocation for Python is python -c 'code here'. With the flag, the invocation would be python -uc 'code here', which is one byte different.

print"\r"+s[:x]+s[x:].capitalize(),; doesn't require an extra flag

@JMat Technically? No. In practice? Yes.

Pretty much your version, but 95 bytes and clears the screen (I tested with 2.7.8 on Windows 7-64). Try It Online does not give the animation, just the line by line result.

@JonathanAllan i=-11 with while i: also works (to save 1 byte)

@Rod, that it does.

You can get it down to 85 by replacing sleep with a "time-wasting" loop [1for y in' '*8**8] and doing away with the import. 8**8 gives a delay of approximately one second on my machine but will vary depending on hardware. Doesn't actually work on Try it online! as it just dumps the whole list at the end but the code is there for reference.

My mistake. Actually 90 because .title() will always capitalize the w after the space. Updated with capitalize() Try it online!. Sorry about that.

@ElPedro thanks for pointing this out, already corrected this mistake previously, so forgot to check again.

Commodore 64, 168 162 137 133 BASIC (and tokenized) bytes used
 0s=1024:?"{control+n}{clear home}hello world":fOi=.to1:fOj=.to11:x=pE(s+j):pokes+j,x+64
 1x=pE(1023+j):pO1023+j,abs(x-64):pO1029,32:pO1035,32:fOz=.to99:i=.:nEz,j,i

You will need to use BASIC keyword abbreviations to enter this into a real C64 or emulator (or enter the program into a Commodore 128 and load it back in C64 mode, although this should work on the 128 as well). The {control+n} will only work/display after the opening quote. It is shorthand for chr$(14) and therefore saves some bytes and switches the character set to business mode or upper/lower case characters.
I have added in some abbreviations for you so you. The {clear home} character is made by pressing Shift and the CLR/HOME key after the opening quotation mark.
For illustrative purposes the unobfustcated listing may be entered as follows:
 0 let s=1024
 1 print chr$(14); chr$(147); "hello world"
 2 for i=0 to 1
 3  for j=0 to 11
 4   let x=peek(s + j)
 5   poke s + j, x + 64
 6   let x=peek(1023 + j)
 7   poke 1023 + j, abs(x - 64)
 8   poke 1029, 32
 9   poke 1035, 32
10   for z=0 to 99
11    let i=0
12   next z
13  next j
14 next i

It works by switching the PETSCII charset into business mode (upper/lower case), and writing the hello world string to the top line of the screen which is located at memory location $0400, it will then take the value at each location for the next 11 bytes from there and increase each value by 64 (the upper case equivalent). If the j counter is > 0, it calls a routine at line 2 to decrease the previous memory location by 64 again.
Line 3 is a pause, it also writes a space to to location $0405 and $040b, which is a bug fix (which could probably be removed to save some bytes).

I should add that fori=0to1step0 ... nexti is essentially creating an infinite (goto-less) loop, kind of like while(true){...} in more modern languages.

Why don't you just use a goto instead of an infinite loop? Even with the 2 newlines that would have to be added, it would still save bytes. Also RAM bytes isn't the same as the number of bytes in your code.

Because GO TO is banned, right ;-) One may easily work out the listing by itself by CLR before working out the remain free bytes with the broken FRE(0) function

oh sorry about that

C#, 230 215 193 161 135 134 130 bytes
It's C# so it's long right! :-( But after some help and searching, I (and others, really) managed to remove exactly 100 bytes already.
Golfed
()=>{for(int i=1;;){var b="\rhello world".ToCharArray();b[i++]-=' ';System.Console.Write(b);System.Threading.Thread.Sleep(1000);}}

Ungolfed
class P
{
    static void Main()
    {
        for (int i = 1;;)
        {
            var b = "\rhello world".ToCharArray();
            b[i++] -= ' ';
            System.Console.Write(b);
            System.Threading.Thread.Sleep(1000);
        }
    }
}

Screenshot

Although it looks alot better when looping and faster..
Updates

Lost 15 bytes by using carriage return instead of Clear() which also allowed me to replace a using with System.Consolesomewhere inline.
Replaced program with lambda saving 23 bytes thanks to @devRicher
It became kind of a collaboration with @devRicher at this point, thanks to some of his suggestions I managed to lose another 32 bytes!
Thanks to 2 really smart and interesting suggestions by @Kratz I managed to replace new string(b) with b and b[i]=char.ToUpper(b[i]) with b[i]-=' ', saving me another 26 bytes!
1 byte less by moving i++ thanks to @Snowfire
4 bytes less by moving carriage return to the beginning of the string and removing i<11 from my for loop

Change class P{static void Main(){ ... }} to ()=>{ ... } to snip off a few bytes. PPCG accepts functions as answers, so a lambda works fine.

@devRicher Ah I see, I never used lambas before, but that seems like a cool improvement. Thanks!

If you don't know how to use them (or don't want to), its still fine for a simple void g(){ ... }.

You can access strings with array indices (char g = string j[x]), to save around 50 bytes: ()=>{var s="Hello world";for(int i=1;i<11;i++){string h = s;h[i]=char.ToUpper(s[i]);System.Console.Write(h+"\r");System.Threading.Thread.Sleep(1000);}}

@devRicher I know you can access them using indices, but unfortunately they're readonly, so I think that might not work here. Correct me if I'm wrong though!

Sorry, yeah, I got that wrong. I'll look for more stuff to golf. i love c# answers

How about ()=>{var s="Hello world\r".ToCharArray();for(int i=1;i<11;i++){var b=s;b[i]=char.ToUpper(s[i]);System.Console.Write(new string(b));System.Threading.Thread.Sleep(1000);}}? Not sure if Hello World\r yields right results, but I changed up other parts of it too.

@devRicher This turns them all uppercase and not lowercase anymore. Probably because b is just a pointer to s, also if we would actually copy the array and use this, I think the "H" in Hello world will stay capitalized which isn't supposed to happen. The idea behind it is nice, though!

Let us continue this discussion in chat.

Instead of Char.ToUpper, you can do s[i]-=' '; Also, write will take an array of char, no need to make a new string, just Write(s).

@Kratz that sounds interesting. Let me try that real quick!

@Kratz Woah, the -=' ' is very smart. Added both to my answer, thanks!

You can save another byte by removing the incrementation from the for clause and putting it in the array access like b[i++]-=' '.
That would come in handy, because then you could also remove the condition in the for loop and just write for(int i=0;;).
OP pointed out in the comments, that the program may exit with an error, so you can allow an IndexOutOfRangeException

@Snowfire Nice find! Thanks (edit: See you edited your comment, you're right, removing the condition from the for loop will work, thanks again!)

Actually @Snowfire I'm afraid I will have to rollback the removal of that condition. I forgot it'll then reach \r too, and '\r'-' ' becomes ? which is then printed :-(

I wasn't 100% sure about that either, but it isn't really specified, whether that is allowed or not.

@Snowfire True.. I asked in a comment just now. i'll leave it out of my answer until I know for sure.

@BenVoigt Not possible without casting to int I think.

I'm wondering if you can use the exact carriage return character (0x0d) instead of \r in your code to save 1 more byte.

Powershell, 126 119 107 104 Bytes
'Hello world';$s='hello world';1..10|%{sleep 1;cls;-join($s[0..($_-1)]+[char]($s[$_]-32)+$s[++$_..11])}

Revisions (there will likely be many):
Change $s.Length to const 10 11
Restructured string builder, removed 1 join statement and used ++$s instead of ($s+1), to save some bytes thanks to @AdmBorkBork
AdmBorkBork points out just using the string twice is actually shorter than encapsulating and then .ToLower()'ing it - which says a lot about how verbose powershell is, -3!

basically loop through the length of the string, form an array of three parts, the pre-capitcal, capital, and post-capital, take 32 away from the middle letter, then convert back to a char to get upper case, luckily this doesn't turn space into a visible character either, I hope this is acceptable?

You can save three more bytes off the front by simply printing the string rather than saving it into $s and .ToLower()ing it. -- 'Hello world';$s='hello world';

102 bytes inline-ing $s

CP-1610 assembly, 50 DECLEs = 63 bytes
This code is intended to be run on an Intellivision.
A CP-1610 opcode is encoded with a 10-bit value, known as a 'DECLE'. This program is 50 DECLEs long, starting at $4800 and ending at $4831.
                                  ROMW  10          ; use 10-bit ROM
                                  ORG   $4800       ; start program at address $4800

                          main    PROC
4800 0002                         EIS               ; enable interrupts (to enable display)

4801 0001                         SDBD              ; load pointer to string in R4
4802 02BC 0026 0048               MVII  #@@str, R4

4805 02A2                         MVI@  R4,     R2  ; R2 = length of string
4806 0091                         MOVR  R2,     R1  ; R1 = uppercase counter

4807 02BD 0214            @@loop  MVII  #$214,  R5  ; R5 = video memory pointer
4809 0093                         MOVR  R2,     R3  ; R3 = character counter

480A 02A0                 @@next  MVI@  R4,     R0  ; R0 = next character
480B 0338 0020                    SUBI  #32,    R0  ; minus 32 -> character #
480D 004C                         SLL   R0,     2   ; multiply by 8 to get the
480E 0048                         SLL   R0          ; correct GROM card
480F 03F8 0007                    XORI  #7,     R0  ; add 7 (for white)

4811 014B                         CMPR  R1,     R3  ; uppercase? ...
4812 020C 0002                    BNEQ  @@draw

4814 0338 0100                    SUBI  #256,   R0  ; ... yes: sub 32*8

4816 0268                 @@draw  MVO@  R0,     R5  ; draw character
4817 0013                         DECR  R3          ; decrement character counter
4818 022C 000F                    BNEQ  @@next      ; process next character or stop

481A 0001                         SDBD              ; R0 = spin counter to wait ~1 second
481B 02B8 0038 00D3               MVII  #$D338, R0  ;    = 54072 = 13518 * 60 / 15
                                                    ; (assuming 13518 cycles per frame)

481E 0010                 @@spin  DECR  R0          ; 6 cycles
481F 022C 0002                    BNEQ  @@spin      ; 9 cycles
                                                    ; -> 15 cycles per iteration

4821 0114                         SUBR  R2,     R4  ; reset pointer to beginning of string
4822 0011                         DECR  R1          ; decrement uppercase counter
4823 022C 001D                    BNEQ  @@loop      ; process next iteration or stop

4825 0017                         DECR  PC          ; infinite loop

4826 000B 0068 0065 006C  @@str   STRING 11, "hello world"
482A 006C 006F 0020 0077
482E 006F 0072 006C 0064
                                  ENDP

Output

MATL, 30 bytes
11:"10&Xx'hello world't@)Xk@(D

Try it at MATL Online!
11:              % Push [1 2 ... 11]
  "              % For each k in [1 2 ... 11]
  10&Xx          %   Pause for 10 tenths of a second and clear screen
  'hello world'  %   Push this string
  t              %   Duplicate
  @)             %   Get the k-th character from the duplicated string
  Xk             %   Convert to uppercase
  @(             %   Write into the k-th position of the string
  D              %   Display
                 % Implicit end

PHP, 76 74 71 bytes
Thank you @hd for the delay being a full second and no fraction thereof!
Thanks @user63956 for 2 bytes and @aross for 3 bytes.
for(;$c=($s="hello world")[$i];sleep(print"$s\r"))$s[$i++]=ucfirst($c);

Run with -nr.

You can save 2 bytes with sleep(print"$s\r").

Save 3 bytes with ucfirst

Noodel, 22 bytes
”<8@\|DḶ|\6þıHḶƥɲSḍsɲS

Try it:)

How it works
”<8@\|DḶ|\6þ           # Displays the string "hello¤world".
”<8@\|DḶ|\6            # Decompresses to the array ["h", "e", "l", "l", "o", "¤", "w", "o", "r", "l", "d"] and pushes it on top of the stack.
           þ           # Pushes a copy of the array to the screen which since is an array is done by reference.

            ı          # Makes the array on the top of the stack the new stack.

             HḶƥɲSḍsɲS # Loops eleven times creating the animation.
             H         # Pushes the string "H" on to the top of the stack.
              Ḷ        # Consumes the "H" that gets evaluated as a base 98 number which comes out to eleven.
               ƥ       # Move the stack pointer up one.
                ɲS     # Switch the case of the top of the stack which will show up on the screen because the array is done by reference.
                  ḍs   # Delay for one second.
                    ɲS # Switch the case back.
                       # Implicit end of the loop.

The snippet uses a 25 byte version that loops continuously.

<div id="noodel" cols="10" rows="2" code="”<8@\|DḶ|\6þıḷʠ*HḶƥɲSḍsɲS" input=""/>
<script src="https://tkellehe.github.io/noodel/release/noodel-2.5.js"></script>
<script src="https://tkellehe.github.io/noodel/ppcg.min.js"></script>

Bash + coreutils, 99 98 bytes
x=hello\ world
for((;n<11;)){
echo -en "\r${x:0:n}"`tr a-z A-Z<<<"${x:n:1}"`"${x:n+++1}"
sleep 1
}

C, 97 withdrawn 106 bytes
with escaped characters counted as 1 byte
char*a="HELLO\0WORLD\xED";b,c;m(){for(b=0;b<156;putchar(a[c]+32*(b/12^c||c==5)))(c=b++%12)||fflush(sleep(1));}

Note: I have commented out the time delay on unlinked TIO because it waits for completion before displaying the output, it also doesn't seem to recognize carriage returns and puts new lines. Also, if you're on Windows, sleep is in milliseconds instead of seconds, so sleep(1) should become sleep(1000).
Note 2: I've withdrawn this entry for the moment until the output bugs have been ironed out.

For some reason, this doesn't output anything on my machine

If you're on windows you will have to change the delay, it will also finish on a carriage return so you may want to change 130 to 129 so it avoids printing it during the last iteration.

For me this program does not end at all, and it doesn't output anything. I had to manually ^C it to stop it . (also I'm on mac)

I believe it's a print buffer issue, I'll withdraw my entry for now.

JavaScript (ES6), 141 139 131 bytes
Saved 8B thanks to Apsillers
_=>a=setInterval("b=[...`hello world`],c.clear(b[d]=b[d].toUpperCase(++d>10&&clearInterval(a))),c.log(b.join``)",1e3,c=console,d=0)

Explanation
This creates a function with no arguments, which splits the string hello world into an array of characters and capitalises the d+1th character. d is a counter that starts as 0 and is increased every time.
Usage
f=_=>a=setInterval("b=[...`hello world`],c.clear(b[d]=b[d].toUpperCase(++d>10&&clearInterval(a))),c.log(b.join``)",1e3,c=console,d=0)
f()

Clever, I'll update it.

Also, I don't see any reason to make this a function, since it takes no input -- just run the code, right?

The question says it's supposed to be a program, but in that case you can also submit a function. Code snippets are generally not allowed.

This is nice, gg!

Can you distinguish between your understanding of a disallowed "code snippet" versus an allowed "program" in this case? If you just remove the leading _=> you do have a complete program (e.g., if you stuck it in a file, Node.js would run successfully it to completion). My understanding of the prohibition against "code snippets" is against writing code that implicitly accepts some input as a variable, like "if we assume i already has the input, we can do..." which is not happening here, since there explicitly is no input.

C, 87 bytes
m(){char*f,a[]="\rhello world";for(f=a;*++f;*f&=95,printf(a),*f|=32,fflush(sleep(1)));}

Compiles and runs on Linux.

R, 106 103 bytes
x=el(strsplit("hello world",""))
for(i in 1:11){y=x;y[i]=toupper(y[i]);cat('\f',y,sep='');Sys.sleep(1)}

Just a simple loop, clearing the console with cat('\f') seems somewhat system-dependent but I am not aware of a better way.

I tried outgolfing this using utf8ToInt. This did not work, the space needs to be handled as a special case. In the process I discovered that cat("\014") seemed to work better then work where cat("\f") did not.but not on TIO

Perl 6, 65 61 bytes

for 3..12 ->\i{sleep say "\echello world".&{S:nth(i)/./{$/.uc}/}}

(sleep say S:nth(3+$++)/./{$/.uc}/with "\echello world")xx 11

GIF:
How it works
The ANSI escape sequence \ec clears the screen.
Each iteration, the i'th character of the hard-coded string is substituted by its upper-case version.
The say function always returns True, which is passed on to the sleep function which interprets it as 1 second.

Ruby, 82 81 bytes
12.times{|a|$><<?^H*11;'Hello world'.chars{|y|$><<((0!=a-=1)?y:y.upcase)};sleep 1}

^H is ascii 8 (backspace), and is only 1 byte.

Mathematica, 130 128 123 110 108 bytes
Dynamic@o
s="hello world";i=1;t=StringTake;Do[o=t[s,{1,i-1}]<>Capitalize@t[s,{i}]<>t[s,{++i,11}];Pause@1,11]

Explanation: From i=1 to 11, print from the 1st to the (i-1)th character of "hello world", capitalise "hello world"[i], then print the rest of the string, incrementing i at the same time.

Java 215 212 204 203 bytes
interface A{static void main(String z[])throws Exception{for(int i=0;i<10;i++){char[]b="helloworld".toCharArray();b[i]=Character.toUpperCase(b[i]);System.out.println(new String(b));Thread.sleep(1000);}}}

Ungolfed:
 interface A {
 static void main(String z[]) throws Exception {
    for (int i = 0; i < 10; i++) {
        char[] b = "helloworld".toCharArray();
        b[i] = Character.toUpperCase(b[i]);
        System.out.println(new String(b));
        Thread.sleep(1000);
    }
  }
}

Shouldn't it be interface A (with a space)? Plus you can remove the space between , and Character.toUpperCase.

Welcome to the site!

Kudos to @NoOneIsHere for the 3 points

Thanks @DJMcMayhem, Always liked reading through the challenges and finally got to answer one!

SmileBASIC, 90 71 bytes
FOR I=0TO 10CLS?"hello world
LOCATE I,0?CHR$(CHKCHR(I,0)-32)WAIT 60NEXT

Jelly, 24 21 bytes
”Æ⁹Œu⁸¦ȮœS
“½,⁻⁸3»Jç€

This is a niladic link/function that prints to STDOUT. It does not work as a full program.
The code can't be tested on TIO; it uses control characters and TIO has no terminal emulator (yet).
How it works
“½,⁻⁸3»Jç€  Niladic link. No arguments.

“½,⁻⁸3»     Index into Jelly's dictionary to yield "hello world".
       J    Indices; yield [1, ..., 11].
        ç€  Apply the helper link to each index, with right arg. "hello world".

”Æ⁹Œu⁸¦ȮœS  Dyadic helper link. Left argument: i. Right argument: "hello world"

”Æ          Set the return value to '\r'.
  ⁹         Set the return value to "hello world". Implicitly prints '\r'.
   Œu⁸¦     Uppercase the i-th letter.
       Ȯ    Print.
        œS  Sleep "hello world" seconds. (Strings are cast to Boolean.)

(Strings are cast to Boolean.) That's devious!

C, 122 bytes
As an exercise, I wrote this to provide a more optimal output format than some of the other answers. Also it means the cursor sits after the most recently capitalized letter during the pauses.
main(){
    char*p=".Hello world\rH";
    write(1,p+1,13);
    do{
        sleep(1);
        *p=8;
        p[1]|=32;
        p[2]^=(p[2]>32)*32;
        write(1,p++,3);
    }while(p[4]);
}

(Newlines and indentations cosmetic and not part of byte count)
Now, some readers may note that this requires some massaging to get to run on modern machines (the magic incantation is -static -Wl,-N), but this is how real implementations of C used to behave, so I think it is valid. It also assumes the character set is ASCII, and it does not print a trailing newline.
Bonus: For an EBCDIC version, you can replace 8 with 22 and 64 with 32, and switch the logic for p[1] and p[2]. To test on a non-EBCDIC system, you can compile with -funsigned-char -fexec-charset=cp037.
Output is 43 bytes: Hello world«H‹hE‹eL‹lL‹lO‹o ‹ W‹wO‹oR‹rL‹lD

Scala, 92 bytes
val h="hello world"
0 to 10 map{i=>print("\b"*99+h.updated(i,h(i)toUpper))
Thread sleep 999}

Ungolfed
val h="hello world"    //declare a variable h with the string "hello world"
0 to 10                //create a range from 0 to 10
map { i=>              //loop with index i
  print(                 //print
    "\b" * 99              //99 backspace chars
    + h.updated(           //and h with
      i,                     //the i-th char
      h(i).toUpper           //replaced with the i-th char in uppercase
    )
  )
  Thread sleep 999       //sleep 999 ms
}

+1 for h(i)toUpper

Clojure, 116 bytes
(doseq[i(range 11)](Thread/sleep 1000)(print"\r"(apply str(update(vec"hello world")i #(char(-(int %) 32)))))(flush))

Basically a for-loop that goes over the indices of each character, updating each character in turn.
(defn -main []
  (doseq [i (range 11)] ; For the index of each character...
    (Thread/sleep 1000)
    (print "\r" ; Clear old line
           (apply str ; Turn the vector back into a string
             (update ; Update the char at index i
               (vec "hello world") ; Turn the string into a vector so it's updatable
               i ; Index to update
               #(char (- (int %) 32))))) ; Subtract 32 from the character to make uppercase
    (flush)))

Batch, 184 bytes
@echo off
for %%h in (Hello hEllo heLlo helLo hellO hello)do call:c %%h world
for %%w in (World wOrld woRld worLd worlD)do call:c hello %%w
exit/b
:c
timeout/t>nul 1
cls
echo %*

Curiously the command line for timeout/t>nul 1 gets corrupted if there is no trailing newline, so I can't put it at the end of the file.

Python 2, 220 189 179 bytes
Solution without using strings and capitalize(), byte count as is:
import time,sys
from numpy import *
F=fromstring("\rhello world",int8)
for i in range(1,12):
    time.sleep(1)
    F[i]-=32
    savetxt(sys.stdout,F,fmt="%c",newline="")
    F[i]+=32

And a bit longer variant (191 chars) without case resetting:
import time,sys
from numpy import *
a=arange(11)
F=tile(fromstring("\rhello world",int8),(11,1))
F[a,a+1]-=32
for i in a:
    time.sleep(1)
    savetxt(sys.stdout,F[i],fmt="%c",newline="")

Welcome to the site!  It looks like you have done extra whitespace. Particularly around your equal signs

Ruby, 108 bytes
First time, first year student. It's no eagle but I'm at least a little proud.
12.times{|i|sleep(0.1); puts "\e[H\e[2J", "hello world".sub(/(?<=.{#{Regexp.quote(i.to_s)}})./, &:upcase);}

C, 122 bytes
i;f(){char s[]="Hello world\r";for(i=0;i<11;i++){s[i]=toupper(s[i]);s[i-1]=tolower(s[i-1]);printf(s);fflush(0);sleep(1);}}

Shorter than C# :D

Also for the last frame to be visible, you have to do i<11 instead of i<10 in your for-loop

Perl, 75 bytes
sleep print"\33c".("hello world"=~s/(.{$_})(.)(.*)/$1\U$2\E$3\n/r)for 0..10

Uses the ANSI code ESCc to clear the console and move the cursor to the top left at every iteration, but still needs \n at the end of the replace string to avoid having the whole animation lost in the line buffer.
A successful call to print returns a value of 1, which can be passed directly to sleep.

You can use $\`` and $'to save a few bytes on that(.{$_})(.)(.*)(it won't work in a terminal, but that's not a problem). It requires modifying a little bit the rest of your code though:"hello world"=~s/./sleep print"\33c$`\U$&\E$'\n"/ger. (I wrote almost this exact code, then when looking if anyone had posted a perl answer yet, I found yours). And a little detail about the bytecount : you can use a litteral newline to save a byte, and maybe some kind of litteral \33c` (not too sure about that last one though).

C 120 110 104 96 bytes
f(){char *j,s[]="\rhello world";for(j=s;*++j;*j-=32,printf(s),*j+=32,fflush(0),sleep(1));}

Ungolfed version
void f()
{
  char *j;
  char s[]="hello world";
  j=s;

   for (;*j;j++)
   {
      *j-=32;
       printf(s); // print the string and right after change the same char to lower case
       *j+=32;
      fflush(0);
      sleep(1);
   }

}

@Pakk Thanks for saving some bytes, great idea. :)
@Pakk @KarlNapf Thanks guys for your inputs.
can still be shortened!? :)

Use -= and +=. Also, a pointer variable might save the [] but i am not sure.

The j should be outside the function

@KarlNapf You're obviously right about the += and -= , completely forgot. Updated. :)

@KritixiLithos Thanks for pointing out, Updated!

I'm not sure, but I think instead of if(j)s[j-1]+=32 you can do j&&s[j-1]+=32 (haven't tested it though)

char *j;f(){char s[]="hello world";for(j=s;*j;j++){*j-=32;printf("\r%s",s);*j+=32;fflush(0);sleep(1);}}  (103 chars)

Idea behind previous comment: Make it lowercase again after the printf, then you don't have to check if j-1 exists. And use pointers to save some characters.

@KritixiLithos j&&s[j-1]+=32 does not work. compilaton error

@Pakk Updated, Thanks for the idea. :)

char *j,s[]="hello world"; to save a few more chars.

And my final idea: define s as "\rhello world";, add a ++j to skip the \r, then you can print with printf(s);, which should save a few bytes. Not tested.

f(){char*j,s[]="\rhello world";for(j=s;*++j;*j-=32,printf(s),*j+=32,fflush(0),sleep(1));} 89 bytes.

@KarlNapf you can shorten it to fflush(sleep(1))

@KarlNapf, It fails at the 5'th iteration where ' ' - 32 truncates the string into 'hello\0'

Pascal, 187 152 bytes
Not exactly the most efficient or the shortest, but works quite well!
uses crt,sysutils;label R;const X:Word=1;P='hello world';begin
R:clrscr;write(P);gotoxy(X,1);write(upcase(P[X]));sleep(999);X:=X*Ord(X<11)+1;goto R
end.

Tested and works on Free Pascal Compiler 2.6+.
Thanks to @manatwork for saving 35 bytes!

I've used http://www.onlinecompiler.net/pascal to compile the file and run it on Windows.
Haven't seen any problem with it, so far.

An UpCase function exists since the old Turbo times. (There it handled only Char, but in Free Pascal also handles strings.)

A couple of minor tweaks: is enough to declare X Word (or Byte); make P a const so it infers type from initialization value; while there, make X an initialized constant to get rid of separate var keyword (this one may not work in all Pascal variants, but certainly does in Free Pascal); use ClrScr to jump to top left corner; replace that if with a single expression: X:=X*Ord(X<11)+1. http://pastebin.com/FfaixkES

I really didn't knew that const X:Word=1;P='hello world'; and that const X:Word=1;P='hello world'; were possible. I learned Pascal on Turbo Pascal 7, which may not be compatible with that. And completely forgot about upcase. Thank you a lot!

C++, 88 125 Bytes
#include<iostream>#include<unistd.h>
int main(){for(int c;++c<12;){char a[]="\rhello world";a[c]-=32;std::cout<<a;sleep(1);}}

Ungolfed version:
#include <iostream>
#include <unistd.h>

int main()
{
   for (int c;++c<12;)
   {
      char a[] = "\rhello world";
      a[c]-=32;
      std::cout << a;
      sleep(1);
   }
}

Compiled with TDM-GCC on a Windows 10 machine with Dev-C++.
Edit: I forgot the includes in my first version.

Hey, you're the guy that helped me with my C# answer! Your C++ approach made me realise I can actually remove that condition from my for loop by moving the carriage return to the beginning of the string.. I'll help you too: Doing for(int c=1;;c++) will save you 1 byte.

Also like you suggested in my C# answer, in combination with my last comment you could then do for(int c=1;;) and then a[c++]-=32; to save another byte.

But even with the carriage return in the beginning, it still prints a character (Ó in my case) to the output after hello world even though I'm not really sure why...

That's... rather strange. That shouldn't happen?!

Linux C, 180 bytes code, 6336 bytes binary (gcc+strip x86_64)
#include<unistd.h>
char s[]="\rhello world";
int main(){int n;for(n=1;s[n]!=0;n++){if(s[n]>0x40)s[n]^=0x20;if(n>1)if(s[n-1]>0x40)s[n-1]^=0x20;write(1,&s,sizeof(s)-1);sleep(1);};};

Do you mind putting the byte count and language in the header? Formatting is like this: # <Language>, <N> bytes

You can golf a few bytes by changing 0x20 into 32

AWK, 123 bytes
BEGIN{s="hello world\n"
split(s,a,"")
for(L=1;L<12;L++){for(m=1;m<13;m++)printf m==L?toupper(a[m]):a[m]
system("sleep 1")}}

Fairly standard AWK but it does require the availability of sleep.  On my Linux box the default argument to sleep is an integer number of seconds.

Java, 137 bytes
String q="HELLO WORLD";for(int x,i=0;i<132;System.out.print((char)(x>10?10:(x!=i/12?32:0)|q.charAt(x))))Thread.sleep((x=i++%12)<1?999:0);

Ungolfed and with comments:
    String q = "HELLO WORLD"; // note that the string is 11 characters long
    for (int x, i = 0;
         i < 132; // 11 rows, 12 columns (one column for newlines)
         System.out.print((char) (x > 10 ? // if this is the last column
                 10 // print newline
                 : // else:
                 (x != i / 12 ? //check if column == row
                         32 : 0) | q.charAt(x)))) // de-capitalize
        Thread.sleep((x = i++ % 12) < 1 ? 999 : 0); // if this is the first column, wait almost 1 second.
    // the above line will also update i and x

Edit:
A full program would take 196 bytes

Common Lisp, 108 bytes
(let((a"hello world"))(dotimes(i 11)(format t"~a~c"(string-upcase a :start i :end(1+ i))#\return)(sleep 1)))

Works on a regular terminal, on tio.run does not overwrite the string.

PowerShell 3.0, 72 63 Bytes
-9 bytes thanks to mazzy
0..10|%{cls;($s=[char[]]'hello world')[$_]-=32;-join$s;sleep 1}

Not too shabby.

It can to save some bytes 0..10|%{cls;($s=[char[]]'hello world')[$_]-=32;-join$s;sleep 1}

Haskell 232 212 Bytes
The trickiest part was reliably implementing a delay using prelude. Control.Concurrent threadDelay could be used for a robust solution. I started with delay n= foldr seq "\&" (drop n[5.5*10^6..10^7] which works in the REPL, however does not work compiled into a .exe.

Golfed Version
d=[0..10]>>"\BS"
p=concat$replicate(2*10^5)" \BS"
l=zip['a'..'z']['A'..'Z']
t x=([u|(l,u)<-l,l==x]++" ")!!0
y(x:xs)e|length xs==12-e=t x:xs|1>0=x:(y xs e)
main = do mapM_ putStr$[y"hello world"x++p++d|x<-[2..12]]

Explanation:
--Create a row of backspaces. When sent to IO deletes last character
delrow= [0..10]>>"\BS"

--print beaucoup spaces and backspaces
printblank = concat $ replicate (200000)  (' ':"\BS")

--Helpers to create a caps letter
lowerandupper = zip (['a'..'z']) (['A'..'Z'])
toupper x = head ([u|(l,u)<-lowerandupper, l==x]++" ")
touppers (x:xs) elem | length xs == 12- elem = toupper x :xs
                   | 1>0 = x: (touppers xs elem)

main = do
        --use mapM_ to putStr for each element of list
        mapM_ putStr $ [touppers "hello world" x ++ printblank++delrow|x <-[2..12]]

Looking forward to comments, feedback and improvements.
@laikoni thanks for the inputs saving numerous bytes.

There appears to be an identifier elem in your golfed code which could be shortened. Also using line breaks instead of ; results in the same byte count but slightly better readable code.

Instead of delrow, can't you just print a carriage return?

(' ':"\BS") is just " \BS". You don't need parenthesis around lists. There is unnecessary whitespace in your main and I think you don't need the do.

@Carcigenicate I was looking at that, but carriage return will start a new line. For example, putStr "Hello world">>= \x -> (putStr "\r")>>= (\y  -> putStr "Hello world") would return 2 lines:  Hello world
Hello world  whereas putStr "Hello world">>= \x -> (putStr delrow)>>= (\y  -> putStr "Hello world") returns just 1 line

It shouldn't. And why not just do putStr "\rhello world"?

The identifier xs can be shortened. You can omit the parenthesis in x:(y xs e). Instead of comparing e to the length of the rest list it might be shorter to check if e is zero and decrement it in each recursive call. Your main can start with main=mapM_ ... and finally you can inline d, p, l and e because they are called only at one position each.

Rebol, 70 bytes
repeat n 11[prin[head uppercase/part at copy"hello world^M"n 1]wait 1]

Ungolfed:
repeat n 11 [
    prin [head uppercase/part at copy "hello world^M" n 1]
    wait 1
]

Java - 240 bytes
interface a{static void main(String[]a)throws Throwable{int x=1;char[]b="\rhello world".toCharArray();while(x<12){if(b[x]!=' ')b[x]=(char)((int)b[x]^32);System.out.print(b);Thread.sleep(1000);if(b[x]!=' ')b[x]=(char)((int)b[x]^32);x++;}}}

Ungolfed version:
interface a {
    static void main(String[] a) throws Throwable {
        int x = 1;
        char[] b = "\rhello world".toCharArray();
        while(x < 12) {
            if (b[x] != ' ')
                b[x]=(char)((int)b[x]^32);
            System.out.print(b);
            Thread.sleep(1000);
            if (b[x] != ' ')
                b[x]=(char)((int)b[x]^32);
            x++;
        }
    }
}

Scala, 139 Bytes
() => {
    val a = "\033[H\033[2J\nhello world"
    8 to 19 map{c=>
        print(a.updated(c,a(c)toUpper))
        Thread.sleep(1000)
    }
}

C (MinGW), 83 80 77 bytes
Only tested on Windows.
f(){for(char s[]="\rhello world",*t=s;*++t;*t+=32)*t-=32,printf(s),sleep(1);}

Ruby, 56 bytes
"hello world".gsub(/./){$><<?\r+$`+$&.upcase+$'
sleep 1}

Perl 5, 49 bytes
sleep say"chello world"^""x$_.$"x!/7/ for 2..12

Try it online! - only really works in a terminal, but you can easily copy/paste from here.
Explanation
This script uses the stringwise XOR operation to capitalise the needed letters in each iteration. First we build the string 'hello world' (which includes \x1bc as an ANSI escape sequence to clear the screen), then we XOR (^) against a string of repeating NUL bytes (repeating as needed, 2 on the first iteration and finishing with 12), followed by a space ($") on all but the 7th iteration (which would remove the space in the middle - well, set it to NUL).
Please note this script contains unprintables, here's a reversible hex dump:
00000000: 736c 6565 7020 7361 7922 1b63 6865 6c6c  sleep say".chell
00000010: 6f20 776f 726c 6422 5e22 0022 7824 5f2e  o world"^"."x$_.
00000020: 2422 7821 2f37 2f20 666f 7220 322e 2e31  $"x!/7/ for 2..1
00000030: 32                                       2

x86 opcode(.COM), 48 bytes
  org 100h
  mov ax, 0x0900
  mov bx, -34
  out 0x70,al
  mov dx, stri
  int 0x21
  push 0xa802
  pop ds
r:in  al,0x71
  cmp al,cl
  jz  r
  xchg ax,cx
  xor [bx],dword 0x200020
  add bx, 2
  jnz r
  stri db 'hello world$'

Small Basic, 166 bytes
Takes no input and outputs to the TextWindow.
For i=1To 11
l=0
t="hello world
p()
l=i-1
t=Text.GetSubText("HELLO WORLD",i,1)
p()
Program.Delay(1000)
EndFor
Sub p
TextWindow.CursorLeft=l
TextWindow.Write(t)
EndSub

Try it at SmallBasic.com! Requires Silverlight/IE

Forth (gforth), 103 bytes
: f s" hello world"11 0 do page over dup i type i + dup c@ toupper emit 1+ over i - type 1000 ms loop ;

Try it online!
Doesn't work properly in TIO, but if you copy and paste into a gforth interpreter/terminal you get a proper animation.
I overwrote page and 1000 in the tio header so the output was readable and didn't take 10+ seconds to render, but the value in the "code" box is correct
Explanation
Loops through all characters in "hello world". For each one:

Clear screen and set cursor to top left of terminal/window
Output all characters before the current one
Output the current character uppercase (or as-is for space)
Output all characters after the current one
Wait 1 sec (1000 milliseconds)

Code Explanation
: f                 \ start a new word definition
  s" hello world"   \ create a string containing "hello world"
  11 0              \ set up loop parameters
  do                \ loop from 0 to 10 inclusive
    page            \ clear the screen/terminal and set cursor to top left
    over            \ get the string's starting address
    dup i type      \ output the first i characters of the string
    i + dup c@      \ get the value at the address of the current character
    toupper emit    \ convert to uppercase and output
    1+ over i -     \ add 1 to address, subtract current index from string length
    type            \ output end of string
    1000 ms         \ wait 1 seconds
  loop              \ end loop
;                   \ end word definition

Stax, 22 bytes
▒4↓σ┘«☼⌡♥Åα≡♂%Ç$K¥╞▲▓►

Run and debug it
delaying takes a lotta bytes.

PowerShell, 76 bytes
$b= # The solution is the next line
{$a=[char[]]$_;1..$a.length|%{$a[--$_]-=32;cls;-join$a;$a[$_]-=-32;sleep 1}}
'hello world'|% $b

ES2015, 126 bytes
Based on this answer.

c=console;d=0;t=_=>setTimeout(_=>{a=[...`hello world`];a[d]?c.clear(a[d]=a[d++].toUpperCase())|t(c.log(a.join``)):a},1e3);t()

Mathematica, 104 bytes
Monitor[Do[s=y=Characters@"hello world";s=s~Delete~i;Pause@1,{i,11}],""<>Insert[s,Capitalize[y][[i]],i]]

C# (Visual C# Compiler), 217 bytes
using u=System.Console;class P{static string a="hello world";static void Main(){for(int i=0;i<11;i++){u.Clear();u.WriteLine(a.Substring(0,i)+char.ToUpper(a[i])+a.Substring(i+1));System.Threading.Thread.Sleep(1000);}}}

Try it online!

Haskell, 161 bytes
import Data.Char;import System.IO;main=mapM(\x->do putStr$('\b'<$z)++[(toUpper v:(v<$z))!!abs(k-x)|(v,k)<-zip"hello world"z];hWaitForInput stdin 1000)z;z=[0..10]

Unfortunately it doesn't quite work in TIO.


text:
Draw/plot a heart graph
Your challenge is to draw/plot one of the hearts below. The size must be at least 50x50 pixels (vector graphics is OK). You may choose which of the hearts you want to draw/plot. Axes, grid lines etc. are accepted. There must be at least 100 distinct coordinates/points on the graph. The heart can be filled with color if you want to.

The equations are either:

or

t is in the range [-1, 1].
or

or

This is code-golf so the shortest code (in each language) in bytes wins. Please provide the output (or link to an online interpreter).

TI-80 BASIC, 45 43 41 39 bytes
LBL 1
RAND4-2->X
RAND4-2
IF (X²+ANS²-1)³<X²ANS³
PT-ON(X,ANS
GOTO 1

This took a while, and my battery is low so I didn't want to keep going.
I tried to use the second equation, but couldn't get it to work it actually turned out to be longer, so I just adapted the other answer I had.
EDIT: I just noticed the 50x50 pixel requirement, unfortunately the screen is only 47 pixels high so this isn't possible.

creative indeed!

It's been a while, but can you replace IF (X²+ANS²-1)³-X²ANS³<0 with IF (X²+ANS²-1)³<X²ANS³?

Oh, I can't believe I didn't think of that! thanks

Perl, 86 bytes
$y=1-$_/25,say+map$y**3*($_*=$_/1e3)-($_+$y**2-1)**3>0?$|--?v60:3:$",-40..40for-6..50

Run with perl -E.
Plots a filled ASCII heart, using the first equation. Note that the x-axis is
stretched by a factor of ~1.265: this is to counteract the fact that terminal
fonts are usually much bigger vertically than horizontally.
Output:
                3<3<3<3<3<3<3<                   3<3<3<3<3<3<3<
              3<3<3<3<3<3<3<3<3<3<           3<3<3<3<3<3<3<3<3<3<
            3<3<3<3<3<3<3<3<3<3<3<3<       3<3<3<3<3<3<3<3<3<3<3<3<
          3<3<3<3<3<3<3<3<3<3<3<3<3<3<   3<3<3<3<3<3<3<3<3<3<3<3<3<3<
         3<3<3<3<3<3<3<3<3<3<3<3<3<3<3< 3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<
        3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3 <3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<
       3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3
      <3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<
      3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3
     <3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<
     3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3
    <3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<
    3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3
    <3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<
    3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3
    <3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<
   3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3
   <3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<
    3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3
    <3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<
    3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3
    <3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<
    3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3
     <3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<
     3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3
     <3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<
      3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3
      <3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<
       3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3
       <3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<
        3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3
         <3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<
         3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3
          <3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<
           3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3
            <3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<
             3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3
              <3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<
               3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3
                <3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<
                 3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3
                  <3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<
                   3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3
                     <3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<
                      3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3
                       <3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<
                         3<3<3<3<3<3<3<3<3<3<3<3<3<3<3
                           <3<3<3<3<3<3<3<3<3<3<3<3<
                            3<3<3<3<3<3<3<3<3<3<3<3
                              <3<3<3<3<3<3<3<3<3<
                                3<3<3<3<3<3<3<3
                                  <3<3<3<3<3<
                                    3<3<3<3
                                     <3<3<
                                       3

Explanation (since OP asked for it):
condition := $y**3*($_*=$_/1e3)-($_+$y**2-1)**3>0

This is simply the first equation, slightly rearranged to make it shorter.
$y directly represents the y in the formula. $_ is initially proportional to x,
but is multiply-assigned with itself ($_*=$_/1e3), making it proportional to x².
Since x² is used twice in the formula, this saves a few bytes.
1e3 means 1000, and was picked because it’s short and the result looks good. **
is Perl’s power operator. I use >0 rather than ==0 because I want a filled heart.
flip_flop := $|--?v60:3

v60 is an abuse of the archaic version-string syntax to denote the character with
ASCII code 60: '<'.
$| is a magical variable that can only ever be 0 or 1. Decrementing when it’s
already 0 sets it to 1. Decrementing when it’s 1 naturally sets it to 0. Thus,
$|-- is often used as a flip-flop: each time it’s evaluated, it alternates
between true and false.
As a whole, this expression returns alternatively '<' and 3.
inner_loop := <condition> ? <flip_flop> :$"

Nested ternaries. If condition is false (→ we’re outside the heart), evaluates to $",
which is a magical variable that defaults to " " (a single space). If condition is true
(→ we’re inside the heart), it evaluates flip_flop.
outer_loop := say+map <inner_loop> ,-40..40

Evaluates inner_loop repeatedly, with $_ (Perl’s “default” variable) going from -40 to 40, in increments of 1.
It collects the results of those evaluation in a temporary list, then prints them all, concatenated, ending with a new line.
$y=1-$_/25, <outer_loop> for-6..50

This runs outer_loop repeatedly, with $y going from 1.24 (1 - (-6 / 25)) to -1 (1 - 50 / 25), in decrements of 0.04.
Note that y is divided by 25, while x² is divided by 1000, which is the same as dividing x by sqrt(1000). The ~1.265 factor I mentioned is sqrt(1000) / 25.

Huh, I guess it doesn't violate any rules... My favorite so far :) I'd love an explanation though :)

I'm confused about something. Why use ?v60 over, say, "<"?

Same length, but easier to type.

A heart made from hearts.

Mathematica WolframAlpha, 17 15 13 11 bytes
Shaved off 2 bytes thanks to Martin Ender (1st heart curve -> heart curve 1)
Shaved off another 2 bytes thanks to Martin Ender (heart curve 1 -> heartcurve1)
This is probably cheating (the obvious solution), but here goes.
heartcurve1

Try it here!
I'm sure there's a way to shorten 1st, heart or curve such that Wolfram still accepts it.  Well it's free of spaces now, maybe some sort of abbreviation for heart?
Do I get bonus points for plotting 2 of them?
heartcurves

Try that here!

heart curve 1

Actually, heartcurve1 works.

@MartinEnder What in the world

first one of heartcurves looks more like a butt though

@MikhailV 0th heartcurve (cardoid) looks like a butt.

it's a buttoid  :-)

Mathematica, 52 bytes
RegionPlot[(x^2+y^2-1)^3-x^2y^3<0,{x,-2,2},{y,-2,2}]

We could save one more byte with ContourPlot but then the background gets a bit trippy:
ContourPlot[(x^2+y^2-1)^3-x^2y^3,{x,-2,2},{y,-2,2}]

For one additional byte we could use the fourth formula and PolarPlot instead:
PolarPlot[(x=Sin@t)Abs@Cos@t^.5/(x+7/5)-2x+2,{t,0,7}]

"A bit trippy" is a bit of an understatement...

Casio fx-7700GH, 21 bytes
sin θ √ Abs cos θ ÷ ( sin θ + 7 ÷ 5 ) - 2 sin θ + 2

Unnamed graph function to be entered into one of the polar coordinate graphing function slots, then does what it says on the tin.
The graphing range must be manually set (unless it happens to fit to the current set range), I set it to Xmin=-2.75, Xmax=2.75, Ymin=-4, Ymax=1.
Should work on other Casio Power Graphic Series calculators too, and quite possibly later Casio graphic calculators.

(yep I'm pretty old and dusty)

MATLAB / Octave, 31 bytes
ezplot('(x^2+y^2-1)^3-x^2*y^3')

Desmos, 20 16 15 bytes
V 2:
xx).3y=xx+yy-1
( = xx)^.3y=xx+yy-1)
V 1:
xx+yy-1)3=xxy3
V 0:
(x2+y2-1)3=x2y3

you could use xx instead of x^2

Your byte count is wrong, you have an extra newline.

@Riker, I don't see how it's wrong. Where is there a newline?

http://imgur.com/a/4eTyt V2 is 14 bytes

@Riker, ah you forgot the ^. It's really xx)^.3=xx+yy-1

@Dopapp then your answer is wrong.....

@Riker, no. As you can see the .3 is a superscript, hence an exponent...

@Dopapp wait, so is that 2 bytes? If so, can you just change it to ^3? It's the same amount of bytes, and clarifies for people reading the answer.

@Riker better now?

SmileBASIC, 85 81 bytes
X=RNDF()*4-2Y=RNDF()*4-2GPSET X*50+99,Y*50+99,-(-X*X*Y*Y*Y>POW(X*X+Y*Y-1,3))EXEC.

MATL, 36 bytes
1e4t:w/EqXJX,JY,J|Yl**JX,X^J|.3^*&XG

Try it at MATL Online

Tfw MATL solution is longer than MATLAB :)

Python, 119 116 bytes
from turtle import*
from math import*
t=1
while-t<1:a=abs(t);c=cos(t);goto(sin(t)*c*log(a)*99,c**.5*a**.3*99);t-=.01

Try it online

Jelly, 31 bytes
*3×
²+’*3<çị⁾*
25µNr÷21µ²ç@þUY

Try it online!
or 35 bytes with a ♥, rather than * fill: change middle line to ²+’*3<ç×9829Ọ»⁶.
          ♥♥♥♥♥♥♥♥♥♥           ♥♥♥♥♥♥♥♥♥♥
        ♥♥♥♥♥♥♥♥♥♥♥♥♥♥       ♥♥♥♥♥♥♥♥♥♥♥♥♥♥
      ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥   ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥
     ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥ ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥
     ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥ ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥
    ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥
   ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥
   ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥
  ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥
  ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥
  ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥
  ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥
  ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥
  ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥
  ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥
  ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥
  ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥
  ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥
  ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥
  ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥
   ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥
   ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥
   ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥
    ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥
    ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥
     ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥
     ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥
      ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥
      ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥
       ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥
        ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥
        ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥
         ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥
          ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥
           ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥
            ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥
             ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥
              ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥
               ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥
                 ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥
                  ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥
                   ♥♥♥♥♥♥♥♥♥♥♥♥♥
                     ♥♥♥♥♥♥♥♥♥
                      ♥♥♥♥♥♥♥
                        ♥♥♥
                         ♥

How?
Implements:  over a 51 by 51 line feed separated grid of characters.
*3× - Link 1: y, xSquared
*3  - cube y
  × - multiply the result by xSquared

²+’*3<çị⁾*  - Link 2: y, xSquared
²           - square y
 +          - add xSquared to the result
  ’         - subtract one
   *3       - cube the result
     <      - less than? (1 if True, 0 if False)
      ç     -     the result of the last link (1) as a dyad: f(y, xSquared)
       ị    - index into (1-based):
        ⁾*  - the string "* " (there is a trailing space on this line)

       ×9829Ọ»⁶ - alternative ending of link 2
       ×9829    - multiply (vectorises) by 9829
            Ọ   - cast to character (vectorises) (9829 is the ♥, 0 is the null-byte)
             »  - maximum (vectorises) of that and:
              ⁶ -     space character (ordinal of space is 32, greater than the null-byte, less than ♥)

25µNr÷21µ²ç@þUY - Main link: no arguments
25              - 25
  µ             - monadic chain separation call that i
   N            - negate i
    r           - inclusive range(negated i, i) -> [-25, -24, ..., 24, 25]
     ÷21        - divide by 21 (vectorises) -> [-1.1904761904761905, -1.1428571428571428, ..., 1.1428571428571428, 1.1904761904761905]
        µ       - monadic chain separation call that r
         ²      - square r (vectorises) (make the xSquared values, left to right)
             U  - upend r (make the y values, top to bottom)
            þ   - outer product using:
          ç@    -     last link (2) as a dyad with reversed arguments: f(y, xSquared)
              Y - join with line feeds
                - implicit print

SageMath, 66 bytes
polar_plot(sin(x)*abs(cos(x))^.5/(sin(x)+7/5)-2*sin(x)+2,(0,2*pi))

Try it online
Unfortunately, the long names of implicit_plot and parametric_plot (plus the need to define a variable other than the implicitly-defined x for the former) make the first three options much too long to be considered.
Thanks to busukxuan and Andrea Lazzarotto for a byte

Does ^.5 work in place of **.5?

@busukxuan Nope. Sage is built on Python, and ^ is XOR.

But sage substitutes ^ with **. I was wondering if it was because it couldn't substitute correctly if followed by a .

@busukxuan Sage uses Python's power notation (**). If you tried to use ^, you'd end up with a warning and an incorrect result.

I took a screenshot. I don't get it, could it be version differences?

@busukxuan Possibly. The online sagecell I used for the permalink is running an older version of Sage, and I don't really have a way to run a newer version right now outside of SageMathCloud.

@Mego Sage treats ^ as an exponentiation. Always did that and it works in the Sage Cell link you posted as an example. :) Check it out here.

@AndreaLazzarotto Then apparently my memory is faulty. Thanks.

C, 137 133 bytes
p;float x,y,f;v(){for(p=4e3;p;x=(float)(p%99-50)/35,y=(float)(p/40-45)/40,f=x*x+y*y-1)putchar(p--%99?f*f*f-x*x*y*y*y<1e-3?35:32:10);}

http://codepad.org/zqqYUui8
Thanks @AlbertRenshaw, I also changed the 100s to 99s for 2 more bytes

+1; I like the use of v for the function, good flair. You can shave two bytes by replacing 4000 with 4e3 and replacing 0.001 with 1e-3

JavaScript (ES6), 151 147 bytes

document.write`<canvas id=c>`;for(i=0;x=2-i/24,i<97;i++)for(j=0;y=2-j/24,z=x*x+y*y-1,j<97;j++)z*z*z-x*x*y*y*y<0&&c.getContext`2d`.fillRect(i,j,1,1)

Edit: Saved 4 bytes thanks to @user2428118. ES7 version for 143 bytes:

document.write`<canvas id=c>`;for(i=0;i<97;i++)for(x=2-i/24,j=0;j<97;j++)x*x*(y=2-j/24)**3-(x*x+y*y-1)**3>0&&c.getContext`2d`.fillRect(i,j,1,1)

how about y**3 instead of y*y*y ?

@svarog Thus my note "Would be slightly shorter in ES7"...

well, it works on chromium 55, so why not add an es7 version ?

@svarog Because I don't have chromium 55 handy...

You could always use Babel...

You could probably save some bytes by using  template strings: document.write`<canvas id=c>`; and c.getContext`2d`  seem possible.

@ThisSuitIsBlackNot It complained about undeclared variables when I tried.

@svarog Finally got around to updating to Firefox 52... only seems to save 4 bytes though.

Ruby, 80 bytes
Show Ruby some love.
-2.step(2,0.2){|y|-2.step(2,0.1){|x|$><<'. O'[(y*y-1+x*=x)**3+x*y**3<=>0]};puts}

Output:
         OOOOO     OOOOO
      .OOOOOOOOO.OOOOOOOOO.
     OOOOOOOOOOOOOOOOOOOOOOO
     OOOOOOOOOOOOOOOOOOOOOOO
     OOOOOOOOOOOOOOOOOOOOOOO
      OOOOOOOOOOOOOOOOOOOOO
      .OOOOOOOOOOOOOOOOOOO.
        OOOOOOOOOOOOOOOOO
         OOOOOOOOOOOOOOO
           OOOOOOOOOOO
              OOOOO
                .

with some empty lines above and below

BBC BASIC, 80
Will finish golfing tomorrow.
Download interpreter at http://www.bbcbasic.co.uk/bbcwin/bbcwin.html
ORIGIN99,99F.u=-56TO56x=u/50b=x^2^.33/2r=(b^2-x^2+1)^.5*50L.u,b*50-r,u,r+b*50N.

Draws a filled heart using the first equation, which we rearrange and take the cube root of (there are 3 cube roots of a real number, one real and 2 complex but we only interested in the real root here.) We then rearrange again to get a quadratic in y
x^2+y^2-1=(x^0.66)y

y^2-(x^0.66)y+x^2-1=0

Using the standard quadratic formula for expressions of the type ay^2+by+c=0, and taking advantage of the fact that a=1 we get
y = -b/2 +/- sqrt((b/2)^2-c)

y = -b/2 +/- sqrt((b/2)^2-x^2+1)

where -b/2 = (x^0.66)/2 (represented by b in the program.)
We simply scan through the values of x from left to right, drawing a vertical line between each pair of valid values for y to build up a solid shape.
ORIGIN99,99F.u=-56TO56x=u/50b=x^2^.33/2r=(b^2-x^2+1)^.5*50L.u,b*50-r,u,r+b*50N.

ungolfed
ORIGIN99,99
FORu=-56TO56
  x=u/50
  b=x^2^.33/2
  r=(b^2-x^2+1)^.5*50
  LINEu,b*50+r,u,b*50-r
NEXT

TI-84 Basic, 40 38 bytes
Similar to @12Me21's answer & output, but for the TI-83/84 series instead.
While 1:2rand-1→A:2rand-1:If (A²+Ans²-1)³>A²Ans³:Pt-On(A,Ans:End

Is using Ans actually smaller here? I thought Ans was 2 bytes.

@12Me21 No, it's the same size, and faster too. (For TI-83/84 at least, I don't know about TI-80).

Processing.js: 123 119 bytes
ungolfed:
t = 0;

void setup() {
    size(99, 300);
}

void draw() {
    point(59+99*sin(t)*cos(t)*log(t),350-400*sqrt(cos(t))*pow(t,0.3));
    t+=0.01;
}

golfed:
t=0;void setup(){size(99,300);}void draw(){point(59+99*sin(t)*cos(t)*log(t),350-400*sqrt(cos(t))*pow(t,0.3));t+=0.01;}

this one is quite cheaty as it plots #2 from 0 to infinity instead of from -1 to 1 as shown in the picture to save on the two abs(t). But it's technically correct as there are more than 100 points.

130 bytes "correctier" one
t=-1;void setup(){size(99,300);}void draw(){point(59+99*sin(t)*cos(t)*log(abs(t)),350-400*sqrt(cos(t))*pow(abs(t),0.3));t+=0.01;}

try it online
note : there's probably a way to get 100 points on the default 100x100 canvas and shave the setup off.

None of your snippets do anything for me on my local version of Processing (except for the second one which just draws 1 point)

have you tried on sketchpad? ("try it online") you need to click "render sketch"

But I think that would be called "Processing.JS" instead. For the snippet to work for me, you have to use float instead of int

oops, forgot the .js, and thanks to that I saved 4 bytes by removing the useless int.

BBC BASIC (BBC Micro) (126 bytes)
This is a variation of Level River Street's answer, but for the original BBC Micro's iteration of BBC BASIC.
You can copy and paste either of the following into JSBeeb's new paste functionality at https://bbc.godbolt.org/ (A JavaScript powered BBC Micro emulator), once it has pasted, press Enter inside the 'screen' to show a new prompt, then type RUN, then press Enter to run either version.
golfed. (126 bytes)
1MO.1:V.29,64;64;:MOVE-57,20:GC.0,1:F.U=-56TO56:X=U/50:IFX<>0TH.B=X^2^.33/2
2R=(B^2-X^2+1)^.5*50:DRAWU,B*50+R:DRAW U,B*50-R:N.

ungolfed. (176 bytes)
1 MODE 1
2 VDU 29,64;64;
3 MOVE -57,20
4 GCOL 0,1
5 FOR U = -56 TO 56
6 X = U/50
7 IF X <> 0 THEN B = X^2^.33/2
8 R = (B^2-X^2+1)^.5*50
9 DRAW U,B*50+R
10 DRAW U,B*50-R
11 NEXT

Line 7 requires a check for X, to prevent a "Log range" error when X becomes 0 half way through the loop. Other than this, it's pretty much the same. It's a lot slower to draw on a real machine, which JSBeeb emulates pretty well.

Google Sheets (Conditional Formatting), 73
Set conditional formatting on range A1:CV100:
=(2500/9-(Column()-25)^2-(ROW()-25)^2)^3>(Column()-25)^2*(ROW()-25)^3/.06

You'll have to adjust your columns/rows so that 100x100 cells fit on your screen. (10 pixels is a good value.) Colors the cells in the cardioid.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Find the outcome of a game of War
Find the outcome of a game of War
When I was in elementary school, there was a "Rock-Paper-Scissors"-ish game we'd play during assemblies, when waiting for our teacher, at recess etc. We called it "War". After some searching however, it turns out this is a much simpler variant of the "Shotgun Game" (according to WikiHow). I'm going to call it "War" since the rules are slightly different:
2 people sit across from each other. The goal of the game is to "kill" the other player. Each turn, you can play one of 3 moves:

Reload: You have a gun that holds a single shot. It must be reloaded before it can be fired each time. Reloading when you already have ammo is legal, but does nothing. A reload was symbolized by tapping your temples with both hands. Each player starts with 0 ammo.
Guard: The only safe move. If you're shot while guarding, you don't die. Guarding was symbolized by crossing your arms over your chest.
Fire: Fire your gun. To successfully fire, you must have reloaded since the last shot. If your opponent is reloading, you win. If they also fire, and you both have ammo, it's a draw. If they're guarding, you wasted the ammo. While firing without ammo is a legal move, it does nothing and leaves you vulnerable like reloading. Firing was symbolized by pointing at the other player.

It was played similar to RPS, in that each player simultaneously throws down their choice (we tapped our legs twice in between turns to keep in rhythm with each other, but that's not important to the challenge).
The Challenge:
Your task is to find the outcome of a game of War. It can be a function or full program.
Input

The option each player chose each turn will be represented by a character/string:

r: reload
g: guard
f: fire

Input will be a list of pairs, a delimited/undelimited string, or anything else along these lines.

An example input in Python could be [("r", "g"), ("f", "r")], meaning on the first turn the first player reloaded, and the second player guarded. On the second turn, the first player fires, while the second player reloads. Player one wins this game. The same input could optionally be represented as "r g f r", "rgfr", "rg fr" "rg-fr"...
You can assume the following:

Input will match your chosen format, and that it will only contain valid characters.
Someone will die within 100 turns.

You cannot however assume that the turns end when someone dies.
Output
A value indicating who won (or, who won first*). You can chose what to output for each scenario, but must account for the following:

Player 1 wins
Player 2 wins
They kill each other (draw)

Each outcome must have a district value, and must always be the same for each scenario.
As an example: you could output 1 when player 1 wins, 2 when player 2 wins, and 0 in the event of a draw. You must then always output 1 when player 1 wins, 2 when player 2 wins, and 0 in the event of a draw.
It can be returned, or printed to the stdout. Trailing whitespace is fine.
Just so it's clear, the only scenario that leads to a draw is if both players fire, and both have ammo.
* Since in this challenge, turns may continue after someone dies, it's possible more than 1 player may win eventually. You need to find who won first according to the input.
Test Cases (assuming 1 when P1 wins, 2 when P2 wins, and 0 for a draw):
"rg fr" => 1 (P1 shot P2 while they were reloading)

"rg ff" => 1 (They both shot, but only P1 had ammo)

"rr ff" => 0 (Both had ammo and shot each other)

"rr ff rr fg" => 0 (Both had ammo and shot each other. Everything after the first win is ignored)

"rr fg rf" => 2 (P2 shot P1 while they were reloading)

"rf gg rr fg rr fr" => 1
    (P2 tried to shoot but didn't have any ammo, then they both guarded, then they both reloaded, then P2 blocked a shot, then they both reloaded again [but P2 still only has 1 ammo!], then P1 shoots P2 while they're reloading.

"rr gf fr rf gg rg ff" => 1
       ^ Player 1 wins here. The rest to the right has no effect on the output

This is code golf, so the smallest number of bytes wins!
Note, as the test cases show, you must handle "dumb" moves. It's perfectly valid for a player to try to shoot when they don't have ammo, or reload 2 turns in a row (and only accumulate a single ammo).

Am I missing something or can the output be determined just from the last round?

@Updated the question. And no, since you need to know if a player has ammo or not. I realize though that you can assume which player has ammo based on the fact that it's the last turn. I actually changed the rules fairly last minute that allowed assuming the input would end when someone died. I'm regretting that now.

Let us continue this discussion in chat.

This is very similar to Score a game of Load, Defend and Shoot. The only differences are that the other challenge has guns with more than one shot and that shooting an empty gun is considered cheating and forfeits the game.

Can we take two separate inputs for two players instead of rounds, e.g. {"rff","rgf"}?

@Dennis Wow, it is too. Would you consider this a dupe?

@betseg Sure, that's reasonable.

This would make a great KotH

Retina, 36 bytes
s`(?<=r..([^f]..)*)f
!
A`g
G1`!
\w
_

The input format should be linefeed separated pairs, e.g.
rr
fr

Output is !_ is player 1 wins, _! if player 2 wins and !! if there's a draw.
Try it online! (A test suite that uses space-separation for convenience.)
I must have completely overlooked this challenge. I'm sure I would have tried this in Retina earlier otherwise. :)
Explanation
s`(?<=r..([^f]..)*)f
!

We start by marking "valid" shots by turning the first f after each r into !. We do this by matching each f from which can find an r on the same player without crossing over another f. Limiting the search to rs on the same player is easy by always going three characters at a time.
A`g

Now we discard all turns in which someone guarded themselves, because the ending turn cannot be one of those.
G1`!

Now we keep only the first turn which contains an !. If a valid shot happens (and we know that no one guarded) the game ends.
\w
_

Finally, we need to consolidate the string to give consistent outputs, and we simply do this by turning the non-! characters (either r or f) into _.

Python, 139 Bytes
c=d=0
for i in input():
 b=(c&(i=='fr'))-(d&(i=='rf'));p,q=i
 if b|(i=='ff')&c&d:print b;break
 c,d=(p=='r',i!='fg')[c],(q=='r',i!='gf')[d]

Takes input on stdin in the form of a list of 2-character strings (eg. ['rf','rr','rg','ff']). Outputs 1 if player 1 wins, -1 if player 2 wins, and 0 for a draw.
Explanation: First checks if anyone fired a bullet, if so the game ends. Then we determine if the players have either reloaded their guns or wasted their ammo.
This is my first codegolf post :)

JavaScript (ES6), 108 107 93 91 89 85 bytes
Saved 4 bytes with the help of Titus
Takes input as an array of 2-character strings describing the moves played by each player.
b=>b.map(c=>w=w||b&'312'[b=(s='0210231')[m='ffrfgrrggf'.search(c)]|s[m-2]&b,m],w=0)|w

Returns:

1 if player 1 wins
2 if player 2 wins
3 for a draw

How it works
We maintain a bitmask b describing who has a loaded bullet:

bit #0: player 1 has a bullet
bit #1: player 2 has a bullet

We use the De Bruijn sequence 'ffrfgrrggf' to identify all 9 possible combinations of moves. We use OR and AND bitmasks to update b according to the move combination. We use a 3rd set of bitmasks which are AND'ed with b to determine the winner w. (The only three winning combinations being ff, fr and rf.)
It's worth noting that the OR and AND masks can be stored with the same pattern, shifted by two positions.
 Index in | Combination | Bullet   | Bullet  | Winner
 sequence |             | AND mask | OR mask | mask
----------+-------------+----------+---------+--------
    0     |     ff      |    0     |    0    |   3
    1     |     fr      |    0     |    2    |   1
    2     |     rf      |    0     |    1    |   2
    3     |     fg      |    2     |    0    |   0
    4     |     gr      |    1     |    2    |   0
    5     |     rr      |    0     |    3    |   0
    6     |     rg      |    2     |    1    |   0
    7     |     gg      |    3     |    0    |   0
    8     |     gf      |    1     |    0    |   0

Test cases

let f =

b=>b.map(c=>w=w||b&'312'[b=(s='0210231')[m='ffrfgrrggf'.search(c)]|s[m-2]&b,m],w=0)|w

console.log(f(["rg","fr"]));                            // 1
console.log(f(["rg","ff"]));                            // 1
console.log(f(["rr","ff"]));                            // 3
console.log(f(["rr","ff","rr","fg"]));                  // 3
console.log(f(["rr","fg","rf"]));                       // 2
console.log(f(["rf","gg","rr","fg","rr","fr"]));        // 1
console.log(f(["rr","gf","fr","rf","gg","rg","ff"]));   // 1

@Carcigenicate This should be fixed for both failing cases. However, I'm now returning 0 (no one was shot) or 3 (players kill each other) in case of a draw. Not sure if this is allowed. If not, I can return w%3 instead.

I wanted 1 output per scenario. I guarantee though that someone will always be shot, so accounting for that case is unnecessary. The only case leading to a draw is when both shoot each other, and both have ammo.

The & mask can be 0 for fr,rf,ff. '312'['0210231'[m='ffrfgrrggf'.search(c)]|'233331'[m-3]&b] or '123'['2100231'[m='frffgrrggf'.search(c)]|'233331'[m-3]&b] save one byte; but do they work?

@Titus Interestingly, applying the OR mask before the AND mask would work for all existing test cases. But that would fail for something such as ["rr","fg","fr","rf"]

& has higher precedence than |, so changing the order shouldn´t change anything there (apart from saving the byte). But the assignment was missing in my code. Try ...'123'[b='2100231'....

@Titus My bad, you are right. And actually, that leads to more bytes saved (see my updated version). Thanks!

Perl 6, 71 62 bytes
{&[<=>](|map {m/r[..[r|g]]*.$^f/.to//∞},/[r|f]f/,/.f[r|f]/)}

Regex-based solution.
Takes input as a string in the form "rg fr".
The three possible outputs are the enum values More (player 1 won), Less ( player 2 won), Same (draw) – which turn into those words when printed, or into 1, -1, 0 when coerced to numbers.
Try it online!
How it works

map { m/r[..[r|g]]*.$^f/.to // ∞ }, /[r|f]f/, /.f[r|f]/
Performs two regex matches on the input. After interpolation, the two regexes are:

r[..[r|g]]*.[r|f]f – Matches the first successful shot by player 2.
r[..[r|g]]*..f[r|f] – Matches the first successful shot by player 1.

In each case, it returns the end position of the match (.to), or infinity if there was no match.
&[<=>](|   )
Applies the <=> operator to the two match end positions. It returns a value from the Order enum (More, Less, or Same), depending on whether the first argument is greater, less, or equal to the second.

Neat. Out of curiosity, how do you type the infinity symbol? Special keyboard, or do you type alt+some number? And do you actually use characters like that in common Perl code, or is that just for golfing?

@Carcigenicate: My customized keyboard scheme lets me input it by hitting the four keys [Menu] i n f (it's called a compose sequence). However, all Perl 6 symbols have ASCII versions – e.g. Inf and ∞ are synonyms – so it's not necessary to use Unicode symbols in Perl 6 code. I just like it... :)

Ahh. That's one thing that's thrown me about Perl was the infinity symbol. I thought it was a requirement, which seemed unnecessarily complicated. Maybe when I get bored of Clojure I'll try Perl. I've seen a lot of Perl code lately.

@Carcigenicate: Be aware that Perl 6 is basically a new language that isn't backwards-compatible with Perl, and its interpreter is still slow (and for some features, buggy). Perl, currently at version v5.24, is continued to be maintained separately.

Ok thanks. Good to know.

Haskell, 101 91 87 bytes
n!(c:r)|'g'>c=n:1!r|'g'<c=1:0!r|1<3=2:n!r
_!r=[]
a#b=[x|x@(y,z)<-zip(1!a)$1!b,2>y+z]!!0

Try it online! The infix function # takes two strings representing the actions of each of the two players and returns (0,1) if player 1 wins, (1,0) for player 2 and (0,0) for a draw.
Example usage:
Prelude> "rgrfrf" # "fgrgrr"
(0,1)

Explanation:
The infix function ! translates a sequence of actions 'r' (reload), 'f' (fire) and 'g' (guard) to a sequence of observable actions 0 (actual fire), 1 (no action) and 2 (guard), where a fire action is only counted as actual fire action if a bullet is loaded, and as no action otherwise. To achieve this the first argument n is 0 if a bullet is loaded and 1 if the gun is not loaded. This way each 'f' can simply be replaced with the current n. (n=0 -> loaded -> actual fire -> 0, n=1 -> unloaded -> no action -> 1)
n ! (c:r)                -- n is 0 or 1, c is 'f', 'g' or 'r' and r the rest of the string
    |'g'>c = n : (1 ! r) -- c is smaller 'g', so it must be 'f'. append n to the list
                         --  and set load status to 1 (unloaded)
    |'g'<c = 1 : (0 ! r) -- c is larger 'g', so it must be 'r'. append 1 (no action)
                         --  and set load status to 0 (loaded)
    |1<3   = 2 : (n ! r) -- c must be equal to 'g'. append 2 (guard)
                         --  and leave the load status unchanged
_ ! r = []               -- base case for recursion

The nine resulting possibilities are then

(0,0): Both players shoot and die, game ends.
(0,1) or (1,0): One player shoots the other, game ends.
(0,2) or (2,0): One player shoots but the other guards, game continues.
(1,1), (1,2), (2,1) or (2,2): No player shoots, game continues.

By design the sum of the game ending options is smaller then 2 and the sum of each game continuing possibility is larger or equal 2. The outcome of the game is then the first tuple with sum less then 2.
a#b=[x|         -- build the list of all x
    x@(y,z) <-  -- where x is an alias for the tuple (y,z) which is drawn from the list
    zip (1!a)   -- of tuples where the first component is from 1!a = eg. [1,2,1,0,1,0]
        (1!b)   -- and the second from 1!b = eg. [1,2,1,2,1,1]
    , 2 > y+z]  -- and y+z are smaller 2.
    !!0         -- return the first element of this list

Clojure, 168 bytes
#(reduce(fn[[l L r R][a A]](if(and l L)(let[M(fn[r a A](if(and(= a \f)r)[nil(= A \g)][(or(= a \r)r)1]))[r L](M r a A)[R l](M R A a)][l L r R])[l L r R]))[1 1 nil nil]%)

Less golfed (if both persons are alive we use M to update their ammo and enemy's life state, otherwise we return the current status):
(def f (fn[A] (reduce
                (fn [[l1 l2 r1 r2] [a1 a2]]
                  (if (and l1 l2)
                    (let[M (fn [r1 a1 a2]
                             (if (and(= a1 \f)r1)
                               [false (= a2 \g)]        ; we lost the ammo, a2 lives if he was guarding
                               [(or(= a1 \r)r1) true])) ; we might gain or keep ammo, a2 lives no matter what
                         [r1 l2] (M r1 a1 a2)
                         [r2 l1] (M r2 a2 a1)]
                      [l1 l2 r1 r2])
                    [l1 l2 r1 r2]))
                [true true false false] A)))

Example usage (first element tells if Player 1 is alive at the game end, second element tells if Player 2 is alive, 3rd and 4th tell the ammo status which isn't relevant when determining the winner):
(-> (for[[a b s] (partition 3 "rr fg rf fr ")][a b]) f (subvec 0 2))

Update: Well look at that, this loop has identical length! I find reduce version easier to develop as you can easily inspect intermediate states if you use reductions.
#(loop[l 1 L 1 r nil R nil[[a A]& I]%](if(and l L)(let[M(fn[r a A](if(and(= a \f)r)[nil(= A \g)][(or(= a \r)r)1]))[r L](M r a A)[R l](M R A a)](recur l L r R I))[l L]))

I was waiting! That's dense, wow.

Hehe thanks, it still annoys me that I had to repeat [l1 l2 r1 r2] (its modified values at let and its original values) and those fn signatures.

At least for the latter, that's why I favor loop. I find it leads to neater code. As soon as I need to fold with more than 1 accumulator, I switch.

Batch, 249 bytes
@echo off
set g=goto gg
set/ax=y=0
:gg
shift&goto %1
:fg
set x=0
%g%
:gf
set y=0
%g%
:rr
set/ax=y=1
%g%
:fr
if %x%==1 exit/b1
:gr
set y=1
%g%
:rf
if %y%==1 exit/b2
:rg
set x=1
%g%
:ff
set/az=3-x-x-y
if %z%==3 %g%
exit/b%z%

Input is in the form of pairs of characters for each turn and outputs by error level (0 = draw, 1 = player 1, 2 = player 2). x and y keep track of whether the player has ammo, so when both fire, the result is 3-x-x-y, unless that is 3, in which case we keep going. On line 5 I abuse Batch's parser - %1 (which is the current move) is substituted before the shift statement executes and removes it, so we still go to the correct label.

PHP, 107 101 90 bytes
using a bit mask $d for the loading status and a DeBruijn sequence for the firing moves.
for(;!$x=$d&strpos(_frff,$m=$argv[++$i]);)$d=$d&g<$m|h<$m|2*($d/2&f<$m[1]|g<$m[1]);echo$x;

takes input as 2-character command line arguments, run with -nr.

1 = Player 1 wins
2 = Player 2 wins
3 = draw

breakdown
for(;!$x=$d&strpos(_frff,       // 1. $x=someone dies, loop while not
    $m=$argv[++$i]          // loop throug moves
);)
    $d=
        $d&g<$m|h<$m            // 2. unload/reload Player 1 = bit 0
    |2*(
        $d/2&f<$m[1]|g<$m[1]    // 3. unload/reload Player 2 = bit 1
    );
echo$x;

DeBruijn Sequence: fr:position=1=P1 fires; rf=position 2=P2 fires, ff=position 3=both fire
g<$m <=>  f<$m[0] (f<$m is always true, because there is a second character).

Python, 200 bytes
def war_game(turns):
    turn=0
    player1=True
    player2=True
    ammo1=False
    ammo2=False
    while turn<len(turns):
        if turns[turn][0]=='f' and ammo1==True and turns[turn][1]!='g':
            player2=False
        elif turns[turn][0]=='f' and turns[turn][1]=='g':
            ammo1=False
        elif turns[turn][0]=='r':
            ammo1=True
        if turns[turn][1]=='f' and ammo1==True and turns[turn][0]!='g':
            player1=False
        elif turns[turn][1]=='f' and turns[turn][0]=='g':
            ammo2=False
        elif turns[turn][1]=='r':
            ammo2=True
        if player2==False or player1==False:
            break
        turn+=1
    if player1==True and player2==False:
        print('Player 1 wins')
        return 1
    elif player1==False and player2==True:
        print('Player 2 wins')
        return 2
    print('Draw')
    return 0

Welcome to the site.  The contest is scored in byte count so I would recommend including a byte count in your title and attempting to minimize it by reducing the length of variable names. You should also include the language you have written this in (looks like Python3 to me).

As mentioned above, this is a competition who can make the smallest program possible to accomplish the task. You're using full names like turns instead of just t, which means the program is far larger than necessary. Also please start your submission with something like #Python 2, 200 bytes (assuming this is 2, and the program is 200 bytes long) so the language you're using is clear.

Clojure, 180 173 bytes
(fn[t](loop[z nil x nil[[c v]& r]t](let[k #(and %3(= %\f)(not= %2\g))h #(and(not= %\f)(or %2(= %\r)))q(k v c x)w(k c v z)](cond(and q w)0 q 2 w 1 1(recur(h c z)(h v x)r)))))

-7 bytes by changing the function to a full function instead of using a macro. That let me make the inner functions macros, which saves a bit.
This is a very literal solution. I'm kind of mind-locked since I just wrote a full version of the game, and this is basically a greatly stripped down version of the algorithm I used. There are probably many optimizations I could do, but I'm fairly happy with it. See pregolfed code for explanation.
(defn outcome [turns] ; Take input as ["rr" "ff"]
  (loop [p1-ammo? false ; Keep track of if each player has ammo
         p2-ammo? false
         [[p1-move p2-move] & rest-turns] turns] ; Deconstruct the turns out

    (let [killed? (fn [m m2 a] (and a (= m \f) (not= m2 \g))) ; Function that checks if one player killed the other
          has-ammo? (fn [m a] (and (not= m \f) (or a (= m \r)))) ; Function that decides if a player has ammo in the
                                                                 ;  next turn
          p1-killed? (killed? p2-move p1-move p2-ammo?) ; Check if each player was killed.
          p2-killed? (killed? p1-move p2-move p1-ammo?)]

      (cond ; Check who (if any) died. If no one died, recur to next turn.
        (and p1-killed? p2-killed?) 0
        p1-killed? 2
        p2-killed? 1
        :else (recur (has-ammo? p1-move p1-ammo?)
                     (has-ammo? p2-move p2-ammo?)
                     rest-turns)))))

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/