#DP mean something different 4 Software Guys! i.e #DailyProgrammer Daily Coding #Challenge for #Learning #Refreshing or just for #Fun #avanish37 #FastForward (at Ameerpet)
seen from United States

seen from Philippines

seen from Malaysia
seen from United States

seen from United States
seen from Australia
seen from Chile

seen from United States

seen from United States
seen from China

seen from United States
seen from China
seen from United States
seen from Taiwan

seen from Canada
seen from Yemen
seen from United Kingdom
seen from Austria
seen from United States

seen from Canada
#DP mean something different 4 Software Guys! i.e #DailyProgrammer Daily Coding #Challenge for #Learning #Refreshing or just for #Fun #avanish37 #FastForward (at Ameerpet)
Java Challenge: Print out the lyrics of The Twelve Days of Christmas.
Challenge: Print out the lyrics of The Twelve Days of Christmas
Bonus 1: Instead of using 1, 2, 3, 4..., use a, two, three, four...
Reddit dailyprogrammer - Cellular Automata Rule #90 Python Code
So to keep my python skills up to speed I’ve recently been trying a few challenges from the dailyprogrammer subreddit. If you need some coding practice then the website is a really useful resource - they’ve got easy, intermediate and expert level challenges designed to be completed in a relatively short period of time.
Here, I just thought I’d post my code to a recent challenge (#213) based on the cellular automata rule #90. You can read the instructions here - it basically produces a nice fractal pattern based on an input of 0 & 1s. Any comments / constructive criticism would be much appreciated.
Input = 00000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000
txt = open("CA_2.txt").read() #opens the text file iterations = 25 #set number of iterations n = 0 while n <= iterations: #carries on for the specified no. #of iterations output = '' for number in list(txt): if number == '1': output += '*' elif number == '0': output += ' ' print (output) #prints the line converting 0 -> ' ' #and 1 -> 'x' new_txt = '' new_txt += txt[1] #this applies the cellular for number in range(len(txt)-2): #automata XOR rules if txt[number] == txt[(number+2)]: new_txt += '0' elif txt[number] != txt[(number+2)]: new_txt += '1' new_txt += txt[len(txt)-2] txt = new_txt n = n + 1
Output = http://imgur.com/7tAzaun
My solution to the daily programmer challenge for 6/8/2015, in Chicken Scheme (run it with cat inputfile | csi -s schemefile.scm):
(require-extension srfi-13) (require-extension extras) (define-record palindromic steps palindrome) (define (is-palindrome? n) (let* ((n-forwards (number->string n)) (n-backwards (string-reverse n-forwards))) (string=? n-forwards n-backwards))) (define (reverse-num n) (string->number (string-reverse (number->string n)))) (define (palindromify p) (define (palin-iter step curr-num) (if (is-palindrome? curr-num) (make-palindromic step curr-num) (palin-iter (+ 1 step) (+ curr-num (reverse-num curr-num))))) (palin-iter 0 p)) ; Main program (for-each (lambda (line) (let* ((n (string->number line)) (result (palindromify n))) (format #t "~A gets palindromic after ~A steps: ~A~%" n (palindromic-steps result) (palindromic-palindrome result)))) (read-lines))
The site where I Get my programming challenges!