Need Help coding a Clock program = Gmail Invite.
Author |
Message |
AsianSensation
|
Posted: Sat Jun 19, 2004 3:28 pm Post subject: (No subject) |
|
|
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.
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
linecode
|
Posted: Tue Jun 22, 2004 9:15 pm Post subject: (No subject) |
|
|
lol. interesting posts. i do have an gmail acct. i didnt not want to or was it my intention to bs anyone.
|
|
|
|
|
|
linecode
|
Posted: Tue Jun 22, 2004 9:19 pm Post subject: (No subject) |
|
|
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...
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.
Description: |
My Clock Assignment Instructions... |
|
Download |
Filename: |
Clock.doc |
Filesize: |
236.5 KB |
Downloaded: |
106 Time(s) |
|
|
|
|
|
|
Dan
|
Posted: Tue Jun 22, 2004 10:23 pm Post subject: (No subject) |
|
|
linecode wrote: 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.
|
Computer Science Canada
Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more! |
|
|
|
|
linecode
|
Posted: Wed Jun 23, 2004 9:13 am Post subject: (No subject) |
|
|
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
|
Posted: Wed Jun 23, 2004 4:15 pm Post subject: (No subject) |
|
|
seems simple enough:
code: | 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
|
Posted: Wed Jun 23, 2004 7:08 pm Post subject: (No subject) |
|
|
hahah..
ok....
dont use:
delay (number here)
in ur program or it will be extremely inacurate..
Time.Delay (time here) < is acually acurate..
|
|
|
|
|
|
zylum
|
Posted: Wed Jun 23, 2004 10:07 pm Post subject: (No subject) |
|
|
you're wrong, if you try :
code: |
delay (10000)
put Time.Elapsed |
vs
code: |
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
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
AsianSensation
|
Posted: Thu Jun 24, 2004 8:54 am Post subject: (No subject) |
|
|
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
|
Posted: Thu Jun 24, 2004 9:28 am Post subject: (No subject) |
|
|
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
|
Posted: Thu Jun 24, 2004 11:35 am Post subject: (No subject) |
|
|
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:
code: | 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
|
Posted: Thu Jun 24, 2004 3:48 pm Post subject: (No subject) |
|
|
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
|
Posted: Thu Jun 24, 2004 5:29 pm Post subject: (No subject) |
|
|
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
|
Posted: Thu Jun 24, 2004 6:03 pm Post subject: (No subject) |
|
|
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
|
Posted: Thu Jun 24, 2004 6:21 pm Post subject: (No subject) |
|
|
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.
|
|
|
|
|
|
|
|