473,408 Members | 2,009 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

trying to implement a timer

I've been teaching myself perl today by writing a simple word game. It's going quite well, except I've hit a wall on the timer.

At the moment it's a simple CLI interface, and what I need to do is present the player with a list of letters, and give them 3 minutes to enter as many words as they can from the list of letters.

I'm thinking that the easiest way to do this would be to wrap the game logic in a while() loop for the 3 minutes.

I can't, however, find any examples of how to do this on the web or in the newsgroups.

Can someone give me a hand?
thanks,
fnord
Jul 19 '05 #1
2 4546
On Thu, 21 Aug 2003 20:49:41 -0400, fnord wrote:
I've been teaching myself perl today by writing a simple word game. It's
going quite well, except I've hit a wall on the timer.

At the moment it's a simple CLI interface, and what I need to do is
present the player with a list of letters, and give them 3 minutes to
enter as many words as they can from the list of letters.

I'm thinking that the easiest way to do this would be to wrap the game
logic in a while() loop for the 3 minutes.

I can't, however, find any examples of how to do this on the web or in
the newsgroups.

Can someone give me a hand?
thanks,
fnord


Check out the sleep command.

Shawn
Jul 19 '05 #2
Sleep doesn't help. He needs the Camel book and to look up alarm and the
%SIG hash, there is a good example of a timer there. He wants to wait
for input, but only for a certain amount of time. Sleep would wait, but
not allow the program to respond to input.

Eric

Shawn Milochik wrote:

On Thu, 21 Aug 2003 20:49:41 -0400, fnord wrote:
I've been teaching myself perl today by writing a simple word game. It's
going quite well, except I've hit a wall on the timer.

At the moment it's a simple CLI interface, and what I need to do is
present the player with a list of letters, and give them 3 minutes to
enter as many words as they can from the list of letters.

I'm thinking that the easiest way to do this would be to wrap the game
logic in a while() loop for the 3 minutes.

I can't, however, find any examples of how to do this on the web or in
the newsgroups.

Can someone give me a hand?
thanks,
fnord


Check out the sleep command.

Shawn

Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Djanvk | last post by:
Ok I'm working on a program where you have say x number of seconds to do something. I'm at a loss on how to go about running a timer function. Can anyone point me in the right direction or post a...
1
by: wukexin | last post by:
I write my own class Cfile, I want to know what about implement ctime().Who help me? My use function ctime, I sign it with $$$. my class Cfile: #------------------------ file.h...
3
by: John | last post by:
Hi I am writing a windows service and don't want a form or any other UI element in it. How can I implement timer in this case to run a piece of code every hour? Thanks Regards
6
by: Steve | last post by:
I am working on a emulator and need to have time based events. I've tried to use the timer control and discovered that it runs waaaaaaay slow. I set the tick frequency to 1, then in the tick...
5
by: Flack | last post by:
Hey guys, Here is what I am trying to achieve: I have a grid, and every once in a while the grid will receive a message to add a new row and highlight it (change the backcolor) for five...
6
by: paresh | last post by:
Hi all, I need to set timer in C/linux like alram, such that i will get a timeout signal after specific timeout and my process remain executing as is it. I can use signal(SIGALRM, xyz) and then...
19
by: UG | last post by:
I just wanted to know whether any timer facility exists in C, as it is not mentioned in K&R 2, or in the ISO Draft. By timer function i mean that when we use standard input function like scanf() or...
8
by: sip.address | last post by:
Hello, I'm trying to find some existing (and simple if possible) timer queue implementation. Does anybody know a simple skeleton to use as example? I just need to send simple (relative)...
19
by: colin | last post by:
Hi, Im trying to time some parts of my code using the Stopwatch class, but it is so slow, I tried the QueryPerformanceFrequency() but this seems to be just as slow, if I just simply call this...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.