View unanswered posts | View active topics It is currently Wed Jul 30, 2014 5:09 am






Reply to topic  [ 3 posts ] 
VEX Alarm Clock Challenge, or the... 
Author Message
Site Admin
Site Admin

Joined: Thu May 24, 2012 12:15 pm
Posts: 556
Post VEX Alarm Clock Challenge, or the...
"I couldn't think of a more original name for this!" Challenge.

Alarm clocks. We have them, we use them, and we eventually grow to hate them. Those annoying little monstrosities are the source of our continued employment and the slayer of our peaceful rest. To help ease the pain of having your serene slumber shattered by a blaring siren, we’ve created a program that will turn a VEX Cortex (with a LCD screen attached) into a basic alarm clock (code attached).

Here’s the catch; although the code is correct and will work, it is very poorly written. It’s all in task main running straight through with little room for flexibility; there are no functions or multitasking involved. Clearly, this is sub-optimal code.

This is where you come in. We would like you, the ROBOTC community, to showcase how you would rewrite the code to make it better. Where can it be improved? What can be cut out? Where can it be more flexible? The fun doesn’t stop there, though (we can’t make this easy now, can we?): the challenge is to showcase the different styles and approaches to coding, so we’d like to see what you can come up with.

Specifically
-How to make the most streamlined code (fewest lines, for instance)
-How to make the most flexible code (switching out 12 hour to 24 time format, etc)
-Who can make the most ‘inventive’ code (one idea was to make the robot ‘run away’ from the groggy user trying to shut the alarm off :twisted: )

We want to see what the community can come up with, the processes involved, the pros and cons of various coding styles, etc. More importantly, we want this to be a fun learning experience for all involved, and to that end we encourage this to be an open brainstorming session.

Good luck, and happy coding!

Attachment:
File comment: This is the long, uncut version of the Alarm Clock program for VEX Cortex.
Alarm_Clock_One_Task.c [8.34 KiB]
Downloaded 1501 times


*This is a sister challenge to the NXT Alarm Clock Challenge

_________________
Check out our Blog! And our Facebook page!
Need help? Take a look at our Wiki and our Forums.

I just met you,
And this is crazy,
But here's my code now,
So fix it, maybe?
~ Carly Rae Jepsen parody


Last edited by JohnWatson on Mon Apr 15, 2013 9:09 am, edited 1 time in total.



Fri Jul 20, 2012 1:38 pm
Profile
Rookie
User avatar

Joined: Fri Aug 24, 2012 8:28 pm
Posts: 1
Post Re: VEX Alarm Clock Challenge, or the...
I quickly wrote this, however I have NO idea if it works or not, I have no way to testing it. There's nothing really special about it yet.. I'll start brainstorming some unique ideas for it and re-upload a new version later =P

Generally I would like to have split this into 2 or 3 files, one being the main task and the other for the functions (and for bigger projects, another for the variables), but just so it's simple to upload/download, I put it into one file.

My coding style has diffidently grown into something pretty solid (I think) this summer, but I'll of course take any tips on how to organize/write everything better.

EDIT: Will the code
Code:
if(toggleLeft!="")
work correctly? I found some examples and it looks like it's possible to do stringA==stringB, but I just want to be sure.

Thanks


Attachments:
File comment: Code
Alarm_Clock_One_Task (1).c [5.3 KiB]
Downloaded 231 times
Fri Aug 24, 2012 8:39 pm
Profile
Rookie

Joined: Thu Nov 01, 2012 3:00 pm
Posts: 1
Post Re: VEX Alarm Clock Challenge, or the...
I don't understand


Thu Nov 01, 2012 3:03 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.