Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

crossword!!

juice88juice88 Posts: 23Member
i have some questions about crossword ~
Please help me!

1) How to set the background colour and text colour in pascal??

2) I want to know does pascal has this function??
if i input the right answer in the game
then the colour of text will change to another colour~~
How can do this??

Suggest the simplest way to me~
THZ~
«134

Comments

  • zibadianzibadian Posts: 6,349Member
    : i have some questions about crossword ~
    : Please help me!
    :
    : 1) How to set the background colour and text colour in pascal??
    :
    : 2) I want to know does pascal has this function??
    : if i input the right answer in the game
    : then the colour of text will change to another colour~~
    : How can do this??
    :
    : Suggest the simplest way to me~
    : THZ~
    :
    1: TextColor() and TextBackground() in the CRT unit.

    2: Set the new textcolor and write the answer again at the same location.
  • juice88juice88 Posts: 23Member
    : : i have some questions about crossword ~
    : : Please help me!
    : :
    : : 1) How to set the background colour and text colour in pascal??
    : :
    : : 2) I want to know does pascal has this function??
    : : if i input the right answer in the game
    : : then the colour of text will change to another colour~~
    : : How can do this??
    : :
    : : Suggest the simplest way to me~
    : : THZ~
    : :
    : 1: TextColor() and TextBackground() in the CRT unit.
    :
    : 2: Set the new textcolor and write the answer again at the same location.
    :
    THX~
    BUT I Have a error200 when i set the text colour.



  • zibadianzibadian Posts: 6,349Member
    : : : i have some questions about crossword ~
    : : : Please help me!
    : : :
    : : : 1) How to set the background colour and text colour in pascal??
    : : :
    : : : 2) I want to know does pascal has this function??
    : : : if i input the right answer in the game
    : : : then the colour of text will change to another colour~~
    : : : How can do this??
    : : :
    : : : Suggest the simplest way to me~
    : : : THZ~
    : : :
    : : 1: TextColor() and TextBackground() in the CRT unit.
    : :
    : : 2: Set the new textcolor and write the answer again at the same location.
    : :
    : THX~
    : BUT I Have a error200 when i set the text colour.
    :
    :
    :
    :
    If you are using TP, have you patched your CRT unit? If not search for CRT patch on google, and install that. It is necessary for fast computers.
  • juice88juice88 Posts: 23Member
    : : : : i have some questions about crossword ~
    : : : : Please help me!
    : : : :
    : : : : 1) How to set the background colour and text colour in pascal??
    : : : :
    : : : : 2) I want to know does pascal has this function??
    : : : : if i input the right answer in the game
    : : : : then the colour of text will change to another colour~~
    : : : : How can do this??
    : : : :
    : : : : Suggest the simplest way to me~
    : : : : THZ~
    : : : :
    : : : 1: TextColor() and TextBackground() in the CRT unit.
    : : :
    : : : 2: Set the new textcolor and write the answer again at the same location.
    : : :
    : : THX~
    : : BUT I Have a error200 when i set the text colour.
    : :
    : :
    : :
    : :
    : If you are using TP, have you patched your CRT unit? If not search for CRT patch on google, and install that. It is necessary for fast computers.
    :
    OK!The problem has been solved.

    2)I think this method is not suitable in my idea.
    My idea is like that:
    I had set a display with many letters for the player to choose them.
    If they choose a right letter, it will change colour.

    Any other method??

    3)How to set a timer that count down 30 minutes.

  • zibadianzibadian Posts: 6,349Member
    [b][red]This message was edited by zibadian at 2004-11-19 12:49:51[/red][/b][hr]
    : : : : : i have some questions about crossword ~
    : : : : : Please help me!
    : : : : :
    : : : : : 1) How to set the background colour and text colour in pascal??
    : : : : :
    : : : : : 2) I want to know does pascal has this function??
    : : : : : if i input the right answer in the game
    : : : : : then the colour of text will change to another colour~~
    : : : : : How can do this??
    : : : : :
    : : : : : Suggest the simplest way to me~
    : : : : : THZ~
    : : : : :
    : : : : 1: TextColor() and TextBackground() in the CRT unit.
    : : : :
    : : : : 2: Set the new textcolor and write the answer again at the same location.
    : : : :
    : : : THX~
    : : : BUT I Have a error200 when i set the text colour.
    : : :
    : : :
    : : :
    : : :
    : : If you are using TP, have you patched your CRT unit? If not search for CRT patch on google, and install that. It is necessary for fast computers.
    : :
    : OK!The problem has been solved.
    :
    : 2)I think this method is not suitable in my idea.
    : My idea is like that:
    : I had set a display with many letters for the player to choose them.
    : If they choose a right letter, it will change colour.
    :
    : Any other method??
    :
    : 3)How to set a timer that count down 30 minutes.
    :
    :
    2: You could change the color directly in the video memory, but that would require some assembly and an intricate knowledge of the video memory. The only true-Pascal way is to use TextColor(), TextBackround(), GotoXY() and write() to set it.

    3: The only two ways to do this is to either use interrupts, or use a loop and GetTime(). Here is a sample code to illustrate the latter:
    [code]
    function TimeInMin: Word;
    var
    Hour, Minutes, Seconds, HSeconds: word;
    begin
    GetTime(Hour, Minutes, Seconds, HSeconds);
    TimeInMin := Hour*60+Minutes;
    end;

    var
    GameFinished: boolean;
    { program part }
    GameStartTime := TimeInMin;
    GameFinished := false;

    repeat

    { Do Game }
    { Do not use read() or readln(), because those have their own waiting routine }
    { but readkey() and keypressed() instead }
    { If the player successfully finishes the game set the GameFinished to true }
    { If you want to let the player know how much time is left: }
    { write the following result somewhere: 30-(TimeInMin-GameStart) }

    until (TimeInMin = GameStartTime+30) or GameFinished;

    if GameFinished then
    PlayerHasWon
    else
    PlayerHasLost;
    [/code]


  • juice88juice88 Posts: 23Member
    : [b][red]This message was edited by zibadian at 2004-11-19 12:49:51[/red][/b][hr]
    : : : : : : i have some questions about crossword ~
    : : : : : : Please help me!
    : : : : : :
    : : : : : : 1) How to set the background colour and text colour in pascal??
    : : : : : :
    : : : : : : 2) I want to know does pascal has this function??
    : : : : : : if i input the right answer in the game
    : : : : : : then the colour of text will change to another colour~~
    : : : : : : How can do this??
    : : : : : :
    : : : : : : Suggest the simplest way to me~
    : : : : : : THZ~
    : : : : : :
    : : : : : 1: TextColor() and TextBackground() in the CRT unit.
    : : : : :
    : : : : : 2: Set the new textcolor and write the answer again at the same location.
    : : : : :
    : : : : THX~
    : : : : BUT I Have a error200 when i set the text colour.
    : : : :
    : : : :
    : : : :
    : : : :
    : : : If you are using TP, have you patched your CRT unit? If not search for CRT patch on google, and install that. It is necessary for fast computers.
    : : :
    : : OK!The problem has been solved.
    : :
    : : 2)I think this method is not suitable in my idea.
    : : My idea is like that:
    : : I had set a display with many letters for the player to choose them.
    : : If they choose a right letter, it will change colour.
    : :
    : : Any other method??
    : :
    : : 3)How to set a timer that count down 30 minutes.
    : :
    : :
    : 2: You could change the color directly in the video memory, but that would require some assembly and an intricate knowledge of the video memory. The only true-Pascal way is to use TextColor(), TextBackround(), GotoXY() and write() to set it.
    :
    : 3: The only two ways to do this is to either use interrupts, or use a loop and GetTime(). Here is a sample code to illustrate the latter:
    : [code]
    : function TimeInMin: Word;
    : var
    : Hour, Minutes, Seconds, HSeconds: word;
    : begin
    : GetTime(Hour, Minutes, Seconds, HSeconds);
    : TimeInMin := Hour*60+Minutes;
    : end;
    :
    : var
    : GameFinished: boolean;
    : { program part }
    : GameStartTime := TimeInMin;
    : GameFinished := false;
    :
    : repeat
    :
    : { Do Game }
    : { Do not use read() or readln(), because those have their own waiting routine }
    : { but readkey() and keypressed() instead }
    : { If the player successfully finishes the game set the GameFinished to true }
    : { If you want to let the player know how much time is left: }
    : { write the following result somewhere: 30-(TimeInMin-GameStart) }
    :
    : until (TimeInMin = GameStartTime+30) or GameFinished;
    :
    : if GameFinished then
    : PlayerHasWon
    : else
    : PlayerHasLost;
    : [/code]
    :
    :
    :
    Thank you.
    But it said GetTime is a unknown identifier.
    what should it set?
    uses crt ??uses Doc or something else??
  • zibadianzibadian Posts: 6,349Member
    : : [b][red]This message was edited by zibadian at 2004-11-19 12:49:51[/red][/b][hr]
    : : : : : : : i have some questions about crossword ~
    : : : : : : : Please help me!
    : : : : : : :
    : : : : : : : 1) How to set the background colour and text colour in pascal??
    : : : : : : :
    : : : : : : : 2) I want to know does pascal has this function??
    : : : : : : : if i input the right answer in the game
    : : : : : : : then the colour of text will change to another colour~~
    : : : : : : : How can do this??
    : : : : : : :
    : : : : : : : Suggest the simplest way to me~
    : : : : : : : THZ~
    : : : : : : :
    : : : : : : 1: TextColor() and TextBackground() in the CRT unit.
    : : : : : :
    : : : : : : 2: Set the new textcolor and write the answer again at the same location.
    : : : : : :
    : : : : : THX~
    : : : : : BUT I Have a error200 when i set the text colour.
    : : : : :
    : : : : :
    : : : : :
    : : : : :
    : : : : If you are using TP, have you patched your CRT unit? If not search for CRT patch on google, and install that. It is necessary for fast computers.
    : : : :
    : : : OK!The problem has been solved.
    : : :
    : : : 2)I think this method is not suitable in my idea.
    : : : My idea is like that:
    : : : I had set a display with many letters for the player to choose them.
    : : : If they choose a right letter, it will change colour.
    : : :
    : : : Any other method??
    : : :
    : : : 3)How to set a timer that count down 30 minutes.
    : : :
    : : :
    : : 2: You could change the color directly in the video memory, but that would require some assembly and an intricate knowledge of the video memory. The only true-Pascal way is to use TextColor(), TextBackround(), GotoXY() and write() to set it.
    : :
    : : 3: The only two ways to do this is to either use interrupts, or use a loop and GetTime(). Here is a sample code to illustrate the latter:
    : : [code]
    : : function TimeInMin: Word;
    : : var
    : : Hour, Minutes, Seconds, HSeconds: word;
    : : begin
    : : GetTime(Hour, Minutes, Seconds, HSeconds);
    : : TimeInMin := Hour*60+Minutes;
    : : end;
    : :
    : : var
    : : GameFinished: boolean;
    : : { program part }
    : : GameStartTime := TimeInMin;
    : : GameFinished := false;
    : :
    : : repeat
    : :
    : : { Do Game }
    : : { Do not use read() or readln(), because those have their own waiting routine }
    : : { but readkey() and keypressed() instead }
    : : { If the player successfully finishes the game set the GameFinished to true }
    : : { If you want to let the player know how much time is left: }
    : : { write the following result somewhere: 30-(TimeInMin-GameStart) }
    : :
    : : until (TimeInMin = GameStartTime+30) or GameFinished;
    : :
    : : if GameFinished then
    : : PlayerHasWon
    : : else
    : : PlayerHasLost;
    : : [/code]
    : :
    : :
    : :
    : Thank you.
    : But it said GetTime is a unknown identifier.
    : what should it set?
    : uses crt ??uses Doc or something else??
    :
    GetTime() is part of the Crt unit. This kind of questions can also be answered by looking the function up in the help files. It lists the unit and also the precise description and declaration.
  • juice88juice88 Posts: 23Member
    : : : [b][red]This message was edited by zibadian at 2004-11-19 12:49:51[/red][/b][hr]
    : : : : : : : : i have some questions about crossword ~
    : : : : : : : : Please help me!
    : : : : : : : :
    : : : : : : : : 1) How to set the background colour and text colour in pascal??
    : : : : : : : :
    : : : : : : : : 2) I want to know does pascal has this function??
    : : : : : : : : if i input the right answer in the game
    : : : : : : : : then the colour of text will change to another colour~~
    : : : : : : : : How can do this??
    : : : : : : : :
    : : : : : : : : Suggest the simplest way to me~
    : : : : : : : : THZ~
    : : : : : : : :
    : : : : : : : 1: TextColor() and TextBackground() in the CRT unit.
    : : : : : : :
    : : : : : : : 2: Set the new textcolor and write the answer again at the same location.
    : : : : : : :
    : : : : : : THX~
    : : : : : : BUT I Have a error200 when i set the text colour.
    : : : : : :
    : : : : : :
    : : : : : :
    : : : : : :
    : : : : : If you are using TP, have you patched your CRT unit? If not search for CRT patch on google, and install that. It is necessary for fast computers.
    : : : : :
    : : : : OK!The problem has been solved.
    : : : :
    : : : : 2)I think this method is not suitable in my idea.
    : : : : My idea is like that:
    : : : : I had set a display with many letters for the player to choose them.
    : : : : If they choose a right letter, it will change colour.
    : : : :
    : : : : Any other method??
    : : : :
    : : : : 3)How to set a timer that count down 30 minutes.
    : : : :
    : : : :
    : : : 2: You could change the color directly in the video memory, but that would require some assembly and an intricate knowledge of the video memory. The only true-Pascal way is to use TextColor(), TextBackround(), GotoXY() and write() to set it.
    : : :
    : : : 3: The only two ways to do this is to either use interrupts, or use a loop and GetTime(). Here is a sample code to illustrate the latter:
    : : : [code]
    : : : function TimeInMin: Word;
    : : : var
    : : : Hour, Minutes, Seconds, HSeconds: word;
    : : : begin
    : : : GetTime(Hour, Minutes, Seconds, HSeconds);
    : : : TimeInMin := Hour*60+Minutes;
    : : : end;
    : : :
    : : : var
    : : : GameFinished: boolean;
    : : : { program part }
    : : : GameStartTime := TimeInMin;
    : : : GameFinished := false;
    : : :
    : : : repeat
    : : :
    : : : { Do Game }
    : : : { Do not use read() or readln(), because those have their own waiting routine }
    : : : { but readkey() and keypressed() instead }
    : : : { If the player successfully finishes the game set the GameFinished to true }
    : : : { If you want to let the player know how much time is left: }
    : : : { write the following result somewhere: 30-(TimeInMin-GameStart) }
    : : :
    : : : until (TimeInMin = GameStartTime+30) or GameFinished;
    : : :
    : : : if GameFinished then
    : : : PlayerHasWon
    : : : else
    : : : PlayerHasLost;
    : : : [/code]
    : : :
    : : :
    : : :
    : : Thank you.
    : : But it said GetTime is a unknown identifier.
    : : what should it set?
    : : uses crt ??uses Doc or something else??
    : :
    : GetTime() is part of the Crt unit. This kind of questions can also be answered by looking the function up in the help files. It lists the unit and also the precise description and declaration.
    :
    I can't do it .Can you make a sample to me??
  • zibadianzibadian Posts: 6,349Member
    : : : : [b][red]This message was edited by zibadian at 2004-11-19 12:49:51[/red][/b][hr]
    : : : : : : : : : i have some questions about crossword ~
    : : : : : : : : : Please help me!
    : : : : : : : : :
    : : : : : : : : : 1) How to set the background colour and text colour in pascal??
    : : : : : : : : :
    : : : : : : : : : 2) I want to know does pascal has this function??
    : : : : : : : : : if i input the right answer in the game
    : : : : : : : : : then the colour of text will change to another colour~~
    : : : : : : : : : How can do this??
    : : : : : : : : :
    : : : : : : : : : Suggest the simplest way to me~
    : : : : : : : : : THZ~
    : : : : : : : : :
    : : : : : : : : 1: TextColor() and TextBackground() in the CRT unit.
    : : : : : : : :
    : : : : : : : : 2: Set the new textcolor and write the answer again at the same location.
    : : : : : : : :
    : : : : : : : THX~
    : : : : : : : BUT I Have a error200 when i set the text colour.
    : : : : : : :
    : : : : : : :
    : : : : : : :
    : : : : : : :
    : : : : : : If you are using TP, have you patched your CRT unit? If not search for CRT patch on google, and install that. It is necessary for fast computers.
    : : : : : :
    : : : : : OK!The problem has been solved.
    : : : : :
    : : : : : 2)I think this method is not suitable in my idea.
    : : : : : My idea is like that:
    : : : : : I had set a display with many letters for the player to choose them.
    : : : : : If they choose a right letter, it will change colour.
    : : : : :
    : : : : : Any other method??
    : : : : :
    : : : : : 3)How to set a timer that count down 30 minutes.
    : : : : :
    : : : : :
    : : : : 2: You could change the color directly in the video memory, but that would require some assembly and an intricate knowledge of the video memory. The only true-Pascal way is to use TextColor(), TextBackround(), GotoXY() and write() to set it.
    : : : :
    : : : : 3: The only two ways to do this is to either use interrupts, or use a loop and GetTime(). Here is a sample code to illustrate the latter:
    : : : : [code]
    : : : : function TimeInMin: Word;
    : : : : var
    : : : : Hour, Minutes, Seconds, HSeconds: word;
    : : : : begin
    : : : : GetTime(Hour, Minutes, Seconds, HSeconds);
    : : : : TimeInMin := Hour*60+Minutes;
    : : : : end;
    : : : :
    : : : : var
    : : : : GameFinished: boolean;
    : : : : { program part }
    : : : : GameStartTime := TimeInMin;
    : : : : GameFinished := false;
    : : : :
    : : : : repeat
    : : : :
    : : : : { Do Game }
    : : : : { Do not use read() or readln(), because those have their own waiting routine }
    : : : : { but readkey() and keypressed() instead }
    : : : : { If the player successfully finishes the game set the GameFinished to true }
    : : : : { If you want to let the player know how much time is left: }
    : : : : { write the following result somewhere: 30-(TimeInMin-GameStart) }
    : : : :
    : : : : until (TimeInMin = GameStartTime+30) or GameFinished;
    : : : :
    : : : : if GameFinished then
    : : : : PlayerHasWon
    : : : : else
    : : : : PlayerHasLost;
    : : : : [/code]
    : : : :
    : : : :
    : : : :
    : : : Thank you.
    : : : But it said GetTime is a unknown identifier.
    : : : what should it set?
    : : : uses crt ??uses Doc or something else??
    : : :
    : : GetTime() is part of the Crt unit. This kind of questions can also be answered by looking the function up in the help files. It lists the unit and also the precise description and declaration.
    : :
    : I can't do it .Can you make a sample to me??
    :
    Here is a sample, which asks you to type a word in 3 minutes:
    [code]
    uses Crt;

    function TimeInMin: Word;
    var
    Hour, Minutes, Seconds, HSeconds: word;
    begin
    GetTime(Hour, Minutes, Seconds, HSeconds);
    TimeInMin := Hour*60+Minutes;
    end;

    var
    GameFinished: boolean;
    TypedWord: string;
    ch: char;
    begin
    GameStartTime := TimeInMin;
    GameFinished := false;
    TypedWord := '';
    GotoXY(1,1); write('Enter word: ');
    repeat
    if Keypressed then
    begin
    ch := readkey;
    case ch of
    #8 {Backspace}: Delete(TypedWord, Length(TypedWord), 1);
    #13 {Enter}: GameFinished := true; {end game}
    #0 {Extended char}: ch := readkey; {clear buffer}
    #1..#7,#9..#12,#14..#19 {system commands}: begin end; {ignore}
    else TypedWord := TypedWord + ch;
    end;
    GotoXY(1,1); write('Enter word: ', TypedWord);
    end;
    until (TimeInMin = GameStartTime+3) or GameFinished;

    if GameFinished then
    begin
    if TypedWord = 'This is an example game' then
    writeln('You typed the correct word.')
    else
    writeln('You typed an incorrect word.')
    end else
    writeln('You did not type fast enough');
    readln;
    end.
    [/code]
  • juice88juice88 Posts: 23Member
    : : : : : [b][red]This message was edited by zibadian at 2004-11-19 12:49:51[/red][/b][hr]
    : : : : : : : : : : i have some questions about crossword ~
    : : : : : : : : : : Please help me!
    : : : : : : : : : :
    : : : : : : : : : : 1) How to set the background colour and text colour in pascal??
    : : : : : : : : : :
    : : : : : : : : : : 2) I want to know does pascal has this function??
    : : : : : : : : : : if i input the right answer in the game
    : : : : : : : : : : then the colour of text will change to another colour~~
    : : : : : : : : : : How can do this??
    : : : : : : : : : :
    : : : : : : : : : : Suggest the simplest way to me~
    : : : : : : : : : : THZ~
    : : : : : : : : : :
    : : : : : : : : : 1: TextColor() and TextBackground() in the CRT unit.
    : : : : : : : : :
    : : : : : : : : : 2: Set the new textcolor and write the answer again at the same location.
    : : : : : : : : :
    : : : : : : : : THX~
    : : : : : : : : BUT I Have a error200 when i set the text colour.
    : : : : : : : :
    : : : : : : : :
    : : : : : : : :
    : : : : : : : :
    : : : : : : : If you are using TP, have you patched your CRT unit? If not search for CRT patch on google, and install that. It is necessary for fast computers.
    : : : : : : :
    : : : : : : OK!The problem has been solved.
    : : : : : :
    : : : : : : 2)I think this method is not suitable in my idea.
    : : : : : : My idea is like that:
    : : : : : : I had set a display with many letters for the player to choose them.
    : : : : : : If they choose a right letter, it will change colour.
    : : : : : :
    : : : : : : Any other method??
    : : : : : :
    : : : : : : 3)How to set a timer that count down 30 minutes.
    : : : : : :
    : : : : : :
    : : : : : 2: You could change the color directly in the video memory, but that would require some assembly and an intricate knowledge of the video memory. The only true-Pascal way is to use TextColor(), TextBackround(), GotoXY() and write() to set it.
    : : : : :
    : : : : : 3: The only two ways to do this is to either use interrupts, or use a loop and GetTime(). Here is a sample code to illustrate the latter:
    : : : : : [code]
    : : : : : function TimeInMin: Word;
    : : : : : var
    : : : : : Hour, Minutes, Seconds, HSeconds: word;
    : : : : : begin
    : : : : : GetTime(Hour, Minutes, Seconds, HSeconds);
    : : : : : TimeInMin := Hour*60+Minutes;
    : : : : : end;
    : : : : :
    : : : : : var
    : : : : : GameFinished: boolean;
    : : : : : { program part }
    : : : : : GameStartTime := TimeInMin;
    : : : : : GameFinished := false;
    : : : : :
    : : : : : repeat
    : : : : :
    : : : : : { Do Game }
    : : : : : { Do not use read() or readln(), because those have their own waiting routine }
    : : : : : { but readkey() and keypressed() instead }
    : : : : : { If the player successfully finishes the game set the GameFinished to true }
    : : : : : { If you want to let the player know how much time is left: }
    : : : : : { write the following result somewhere: 30-(TimeInMin-GameStart) }
    : : : : :
    : : : : : until (TimeInMin = GameStartTime+30) or GameFinished;
    : : : : :
    : : : : : if GameFinished then
    : : : : : PlayerHasWon
    : : : : : else
    : : : : : PlayerHasLost;
    : : : : : [/code]
    : : : : :
    : : : : :
    : : : : :
    : : : : Thank you.
    : : : : But it said GetTime is a unknown identifier.
    : : : : what should it set?
    : : : : uses crt ??uses Doc or something else??
    : : : :
    : : : GetTime() is part of the Crt unit. This kind of questions can also be answered by looking the function up in the help files. It lists the unit and also the precise description and declaration.
    : : :
    : : I can't do it .Can you make a sample to me??
    : :
    : Here is a sample, which asks you to type a word in 3 minutes:
    : [code]
    : uses Crt;
    :
    : function TimeInMin: Word;
    : var
    : Hour, Minutes, Seconds, HSeconds: word;
    : begin
    : GetTime(Hour, Minutes, Seconds, HSeconds);
    : TimeInMin := Hour*60+Minutes;
    : end;
    :
    : var
    : GameFinished: boolean;
    : TypedWord: string;
    : ch: char;
    : begin
    : GameStartTime := TimeInMin;
    : GameFinished := false;
    : TypedWord := '';
    : GotoXY(1,1); write('Enter word: ');
    : repeat
    : if Keypressed then
    : begin
    : ch := readkey;
    : case ch of
    : #8 {Backspace}: Delete(TypedWord, Length(TypedWord), 1);
    : #13 {Enter}: GameFinished := true; {end game}
    : #0 {Extended char}: ch := readkey; {clear buffer}
    : #1..#7,#9..#12,#14..#19 {system commands}: begin end; {ignore}
    : else TypedWord := TypedWord + ch;
    : end;
    : GotoXY(1,1); write('Enter word: ', TypedWord);
    : end;
    : until (TimeInMin = GameStartTime+3) or GameFinished;
    :
    : if GameFinished then
    : begin
    : if TypedWord = 'This is an example game' then
    : writeln('You typed the correct word.')
    : else
    : writeln('You typed an incorrect word.')
    : end else
    : writeln('You did not type fast enough');
    : readln;
    : end.
    : [/code]
    :
    THX!!!!
    { If you want to let the player know how much time is left: }
    { write the following result somewhere: 30-(TimeInMin-GameStart) }
    How about this??

«134
Sign In or Register to comment.