Planète Casio - Projets de programmation - Flux RSS http://www.planet-casio.com Programmes Casio, Jeux, Cours pour Calculatrices Casio fr-FR https://www.planet-casio.com/images/logo.gif Planète Casio - Projets de programmation - Flux RSS http://www.planet-casio.com 55 50 Programmes Casio, Jeux, Cours pour Calculatrices Casio. Tue, 03 Dec 2024 11:23:14 GMT Tue, 03 Dec 2024 11:23:14 GMT contact@planet-casio.com (Planet Casio) contact@planet-casio.com (Planet Casio) 5 Sous-programmes et divers https://www.planet-casio.com/Fr/forums/topic18531--.html Bonjour, Ce qui suit est mon premier message ... Je viens tout juste de m'inscrire à ce site et, après avoir sorti ma calculatrice CASIO fx-9860G de son lieu de stockage et "d'oubli", tenté de créer un programme à l'intention d'une personne pas du tout versée en calculs et encore moins en programmation ... Cette programmation 'Basic' de CASIO, malgré ma grande expérience en programmation orientée plutôt en langage C (LabWindows) sur PC, se révèle assez déroutante et plutôt limitée en possibilités. Il faut dire que je viens tout juste de constater que sur ce modèle fx-9860G on ne peut pas traiter les chaînes de caractères ! L'entrée manuelle de données par la fonction 'Getkey' en testant le code associé à une touche du clavier n'est pas évidente du tout. Mon dernier problème se trouve être l'appel d'un 'sous-programme' à partir d'un programme principal : Je crois avoir compris qu'il faut utiliser 'Prog' et 'Return', mais où et comment ... Merci de bien vouloir m'aider à solutionner ces questions mais sans me demander de changer de modèle de calculatrice. Meilleures salutations. W. Fürst CH-1197 Prangins Suisse Sun, 01 Dec 2024 17:41:03 +0100 Duvet, a spreadsheet alternative https://www.planet-casio.com/Fr/forums/topic18266--.html Duvet Duvet is a spreadsheet add-in for Casio fx-9860G or later (including Slim), both mono and color calculators, as an alternative to Casio's built in spreadsheet/S-SHT app. https://i.imgur.com/i7bKqkq.png Motivation The initial idea for writing a spreadsheet add-in came because, at the time, the Math+ didn't provide a spreadsheet app. I was also interested to see whether a spreadsheet could be made to be Turing-complete with a SET(column, row, value) formula. Additionally, S-SHT was very slow and I wondered if I could do better. However, Casio announced a spreadsheet for Math+ and other projects were more interesting, so it got shelved. The project was revived when I received my fx-CG50 and my CPC game entry would load, but could not be edited without a math error, despite working (albeit very slowly) on the fx-9750GIII and even working on the fx-9860G Slim. In order to get the game working on the fx-CG50, I had to delete over 500 cells. And, even then, it was still quite slow. I wanted my game to be playable on all calculators, so I challenged myself to write a spreadsheet add-in before CPC 31. Goals My goals for Duvet are: 1. Faster calculation than S-SHT. Duvet uses integer math, when possible, and the plan is to examine floating point results and return them back to integers, when possible. For example, 10 / 2 = 5.0, but 5.0 == 5, so it can remain an integer, and cos(0) = 1. Currently, Duvet calculates my CPC entry, a sheet containing around 1000 formula cells, in a fraction of a second, compared to approximately 7 seconds in S-SHT on an fx-9750GIII. Video from an earlier build (fx-9750GIII and S-SHT on the left, fx-9860G Slim and Duvet on the right): https://i.imgur.com/zJk7gSC.mp4 2. Provide a larger sheet area than S-SHT, using sparse cells. Currently, Duvet allows 26 columns (A-Z) and 2048 rows. 3. Be compliant with some subset of ODF types, operators and formulas. In particular, I want to allow formulas involving TEXT fields, which isn't possible in S-SHT. 4. Turing-completeness, by way of a SET(column,row,value) formula. 5. File import/export. Formats to be determined, but at least CSV import/export. 6. Best effort: due to spreadsheets often being used for financial calculations, I'd like to use decimal64 floats (or an equivalent) rather than using double. The decimal library I was planning on using (libdfp)) is not available for SuperH, and I need to investigate the feasibility of porting it. Notably, it is not a goal to perfectly replicate the UI or feature set of Casio's S-SHT. For example, the UI has already diverged slightly, the menus and key input are going to be different, and I don't currently plan on implementing graphing, regressions, list import/export, etc. Nor is it a goal to be 100% Open Document Format or OpenFormula compliant. However, I'll strive (best effort) for subset compliance as far as being able to export a LibreOffice sheet to CSV and have some subset of OpenFormula formulas, operators, and data types work without changes. Formulas All formulas are currently limited to 64-bit integer math: • ABS(integer) → integer • BITAND(integer,integer) → integer • BITLSHIFT(integer,integer) → integer • BITOR(integer,integer) → integer • BITRSHIFT(integer,integer) → integer • BITXOR(integer,integer) → integer • FALSE() → integer • IF(integer,integer,integer) → integer • ISEVEN(integer) → integer • ISODD(integer) → integer • MOD(integer,integer) → integer • NOT(integer) → integer • SIGN(integer) → integer • SUM(range) → integer • TRUE() → integer Formulas Planned This is just an initial list of formulas where integer math can be used; there will be more once I implement the NUMBER type and determine which TEXT operations are feasible: AND(range), AVERAGE(range), DELTA(a,b), FACT(integer), GCD(range), LCM(range), MAX(range), MIN(range), OR(range), POWER(integer,integer), PRODUCT(range), QUOTIENT(integer,integer), RANDBETWEEN(integer,integer), SET(column,row,value), XOR(range) Operators Listed in order of precedence, highest first: • (integer) → integer • -integer → integer, +integer → integer • integer^integer → integer • integer*integer → integer, integer/integer → integer • integer+integer → integer, integer-integer → integer • integer=integer → integer, integer<>integer → integer, integer<integer → integer, integer<=integer → integer, integer>integer → integer, integer>=integer → integer Limitations Currently Duvet is extremely limited. It can play my CPC #31 entry, but that's about it: • Cannot create new sheets. • Sheets cannot be edited, except for cells containing integers (and also 64-bit integers cannot currently be edited). • Cells cannot be created, deleted, edited to become empty, copied, moved, etc. • Only loads and saves spreadsheets in a proprietary format. • Floating point math is not available (needed for Video Poker) • A `Ran#` substitute is not available (also needed for Video Poker) Name The name is meant to be silly. In British English, a duvet (or "duvet cover" here in USA) is a comforter, often used instead of a bedsheet ("sheet"). So, the name represents the idea of Duvet replacing S-SHT. And the name also appeals to me because it's a word common to both French and English. Source Code https://git.planet-casio.com/calamari/Duvet Fri, 25 Oct 2024 19:38:25 +0200 WIP: LizyLang, un petit interpréteur de lisp bientôt on-calc. https://www.planet-casio.com/Fr/forums/topic17995--.html >> Dépot git: https://github.com/mibi88/tinylisp << Fin septembre j'ai commencé à coder un petit interprétateur de mon propre dialecte de lisp, avec les calculatrices en tête. Mais c'est un peu galère de coder un interprétateur directement pour la calculatrice (sans shell, valgrind, etc.) donc je l'ai codé pour PC déjà et je vais bientôt le porter vers les calculatrices. Pour l'instant il reste beaucoup à ajouter (surtout des fonctions), je ne suis même pas sur qu'il soit Turing complete (faut vraiment que j'essaye de coder le jeu de la vie avec, qui est Turing complete). Il y a quelque trucs qui peuvent un peu surprendre: toutes les fonctions où la valeur qu'elles retournent est passé en argument d'une autre fonction sont appelées avant cette fonction, donc il ne faut pas faire `(if (< n 10) (loop (- n 1)) 0)`, ou loop est appelé avant if, mais `(callif (< n 10) loop (- n 1))`, où la fonction callif se chargera d'appeler la fonction si la condition est vraie. Un petit exemple: (fncdef factorial (params n)) (* (callif (> n 1) factorial (- n 1)) n) (defend) (print (factorial 6)) Affiche `720.000000` J'ai mis plein de tests dans le dépôt :D . Amusez-vous bien ! Sat, 12 Oct 2024 21:38:05 +0200 Mastermind https://www.planet-casio.com/Fr/forums/topic17892--.html J'ai fait une version plutôt simplifiée du Mastermind, avec les couleurs remplacées par des chiffres de 0 à 9. Il marche mais ressemble à rien au niveau de l'interface. Je verrai quand j'aurai le temps de l'améliorer. si vous voulez le test je le met là Thu, 03 Oct 2024 21:34:58 +0200 CSV to Casio G1M spreadsheet conversion script https://www.planet-casio.com/Fr/forums/topic17891--.html Motivation I've written a couple of Casio S-SHT spreadsheet games for my own amusement, the absurdity of which have hopefully brought a few laughs to the community. For my S-SHT Tic-Tac-Toe game, I manually entered each cell on the calculator. Well, I didn't wish to repeat that unique experience for S-SHT Video Poker! So, I wrote this script instead, which probably took me days longer than if I'd just typed it all in. :lol: Script Usage Note: I've only tested any of this with LibreOffice Calc. I imagine Google Sheets and Microsoft Excel offer similar formulas and CSV export functionality. So other spreadsheet software MIGHT generate CSV's compatible with this script... or it might not. Prerequisites: LibreOffice Calc, Python 3. Download the script here: csv2g1m.py (1.0) 1. Write and test your spreadsheet using LibreOffice, saving in the ODS format. 2. "Save As" the spreadsheet to "Text CSV (.csv)". Use , (comma) for the field delimiter, and " (quotation mark) for the string delimiter. Select "Save cell content as shown", "Save cell formulas instead of calculated values", and "Quote all text cells". Deselect "Fixed column width". 3. Close the CSV spreadsheet (important!) and then re-open the CSV using LibreOffice Calc. Closing the CSV immediately is a good idea anyhow, as there were times where I realized I was making changes to the CSV when I meant to be editing the original ODS! Verify that the spreadsheet still works from the CSV. If it doesn't, fix it before proceeding. 4. Run ./csv2g1m.py CSV_FILENAME SPREADSHEET_NAME. Note that the spreadsheet name must be at most 8 letters long, and will be automatically capitalized. I don't know which characters are allowed, so I'd recommend sticking to letters and numbers, for safety. The script will write a G1M file based on the spreadsheet name. A spreadsheet name of MYGAME will result in the output file MYGAME.g1m. 5. Back up any of your calculator's important programs or data, just in case. I used https://bible.planet-casio.com/simlo/chm/v20/fx_legacy_SpreadSheetFormat.htm to implement Casio's spreadsheet format. The document was invaluable. However, it seems to have been written before text cells and formulas, so I had to reverse engineer those parts of the G1M format myself. I believe I got it right, but I don't have the knowledge of Casio internals like the authors of that documentation do, so I could have easily made mistakes or incorrect assumptions. 6. Transfer the spreadsheet to the SSHEET directory of the Casio's main memory. 7. Open the spreadsheet using S-SHT. You'll see a LOT of errors. This is because the script is not computing any values. Using FILE > RECAL should fix the errors. If errors remain, there are many reasons. Perhaps a formula you are using isn't supported, or isn't fully supported by Casio's spreadsheet implementation. Or a formula might not be allowed in certain contexts, or might not support the same range of numbers as LibreOffice. See below for a list of limitations and omissions that I'm aware of. There are almost certainly additional limitations that I'm currently unaware of. Supported Formulas and Operators The script supports the following LibreOffice Calc formulas, some with limitations (see below). Consult the LibreOffice Function Wizard or LibreOffice documentation for an explanation of what each of these do: ABS(n), ACOS(n), ACOSH(n), ASIN(n), ASINH(n), ATAN(n), ATANH(n), AVERAGE(range), BITAND(n,n), BITOR(n,n), BITXOR(n,n), COS(n), COSH(n), EXP(n), FACT(n), FALSE(), GCD(n,n), IF(test_expr,then_expr,else_expr), INT(n), LCM(n,n), LOG10(n), LN(n), MEDIAN(range), MOD(n,n), MIN(range), MAX(range), NOT(n), PI(), PRODUCT(range), RANDBETWEEN(n,n), RAND(), SUM(range), SIN(n), SINH(n), SQRT(n), TAN(n), TANH(n), TRUE() The script also supports the following LibreOffice operators: <=, <>, >=, +, -, ^, *, / The script supports text cells (including lowercase letters!) and converts the following Unicode characters in text cells to their Casio equivalents: ◢→⇒√⁻²⸋∛°×⏨÷⌟𝐫𝑟θπ𝐢ⅈ∠. If the first character in a text cell is ' (apostrophe), the cell will be considered a comment and not exported to the G1M. Limitations and Omissions The AND(n,...) and OR(n,...) formulas are not implemented. For OR, add a sequence of test expressions, such as ((A1=5)+(B1=6)). For AND, you could multiply the test expressions, but I add them up the same as for OR, then test that the sum is equal to the number of expressions: ((A1=5)+(B1=6))=2. MOD(n,d) is converted to ((n) Rmdr (d)). This was done as Casio's MOD didn't seem to be usable inside a CellIf. Casio's Rmdr seems to only allow for 10 integer digits, despite the calculator supporting larger integers still with full internal precision. As a result, for Video Poker I ended up using the formula n-INT(n/d)*d instead. Casio's GCD and LCM functions only support two arguments, compared to multiple in LibreOffice. Casio's spreadsheet app does not support string literals in formulas, nor any string operations. You can't even reference a cell with a string in it from a CellIf. As a result, no string-related LibreOffice formula is supported, nor the “&” operator. Casio's CellIf, which LibreOffice IF() is converted to, has some severe limitations. CellIf's cannot be nested, and can't seem to contain other range functions like CellSum. So, while you might happily code such things in LibreOffice, they won't actually work on the calculator. Use separate cells for each one. You can add IF()'s using “+”, though. Formulas that accept a range, such as SUM only support a single range on the Casio. I didn't implement the percent operator “%”. Divide the value by 100 instead. The following formulas are also unimplemented, but I've worked out replacements. Most of these are untested, so if I've made any mistakes please let me know: • ACOT(n) = ATAN(1/(n)) • ACOTH(n) = (LOG((n)+1)/((n)-1))/2) • BITLSHIFT(a,b) = ((a)*2^(b)) • BITRSHIFT(a,b) = INT((a)/2^(b)) • COT(n) = (1/TAN(n)) • COTH(n) = (EXP(2*(n))+1)/(EXP(2*(n))-1)) • CSC(n) = (1/SIN(n)) • CSCH(n) = (1/SINH(n)) • DEGREES(n) = ((n)*PI()/180) • DELTA(a,b) = ((a)=(b)) • ISEVEN(n) = (INT((n)/2)=((n)/2)) • ISODD(n) = (INT((n)/2)<>((n)/2)) • LOG(a,b) = (LOG(a)/LOG(b)) • POWER(a,b) = ((a)^(b)) • QUOTIENT(a,b) = INT((a)/(b)) • RADIANS(n) = ((n)*180/PI()) • SEC(n) = (1/COS(n)) • SECH(n) = (1/COSH(n)) • SIGN(n) = IF((n),ABS(n)/(n),0) • SQRTPI(n) = SQRT((n)*PI()) Spreadsheet Programming Techniques When writing the spreadsheet games, I came up with a few things that helped me, such as something resembling a C switch statement. If there is interest. perhaps this would also be a good thread to share spreadsheet programming techniques. Thu, 03 Oct 2024 05:16:58 +0200 3D minecraft clone for cg50/graph 90-E https://www.planet-casio.com/Fr/forums/topic17890--.html A full 3D minecraft clone for the fx-cg50 calculator. features: -96x96x40 world -41 different blocks -69 different items -lighting engine -survival/creative controls: F1 - hotbar left F2 - hotbar right F3 - explosion F4 - increase brightness F5 - decrease brightness alpha - switch game modes vars - inventory menu - game menu dpad - camera 7 - destroy block 9 - place block/interact 8 - forward 5 - backward 4 - left 6 - right 3 - save heap log 2 - reset heap, reload map and reload lighting 1 - show performance stats 0 - screenshot exe - select screenshots from the last update: https://i.postimg.cc/BQQrXGg2/image3.png https://i.postimg.cc/jd0hF6W2/image4.png https://i.postimg.cc/gcqwG3Sn/image5.png https://i.postimg.cc/bvxP192n/image6.png https://i.postimg.cc/xT3FGpsn/image11.png https://i.postimg.cc/rmGS63Rp/image12.png download: https://drive.google.com/file/d/1vh_GX9NJdYEwqUM3NozEFZrI6KWQgtZM/view topic on cemetech forms: https://www.cemetech.net/forum/viewtopic.php?t=19552&highlight= if anyone has any ideas for features or finds bugs please let me know. Thu, 03 Oct 2024 00:14:37 +0200 planetcasio -- bibliothèque client pour Planète Casio en Python https://www.planet-casio.com/Fr/forums/topic17877--.html J'ai fait un petit module Python, simplement nommé `planetcasio`, pour interagir avec Planète Casio aujourd'hui, notamment avec la shoutbox, dans le cadre du développement d'un bot pour du suivi de projets. Un exemple d'usage pour envoyer un message sur la shoutbox, dans le channel `hs` : import asyncio from planetcasio.client import Client async def main(): async with Client(auth=("my_username", "my_password")) as client: channel = await client.shout.get_channel("hs") await channel.post("Hello, world!") asyncio.run(main()) Vous pouvez retrouver le projet aux endroits suivants : Site officiel et documentation sur planetcasio.touhey.pro ;Dépôt thomas.touhey/planetcasio sur Gitlab ;planetcasio sur PyPI. Tue, 24 Sep 2024 21:00:21 +0200 Un petit raycaster https://www.planet-casio.com/Fr/forums/topic17874--.html J'ai commencé à coder un raycaster et j'en publie un premier port pour les 20 ans de PC :D https://git.planet-casio.com/mibi88/raycaster_pc_20 . Add-in en pièce jointe :D Il supporte les textures, qui peuvent être désactivés avec OPTN. ALPHA permet d'activer la correction de l'effet œil de poisson, et SHIFT de changer vers la vue en 1ère personne. VARS cache ou affiche le compteur de FPS. Sun, 15 Sep 2024 00:01:54 +0200 WIP: md2bb - un convertisseur en ligne de commande de Markdown vers du BBCode https://www.planet-casio.com/Fr/forums/topic17850--.html WIP: md2bb - un convertisseur en ligne de commande de Markdown vers du BBCode Dépot : https://github.com/mibi88/md2bb Il y a quelque jours j'ai commencé à coder un convertisseur Markdown vers BBCode, car il est bien plus pratique d'écrire de longs textes en Markdown qu'en BBCode. Il existe déjà des convertisseurs Markdown vers BBCode, mais le BBCode est différent d'un site web à l'autre, mon convertisseur peut donc être adapté pour des sites web différents assez facilement. Pour l'instant, seul phpBB et Planet Casio sont supportés. Tout cela semble merveilleux, mais mon convertisseur, qui vise à être compatible avec https://daringfireball.net/projects/markdown/dingus, est loin de l'être. Essayez de convertir le fichier test.md du dépôt, et vous verrez que beaucoup de choses ne sont pas encore converties, mais les fonctionnalités les plus basiques du markdown sont déjà supportés, comme vous pouvez le voir, car ce post lui même est écrit en markdown (markdown en pièce jointe). Pour convertir du markdown en BBCode avec, il vous suffit d'entrer la commande suivante : $ python3 main.py [fichier markdown] -o [fichier BBCode] -t planet-casio -o spécifie le fichier de sortie. Si vous ne le spécifiez pas de fichier de sortie, le BBCode sera écrit sur la sortie standard. -t spécifie le site web visé, ici planet-casio. Toutes les contributions sont, bien sûr, bienvenues ! PS: J'ai du renommer le fichier markdown en .txt pour pouvoir l'ajouter en pièce jointe. Mon, 26 Aug 2024 18:09:44 +0200 3D Racer : Un petit jeu en 3D wireframe ! https://www.planet-casio.com/Fr/forums/topic17831--.html Un petit jeu en wireframe :D ! https://www.planet-casio.com/storage/forums/Capture%20de%20Capture%20vid%C3%A9o%20du%202024-08-11%2016-00-28.mp4-17831.png Programme : https://www.planet-casio.com/Fr/programmes/programme4444-1-racer3d-mb88-jeux-add-ins.html Dépôt git : https://git.planet-casio.com/mibi88/racer3d Version pour Graph 90+e : https://www.planet-casio.com/Fr/programmes/programme4445-1-racer3d-cg-mb88-jeux-add-ins.html Dépôt de la version pour Graph 90+e : https://git.planet-casio.com/mibi88/racer3d_cg Une vidéo du jeu sur mono : https://www.planet-casio.com/storage/forums/main-2000_40-197661.mp4 Une vidéo du jeu sur G90+e : https://www.planet-casio.com/storage/forums/Capture%20vid%C3%A9o%20du%202024-08-12%2014-40-37-197669.mp4 Des fonctions de trigonométrie : https://www.planet-casio.com/storage/forums/Capture%20d%E2%80%99%C3%A9cran%20du%202024-08-09%2014-55-11-17831.png Du rendu 3D : https://www.planet-casio.com/storage/forums/Capture%20vid%C3%A9o%20du%202024-08-09%2018-06-02-197627.mp4 On peut bouger le vaisseau dans un joli champ d'étoiles : https://www.planet-casio.com/storage/forums/Capture%20vid%C3%A9o%20du%202024-08-09%2022-04-44-197639.mp4 Un écran de titre : https://www.planet-casio.com/storage/forums/Capture%20vid%C3%A9o%20du%202024-08-09%2023-10-52-197640.mp4 Le jeu est déjà presque complet : https://www.planet-casio.com/storage/forums/main2-197648.mp4 Le jeu est fini : https://www.planet-casio.com/storage/forums/main-2000_40-197661.mp4 Je suis en train de faire un petit jeu en 3D wireframe avec libMicrofx, et je viens de faire des fonctions pour la trigonométrie en fixed point (mais va falloir un jour que je les change parce que là avec des tables ça fait un add-in de 6Ko :/) : https://www.planet-casio.com/storage/forums/Capture%20d%E2%80%99%C3%A9cran%20du%202024-08-09%2014-55-11-17831.png Fri, 09 Aug 2024 14:57:41 +0200