Log In  
Follow
camp39
the true guide to objects, prototypes and metatables
by merwok

How are colons used? NOT the double colons ::_::
But just the single ones :

I'm looking at this guys code and he's doing this:

function get_shape()
    local sc = {}
    sc.x = 0
    sc.y = 0
    sc.col = colors[rand(1,#colors)]
    sc.ori = 1
    sc.sha = rand(1,#shapes)

    function sc:check_collide()
        for px in all(shapes
                        [self.sha][self.ori]) do
            local x = px[1]+self.x
            local y = px[2]+self.y
         if x > fieldx or
            x < 1 or
            y > fieldy or
            y < 1 or
            f[x][y] != 1 then
          return true
         end
        end
        return false
    end

    function sc:move_shape_h(m)
     self.x += m
     if self:check_collide() then
         self.x -= m
         return false
     end
     return true
    end

[ [size=16][color=#ffaabb] [ Continue Reading.. ] [/color][/size] ](/bbs/?pid=187687#p)
1 comment



Cart #mate2vol6-2 | 2026-04-04 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
3

Mate in 2, Vol 6 -- 3 Strikes and you are OUT!

Randomly selects from over 300 mate in 2 puzzles. Get 5 points per right move.
Busted after 3 strikes (wrong moves).
Saves highscore for you to beat next time.
Right mouse button = show/hide infographics
Left mouse button = continue/move pieces

3
1 comment



Tonight, Saturday November 29th from 9:00 pm to 11:59 pm Pacific Standard time, I'll be playing Picotrons ultimate-tic-tac-toe online. If you want to play me, hit me up on discord and we will share the join link. If you dont have discord you can use this comment section.

I'm also open to any other Picotron turn-based games if you know of one.

Hope to see you then.

1
0 comments



Can you please keep keyboard shortcuts in step with other functionality? So that the final product a heavy keyboard user can still use and enjoy? For gfx I understand (but even there it would be awesome to have the option).

For instance, close a window or pod;

appdata/system>open widgets.pod

--this opens a pod that I can manipulate with keyboard but cant close without mouse :(   

BTW, Picotron can be run without a desktop by holding down both CNTRL keys during boot :)

1
2 comments



from within pico-8 terminal:

CONFIG THEME

only shows:

AUTO
BLUE
CLASSIC

but there should be a 4th one for a black backround.
I tried:
CONFIG THEME 3
CONFIG THEME BLACK
CONFIG THEME DARK
but all do nothing.

I know I can change config.txt but just saying.

0 comments



Is it going to be possible to have 2-player, online play with picotron?
I've seen some stuff with chat (that I never got to work). Is a 2-player picotron game in real-time feasible for the future? Can it be done now?

2
5 comments



Cart #diana1-0 | 2025-09-24 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
7


6x6 chess with no queens (Diana Chess).
I have larger ambitions and made this as practice but thought its good enough
to share.
engine only looks for material and mate, but is still fun to play.
Although, no 3-fold repetition or insufficient material draws.
Play as white against the engine

7
2 comments



I have a table:
a={0,0,1,2,0,6,9,2,0,5,3,0,7,0,0}
I want to sort it so the 0's are moved to the front
This works:

 a={0,0,1,2,0,3,4,0,0,5,6,7,8,0,9,10}
 b={}
 c={}
 for v in all(a) do
  if v==0 then
   add(b,v)
  else
   add(c,v)
  end
 end
 for v in all(c) do
 add(b,v)
 end
 a=b

but is clunky and since this will be in a recursive function, efficiency is essential.
what is a more elegant/quicker way to do this?

1
4 comments



Cart #gravitychess1-0 | 2025-09-07 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
13

Gravity Chess Puzzles

knock the red king from his perch

Credits

based off of itch.io game, Chessformer by Robert Alvarez

13
5 comments



Cart #alicechess1-0 | 2025-07-18 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
2

Alice Chess

50 Alice Chess Mate-in-2 puzzles

About Alice Chess Mate-in-2

Alice chess is a chess variant played on 2 boards. What is cool is that there is no fairy-stockfish engine for it. Therefore, these puzzles are custom built using an experimental engine made by ubdip over at pychess.org. These are very fun once you understand how to play.

How to play Alice Chess

from chessvariants.com :

*The standard game of Alice Chess is played using two boards, A and B. All pieces move as in standard chess. The normal array is on board A; board B starts empty.

The rules are very simple. In turn, each player makes a single move on either board following these three rules:

[ Continue Reading.. ]

2
0 comments



Moving game pieces using atan2().
I check to see if the position (px,py)
has reached the target (tx,ty) by
absolute values of positions minus targets.
If they havent reached the destination I increment
by the dx I got from the atan2() calculation.

This works as it is. But I cannot actually control the speed.
If I want it to go faster, say speed 8, there are certain
situations where condition if abs(px-tx)<3 and abs(py-ty)<3 will never
be met and piece will just go forever. And I cant fine tune the <3 either
because sometimes the math just wont allow it.

How do I write code or think about this to move my sprite so I can actually control
the speed and/or accuracy?
Must be able to move any direction at any angle.
Thank you.

speed=5	
px,py=getxy(location)
tx,ty=getxy(destination)
local angle=atan2(ty-py,tx-px)
dx=sin(angle)*speed
dy=cos(angle)*speed  --PROBLEM HERE

function _update_move()
 if abs(px-tx)<3 and abs(py-ty)<3 then --AND PROBLEM HERE
  --ARRIVED AT LOCATION
 else
  px+=dx
  py+=dy
 end
end
1
6 comments



Are there config files for the editors?
So if I wanted to say, change the tab size or key-bindings in the code-editor.

if not, does anyone know where I could start poking around?

update: i did find /system/apps/code.p64 which looks promising. any other info is welcome

2 comments



Cart #yinyang1-1 | 2025-03-21 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
12

YinYang

  • 30 yinyang puzzles

Rules

  • all spaces be filled
  • some spaces are pinned with balls that cannot be changed
  • all dark balls connected orthogonally in single group
  • all light balls connected orthogonally in single group
  • no 2x2 group of the same color allowed
12
5 comments



Cart #solitaire_chess_v2-0 | 2025-03-16 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
9

If you find a puzzle you think is impossible, let me know in the comments. enjoy!

Solitaire Chess -- Vol. 2

-400 solitaire chess puzzles
-50 puzzles each from 4 to 11 pieces
-navigation map and autosave

9
5 comments



Cart #piconissimo_v1-1 | 2025-03-23 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
8

Piconissimo v1.5

Sound editor

Version 1.5 Additions

  • copy/paste
    (Z=copy,X=paste)

  • horizontal pattern scroll
    (click right/left icons on either side of note display.)

Getting started

  • click garbage icon at top right for fresh start. This will permanently erase everything...Including theme music :(
  • all numbers can be right/left clicked
  • rightclick a piano key to test, leftclick to insert note into selected sfx
  • red 'stop sign' stops anything playing
  • unmute dark blue sfx in patterns by clicking on dot
  • click blue floppy icon to save. save often.
  • see manual for detailed info

[ Continue Reading.. ]

8
0 comments



Cart #headache100-0 | 2025-02-22 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
6

100 Headaches

100 extremely difficult mate in 2 chess puzzles.
Based on the book 100 Headachingly Hard Mate In Two Chess Puzzles by Sam Loyd by Martin B. Justesen.

Gameplay

It is white to move on every puzzle. But the player ALSO makes black's move rather than a computer-automated response. That way, you can try out different moves for black to prove to yourself that it is, indeed, mate in 2.

Scoring

Plus 5 for every correct move. Minus 1 for every wrong move. Only on unsolved puzzles. Once a puzzle is completed, you can replay it as many times as you like and not lose/gain points.

Navigation

All progress is automatically saved. There is a handy 'map' of all 100 puzzles and you are free to jump to any number you like.

[ Continue Reading.. ]

6
4 comments



Cart #mate123v1-0 | 2025-01-24 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
6

Mate in 1-2-3 vol.1

each level is a mate in 1, a mate in 2, and a mate in 3.
50 levels for a total of 150 puzzles.

progress saves with each puzzle.

about the puzzles and the code


These puzzles were collected from the lichess api. This is easier than manually pulling them from books, but unfortunately lichess only provides the pgn, not the fen. So there is still a tedious step. But I should be able to make more chess puzzlers a lot faster than before. @toadofsky had talked about getting live lichess puzzle updates and playing in real time. I'm not sure if that is possible, and I see my carts as useful to people with handhelds and no internet. However, the lichess api idea was a good one and so I'm grateful for his suggestion.

The only problem is that lichess rates it's puzzles by the ratings of people that play. So if a strong player screws up on a puzzle, it's rating goes up... It makes sense but the puzzle strengths don't seem consistent. I called 10 puzzles for each of the five difficulty settings, easiest to hardest. But honestly they all seem too easy. That is the good thing about getting puzzles from books, because those are designed to be tricky and are explicitly puzzles instead of real games.

I finally have move generation and so I think the interface is much more pleasant than any of my previous mate in 2 games. But I still really want some kind of animation when the pieces move.

6
3 comments



Cart #nicev1freestyle-0 | 2024-12-28 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
4


Freestyle Chess == Chess960 == Fischer Random

NICE: Nice Is Camp39's Engine

The Good

  • pass n play and board flip option
  • clean interface & themes
  • play against computer
  • opening book for standard chess
  • endless openings with Freestyle Chess (press up while on chess960 to view positions)
  • all rules, including 50 move and 3-fold repetition

The Bad

  • my first engine ever... its a little slow
  • my first engine ever... its a little dumb
  • maybe 2.0 will be better!

About NICE

[hidden]
This was a real accomplishment for me and is my first engine. The move generation follows the tutorial of Bluefever Software video series on Youtube: Programming a Chess Engine in Pure Javascript.

When it came to the search functions I learned a ton by following the book: Chess Algorithms by Noah Caplinger.

The limitations of Pico-8 though make for a challenging adaptation of these types of tutorials. (translating from zero-based arrays can give some crazy nasty bugs). The speed limitations make some variation strategies useless e.g. "killer moves" only make sense with a depth of at least 4. It was a really cool experience and gave me more insight into the game.

I liked the board layout from cart #quickchessyness-4 by @Adam_Howell so much that I copied it :)

This cart will need some updates however. I was unable to get quiesence to work without a move taking FOREVER. Maybe due to my move ordering, maybe due to the evaluation function, maybe due to lots of things. Its all very complicated and hurts my brain since it is recursive at iterative depths. Hard to pinpoint problems like that. If any kind soul wants to offer tips, I'm all ears!

@Krystman of course released the fabulous Pico Checkmate, cart #54038 6 years ago. I definitely looked through his code for clues but couldn't manage to find a way to cut off a search if time got too long. But I did follow his lead and purge illegal moves right off the bat instead of making and taking them. Without a full quiesence search though, I don't think NICE will stand a chance against Pico Checkmate.

This cart, while not having the best engine still has some nice features. Chess960 is chess but with almost random starting positions. Its just like standard chess with the exception that castling can be a little weird. Just remember that king and rook end up in the same ending positions as in regular chess, regardless of where they started. Otherwise, same rules apply. This eliminates the same opening every time you play against the computer. Also, to prevent that from happening in standard chess, I coded in a small opening book with response options being chosen randomly so that you can get different responses even if you play the same.

I hope this cart is popular with hand-held users (I don't personally own one). The pass n play is not something I've seen on other chess carts and I imagine a game of chess on a long flight or bus ride would be cool, but playing upside down is a bit awkward.

Crazy idea: what if there was a cart with the move generation and graphics already on it (and optimized to the max) and then two different users could put in a tiny engine each and let them battle. Maybe more realistic on picotron?

[ Continue Reading.. ]

4
1 comment



how do i test for big numbers that print different than their true value?

function _init()
 srand(39)
 a=rnd(-1) --prints -20954.2428
 b=-20954.2428
end

function draw()
 if b==a then
  ?"true"
 else
  ?"false"
 end  --prints false
end

I have some big numbers that would be nice to know their true value.
thanks and merry Christmas!

2 comments



When the AI plays itself in my game, it is too much for the _update() so PICO-8 drops _draw() frames. The moves are correct, but its awkward because both pieces move at once.

How do I remedy this? Is it a coroutine I need? I've been playing with them and have gotten some crazy results, not really knowing what I am trying to accomplish. But is that even the right approach?

Or can I make some kind of delay between moves to give the cpu time to catch up? I tested by making it only run the engine after a button press and it works fine.

I also tried calling flip() explicitly after the resource-heavy function but no dice.

any pointers are appreciated.

2 comments





Top    Load More Posts ->