Recent

Author Topic: I've written a program  (Read 443 times)

JimA

  • Newbie
  • Posts: 1
I've written a program
« on: February 16, 2025, 06:01:23 pm »
Actually re-written one I wrote 20 years ago for my kids in turboBasic(!)  and now updated it for my grandkids with Lazarus.

Its not earth shattering; just a little 2 player noughts & crosses program that requires you to solve a sum to position your X with varying degrees of difficulty to test basic maths

I'm not looking to cash in; just offer it for other parents/grandparents/teachers.  Back in the day I uploaded the program to a Compuserve  forum and a few people used it

Has anyone got any advice ?

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10926
  • Debugger - SynEdit - and more
    • wiki
Re: I've written a program
« Reply #1 on: February 16, 2025, 06:55:00 pm »
If you want to make it avail as open source, then IMHO nowadays the place is GitHub and Gitlab (and then a few other git hosters). But there also is still plenty going on at sourceforge (where you can use svn or git or just upload files).
In the end you probably don't need git, to use gitlab. They have online tools to add files to the repo, so you can just upload files.

Afaik any of them allows you do add a description (usually Readme or readme.md) and some form of webpage/wiki if you want to.

Where ever you put it, you can then post the link here (the forum allows attachments, just zip or tar it), and on our wiki is a page with "programs written in pascal", where you can also link it.

Of course you can also attach it here (it sounds it will fit into the size limitations), but as the post will get older, less people will get to see it.

MarkMLl

  • Hero Member
  • *****
  • Posts: 8335
Re: I've written a program
« Reply #2 on: February 16, 2025, 09:56:45 pm »
:-) When I were a lad... noughts & crosses were played by boxes with a 3x3 grid of switches and lights on the top (in fact Arthur C. Clarke mentions one in "Tales from the White Hart", although it's somewhat younger than I am).

What would be really cool would be an animation of that, which managed to get across how and why it worked.

Back in the 1950s, the behaviour of a few switches was popularly interpreted as "thinking". 70 years later, the behaviour of a few ** matrices is popularly interpreted as "thinking".

MarkMLl

** OK, I know that I should really put "hundreds of billions" in there. But please cut me some slack :-)







MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Thaddy

  • Hero Member
  • *****
  • Posts: 16665
  • Kallstadt seems a good place to evict Trump to.
Re: I've written a program
« Reply #3 on: February 17, 2025, 04:20:30 pm »
This is no longer compatible with TP for years, but you still may enjoy it as comparison:
Code: Pascal  [Select][+][-]
  1. program TicTacToe;
  2. {$mode objfpc}
  3. uses sysutils;
  4. var
  5.   b: array[0..8] of char = ('1','2','3','4','5','6','7','8','9');
  6.   w: array[0..7, 0..2] of integer = ((0,1,2),(3,4,5),(6,7,8),(0,3,6),(1,4,7),(2,5,8),(0,4,8),(2,4,6));
  7.   p, i: integer;
  8.   c: char = 'X';
  9.  
  10. function chk: boolean;
  11. var i: integer;
  12. begin
  13.   for i := 0 to 7 do
  14.     if (b[w[i,0]] = b[w[i,1]]) and (b[w[i,1]] = b[w[i,2]]) then exit(true);
  15.   exit(false);
  16. end;
  17.  
  18. begin
  19.   repeat
  20.     for i := 0 to 8 do begin
  21.       write(b[i], ' ');
  22.       if (i+1) mod 3 = 0 then writeln;
  23.     end;
  24.     write(c, ' turn: '); readln(p);
  25.     if (p > 0) and (p < 10) and (b[p-1] = chr(p+48)) then begin
  26.       b[p-1] := c;
  27.       if chk then begin writeln(c, ' wins!'); exit; end;
  28.       c := chr(88 + 79 - ord(c));
  29.     end;
  30.   until false;
  31. end.
I see a helluvelot of possible improvements, still to do.
I am sure many of you wrote tictactoe at some point?
Go find it in that attick! It still is a great little thingy we all love to play with our children and grand children.

Big flaw above, but works (big flaw = draw)
« Last Edit: February 17, 2025, 04:24:15 pm by Thaddy »
But I am sure they don't want the Trumps back...

 

TinyPortal © 2005-2018