
-----------------------------------
linecode
Thu Jun 17, 2004 3:18 pm

Need Help coding a Clock program = Gmail Invite.
-----------------------------------
I have 2 Gmail invites, anyone interested in doing a program for me. I will give you a link to the turing software that is used in windows, as well as a document explaining the instructions to what the clock needs to look like and what it suppose to do? In return I will give u a Gmail invite to have 1 gig of email service from Google. Upon completion and the program being able to work, I will send you the invite.

Anyone interested PM. or post back..i will be checking it every so oftan. It is really important for me.

Thank you all in advance.

-----------------------------------
Delos
Thu Jun 17, 2004 4:40 pm


-----------------------------------
What category does this fall under?

Bribary?
Contractual Breech?
Plagarism?

Hehehe...the fun ticks on...

-----------------------------------
linecode
Thu Jun 17, 2004 4:43 pm


-----------------------------------
I suck at coding. And i need help...and for the help my thank you would be by giving a invitation to a gmail account. its a nice gesture to thank the person for their help.

all i ask is for help.

-----------------------------------
DanShadow
Thu Jun 17, 2004 6:09 pm


-----------------------------------
Ya see, there is no forum in the index for what your asking for. This is Turing Help, not "please do my damn project because im a lazy freak" forum. I decided to make the clock program decoding your computers clock, I even added an alarm feature. Now im just gonna sit an look at the program and think about you. And no, im not posting it, now go do your own work, if you have a question, ask, and we will help. Geez, if I was the Turing Mod, I would delete this.

-----------------------------------
linecode
Thu Jun 17, 2004 6:16 pm


-----------------------------------
wow. if i knew how to code in turing i would do it. but i dont. why is everyone such an asshole so far that has posted?

i tried doing it...and im lost in doing it. why cant someone help me...in which i will show my gratitude back.

im sorry if i have offended people with my request. but i am just asking for help.

-----------------------------------
Mazer
Thu Jun 17, 2004 6:23 pm


-----------------------------------
all i ask is for help.
No you didn't. Seriously, if you ask for help chances are we will help you. Come with a specific problem, and we can give you a hint or solution. Don't be stupid man, this really pisses us off.

-----------------------------------
linecode
Thu Jun 17, 2004 6:34 pm


-----------------------------------
i need to make a command to the clock program that will have a  put statement asking the user to input the starting time and the clock will set itself to that time and the next question the user will be asked whether in real time or in fast mode for the time to go in.

I figured out that i will need to set real time to 1000 and fast to 500 (or less) to go really quickly.

what code do i use so that the instructions the users commands for the clock to do?

-----------------------------------
Dan
Thu Jun 17, 2004 7:08 pm


-----------------------------------
Here is the basick idea of how to do real time:


var offset : int

put "in put start time in secs: "
get offset

var startTime : int := Time.Sec

loop
    cls
    put (Time.Sec - startTime) + offset
    delay(500)
end loop


to input time in a noraml format you can use the Time.DateSec to covert a string to a number in secs.

for fast time you could do the same thing but with a couter and a nomral dealy.

NOTE: in new verson of turing there is a Time.dealy method witch is an easer way to real time dealys then keeping track of the start time.

-----------------------------------
AsianSensation
Thu Jun 17, 2004 7:14 pm


-----------------------------------
wait, do you want to reset the system clock, or are you just interested in keeping track of time in your own program?

it's rather hard to reset system clock with turing, but easier if you want to keep track of your own time. Use the time function, something like this:

var second, t1, t2, choice : int := 0
put "How many seconds?"
get second
put "What mode?"
get choice

t1 := Time.Elapsed
loop
    t2 := Time.Elapsed
    if choice = 1 then
        if t2 - t1 >= 1000 then
            t2 := 0
            t1 := Time.Elapsed
            second += 1
        end if
    else
        if t2 - t1 >= 500 then
            t2 := 0
            t1 := Time.Elapsed
            second += 1
        end if
    end if
    put second
end loop


this asks the user to input how many seconds, and then it checks to see the time passed, and adds to your seconds variable every second or half second, depend what mode you chose.

-----------------------------------
linecode
Thu Jun 17, 2004 7:22 pm


-----------------------------------
no need for a restart. just asked in the beginning...what time do you want to start the clock at? and then be asked....in real time or fast time? thats the main idea.

thank you for the help. i appreciate it extremely. as i havent gotten a warm welcome from some of the members due to the way I asked for help. but i was just being honest. I know the basics of turing, i am not advanced, i am a economics student...not a programmer.

I thank you for your help. and thank in advance for the further help I will recieve. Thank YOU!  :D

-----------------------------------
Delos
Thu Jun 17, 2004 8:04 pm


-----------------------------------

time ( var t : string )
 
Description   The time statement is used to determine the current time of day. Variable t is assigned a string in the format "hh:mm:ss". For example, if the time is two minutes and 47 seconds after nine A.M., t will be set to "09:02:47". Twenty-four hour time is used. For example, eleven thirty P.M. gives the string "23:30:00".
 
Example   This program greets you and tells you the time of day.

        var timeOfDay : string
        time ( timeOfDay )
        put "Greetings!!  The time is ", timeOfDay
 
Details   Be warned that on some computers such as IBM PC compatibles or Apple Macintoshes, the time may not be set correctly in the operating system. In this case, the time procedure will give incorrect results. 


I'm guessing that you don't have the helpfile on your version of Turing...we have the same type at school (no, I'm not being sarcastic...)

Hehehe...it's been a while since someone called me an @$$0...let's see...about a week now! :D.

NEhow, just edit the above code a bit and

var timeOfDay : string
loop
    time (timeOfDay)
    locate (1, 1)
    put "Greetings!!  The time is ", timeOfDay
    exit when hasch
    % as soon as you press a key it exits.
end loop


Now that you've seen 3 or so examples of how to use the various time functions, see how much farther you can get w/ your proj...

Hehehe...I'm an @$$...hahahahahhahaa....

-----------------------------------
linecode
Thu Jun 17, 2004 8:24 pm


-----------------------------------
thats awesome, that gives me a great help what to do. thank you!

-----------------------------------
templest
Fri Jun 18, 2004 9:42 pm


-----------------------------------
You made a compsci account just to bribe us with a gMail account... you bastard.  :evil: 

How about you just be nice and give me one?  :D

-----------------------------------
Dan
Fri Jun 18, 2004 10:02 pm


-----------------------------------
i have a fealing he dose not realy have any invites....

if he did u whould think he whould at least have his e-mail in his profile as @gmail  :roll:

-----------------------------------
templest
Sat Jun 19, 2004 12:20 am


-----------------------------------
good point, if I was him I'd only have 1 invite to give away. :lol:

-----------------------------------
AsianSensation
Sat Jun 19, 2004 3:28 pm


-----------------------------------
meh, doesn't really matter to me if he has the invite or not, we are not a reward-based programming/help community. But if he actually doesn't have the invites, it will only make himself look bad, because we would have helped him regardless. I think alot of members were cold to him in the beginning is because we got way too many of those "do my Final Project and I'll paypal you $10" type of messages.

-----------------------------------
linecode
Tue Jun 22, 2004 9:15 pm


-----------------------------------
lol. interesting posts. i do have an gmail acct. i didnt not want to or was it my intention to bs anyone.

-----------------------------------
linecode
Tue Jun 22, 2004 9:19 pm


-----------------------------------
Okay, lets do it this way...I have been getting help from my friend for the past 2 weeks trying to get this program done for the clock to work.

But i need the two or three commands as many have helped me already (thank you)...to have the user input the time they want to start out with and whether to have it be going in real time or is fast pace mode. Check the attachment.

Whoever wants to complete the rest of the code for this program I will be HAPPY to give out my GMAIL invites to those who helped me. I have ONE left. And if i will get more from gmail...i will surely come back and invite those who have helped me. make sure u post anything but hotmail or yahoo...they block gmail invites.

I will prove to you all my honesty.

here is the code...


procedure displayClock (varhour, varminute, rate : int)

    var hourHand, minuteHand, secondHand : int
    hourHand := 70
    minuteHand := 80
    secondHand := 100

    setscreen ("offscreenonly")
    
    const PI := 3.14159
    var second, minute, hour : int
    var x, y, x2, y2 : int
    var ang : real
    
    second := 0
    
    minute := varminute
    hour := varhour

    var chars : array char of boolean    
    
    loop
                    
        delay (rate)
        second := second + 1
        
        if second = 60 then
            second := 0
            minute := minute + 1
            end if
            
        if minute = 60 then
            minute := 0
            hour := hour + 1
            end if
            
        if hour = 12 then
            hour := 0
            end if
        
        %hour hand
        ang := ((hour + (minute / 60)) / 12) * 360 - 90
        x := round (cos (-ang * (PI / 180)) * hourHand + maxx div 2)
        y := round (sin (-ang * (PI / 180)) * hourHand + maxy div 2)
        drawline (maxx div 2, maxy div 2, x, y, 7)
        
        %minute hand
        ang := (minute / 60) * 360 - 90
        x := round (cos (-ang * (PI / 180)) * minuteHand + maxx div 2)
        y := round (sin (-ang * (PI / 180)) * minuteHand + maxy div 2)
        drawline (maxx div 2, maxy div 2, x, y, 7)
        
        %second hand
        ang := (second / 60) * 360 - 90
        x := round (cos (-ang * (PI / 180)) * secondHand + maxx div 2)
        y := round (sin (-ang * (PI / 180)) * secondHand + maxy div 2)
        drawline (maxx div 2, maxy div 2, x, y, 4)
        
        %draw face
        for i : -90 .. 270 by 6
            if i mod 15 = 0 then
                x := round (cos (-i * (PI / 180)) * (max (hourHand, max (minuteHand, secondHand))) + maxx div 2)
                y := round (sin (-i * (PI / 180)) * (max (hourHand, max (minuteHand, secondHand))) + maxy div 2)
                x2 := round (cos (-i * (PI / 180)) * (max (hourHand, max (minuteHand, secondHand)) + 10) + maxx div 2)
                y2 := round (sin (-i * (PI / 180)) * (max (hourHand, max (minuteHand, secondHand)) + 10) + maxy div 2)
            else
                x := round (cos (-i * (PI / 180)) * (max (hourHand, max (minuteHand, secondHand)) + 5) + maxx div 2)
                y := round (sin (-i * (PI / 180)) * (max (hourHand, max (minuteHand, secondHand)) + 5) + maxy div 2)
                x2 := round (cos (-i * (PI / 180)) * (max (hourHand, max (minuteHand, secondHand)) + 10) + maxx div 2)
                y2 := round (sin (-i * (PI / 180)) * (max (hourHand, max (minuteHand, secondHand)) + 10) + maxy div 2)
            end if
            drawline (x, y, x2, y2, 7)
        end for
        
        drawoval (maxx div 2, maxy div 2, max (hourHand, max (minuteHand, secondHand)) + 10, max (hourHand, max (minuteHand, secondHand)) + 10, 1)
        View.Update
        cls
        
        
        Input.KeyDown (chars)
            
        
    end loop
end displayClock



displayClock (1, 30, 1000)


I will stay on. Please dont take this post the wrong way. I thank everyone in Advance for their help. As i mentioned before, I am not a programmer.

-----------------------------------
Dan
Tue Jun 22, 2004 10:23 pm


-----------------------------------
make sure u post anything but hotmail or yahoo...they block gmail invites.

thats is aucctlay not true, i have given invites to many poleop who use hotmail and at worse yahoo just puts them in the spam foldoer.

-----------------------------------
linecode
Wed Jun 23, 2004 9:13 am


-----------------------------------
some do some don't. everyone has different experiences with the invites. but yahoo, yeah they put anything in the junk mail folder.

no one wants to take a stab at completing the two or three commands?

-----------------------------------
AsianSensation
Wed Jun 23, 2004 4:15 pm


-----------------------------------
seems simple enough:

var tmp : string

put "What's the starting time, in the form of hh:mm"
get tmp

displayClock (strint (tmp (1 .. 2)), strint (tmp (4 .. 5)), 1000)

but they must input in the form of hh:mm, like 03:10. I didn't bother to error trap, so if the input isn't like that, you get a run time error. So you could either ask for the hour and minute separately, I was lazy, so I did it like this.

-----------------------------------
the_short1
Wed Jun 23, 2004 7:08 pm


-----------------------------------
hahah..


ok....  

dont use:

delay (number here)
in ur program  or it will be extremely inacurate..

Time.Delay (time here) < is acually acurate..

-----------------------------------
zylum
Wed Jun 23, 2004 10:07 pm


-----------------------------------
you're wrong, if you try :


delay (10000)
put Time.Elapsed

vs


Time.Delay (10000)
put Time.Elapsed

it shows the exact same thing, well maybe a millisecond or 2 off, but on average its the same thing

-----------------------------------
AsianSensation
Thu Jun 24, 2004 8:54 am


-----------------------------------
alright, to clear up confusions about people doubting linecode (we were pretty harsh in the beginning), linecode did have a gmail invite, I got it, but since I already have a gmail account, I guess I don't need it anymore, so I think I'll donate it to compsci.ca, and we can give out the invite for the FP contest or something. (Though I'm still pissed that AsianSensation@gmail, and AznSensation@gmail were both taken.....)

-----------------------------------
the_short1
Thu Jun 24, 2004 9:28 am


-----------------------------------
well u prob have an average copmputer...


hacker dans laptop would be done 5 seconds before the time.delay one

and mine... (peice of crap) would prob take ten seconds longer then the time.delay one..




i had that problem with speeds in my pacman game.. that is why i turned to time.delay...   


but w/e




  ok... i tried reading ur code.... but either im really tired rite now...   or i just dont understand all it....


yea ... asian sensation...!! that must suck having those taken,.. :( but donate to FP ... thats a GREAT idea!

-----------------------------------
zylum
Thu Jun 24, 2004 11:35 am


-----------------------------------
that's nonsense. delay and Time.Delay are the same thing except that Time.Delay is in the predefined unit "Time". they are the same procedure and it makes no difference which you use.... in fact make your own delay procedure if you're so skeptical:

proc DELAY (t : int)
    var startTime := Time.Elapsed
    loop
        exit when Time.Elapsed - startTime >= t
    end loop
end DELAY

DELAY (10000)
put Time.Elapsed

it's never off by more than 2 milliseconds for me... using my code, the most it could be off by is the amount of time your computer takes to compute one loop which is nothing, or about 2 milliseconds for my machine.

-----------------------------------
Paul
Thu Jun 24, 2004 3:48 pm


-----------------------------------
not like it makes a large difference but:
with 
Time.Delay (10000)
put Time.Elapsed
I got 
10001

and with

delay (10000)
put Time.Elapsed
I got
10003

-----------------------------------
this_guy
Thu Jun 24, 2004 5:29 pm


-----------------------------------
hmmmmmmmm......
i got 10004 for both of them.
mine must be really slow, or i should close some of my internet explorer windows.

-----------------------------------
the_short1
Thu Jun 24, 2004 6:03 pm


-----------------------------------
zylum.... thats a nice way to make a delay.....


well.... like i said..it was in my case... .  cuz u are doing that on an EMPTY turing program..


try doign the same test while in full fledged game is going.... then its WAY off cuz ur PC speed dips a lot more and then the delay(time) one is much slower or faster...


thats my experience..

ur system is idle when just doing that.... when doing my game ur pc is using more and prob does that delay a lot longer.....   at least for me...

heres the results for that test on my pc..


Time.Delay (10000)
put Time.Elapsed 

i got 10190


now

with

delay (10000)
put Time.Elapsed 

i got 10016




now... is that not a HUGE difference...
.
get dan to do the same test with his alienware pabtop....  it will be more liokle 900 for one... and like 1000 for the other..



wait a second.... . that was odd...time.delay shoulda be the one with 10016... .   wait i know why.... my PC clock is SLOW....  my batery is dying..  whenever i shutdown... the comp stops recording time... meh... im too lazy to get a new batery...


either way.... depends on ur PC..... sometimes it really makes a difference...

-----------------------------------
zylum
Thu Jun 24, 2004 6:21 pm


-----------------------------------
it will never be less that the number you specify.... anyways, my delay seems to be the most accurate in any case, no matter the conditions.

-----------------------------------
Dan
Thu Jun 24, 2004 6:58 pm


-----------------------------------
I tested them and i got the same for values for both, i even tryed diffrent lengths for the dealys and got the same.

-----------------------------------
the_short1
Thu Jun 24, 2004 7:06 pm


-----------------------------------
i guess it only effects the really slow comps like mine.,..




dam...


i take back some of my argument..

-----------------------------------
cbc
Wed Jul 07, 2004 8:09 pm


-----------------------------------
shudnt Time.Delay and delay be the same thing?

its just like locate and Text.Locate

colour and Font.Colour
etc...

-----------------------------------
Delos
Wed Jul 07, 2004 8:16 pm


-----------------------------------
Theoretically yes.  But in practise, one finds that delay() is less reliable for cross-platform compatibility than Time.Delay() is.

In other words...a
delay (500)
is less likely to give you that desired half second pause than a 
Time.Delay (500)
on a variety of computers.

This is due to the fact that Turing works its processor around the CPU speed...yeah...that thing...
Thus being...delay()s can really screw up, especially in programmes in which graphics/audio must sync...

-----------------------------------
Mazer
Wed Jul 07, 2004 8:52 pm


-----------------------------------
Ya sure about that? AFAIK, delay() is the same function as Time.Delay() that HoltSoft has available for those that don't want to type as much. Just like drawfillbox() vs Draw.FillBox().

-----------------------------------
Delos
Wed Jul 07, 2004 9:16 pm


-----------------------------------
I'm not entirely positive about it...I do know that the whole Draw./Time. thing came into play after Holt moved to OOT...the older commands being intrinsic in Classic Turing...so, to allow for some backward compatibility, the left them in.

I think (note the uncertainty) that I tried this out once, using delay() vs. Time.Delay() w/ the above described combination of graphics and sound...it would seem that the latter form of the command must have caught my attention...otherwise, I mightn't have said what I did...but I could be wrong.
It was a while ago...if ever... :? .
Clarification anyone?

-----------------------------------
the_short1
Wed Jul 07, 2004 9:56 pm


-----------------------------------
u sound right delos..


cuz i based my argument on a full program .. meaning.. basically my pacman game with sounds and graphics....  and it played a HUGE role which one i used...

i used  Time.Delay for acuracy..
delay () when i was being lazy and it did not matter..

-----------------------------------
this_guy
Thu Jul 08, 2004 5:54 pm


-----------------------------------
hmmm....interesting

i've always thought they were the same thing, just a different way of calling the same procedure, but i've always prefered writing the non-lazy way

-----------------------------------
the_short1
Thu Jul 08, 2004 7:03 pm


-----------------------------------
the  non-lazy way of life....  why?   thats so much extra work :P ;)

all that shift holding... and extra letters...




lol..

:lol:

-----------------------------------
TheZsterBunny
Sat Aug 07, 2004 8:32 am


-----------------------------------
Yeah, i know this is an old post, but I couldn't resist.


var tod, tup, tap : string
var sc, mn, hr : int
var counter : int := 0
var asec, amin, ahr : real
var fonta : int := Font.New ("Arial:8")
setscreen ("offscreenonly,nobuttonbar,title: Clock Display")
time (tup)
tap := tup

loop
    time (tod)
    if tap not= tod then
        time (tup)
        tap := tup
        hr := strint (tup (1 .. index (tup, ":") - 1))
        tup := tup (index (tup, ":") + 1 .. *)
        mn := strint (tup (1 .. index (tup, ":") - 1))
        tup := tup (index (tup, ":") + 1 .. *)
        sc := strint (tup)
        asec := (sc / 60) * (Math.PI * 2)
        amin := (mn / 60) * (Math.PI * 2)
        ahr := (hr / 12) * (Math.PI * 2)
        cls
        drawoval (maxx div 2, maxy div 2, 42, 42, blue)
        drawoval (maxx div 2, maxy div 2, 58, 58, blue)
        drawoval (maxx div 2, maxy div 2, 62, 62, green)
        drawoval (maxx div 2, maxy div 2, 78, 78, green)
        drawoval (maxx div 2, maxy div 2, 82, 82, red)
        drawoval (maxx div 2, maxy div 2, 98, 98, red)
        Draw.ThickLine (round (sin (ahr) * 55) + maxx div 2, round (cos (ahr) * 55) + maxy div 2, round (sin (ahr) * 45) + maxx div 2, round (cos (ahr) * 45) + maxy div 2, 1, blue)
        Draw.ThickLine (round (sin (amin) * 65) + maxx div 2, round (cos (amin) * 65) + maxy div 2, round (sin (amin) * 75) + maxx div 2, round (cos (amin) * 75) + maxy div 2, 1, green)
        Draw.ThickLine (round (sin (asec) * 95) + maxx div 2, round (cos (asec) * 95) + maxy div 2, round (sin (asec) * 85) + maxx div 2, round (cos (asec) * 85) + maxy div 2, 1, red)
        drawline (maxx div 2 - 1, maxy div 2 + 100, maxx div 2 - 1, maxy div 2 + 110, black)
        drawline (maxx div 2 + 1, maxy div 2 + 100, maxx div 2 + 1, maxy div 2 + 110, black)
        drawline (maxx div 2 + 100, maxy div 2, maxx div 2 + 110, maxy div 2, black)
        drawline (maxx div 2 - 100, maxy div 2, maxx div 2 - 110, maxy div 2, black)
        drawline (maxx div 2, maxy div 2 - 100, maxx div 2, maxy div 2 - 110, black)
        drawoval (maxx div 2, maxy div 2, 112, 112, black)
        Font.Draw (tap, maxx div 2 - (Font.Width (tap, fonta) div 2), maxy div 2 - 4, fonta, black)
        % counter += 1
        % locate (1, 1)
        % put counter
        View.Update
    end if
end loop


okay, the outermost circle (black) is the cardinal points on the clock
the next circle inwards (red) is the seconds
next (green) minutes
next (blue) hours
and finally, in the centre we have the time for all those who are too lazy to figure it out.

-Z

-----------------------------------
DanShadow
Sat Aug 07, 2004 2:28 pm


-----------------------------------
But...did you read the first part of the post? It was a guy asking us to give him code for a project (or something like that). So you technically just broke our non-cheating rule, even if it is an old post. Please refrain from providing people with complete answers, especially if thats what they are asking for. Like, if somebody asks a question, its better to answer a question, then to provide them with every bit of information they need...it eliminates the learning experience. Anyway...just thought Id add that in.  :P
