I am writing a program for making the game snakes.
I am already successful in making the snake move continuously.
Now what I want is that my snake should not wait for a key to be pressed that is it should continue to move in the direction it is moving, but if a particular key is pressed it should change its direction to what is specified by that key.
for example if the snake is moving in right direction and somebody presses 'v' (for down direction), it should start moving downwards.
If I use getch(), the snake starts waiting for the key press and does not move contiously in the direction it was previously moving.
Is there any way I could make a particular part of my program execute when a particular key is pressed without waiting for a key press?