![]() |
|
[Challenge] Hello, Creativity! - Printable Version +- Sinisterly (https://sinister.ly) +-- Forum: Coding (https://sinister.ly/Forum-Coding) +--- Forum: Coding (https://sinister.ly/Forum-Coding--71) +--- Thread: [Challenge] Hello, Creativity! (/Thread-Challenge-Hello-Creativity) |
[Challenge] Hello, Creativity! - Equinox - 08-23-2015 This challenge is based off of an entry I was going to do for @Eclipse's Anti-golfing Hello world challenge, however I have decided to branch off and make this a creativity challenge rather than golfing. If you haven't seen Eclipse's thread, you can view it here: https://www.sinister.ly/Thread-Syntax-Anti-Golfing-Hello-World The challenge is simple. You will be making writing a program that print "Hello, Creativity!" in the most creative way you can think of. Byte count does NOT matter here, and as creativity can be subjective, I won't be picking winners (and this is really just for fun anyways). Here's my little creative solution in Python 3: Code: characters = [
[72 , [0] ],
[101, [1,9] ],
[108, [2,3] ],
[111, [4,8] ],
[44 , [5] ],
[32 , [6] ],
[67 , [7] ],
[114, [8] ],
[97 , [10] ],
[116, [11,15]],
[105, [12,14]],
[118, [13] ],
[121, [16] ],
[33 , [17] ]
]
string = ""
for (character, positions) in characters:
string += (" " * len(positions))
for (character, positions) in characters:
string = list(string)
for position in positions:
string[position] = chr(character)
string = "".join(string)
print(string)(Also I didn't use the if statement to properly execute the program, bite me) Output: Code: LVL 84 (686/4120) ~ ●●● python ~/Desktop/Python/antigolf.py
Hello, Creativity!RE: [Challenge] Hello, Creativity! - Eclipse - 08-23-2015 Hmm, now this has given me an idea. It may take a while. RE: [Challenge] Hello, Creativity! - Eclipse - 08-25-2015 Code: import requests as r
import random
pi = r.get('http://newton.ex.ac.uk/research/qsystems/collabs/pi/pi6.txt').text
pi = str("".join(pi.split()))
splitted = []
prev = 0
while True:
n = random.randint(1,3)
splitted.append(pi[prev:prev+n])
prev = prev + n
if prev >= len(pi)-1:
break
splitted = splitted[2:]
completed = []
#Hello, Creativity!
for dec in splitted:
dec = int(dec)
if dec < 256:
if chr(dec) == "H":
completed.append(chr(dec))
break
for dec in splitted:
dec = int(dec)
if dec < 256:
if chr(dec) == "e":
completed.append(chr(dec))
break
for dec in splitted:
dec = int(dec)
if dec < 256:
if chr(dec) == "l":
completed.append(chr(dec))
break
for dec in splitted:
dec = int(dec)
if dec < 256:
if chr(dec) == "l":
completed.append(chr(dec))
break
for dec in splitted:
dec = int(dec)
if dec < 256:
if chr(dec) == "o":
completed.append(chr(dec))
break
for dec in splitted:
dec = int(dec)
if dec < 256:
if chr(dec) == ",":
completed.append(chr(dec))
break
for dec in splitted:
dec = int(dec)
if dec < 256:
if chr(dec) == " ":
completed.append(chr(dec))
break
for dec in splitted:
dec = int(dec)
if dec < 256:
if chr(dec) == "C":
completed.append(chr(dec))
break
for dec in splitted:
dec = int(dec)
if dec < 256:
if chr(dec) == "r":
completed.append(chr(dec))
break
for dec in splitted:
dec = int(dec)
if dec < 256:
if chr(dec) == "e":
completed.append(chr(dec))
break
for dec in splitted:
dec = int(dec)
if dec < 256:
if chr(dec) == "a":
completed.append(chr(dec))
break
for dec in splitted:
dec = int(dec)
if dec < 256:
if chr(dec) == "t":
completed.append(chr(dec))
break
for dec in splitted:
dec = int(dec)
if dec < 256:
if chr(dec) == "i":
completed.append(chr(dec))
break
for dec in splitted:
dec = int(dec)
if dec < 256:
if chr(dec) == "v":
completed.append(chr(dec))
break
for dec in splitted:
dec = int(dec)
if dec < 256:
if chr(dec) == "i":
completed.append(chr(dec))
break
for dec in splitted:
dec = int(dec)
if dec < 256:
if chr(dec) == "t":
completed.append(chr(dec))
break
for dec in splitted:
dec = int(dec)
if dec < 256:
if chr(dec) == "y":
completed.append(chr(dec))
break
for dec in splitted:
dec = int(dec)
if dec < 256:
if chr(dec) == "!":
completed.append(chr(dec))
break
strcompleted = ''
for char in completed:
strcompleted += char
print strcompleted3,030 bytes 1) Retrieve Pi to a million digits and convert to string 2) Split string every n characters where n is a random integer between 1 and 3 3) Iterate through split string for each character of target string, convert the integer to its ascii chr() 4) Check if result is same as target character 5) If yes, append the chr() of the integer to a list. 6) print RE: [Challenge] Hello, Creativity! - null - 08-27-2015 (08-25-2015, 10:25 PM)eclipse Wrote: damn it. I had pretty much the same idea. http://pastebin.com/z6sTZkpe Code: #!/bin/ruby
# Setting up variables
string = "" # The string we want to be the same as target
target = "Hello, Creativity!" # The target string
attempt = 0 # Attempt number
until string == target do # Until our string is the same as the target do this
targetChar = target[string.length] # Getting the target character by checking the index of the
# Target with the length of string
ascii = rand(1..127) # Random string between 1 @ 127
if ascii.chr == targetChar then # If the character converted from ascii is the same as the target character
string << ascii.chr # Append the char to our string
# Stupid art shit
p "--------------------------------------"
p "MATCH FOUND!"
p "Current progress: #{string}"
p "Target: #{target}"
p "Attempt: #{attempt }"
p "--------------------------------------"
# /stupid art shit
end
p "#{ascii}:#{ascii.chr}" # Print the ascii value and char
attempt +=1 # increase attempts by 1
endNot quite as extreme as yours. It just generates a random number and converts it to a chr. If the string is a match to the target string it appends it. Example output: http://pastebin.com/Pa4CxdDY RE: [Challenge] Hello, Creativity! - Eclipse - 08-27-2015 (08-27-2015, 07:37 AM)null Wrote: damn it. I had pretty much the same idea. That would execute much faster if you didn't print each attempt. Instead, print each successful attempt and the final string. RE: [Challenge] Hello, Creativity! - null - 08-27-2015 (08-27-2015, 11:05 AM)eclipse Wrote: That would execute much faster if you didn't print each attempt. Instead, print each successful attempt and the final string. It is not meant to be fast. RE: [Challenge] Hello, Creativity! - Eclipse - 08-27-2015 (08-27-2015, 11:07 AM)null Wrote: It is not meant to be fast. Phew. That'd take a while. May I ask why? RE: [Challenge] Hello, Creativity! - null - 08-27-2015 (08-27-2015, 11:10 AM)eclipse Wrote: Phew. That'd take a while. May I ask why? It is just a stupid little thing. It is made to be inefficient by design. I like having all the numbers/letters fly past too. It completes pretty much instantly anyway. RE: [Challenge] Hello, Creativity! - Eclipse - 08-27-2015 (08-27-2015, 11:13 AM)null Wrote: It is just a stupid little thing. It is made to be inefficient by design. I like having all the numbers/letters fly past too. It does? Ahh, now I get why you don't care about efficiency here. Mine would take a while if I printed each attempt. I didn't time it, but it was longer than a few seconds. RE: [Challenge] Hello, Creativity! - null - 08-27-2015 (08-27-2015, 11:36 AM)eclipse Wrote: It does? Ahh, now I get why you don't care about efficiency here. Mine would take a while if I printed each attempt. I didn't time it, but it was longer than a few seconds. Yep. ![]() It actually caught me off guard how quickly it runs. I can't think of any new and creative ways to do this. I am not good with ideas. |