camp39 [Lexaloffle Blog Feed]https://www.lexaloffle.com/bbs/?uid=92361 question about realtime play <p>Is it going to be possible to have 2-player, online play with picotron?<br /> 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? </p> https://www.lexaloffle.com/bbs/?tid=152160 https://www.lexaloffle.com/bbs/?tid=152160 Sat, 18 Oct 2025 02:41:09 UTC Diana Chess <p> <table><tr><td> <a href="/bbs/?pid=174477#p"> <img src="/bbs/thumbs/pico8_diana1-0.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=174477#p"> Diana Chess</a><br><br> by <a href="/bbs/?uid=92361"> camp39</a> <br><br><br> <a href="/bbs/?pid=174477#p"> [Click to Play]</a> </td></tr></table> <br /> 6x6 chess with no queens (Diana Chess).<br /> I have larger ambitions and made this as practice but thought its good enough<br /> to share.<br /> engine only looks for material and mate, but is still fun to play.<br /> Although, no 3-fold repetition or insufficient material draws.<br /> Play as white against the engine</p> https://www.lexaloffle.com/bbs/?tid=151705 https://www.lexaloffle.com/bbs/?tid=151705 Wed, 24 Sep 2025 05:26:49 UTC sorting tables <p>I have a table:<br /> <code>a={0,0,1,2,0,6,9,2,0,5,3,0,7,0,0}</code><br /> I want to sort it so the 0's are moved to the front<br /> This works:</p> <div> <div class=scrollable_with_touch style="width:100%; max-width:800px; overflow:auto; margin-bottom:12px"> <table style="width:100%" cellspacing=0 cellpadding=0> <tr><td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> <td background=/gfx/code_bg0.png> <div style="font-family : courier; color: #000000; display:absolute; padding-left:10px; padding-top:4px; padding-bottom:4px; "> <pre> 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</pre></div></td> <td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> </tr></table></div></div> <p>but is clunky and since this will be in a recursive function, efficiency is essential.<br /> what is a more elegant/quicker way to do this?</p> https://www.lexaloffle.com/bbs/?tid=151629 https://www.lexaloffle.com/bbs/?tid=151629 Sat, 20 Sep 2025 16:56:38 UTC Gravity Chess Puzzles <p> <table><tr><td> <a href="/bbs/?pid=173513#p"> <img src="/bbs/thumbs/pico8_gravitychess1-0.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=173513#p"> Gravity Chess Puzzles</a><br><br> by <a href="/bbs/?uid=92361"> camp39</a> <br><br><br> <a href="/bbs/?pid=173513#p"> [Click to Play]</a> </td></tr></table> </p> <h3>Gravity Chess Puzzles</h3> <p>knock the red king from his perch</p> <img loading="lazy" style="margin-bottom:16px" border=0 src="/media/92361/gravity_2.gif" alt="" /> <h3>Credits</h3> <p>based off of itch.io game, Chessformer by Robert Alvarez</p> https://www.lexaloffle.com/bbs/?tid=151412 https://www.lexaloffle.com/bbs/?tid=151412 Sun, 07 Sep 2025 04:53:38 UTC Alice Chess (Mate in 2 Vol. 5) <p> <table><tr><td> <a href="/bbs/?pid=170619#p"> <img src="/bbs/thumbs/pico8_alicechess1-0.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=170619#p"> Alice Chess (Mate in 2 Vol. 5)</a><br><br> by <a href="/bbs/?uid=92361"> camp39</a> <br><br><br> <a href="/bbs/?pid=170619#p"> [Click to Play]</a> </td></tr></table> </p> <h3>Alice Chess</h3> <p>50 Alice Chess Mate-in-2 puzzles</p> <h3>About Alice Chess Mate-in-2</h3> <p>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. </p> <h3>How to play Alice Chess</h3> <p>from <a href="https://www.chessvariants.com/other.dir/alice.html">chessvariants.com</a> :</p> <p>*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.</p> <p>The rules are very simple. In turn, each player makes a single move on either board following these three rules:</p> <p>A move must be legal on the board where it is played.</p> <p>A piece can only move or capture if the corresponding destination square on the other board is vacant.</p> <p>After moving, the piece is transfered to the corresponding square on the other board.*</p> <p>In this cart, both boards are combined into one. Pieces on the second board are shown as 'grayed-out' in the same convention used at <a href="https://www.pychess.org/">pychess.org</a></p> <h3>Features</h3> <ul> <li>puzzlemap</li> <li>autosaves progress</li> </ul> <h3>Credits</h3> <p>thanks to<br /> ubdip and gbtami for the puzzles file and the direction.</p> https://www.lexaloffle.com/bbs/?tid=150391 https://www.lexaloffle.com/bbs/?tid=150391 Fri, 18 Jul 2025 21:01:28 UTC trouble moving sprite, atan2() <p>Moving game pieces using atan2().<br /> I check to see if the position (px,py)<br /> has reached the target (tx,ty) by<br /> absolute values of positions minus targets.<br /> If they havent reached the destination I increment<br /> by the dx I got from the atan2() calculation.</p> <p>This works as it is. But I cannot actually control the speed.<br /> If I want it to go faster, say speed 8, there are certain<br /> situations where condition <code>if abs(px-tx)&lt;3 and abs(py-ty)&lt;3</code> will never<br /> be met and piece will just go forever. And I cant fine tune the <code>&lt;3</code> either<br /> because sometimes the math just wont allow it.</p> <p>How do I write code or think about this to move my sprite so I can actually control<br /> the speed and/or accuracy?<br /> Must be able to move any direction at any angle.<br /> Thank you.</p> <div> <div class=scrollable_with_touch style="width:100%; max-width:800px; overflow:auto; margin-bottom:12px"> <table style="width:100%" cellspacing=0 cellpadding=0> <tr><td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> <td background=/gfx/code_bg0.png> <div style="font-family : courier; color: #000000; display:absolute; padding-left:10px; padding-top:4px; padding-bottom:4px; "> <pre>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)&lt;3 and abs(py-ty)&lt;3 then --AND PROBLEM HERE --ARRIVED AT LOCATION else px+=dx py+=dy end end</pre></div></td> <td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> </tr></table></div></div> https://www.lexaloffle.com/bbs/?tid=148204 https://www.lexaloffle.com/bbs/?tid=148204 Thu, 03 Apr 2025 03:59:17 UTC config files? <p>Are there config files for the editors?<br /> So if I wanted to say, change the tab size or key-bindings in the code-editor.</p> <p>if not, does anyone know where I could start poking around?</p> <p>update: i did find /system/apps/code.p64 which looks promising. any other info is welcome</p> https://www.lexaloffle.com/bbs/?tid=147969 https://www.lexaloffle.com/bbs/?tid=147969 Sat, 22 Mar 2025 02:10:04 UTC YinYang <p> <table><tr><td> <a href="/bbs/?pid=164157#p"> <img src="/bbs/thumbs/pico8_yinyang1-1.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=164157#p"> YinYang</a><br><br> by <a href="/bbs/?uid=92361"> camp39</a> <br><br><br> <a href="/bbs/?pid=164157#p"> [Click to Play]</a> </td></tr></table> </p> <h3>YinYang</h3> <ul> <li>30 yinyang puzzles</li> </ul> <h3>Rules</h3> <ul> <li>all spaces be filled</li> <li>some spaces are pinned with balls that cannot be changed</li> <li>all dark balls connected orthogonally in single group</li> <li>all light balls connected orthogonally in single group</li> <li>no 2x2 group of the same color allowed</li> </ul> https://www.lexaloffle.com/bbs/?tid=147952 https://www.lexaloffle.com/bbs/?tid=147952 Fri, 21 Mar 2025 07:48:00 UTC Solitaire Chess -- Vol. 2 <p> <table><tr><td> <a href="/bbs/?pid=163875#p"> <img src="/bbs/thumbs/pico8_solitaire_chess_v2-0.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=163875#p"> Solitaire Chess -- Vol. 2</a><br><br> by <a href="/bbs/?uid=92361"> camp39</a> <br><br><br> <a href="/bbs/?pid=163875#p"> [Click to Play]</a> </td></tr></table> </p> <p>If you find a puzzle you think is impossible, let me know in the comments. enjoy!</p> <h3>Solitaire Chess -- Vol. 2</h3> <p>-400 solitaire chess puzzles<br /> -50 puzzles each from 4 to 11 pieces<br /> -navigation map and autosave</p> <img loading="lazy" style="margin-bottom:16px" border=0 src="/media/92361/solitairev2_0.gif" alt="" /> https://www.lexaloffle.com/bbs/?tid=147863 https://www.lexaloffle.com/bbs/?tid=147863 Sun, 16 Mar 2025 07:30:04 UTC Piconissimo v1.5 <p> <table><tr><td> <a href="/bbs/?pid=163138#p"> <img src="/bbs/thumbs/pico8_piconissimo_v1-1.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=163138#p"> Piconissimo v1.5</a><br><br> by <a href="/bbs/?uid=92361"> camp39</a> <br><br><br> <a href="/bbs/?pid=163138#p"> [Click to Play]</a> </td></tr></table> </p> <h3>Piconissimo v1.5</h3> <p>Sound editor</p> <h3>Version 1.5 Additions</h3> <ul> <li> <p>copy/paste<br /> (Z=copy,X=paste)</p> </li> <li>horizontal pattern scroll<br /> (click right/left icons on either side of note display.)</li> </ul> <img loading="lazy" style="margin-bottom:16px" border=0 src="/media/92361/piconissimo p8_0.png" alt="" /> <h3>Getting started</h3> <ul> <li>click garbage icon at top right for fresh start. This will permanently erase everything...Including theme music :(</li> <li>all numbers can be right/left clicked</li> <li>rightclick a piano key to test, leftclick to insert note into selected sfx</li> <li>red 'stop sign' stops anything playing</li> <li>unmute dark blue sfx in patterns by clicking on dot</li> <li>click blue floppy icon to save. save often.</li> <li>see manual for detailed info</li> </ul> <h3>Manual</h3> <p><div><div><input type="button" value=" Show " onClick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = ''; this.innerText = ''; this.value = ' Hide '; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = ' Show '; }"></div><div><div style="display: none;"></p> <div> <div class=scrollable_with_touch style="width:100%; max-width:800px; overflow:auto; margin-bottom:12px"> <table style="width:100%" cellspacing=0 cellpadding=0> <tr><td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> <td background=/gfx/code_bg0.png> <div style="font-family : courier; color: #000000; display:absolute; padding-left:10px; padding-top:4px; padding-bottom:4px; "> <pre>--[[ Piconissimo v1.0 2025 by camp39 Uses mouse and keyboard. --Piconissimo has a full PICO-8 keyboard GUI.-- SET KEYBOARD VALUES: right/left click on pink/blue/gray to right of keyboard PLAY NOTE: rightclick on keyboard SET SPEED: right/left click on top red number --only selected track/sfx speed displayed SET JUMP: right/left click on green number --when a note is set, if there is room, the cursor will &quot;jump&quot; this many slots forward in the sfx TOGGLE BARS: press X btn while on gray dots above tracks --will turn on/off bar displays --useful as a visual aid for timing SELECT NOTE: Arrow keys to move square cursor to track/sfx/position COPY/PASTE: Z to copy. X to paste. NOTE DISPLAY: Selected note displays beneath tracks SET NOTE: leftclick on keyboard (track/sfx must be selected) --overwrites any selected note SET TRACK: right/left click on lefthand track numbers to desired sfx PLAY SINGLE SFX: select track, click right hand play icon (red triangle) ERASE SINGLE SFX: select track, click righthand &quot;x&quot; icon PLAY SELECTED NOTE: Click pink triangle right of note display ERASE SELECTED NOTE: Click gray &quot;X&quot; icon left of note display. Or copy (Z BTN) and paste (X BTN) a blank space. ADJUST SELECTED NOTE: Right/left click note display values SAVE WORK: leftclick blue floppy disk icon in top right corner --cntrl-s does NOT save your music! --save often --Rebooting, pressing ESC or CNTRL-R will lose any unsaved work ERASE ALL: leftclick garbage can icon --all channels set to sfx(0) --all channels set to mute, no loop or stop flags. --all sfx notes set to C0 000 (note,ins,vol,eff) --all saved work will be lost --do this first thing to erase theme music PLAY CURRENT TRACKS: left click 4-shafted, red triangle icon on right of screen. --this plays current track sfxs regardless of whether they are in a pattern channel or not. STOP ALL: Click red &quot;stop sign&quot; icon. Stops anything currently playing. --Piconissimo displays up to 5 patterns at once-- SELECT PATTERNS: Right/left click on pink pattern numbers. SET CHANNELS: Right/left click on 4 sfx numbers beneath pattern number. --displays red if sfx is currently selected in tracks PATTERN TO TRACKS: click &quot;up arrow&quot; icon to right of pattern number --this changes each track to the sfx in each channel of pattern MUTE SFX: leftclick dot to left of sfx to toggle. Displays dark blue if muted. LOOPS AND STOPS: same as built-in editor PLAY PATTERN: Click triangle icon under pattern. --Current playing pattern displayed in bright yellow next to JUMP value. ]] </pre></div></td> <td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> </tr></table></div></div> <p></div></div></div></p> <h3>Credits</h3> <p><a href="https://www.lexaloffle.com/bbs/?tid=2341">This thread</a> started by <a href="https://www.lexaloffle.com/bbs/?uid=10210"> @eruonna</a> 10 years ago was ...instrumental... in making this cart. And <a href="https://www.lexaloffle.com/bbs/?uid=69199"> @PennDraken</a>'s more recent contributions as well. Its a good thread, you should check it out.</p> https://www.lexaloffle.com/bbs/?tid=147631 https://www.lexaloffle.com/bbs/?tid=147631 Mon, 03 Mar 2025 04:11:00 UTC 100 Headaches (Mate in 2 -- vol. 4) <p> <table><tr><td> <a href="/bbs/?pid=162652#p"> <img src="/bbs/thumbs/pico8_headache100-0.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=162652#p"> 100 Headaches (mate-in-2 vol.4)</a><br><br> by <a href="/bbs/?uid=92361"> camp39</a> <br><br><br> <a href="/bbs/?pid=162652#p"> [Click to Play]</a> </td></tr></table> </p> <h3>100 Headaches</h3> <p>100 extremely difficult mate in 2 chess puzzles.<br /> Based on the book <em>100 Headachingly Hard Mate In Two Chess Puzzles by Sam Loyd</em> by Martin B. Justesen.</p> <h3>Gameplay</h3> <p>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.</p> <h3>Scoring</h3> <p>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.</p> <h3>Navigation</h3> <p>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.</p> <p>I do not expect anyone to finish this. Let alone with a positive score. But if there is a true masochist out there, please share a screenshot!</p> <p>Thanks to <a href="https://www.lexaloffle.com/bbs/?uid=2185"> @phil</a> for helpful feedback on my last cart. It made this cart better.</p> https://www.lexaloffle.com/bbs/?tid=147467 https://www.lexaloffle.com/bbs/?tid=147467 Sat, 22 Feb 2025 02:56:47 UTC mate in 1-2-3 <p> <table><tr><td> <a href="/bbs/?pid=161058#p"> <img src="/bbs/thumbs/pico8_mate123v1-0.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=161058#p"> mate in 1-2-3 vol. 1</a><br><br> by <a href="/bbs/?uid=92361"> camp39</a> <br><br><br> <a href="/bbs/?pid=161058#p"> [Click to Play]</a> </td></tr></table> </p> <h3>Mate in 1-2-3 vol.1</h3> <p>each level is a mate in 1, a mate in 2, and a mate in 3.<br /> 50 levels for a total of 150 puzzles.</p> <p>progress saves with each puzzle.</p> <h3>about the puzzles and the code</h3> <p><div><div><input type="button" value=" Show " onClick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = ''; this.innerText = ''; this.value = ' Hide '; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = ' Show '; }"></div><div><div style="display: none;"><br /> 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. <a href="https://www.lexaloffle.com/bbs/?uid=112843"> @toadofsky</a> 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.</p> <p>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.</p> <p>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.<br /> </div></div></div></p> https://www.lexaloffle.com/bbs/?tid=146745 https://www.lexaloffle.com/bbs/?tid=146745 Fri, 24 Jan 2025 06:10:49 UTC NICE 1.0 Freestyle Chess <p> <table><tr><td> <a href="/bbs/?pid=159904#p"> <img src="/bbs/thumbs/pico8_nicev1freestyle-0.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=159904#p"> NICE 1.0 Freestyle Chess</a><br><br> by <a href="/bbs/?uid=92361"> camp39</a> <br><br><br> <a href="/bbs/?pid=159904#p"> [Click to Play]</a> </td></tr></table> <br /> Freestyle Chess == Chess960 == Fischer Random</p> <h2>NICE: Nice Is Camp39's Engine</h2> <h3>The Good</h3> <ul> <li>pass n play and board flip option</li> <li>clean interface &amp; themes</li> <li>play against computer</li> <li>opening book for standard chess</li> <li>endless openings with Freestyle Chess (press up while on chess960 to view positions)</li> <li>all rules, including 50 move and 3-fold repetition</li> </ul> <h3>The Bad</h3> <ul> <li>my first engine ever... its a little slow</li> <li>my first engine ever... its a little dumb</li> <li>maybe 2.0 will be better!</li> </ul> <h3>About NICE</h3> <p><div><div><input type="button" value=" Show " onClick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = ''; this.innerText = ''; this.value = ' Hide '; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = ' Show '; }"></div><div><div style="display: none;"><br /> 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: <a href="https://www.youtube.com/watch?v=2eA0bD3wV3Q&amp;list=PLZ1QII7yudbe4gz2gh9BCI6VDA-xafLog">Programming a Chess Engine in Pure Javascript</a>. </p> <p>When it came to the search functions I learned a ton by following the book: <em>Chess Algorithms</em> by Noah Caplinger.</p> <p>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. &quot;killer moves&quot; only make sense with a depth of at least 4. It was a really cool experience and gave me more insight into the game.</p> <p>I liked the board layout from cart #quickchessyness-4 by <a href="https://www.lexaloffle.com/bbs/?uid=68584"> @Adam_Howell</a> so much that I copied it :)</p> <p>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!</p> <p><a href="https://www.lexaloffle.com/bbs/?uid=16423"> @Krystman</a> 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.</p> <p>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.</p> <p>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.</p> <p>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?</p> <p></div></div></div></p> https://www.lexaloffle.com/bbs/?tid=146322 https://www.lexaloffle.com/bbs/?tid=146322 Sat, 28 Dec 2024 06:52:41 UTC numbers equivalence <p>how do i test for big numbers that print different than their true value?</p> <div> <div class=scrollable_with_touch style="width:100%; max-width:800px; overflow:auto; margin-bottom:12px"> <table style="width:100%" cellspacing=0 cellpadding=0> <tr><td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> <td background=/gfx/code_bg0.png> <div style="font-family : courier; color: #000000; display:absolute; padding-left:10px; padding-top:4px; padding-bottom:4px; "> <pre>function _init() srand(39) a=rnd(-1) --prints -20954.2428 b=-20954.2428 end function draw() if b==a then ?&quot;true&quot; else ?&quot;false&quot; end --prints false end</pre></div></td> <td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> </tr></table></div></div> <p>I have some big numbers that would be nice to know their true value.<br /> thanks and merry Christmas!</p> https://www.lexaloffle.com/bbs/?tid=146284 https://www.lexaloffle.com/bbs/?tid=146284 Wed, 25 Dec 2024 04:04:35 UTC coroutines? <p>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.</p> <p>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? </p> <p>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.</p> <p>I also tried calling flip() explicitly after the resource-heavy function but no dice.</p> <p>any pointers are appreciated.</p> https://www.lexaloffle.com/bbs/?tid=145801 https://www.lexaloffle.com/bbs/?tid=145801 Sat, 30 Nov 2024 09:05:13 UTC lichess api <p><a href="https://www.lexaloffle.com/bbs/?uid=112843"> @toadofsky</a><br /> I moved the conversation to chat so as not to clog up the cartridge section. </p> <p>in response to your last post;<br /> how are you going to hook up PICO-8 to the internet though? Can you do that?</p> https://www.lexaloffle.com/bbs/?tid=145789 https://www.lexaloffle.com/bbs/?tid=145789 Fri, 29 Nov 2024 06:54:04 UTC PICO in Nano <img loading="lazy" style="margin-bottom:16px" border=0 src="/media/92361/piconano.png" alt="" /> <p>made external editor feel more like pico...does anyone else do this too?</p> https://www.lexaloffle.com/bbs/?tid=144950 https://www.lexaloffle.com/bbs/?tid=144950 Sun, 27 Oct 2024 00:03:26 UTC string to assoc array <p>I'd like to make some associative tables e.g. <code>table={x=7,y=90,z=40}</code><br /> but I want to save tokens by using a string because I'm going to have a lot of them, and make a function that returns a table based on whatever is in the string.</p> <p>So something like:</p> <div> <div class=scrollable_with_touch style="width:100%; max-width:800px; overflow:auto; margin-bottom:12px"> <table style="width:100%" cellspacing=0 cellpadding=0> <tr><td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> <td background=/gfx/code_bg0.png> <div style="font-family : courier; color: #000000; display:absolute; padding-left:10px; padding-top:4px; padding-bottom:4px; "> <pre>string1=&quot;x=7,y=90,z=40&quot; string2=&quot;empty=100, dinner=casserole, transport=horse, weight=150&quot; table1=assoc_table(string1) table2=assoc_table(string2) ?table1.z -- 40 ?table2.transport -- horse</pre></div></td> <td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> </tr></table></div></div> <p>how do I go about this? <code>split</code> wont work. what does my <code>function assoc_table(str)</code> look like? </p> https://www.lexaloffle.com/bbs/?tid=144886 https://www.lexaloffle.com/bbs/?tid=144886 Wed, 23 Oct 2024 04:36:07 UTC hide_mouse_cursor bug <p>v0.2.6b<br /> The hide_mouse_cursor feature is very buggy. That is the option that makes the mouse cursor disappear while typing in the PICO-8 editor. Length in seconds can be configured in config.txt but the problem is there even with the default of 5 sec. </p> <p>On startup it works but after a while of coding it stops working at all. I posted this before but deleted my post because the steps I gave to reproduce didn't always make it happen. So it's hard for me to say exactly when it stops working. But I think that everyone here will notice if they pay attention, that after a some time working on a game, the mouse cursor will remain in the way while typing.</p> <p>If you <code>ctrl-r</code> <code>ctrl-r</code> it will start working again. But if you type something at the command prompt and say, get a syntax error, or even just <code>ls</code> to show whats in the directory, or <code>cls()</code>, most of the time (but not always!) when you esc back to the editor it will be broken and the mouse will show even while you are typing. This will persist for the rest of the session. <code>ctrl-r</code> TWICE seems to reset it, but once is not enough.</p> <p>I know this is a small thing, but once you notice it, its sort of annoying because of how nice it is when it is working. I've been coding directly in the editor lately. I used to think it was impossible but now I realize just how cool it is.</p> https://www.lexaloffle.com/bbs/?tid=144781 https://www.lexaloffle.com/bbs/?tid=144781 Thu, 17 Oct 2024 01:09:08 UTC gamepad support please...(Linux) <p>I bought a couple of bluetooth gamepads off Amazon:<br /> KIWITATA 2.4G Wireless NES USB Controller<br /> Which are imitation NES classic, 2-button, D-pad, select start controllers.</p> <p>It gets recognized right away by my latest Linux Mint OS and works in Pico-8<br /> EXCEPT that both buttons do the same thing (I think they are both X).</p> <p>I ran this code:</p> <div> <div class=scrollable_with_touch style="width:100%; max-width:800px; overflow:auto; margin-bottom:12px"> <table style="width:100%" cellspacing=0 cellpadding=0> <tr><td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> <td background=/gfx/code_bg0.png> <div style="font-family : courier; color: #000000; display:absolute; padding-left:10px; padding-top:4px; padding-bottom:4px; "> <pre>function _draw() cls() ?btn() end --both B and A output 32</pre></div></td> <td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> </tr></table></div></div> <p>and sure enough I get different values for all the buttons except both B1 and B2 print 32.</p> <p>I've found this thread <a href="https://www.lexaloffle.com/bbs/?tid=3623">https://www.lexaloffle.com/bbs/?tid=3623</a> where one poster talks about the same problem. But its from 2016 and was for pocketCHIP and they solved it by getting a different controller.</p> <p>I've also installed the <a href="https://www.generalarcade.com/gamepadtool/">SDL2 gamepad-tool for Linux</a> but had issues. It sort of works EXCEPT that it wont recognize left/right on the dpad. I tried a million times and also tried skipping and mapping it to the little joysticks instead but it didn't work.</p> <p>my understanding is that I am to copy/paste the resulting mapping line into<br /> .lexaloffle/pico-8/sdl_controllers.txt<br /> but haven't yet because it doesn't do me any good without right and left on the dpad.</p> <p>I've got to think this is a pretty easy fix in 2024. Any suggestions?</p> <p>Or at least, which NES classic style wireless controllers DO work?</p> https://www.lexaloffle.com/bbs/?tid=144033 https://www.lexaloffle.com/bbs/?tid=144033 Wed, 04 Sep 2024 02:59:17 UTC