fork download
  1.  
  2. object Main {
  3. def main(args: Array[String]) {
  4. val l = List(new AClass, AnObject, ACompanionExample)
  5. l.map(a => a.autocorrect)
  6. .foreach(println)
  7. }
  8.  
  9. }
  10.  
  11. trait Autocorrector {
  12. def autocorrect: String // this is abstract
  13. }
  14.  
  15. class AClass extends Autocorrector {
  16. def autocorrect = "AClass autocorrect"
  17. }
  18.  
  19. object AnObject extends Autocorrector {
  20. def autocorrect = "AnObject autocorrect"
  21. }
  22.  
  23. class ACompanionExample
  24. object ACompanionExample extends Autocorrector {
  25. def autocorrect = "CompanionExample autocorrect"
  26. }
  27.  
Success #stdin #stdout 0.64s 54372KB
stdin
import math
from turtle import *

def hearta(k):
    return 15 * math.sin(k) ** 3

def heartb(k):
    return 12 * math.cos(k) - 5 * math.cos(2 * k) - 2 * math.cos(3 * k) - math.cos(4 * k)

# Set up the turtle
speed('fastest')  # Maximum speed for the drawing
bgcolor("black")
pensize(2)
hideturtle()

# Draw the heart outline
color("red")
begin_fill()

for i in range(1000):
    k = i / 100
    x = hearta(k) * 20
    y = heartb(k) * 20
    goto(x, y)

end_fill()  # Fill the heart outline

# Now fill inside the heart with varying shades
for scale in [0.8, 0.6, 0.4, 0.2]:  # Different scales for layered filling
    color((1 - scale, 0, 0))  # Shades of red
    begin_fill()

    # Use fewer iterations for inner filling to increase speed
    for i in range(0, 1000, 5):  # Increased step size to 5
        k = i / 100
        x = hearta(k) * 20 * scale  # Scale down the coordinates
        y = heartb(k) * 20 * scale
        goto(x, y)

    end_fill()  # Fill the layer

# Adding text inside the heart
penup()  # Lift the pen to avoid drawing lines
goto(0, -10)  # Position the text in the center of the heart
color("lightpink")  # Text color
write("JEETU", align="center", font=("Arial", 22, "bold"))  # Change "Your Name" to the desired name

done()
stdout
AClass autocorrect
AnObject autocorrect
CompanionExample autocorrect