Log In  

Cart #picotoe-1 | 2024-06-08 | Embed ▽ | License: CC4-BY-NC-SA

My first game in Picotron !!

Hello there :3
I recently got this workstation and wanted to make something with it.
So why not make a little simple game to start with !!


For now, you can play only with the mouse. But I think I will add some other control in the future.


It's a little bit basic for now. But if you install it with load #picotoe you will be able to personalize the color of the X and O symbol. (You can find it in the sprite tab)

However, I want to try some botfeature. So don't hesitate to follow and keep in touch with future progress.



  • Fix forced reload on draw games


  • Simple integration of the tic-tac-toe game
P#149631 2024-06-08 15:47 ( Edited 2024-06-10 12:42)


Nice work! It's a great idea to add a bot player.

Another feature idea: add a score (how many games were won by X and by O).

Welcome to the community :)

P#149677 2024-06-09 10:03

Thanks @pck404 !! Yesterday I worked on a refactoring of all the code (so that it no longer depends on a fixed value, but can be enlarged to any desired shape).

I've enlarged the window to allow text to be written on top to integrate a victory counter (and potentially a choice of symbol), but I confess I don't yet know how I intend to indicate the scores. Or how to save them.

However, I intend to continue this little project for a while! This is the first time I've done lua if you don't count some experience on Pico-8. I had already done javascript and other things. I must admit that I have a problem with table ‘cloning’. I have the impression that whatever I do, lua just assigns a pointer to my variables instead of their value.

P#149733 2024-06-10 07:31 ( Edited 2024-06-10 17:04)

@moee "I must admit that I have a problem with table 'cloning'. I have the impression that whatever I do, lua just assigns a pointer to my variables instead of their value"

Yes, that's how tables work in Lua. it can be helpful sometimes, but it can also get in your way if you're not expecting it. Here is a useful function to get around this:

function cpy_obj(obj)
    local cpy={}
    for key,val in pairs(obj) do
    return cpy

Here's a snippet of code to test the above function:

function _draw()

    table_a={1,3,6} -- table_a is a pointer to {1,3,6}
    table_b=table_a -- table_b is the same pointer as table_a
    table_b[4]=10 -- also affects table_a
    print(table_a[4]==10) -- should be true

    table_c=cpy_obj(table_a) -- table_c is now a different table
    print(table_a[2]==table_c[2]) -- should be true

    table_c[5]=15 -- does not affect table_a
    print(table_a==nil) -- should be true
P#149758 2024-06-10 16:55

Thanks @Kaius, I had tried this before, but it doesn't work with multi-level tables.

So I make it recursive to do it correctly!

ta = {

function _draw()
    tb = ta
    tb[1][1] = 3


    tc = table.clone(ta)
    tc[1][1] = 5

-- Helper fonction to clone tables
-- param  : table   t  - the table to be cloned
-- return : table      - the table cloned
function table.clone(t)
    -- c: cloned table
    local c={}

    -- k: key, v: value
    for k,v in pairs(t) do
        if(type(v)=="table") then

    return c
P#149759 2024-06-10 17:44

[Please log in to post a comment]