Jump to content

Nursery Rhyme Coding Challenge

vorticalbox

So I'm doing an extra thing for college called coderdojo https://coderdojo.com/.  So I came up with this

 

1. You can use any language

 

2. As complicated as you like

 

3. Program is to display a kids Nursery Rhyme or kids song.

 

So what do you guys think good idea for a class? 

 

Here is mine:

 

5 Little ducks, c#

using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace LittleDucks{    class duck    {        public int number = 5;        public void count()        {            Console.WriteLine("{0} Little ducks", number);        }        public void lost ()        {            if (number != 0)            {                number--;            } else            {                number = 5;            }                               }        public void back()        {            Console.WriteLine("Came swimming back.");        }    }    class baby : duck    {        public void swim()        {            Console.WriteLine("Went swimming one day.");            Console.WriteLine("Over the hills and far away.");        }    }    class mother : duck    {        public void quack()        {            Console.WriteLine("Mother Duck Said");            Console.WriteLine("'Quack quack quack'");        }    }    class Program    {        static void Main(string[] args)        {            duck myDuck = new duck();            baby babyDuck = new baby();            mother motherDuck = new mother();            do            {                myDuck.count();                babyDuck.swim();                motherDuck.quack();                myDuck.lost();                myDuck.count();                myDuck.back();                Console.ReadKey();                Console.Clear();            } while (myDuck.number > 0);            myDuck.count();            babyDuck.swim();            motherDuck.quack();            myDuck.lost();            myDuck.count();            myDuck.back();            Console.ReadKey();        }    }}

Feel free to post your own :)

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
Share on other sites

Link to post
Share on other sites

-snip-

 

Can you post an example / examples of what it outputs?

 

Edit: Sorry, just looked at it again, thought it randomised. :0/

 

But post the output anyway?

Edited by Blade of Grass
Removed quote of OP text

"I try to put good out into the world...that way I can believe it's out there." --CKN                  “How people treat you is their karma; how you react is yours.” --Wayne Dyer            

[Needs Updating] My PC: i5-10600K @TBD / 32GB DDR4 @4000MHz / Z490 AORUS Elite AC / Titan RTX / Samsung 1TB 960 Evo / EVGA SuperNova 850 T2

Link to comment
Share on other sites

Link to post
Share on other sites

Can you post an example / examples of what it outputs?

 

Edit: Sorry, just looked at it again, thought it randomised. :0/

 

But post the output anyway?

 

sure thing, cut out some windows.

post-44895-0-69169100-1426337065_thumb.p

post-44895-0-89822800-1426337171_thumb.p

post-44895-0-54805600-1426337223_thumb.p

post-44895-0-69169100-1426337065_thumb.p

post-44895-0-89822800-1426337171_thumb.p

post-44895-0-54805600-1426337223_thumb.p

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
Share on other sites

Link to post
Share on other sites

Awesome. :0)

"I try to put good out into the world...that way I can believe it's out there." --CKN                  “How people treat you is their karma; how you react is yours.” --Wayne Dyer            

[Needs Updating] My PC: i5-10600K @TBD / 32GB DDR4 @4000MHz / Z490 AORUS Elite AC / Titan RTX / Samsung 1TB 960 Evo / EVGA SuperNova 850 T2

Link to comment
Share on other sites

Link to post
Share on other sites

Does ripping the words straight from a website count?

import urllib.request, reprint(re.findall('Star</h2><span style="background-color:transparent;do_recalc:1;">(.*)</span><h2 style="background-color:transparent;font-size:24px;font-weight:bold;">Jack',urllib.request.urlopen(urllib.request.Request('http://www.nurseryrhymes.com/',headers={'User-Agent':'as'})).read().decode('utf-8').replace('\r','').replace('\n',''))[0].replace('<br>','\r\n'))

1474412270.2748842

Link to comment
Share on other sites

Link to post
Share on other sites

 

Does ripping the words straight from a website count?

import urllib.request, reprint(re.findall('Star</h2><span style="background-color:transparent;do_recalc:1;">(.*)</span><h2 style="background-color:transparent;font-size:24px;font-weight:bold;">Jack',urllib.request.urlopen(urllib.request.Request('http://www.nurseryrhymes.com/',headers={'User-Agent':'as'})).read().decode('utf-8').replace('\r','').replace('\n',''))[0].replace('<br>','\r\n'))

Yes it does :)

 

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
Share on other sites

Link to post
Share on other sites

I don't understand, are we supposed to play the audio and make the text show up on screen to the words in the song or what.

i want to die

Link to comment
Share on other sites

Link to post
Share on other sites

I don't understand, are we supposed to play the audio and make the text show up on screen to the words in the song or what.

 

you can do music if you like. 

 

The idea is to make a program that shows a nursery rhyme. The plan is that as these are rather simple songs that translating that into a program would be easy for them to get a grasp off.

 

like i have got duck class with mother and duck classes.

 

10 green bottles you could do in a for loop that ends on 0 bottles.

 

I just thought that having something laid out like this would be easier to get them to do that saying "make a program that adds two numbers togther"

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
Share on other sites

Link to post
Share on other sites

you can do music if you like. 

 

The idea is to make a program that shows a nursery rhyme. The plan is that as these are rather simple songs that translating that into a program would be easy for them to get a grasp off.

 

like i have got duck class with mother and duck classes.

 

10 green bottles you could do in a for loop that ends on 0 bottles.

 

I just thought that having something laid out like this would be easier to get them to do that saying "make a program that adds two numbers togther"

 

Who are you talking about? Who's "them"? What?

 

Link to comment
Share on other sites

Link to post
Share on other sites

Who are you talking about? Who's "them"? What?

 

read at the top about coderdojo :)

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×