Page 3 of 3

Re: glcc: some simple c source as play ground

Posted: 01 Aug 2023, 20:26
by petersieg
Hi.

ok. My mistake. You are right. Youre version works.
In the original version from me, the snake starts immediadly. In your version, you have to press a movement key first, otherwise it waits in the middle.
And I was using cursor keys in KBD mode, not wasd keys. Therefore, I thought, it is not working.

Thanks again, for the explanation. So snake might now be an very simple example of using conio.h and game movement without waiting for key input.
(Working source attached again)

best, Peter

Re: glcc: some simple c source as play ground

Posted: 02 Aug 2023, 06:47
by lb3361
petersieg wrote: 01 Aug 2023, 20:26 My mistake. You are right. Youre version works.
I did not understand the lastkey logic. But I realize now that my version stops the snake whenever you press a key that is not an arrow.
Is this why lastkey was necessary?

Re: glcc: some simple c source as play ground

Posted: 04 Aug 2023, 10:38
by petersieg
Yes. lastkey logic was required.
Here is an updated snake.c with lastkey logic.

best, Peter

Re: glcc: some simple c source as play ground

Posted: 06 Aug 2023, 17:30
by petersieg
So here is another game 'Atom / Chain Reaction' using conio with a quick fix to make it work under glcc+Gigatron.

Game Play: https://learncgames.com/tutorials/atoms ... -tutorial/
Original Source: https://github.com/David-H-Bolton/LearnCCode/tree/main
Conio used for linux/macos: https://github.com/casualsnek/linuxconio/tree/main

In the zip file:
v0 = original source using local conio.h from above side: cc atoms.c -o atoms (Mac OS Ventura)
v1 = working Gigatron version - same as on main directory as a safe place.

Have fun playing, making it better (eg: no scrolling; using colors..) whatsoever ;-)

best, Peter

Re: glcc: some simple c source as play ground

Posted: 08 Aug 2023, 07:20
by lb3361
One of my GLCC tests is now a rewritten variant of snake.
I also have a good conio emulation for unix (in the unix directory).
Just "make snake" for unix, "make TSTsnake.gt1" for gigatron.
- Leon

https://github.com/lb3361/gigatron-lcc/ ... tuff/conio

Re: glcc: some simple c source as play ground

Posted: 08 Aug 2023, 11:57
by petersieg
Very nice improvement! Many Thx.

best, Peter

Re: glcc: some simple c source as play ground

Posted: 09 Aug 2023, 18:05
by petersieg
I apologize upfront - but I could not resist.
I know - nobody needs Eliza - but here it is adapted for Gigatron 64k required. ;-)

Source from here:
https://github.com/mottosso/cs50x/blob/master/eliza.c

(In the Mac Emu, it does NOT run - only black screen?. In gtemuAT67 it runs fine)

best, Peter

Re: glcc: some simple c source as play ground

Posted: 10 Aug 2023, 10:59
by petersieg
Simple 2048 game.
Original Source from here: https://gist.github.com/ibaned/41481b2fdddbb61a4291
Now runs on Gigatron ;-) Use wasd for movements.
Lot of improvements possible ;-)

best, Peter

Re: glcc: some simple c source as play ground

Posted: 20 Dec 2023, 18:51
by petersieg
Some more simple c code examples.
This time "Enigma".
The crypto machine used in WW2 by german army.

Links:
https://en.wikipedia.org/wiki/Enigma_machine
https://www.codeproject.com/Articles/831015/ENIGMA
Some simple c code used here and found at:
https://github.com/timlindquist/Enigma/tree/master

Could be improved by showing rotating wheels etc. pp;-)

Have fun, Peter