M-N-K-game

76 views
Skip to first unread message

gmhwxi

unread,
May 15, 2014, 7:26:14 PM5/15/14
to ats-lan...@googlegroups.com

To help people use ATS more effectively, I would like to use a simple example to demonstrate
a typical way of using types to guide program design and implementation:

https://github.com/githwxi/ATS-Postiats-contrib/tree/master/projects/SMALL/M-N-K-game

If you are not familiar with M-N-K-game, please visit: http://en.wikipedia.org/wiki/M,n,k-game

Note that the emphasis here is on program design. For a simple game like M-N-K, one may
hardly see a need for design. While that is likely to be true, I hope you can stretch your imagination
a bit so that you get to see a "bigger" picture.

gmhwxi

unread,
May 17, 2014, 2:22:43 PM5/17/14
to ats-lan...@googlegroups.com

Okay, I have got Part1 finished:

https://github.com/githwxi/ATS-Postiats-contrib/tree/master/projects/SMALL/M-N-K-game/Part1

I did this in a rather "elaborate" way, showing how I think a small project in ATS should be structured.
Also, the Makefile in the above directory is a reasonable one that one can use as a template.

Right now, my plan is to implement this game in the so-called coroutine-style, which I think is superior
to the callback-style. But I will first finish a sequential style of implementation as it is the easiest to do.

gmhwxi

unread,
May 18, 2014, 2:22:36 AM5/18/14
to ats-lan...@googlegroups.com
Okay, I have got Part1-2 finished:

https://github.com/githwxi/ATS-Postiats-contrib/tree/master/projects/SMALL/M-N-K-game/Part1-2

This implementation is of the sequential style. The game logic is there but IO support is very limited.

gmhwxi

unread,
May 19, 2014, 1:51:01 PM5/19/14
to ats-lan...@googlegroups.com
I did get a coroutine style of implementation working for the M-N-K-game:

https://github.com/githwxi/ATS-Postiats-contrib/tree/master/projects/SMALL/M-N-K-game/Part2

Basically, there are two cooperating threads in this implementation calling each other. The code
is a bit messy right now, but it does serve as a rather informative example.
Reply all
Reply to author
Forward
0 new messages