Log In  
Follow
Einstein2

Cart #langtons_ant_tweetcart-0 | 2024-02-05 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
2

Langton's Ant is a tremendously simple system played on a grid of pixels that can either be on (white) or off (black). Each during timestep, the ant moves forward in the direction it is currently facing (I have it facing right at the start). Then, if the ant was on a black square before it moved, it makes the square white and turns right; if the ant was on a white square, it sets the square to black and turns left. And... that's it. But despite these incredibly simple rules, Langton's ant emerges from the apparent randomness after about 11000 steps and starts forming a recurring "highway". In fact, Langton's ant not only tends toward this self-organizing behavior, but also is capable of computation with the right setup (i.e. it is a universal Turing machine) -- see this paper for a proof of that.

[ Continue Reading.. ]

2
4 comments



?"\*0abc" 
-- expected: bc 
-- actual: abc

Perhaps this isn't a bug, but it could make a padding function a lot simpler.

function pad(str, char, len)
 return str.."\*"..(len-#str)..char
end
?pad("hello","h",6) -- helloh
?pad("hello","h",5) -- helloh
-- second one should just be hello
1
4 comments



Basically the title.

info([cart])--returns tokens,chars,compressed_size of [cart] or the current cart if given none

This could be useful for people who are creating carts using printh() and such, to detect if the cart is able to be run before load()ing it:

tokens,chars,compressed=info("cart.p8")
if(tokens<8192 and chars<65536)load("cart.p8")

What do you all think?

1
0 comments



Cart #picoforth-4 | 2021-06-04 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
12


Welp, this took way to long to finish. But now it's here!

about

picoforth is a programming language based on Forth, a family of stack-based programming languages. If you're unfamiliar with stack-based programming languages or Forth, I recommend you check out this site.

wordlist

Here is a list of every word in picoforth. (A "word" in a stack-based language is roughly equivalent to a "function" or a "subroutine" in a normal programming language.)

--typical forth stack-manipulating words
pop
2pop
dup
2dup
over
swap
rotl
rotr

--mathematical operators

[ [size=16][color=#ffaabb] [ Continue Reading.. ] [/color][/size] ](/bbs/?pid=93031#p)
12
11 comments



Cart #picoforth-0 | 2021-05-14 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
5

picoforth - a stack-based programming language

picoforth is a project I started working on a while ago, and then gave up on, then returned to yesterday. It is unfinished (there are a few minor bugs, there is essentially no support for strings yet, and the method of inputting text is pretty bad), but still can do quite a lot.

If you are unfamiliar with stack-based languages, I recommend you check out easyforth, a stack-based language resembling a typical Forth. It can teach you the basics of stack-based languages, and to a lesser extent, Forth.

Here's the list of the words (for those unfamiliar, a "word" in forth is roughly comparable to a function in most other languages) currently in picoforth:

[ Continue Reading.. ]

5
2 comments



context

Earlier today, I learned that pressing ctrl+p while running a cart brings up a performance monitor (and something else I learned on accident: pressing ctrl+p in the commandline/text editor lets you use the tiny characters; this isn't documented in the pico-8 fandom wiki but is on pico-8's changelog in the manual.)

I booted up one of my carts and opened the performance monitor. (It runs at a smooth 60fps, it's not very complicated at all). For fun, I changed the cls(1) to print("\^c1"). To my great surprise, the performance monitor indicated that it did this ever so slightly quicker than cls(1). So I made a new cartridge (function _update60()for _=1,1000do print("\^c1") end) and it ran smoothly, never going over the virtual processor limit. I switched the print() to the respective cls() and it was almost 2 times more resource intensive, constantly over the virtual limit, and running at an extremely choppy ~1fps.

conclusion

I'm not sure how this would be useful unless you're calling cls() an awful lot of times, as it takes quite a few extra characters. Even with the minor improvement of using ? rather than print() is small, as you still need a newline on either side. If you really wanted to, you could just redefine cls() to simply be something like this:

[ Continue Reading.. ]

2
1 comment



Cart #lotsocolors-2 | 2020-12-15 | Code ▽ | Embed ▽ | No License
3


This is a simple pico-8 program that I thought I would share. The concept is simple; it's drawing circles where the center is a point on an (hidden) circle, incrementing the color each time. You can adjust the radius of the hidden circle by using left/right and the amount of circles being drawn with up/down. Since it never clears the screen, it gives really nice visuals with the trails left behind by the circles.

edit: there is now a version 1.1, which allows you to press x/o to swap whether or not screen clearing is on or not. While this looks much more boring, it allows to see how it works much better.

Cart #lotsocolors-3 | 2020-12-17 | Code ▽ | Embed ▽ | No License
3

3
1 comment



Cart #juliasetrender-0 | 2020-11-04 | Code ▽ | Embed ▽ | No License
2


This is a Julia set renderer. Not much else to say. The code was based off of the Wikipedia Pseudocode for the Julia Set.
The controls are (X) to zoom out, (Z)/(C) to zoom in, and the arrow keys to adjust the fractal parameters.
Hopefully you can enjoy it!
PS There are probably ways to increase the speed of this program. (This is my third published cartridge and so I'm not too great at pico-8 yet.) Once you zoom to fit the screen it takes ~2 seconds to respond. Feel free to point out changes that can be made.

2
0 comments



Cart #wezemogowo-0 | 2020-10-11 | Code ▽ | Embed ▽ | No License
2


This is my second published Pico-8 cartridge. It shows a near-perfect (in collision detection, not in the way it works) tiny collision detection function for a square. It can be expanded to any arbitrarily-sized rectangle. A square was chosen for simplicity.

There is no doubt in my mind that this can be improved upon. You know what, there's probably a way better, super obvious way that I glanced over.

I don't recommend using this for any of your games, as it has a blazingly obvious issue: You can't go into anything that isn't a black pixel. Also, due to the way it detects the pixels, it cannot detect sprites/map tiles that are smaller then a square.

The only reason I made this was to see if I could make a collision detection system that didn't use:

[ Continue Reading.. ]

2
7 comments



Cart #sss-0 | 2020-10-04 | Code ▽ | Embed ▽ | No License
2


This is a simple program that picks a random sprite, displays it, moves, and then repeats. This is my first Pico-8 program and doesn't do much but is a decent screensaver in a pinch. If you're wondering where those sprites came from, it was my interpretation of sitelen pona, one of the writing systems of Toki Pona. Hopefully I didn't mess anything up!

2
4 comments