New programmable tech?

The Joy of Tech - Anything and everything about all things shiny..
User avatar
gravy
Sheepie Whore
Sheepie Whore
Posts: 19572
Joined: Wed May 01, 2002 1:28 pm 0
Location: The Other Place

Re: New programmable tech?

Post by gravy »

Got to agree. Judge people by what they do not what they say they want to do.

Go on Zip, give something a go. You'll either enjoy or kick it off you bucket list and make room for something else :)
User avatar
zip accident
Sheepie Whore
Sheepie Whore
Posts: 13928
Joined: Sun Feb 20, 2005 1:58 pm 0
Location: Bristol, UK

Re: New programmable tech?

Post by zip accident »

venusian wrote:ISTM that effective learning requires that you want to learn. Your comments in this thread suggest that at some point in the future you want to have learned
Yeah, wanting to have learned stuff is definitely a thing I do. Don't other people do that at all?

I'm not convinced that at this point I have the capacity any more to learn anything.

Rote learning never was enjoyable, I think understanding the reasons behind things always worked better for me than just going over and over apparent nonsense until you could recite it.
"My way is the way of not fighting":- the book of Enter the Dragon.
User avatar
venusian
Baaaaaaa!
Baaaaaaa!
Posts: 6655
Joined: Wed Nov 06, 2002 2:22 pm 0
Location: South Gloucestershire

Re: New programmable tech?

Post by venusian »

zip accident wrote:
venusian wrote:ISTM that effective learning requires that you want to learn. Your comments in this thread suggest that at some point in the future you want to have learned
Yeah, wanting to have learned stuff is definitely a thing I do. Don't other people do that at all?
Obviously yes, hence my comment about (human) language book. Also OpenGL. And VHDL. And guitar playing.
zip accident wrote:I'm not convinced that at this point I have the capacity any more to learn anything.
Nonsense.
zip accident wrote:Rote learning never was enjoyable, I think understanding the reasons behind things always worked better for me than just going over and over apparent nonsense until you could recite it.
In my experience there's almost no rote learning in programming. The core of good programming is in never doing the same thing twice when you could get the computer to do it for you, and the core of a good language is that it has a few simple ideas which you use and adapt as necessary, not a vast array of nearly identical things you have to learn. Those big thick books about APIs? They exist because nobody learns APIs or language features by rote; you look them up as necessary.

Just dive in and stop worrying about it. That "...The Hard Way" link looks very much worth a go.
User avatar
zip accident
Sheepie Whore
Sheepie Whore
Posts: 13928
Joined: Sun Feb 20, 2005 1:58 pm 0
Location: Bristol, UK

Re: New programmable tech?

Post by zip accident »

venusian wrote:
zip accident wrote:I'm not convinced that at this point I have the capacity any more to learn anything.
Nonsense.
You are very kind, thank you.
zip accident wrote:Rote learning never was enjoyable, I think understanding the reasons behind things always worked better for me than just going over and over apparent nonsense until you could recite it.
In my experience there's almost no rote learning in programming. The core of good programming is in never doing the same thing twice when you could get the computer to do it for you, and the core of a good language is that it has a few simple ideas which you use and adapt as necessary, not a vast array of nearly identical things you have to learn. Those big thick books about APIs? They exist because nobody learns APIs or language features by rote; you look them up as necessary.
There was a time, when you could do that, then along came C++.
Just dive in and stop worrying about it. That "...The Hard Way" link looks very much worth a go.
Sorry, not to me.

I'm interested in static patterns, Conway's Life, the Mandelbrot Set and maybe Julia sets, maybe other cellular automata or fractals. There isn't any apparent easy route to those via Python.

I did mean to look up Processing, but it didn't seem to start going in the sort of direction I was interested in travelling.
"My way is the way of not fighting":- the book of Enter the Dragon.
User avatar
gumboot
Baaaaaaa!
Baaaaaaa!
Posts: 7652
Joined: Sun Aug 26, 2007 3:42 am 0
Location: trumpstain!

Re: New programmable tech?

Post by gumboot »

zip accident wrote:What I don't run, is Java in my browser.
Silliness! It's been over a year since Java's last known zero-day: http://www.java-0day.com/

Possibly only because people like you spoiled the game, though. Bastard.

zip accident wrote:
learnpythonthehardway wrote: Do Not Copy-Paste

You must type each of these exercises in, manually. If you copy and paste, you might as well not even do them. The point of these exercises is to train your hands, your brain, and your mind in how to read, write, and see code. If you copy-paste, you are cheating yourself out of the effectiveness of the lessons.
You see what I did there? :lol:

That style of learning isn't for me. It would probably work if I did have the attention span to stick with it. :)

I want something I can play with.
I don't have the attention span to learn to solve a rubik's cube. Specifically, I don't have the attention span to derive my own routines for the last layer. I can look them up on the internet, but that's not really solving anything[*]. However, sitting and fiddling with a cube is a fairly pleasant exercise and the more I do that the more I derive on my own patterns (but I still don't expect or intend ever to find my way over that hump). I would guess that the paragraph quoted above strives to get the same effect but for Python.

So, uhh... get a model-M and just try to enjoy bashing the keyboard.



[*] I did learn Petrus method rote, just so I could keep my bookshelf tidy.

[edti] Also, after fiddling with some locks briefly, I wondered if maybe locksmithery would take all of the manual joy of fiddling with cubes and do away with that can't-quite-be-bothered factor of having to derive overly complex patterns to complete the task.
User avatar
Kamineko
Baaaaaaa!
Baaaaaaa!
Posts: 7569
Joined: Fri Dec 17, 2004 2:53 pm 0
Contact:

Re: New programmable tech?

Post by Kamineko »

I'm interested in static patterns, Conway's Life, the Mandelbrot Set and maybe Julia sets, maybe other cellular automata or fractals. There isn't any apparent easy route to those via Python.
HUH? Life is simple... you only need 1 bit display to show Life! Why wouldn't Python be able to do life?

Python is all about trying stuff out. That's what the interactive prompt is for. Just type stuff in and check the result if you've got it right. Lame looking text programs like 'Type in your name?' 'Welcome BLAH. It has 4 letters. Your name backwards is HALB.' is a first step. A list of square numbers? Prime number checker? Card game deck shuffler?

There's a site called Tutorials Point that has some tutorials for loads of languages (can't vouch for 'em haven't read 'em), but they have a really cool section called Coding Ground which lets you try pretty much ANY programming language in your browser on a nifty virtualised PC type thing.

http://www.tutorialspoint.com/execute_python_online.php

Here's a life I threw up in a couple of minutes just transcribing the rules into python 3. http://pastebin.com/FeZvCW9p

It might look scary because Python doesn't have 2d arrays, but if you read my bracket-heavy stuff as 'a list containing... a list containing a row of cells', then the weird board[y][x] will make sense. (We take the y'th row... and then take the x'th cell across.)

Copy my code into the Coding Ground thing, make sure you've 'saved' it to the virtual pc, and then type 'python3 life.py' on the prompt on the right to see the glider wobble about for a few cycles.

Pretty much any programming language will help you with a Mandelbrot! You just need a way to calculate numbers and a place to put 'em when you're done.

(My Python suggestion would be learn a really simple graphics file format like PGM (It's a text file with just numbers in it showing the brightness!) and get your Mandelbrot code to splat out something in that. Load it up in a paint program and you're done!)
User avatar
zip accident
Sheepie Whore
Sheepie Whore
Posts: 13928
Joined: Sun Feb 20, 2005 1:58 pm 0
Location: Bristol, UK

Re: New programmable tech?

Post by zip accident »

Kamineko wrote:
I'm interested in static patterns, Conway's Life, the Mandelbrot Set and maybe Julia sets, maybe other cellular automata or fractals. There isn't any apparent easy route to those via Python.
HUH? Life is simple... you only need 1 bit display to show Life! Why wouldn't Python be able to do life?
The problem I fear isn't Life, it's displaying it. It's probably easy enough when you know how. Life under DOS was simple, open a screen, plot pixels as required. It's opening a screen and plotting pixels on it that is threatening under Windows. I could open a screen and throw pixels on it under GEM, but I never did sort out opening a window (What did GEM call windows? I don't remember now) to do it there either.
Python is all about trying stuff out. That's what the interactive prompt is for. Just type stuff in and check the result if you've got it right. Lame looking text programs like 'Type in your name?' 'Welcome BLAH. It has 4 letters. Your name backwards is HALB.' is a first step. A list of square numbers? Prime number checker? Card game deck shuffler?

There's a site called Tutorials Point that has some tutorials for loads of languages (can't vouch for 'em haven't read 'em), but they have a really cool section called Coding Ground which lets you try pretty much ANY programming language in your browser on a nifty virtualised PC type thing.

http://www.tutorialspoint.com/execute_python_online.php

Here's a life I threw up in a couple of minutes just transcribing the rules into python 3. http://pastebin.com/FeZvCW9p

It might look scary because Python doesn't have 2d arrays, but if you read my bracket-heavy stuff as 'a list containing... a list containing a row of cells', then the weird board[y][x] will make sense. (We take the y'th row... and then take the x'th cell across.)

Copy my code into the Coding Ground thing, make sure you've 'saved' it to the virtual pc, and then type 'python3 life.py' on the prompt on the right to see the glider wobble about for a few cycles.
So you copy 'n' paste that code across the net? that a messy process to my eyes.
Pretty much any programming language will help you with a Mandelbrot! You just need a way to calculate numbers and a place to put 'em when you're done.

(My Python suggestion would be learn a really simple graphics file format like PGM (It's a text file with just numbers in it showing the brightness!) and get your Mandelbrot code to splat out something in that. Load it up in a paint program and you're done!)
Urg. running a Mandelbrot to an image file as the main display? that is horrid. I don't remember whether I ever did a Mandelbrot, if I did then it was just the basic shape drawn to the screen, no zooming in or anything clever, but to a bitmap file? that's the definition of horrid. Writing out to file is a useful second stage, but you need to see the thing live (that was when the CPU ran in low MHz, so you actually saw it draw).

I suppose it's a culture clash, but to me setting up screens or windows to write to is grunt work that needs to be done but it's not part of what I want to do, and I resent months being spent learning how to do it. Yes I want colours, lots of pretty colours. It used to be easy to set that stuff up in the old days of the '80s and '90s.
"My way is the way of not fighting":- the book of Enter the Dragon.
User avatar
toxibunny
Baaaaaaa!
Baaaaaaa!
Posts: 5906
Joined: Thu Jun 17, 2004 11:59 pm 0
Location: limb clock land

Re: New programmable tech?

Post by toxibunny »

do it in pygame with a bit of boilerplate code then. It won't take long.
I made a deviantart page.
'....The baron is a gay old rogue with an eye for the ladies....'
User avatar
pogo
Sheepie Whore
Sheepie Whore
Posts: 14180
Joined: Tue Sep 10, 2002 8:28 pm 0
Yahoo Messenger: BrassSparrow
Location: County Durham

Re: New programmable tech?

Post by pogo »

http://wonderfl.net/c/98ib

A Mandelbrot program in 77 lines of Actionscript. But a lot of it's not needed. Loose the text printing and the animation and it's probably only 30 lines, most of which are setup. The code that does all the work (calculation, writing to bitmap) is 10 lines from line 41.

The great thing about wonderfl is you can 'fork' anything you see. Want to experiment, just change a single line? Fork to create your own copy, make your change and it runs automatically, a few seconds after you stop typing. And you can do that to anything, from the simplest experiments like the above to full games.
User avatar
gravy
Sheepie Whore
Sheepie Whore
Posts: 19572
Joined: Wed May 01, 2002 1:28 pm 0
Location: The Other Place

Re: New programmable tech?

Post by gravy »

zip accident wrote:
Kamineko wrote:
I'm interested in static patterns, Conway's Life, the Mandelbrot Set and maybe Julia sets, maybe other cellular automata or fractals. There isn't any apparent easy route to those via Python.
HUH? Life is simple... you only need 1 bit display to show Life! Why wouldn't Python be able to do life?
The problem I fear isn't Life, it's displaying it. It's probably easy enough when you know how. Life under DOS was simple, open a screen, plot pixels as required. It's opening a screen and plotting pixels on it that is threatening under Windows. I could open a screen and throw pixels on it under GEM, but I never did sort out opening a window (What did GEM call windows? I don't remember now) to do it there either.
There you go then:

https://github.com/daogan/conways-game-of-life

So there's a bunch of stuff you don't seem to get but would start getting if you actually started doing something.

That link uses PyGame, a library that does a bunch of the boilerplate nonsense for game related projects that will give you a screen.

You need to install that and Python and you'll have everything you need to get going. You have to remember this is the sort of thing lots of people like to try and do so there are great solutions for loads of languages. Things have come a long way since you had to fuck around with the intricacies of opening a window and setting up a surface through an OS interface.

But honestly the recurrent theme seems to be that you can't be arsed. I can't give you a link to download some being bothered :D
User avatar
gravy
Sheepie Whore
Sheepie Whore
Posts: 19572
Joined: Wed May 01, 2002 1:28 pm 0
Location: The Other Place

Re: New programmable tech?

Post by gravy »

zip accident wrote:
Kamineko wrote:
I'm interested in static patterns, Conway's Life, the Mandelbrot Set and maybe Julia sets, maybe other cellular automata or fractals. There isn't any apparent easy route to those via Python.
HUH? Life is simple... you only need 1 bit display to show Life! Why wouldn't Python be able to do life?
The problem I fear isn't Life, it's displaying it. It's probably easy enough when you know how. Life under DOS was simple, open a screen, plot pixels as required. It's opening a screen and plotting pixels on it that is threatening under Windows. I could open a screen and throw pixels on it under GEM, but I never did sort out opening a window (What did GEM call windows? I don't remember now) to do it there either.
There you go then:

https://github.com/daogan/conways-game-of-life

So there's a bunch of stuff you don't seem to get but would start getting if you actually started doing something.

That link uses PyGame, a library that does a bunch of the boilerplate nonsense for game related projects that will give you a screen.

You need to install that and Python and you'll have everything you need to get going. You have to remember this is the sort of thing lots of people like to try and do so there are great solutions for loads of languages. Things have come a long way since you had to fuck around with the intricacies of opening a window and setting up a surface through an OS interface.

But honestly the recurrent theme seems to be that you can't be arsed. I can't give you a link to download some being bothered :D

EDIT

Lol, pick a language you like the look of here -> http://rosettacode.org/wiki/Conway%27s_Game_of_Life

Man, the functional versions are beautiful, check out the Haskell and F# implementations
User avatar
gumboot
Baaaaaaa!
Baaaaaaa!
Posts: 7652
Joined: Sun Aug 26, 2007 3:42 am 0
Location: trumpstain!

Re: New programmable tech?

Post by gumboot »

Did somebody say Life?

A classic case of I-can't-belive-how-fucking-long-ago-these-techniques-were-known.

Flip back a few pages for a write-up on 6809, by the way.
User avatar
Kamineko
Baaaaaaa!
Baaaaaaa!
Posts: 7569
Joined: Fri Dec 17, 2004 2:53 pm 0
Contact:

Re: New programmable tech?

Post by Kamineko »

The problem I fear isn't Life, it's displaying it. It's probably easy enough when you know how. Life under DOS was simple, open a screen, plot pixels as required. It's opening a screen and plotting pixels on it that is threatening under Windows. I could open a screen and throw pixels on it under GEM, but I never did sort out opening a window (What did GEM call windows? I don't remember now) to do it there either.

I suppose it's a culture clash, but to me setting up screens or windows to write to is grunt work that needs to be done but it's not part of what I want to do, and I resent months being spent learning how to do it. Yes I want colours, lots of pretty colours. It used to be easy to set that stuff up in the old days of the '80s and '90s.
Even on the Amiga, getting a nice screen up to throw things at was a little involved wasn't it?

To get a stable screen mode set up, you'd have to work through miles of magic numbers (for asm programmers) or interconnected API calls (for C programmers). On a home micro, it was only simple because either:
a) You were extremely lucky and didn't need a lot: if you hit some things in the right place in DOS you get nice and easy 320x200 8-bit colour graphics, but if you try to push it a little further, even just getting keyboard input, can be a headscratcher.
or, more likely:
b) A lot of the work was already done for you. You'd run in a safe environment where all the useful features were accessible with nice names, all designed to make things easier for the user. And there's nothing wrong with that! You want to make cool things happen, not spend time setting up the things that make cool things possible.

So, essentially, you want the modern equivalent of QBASIC for DOS or Blitz BASIC for the Amiga, but on the PC?

It sounds like you want something like, well, Blitz BASIC! (Blitz 3D and Plus are very similar and they're free now.)

You can get up a graphics screen in one line, and plop a pixel onto it with another. You get a nice self-contained environment with everything you could want within arms reach: text, graphics, keyboard and joystick input, sound, loading, saving, and a great big interactive help file for it all.

Because they're very old, there's TONS of example code on the net. Absolutely everybody and their dog has tried Blitz. They're also even blitzier now than they were when they were first released for Windows. You'll probably be a little disappointed that your screen-filling Mandelbrot won't appear crawling along the screen one pixel at a time! :P

Don't be discouraged by anyone who says it's not 'real programming'! Fortunes have been made with less. (And don't bring up Dijkstra.)

And if BASIC is too kiddie for you, consider it a challenge to port your completed BASIC program to Python + PyGame. You'll be surprised at how much you -do- know.
So you copy 'n' paste that code across the net? that a messy process to my eyes.
That was only an example in case you didn't want to download and install Python yourself (or alternatively Portable Python without installing it). That site is there for folks who just want to poke about. My life example just plops characters to the console, so it'll work pretty much anywhere.
User avatar
zip accident
Sheepie Whore
Sheepie Whore
Posts: 13928
Joined: Sun Feb 20, 2005 1:58 pm 0
Location: Bristol, UK

Re: New programmable tech?

Post by zip accident »

Kamineko wrote:
The problem I fear isn't Life, it's displaying it. It's probably easy enough when you know how. Life under DOS was simple, open a screen, plot pixels as required. It's opening a screen and plotting pixels on it that is threatening under Windows. I could open a screen and throw pixels on it under GEM, but I never did sort out opening a window (What did GEM call windows? I don't remember now) to do it there either.

I suppose it's a culture clash, but to me setting up screens or windows to write to is grunt work that needs to be done but it's not part of what I want to do, and I resent months being spent learning how to do it. Yes I want colours, lots of pretty colours. It used to be easy to set that stuff up in the old days of the '80s and '90s.
Even on the Amiga, getting a nice screen up to throw things at was a little involved wasn't it?
I had an ST.

*goes off to dig up some old code*

Code: Select all


/* ************************************ header files to be included */

#include <dos.h>
#include <fortstyl.h>
#include <linea.h>
#include <errno.h>
#include <limits.h>


/* ****************************************** function prototypes */

void plot_pixel ( short, short, short );
void setup_linea ( void );
short set_mode ( short );
void cls( void );
void lose_mse( void );
void find_mse( void );

...


/* **************************************************** global variables */

static short *ptr_intin, *ptr_ptsin, *ptr_ptsin2;

  /* these ( ptr_intin, ptr_ptsin, ptr_ptsin2 ) global variables are not */
  /* good style, but they are the quickest way by far to get the values  */
  /* required into plot_pixel, that is, there are fewer parameters to be */
  /* passed in, and the values do not need to be continually             */
  /* recalculated in there.  Given that in some programs the whole       */
  /* screen is plotted pixel by pixel, that's a worthwhile advantage.    */


/* ******************************************************* set linea */
/* set up lineA graphics for Atari ST only.  Must be called at least */
/* once before plot pixel can be ( on an ST ), though more than one  */
/* call is probably a waste of processing time.  In fact needed      */
/* before any lineA functions, even if the pointers aren't needed.   */ 
/* ***************************************************************** */

void setup_linea ( void )

{
   /* get pointers to the lineA variables */

   struct RegRec registers;

   long temp;

   temp = ( A000( &registers ) );

   ptr_intin = *( short ** ) ( temp + 8 );

   ptr_ptsin = *( short ** ) ( temp + 12 );

   ptr_ptsin2 = ptr_ptsin + 1;
}

/* ****************************************************** plot_pixel */
/* routine to change the state of a pixel on the graphics mode       */
/* screen.  Variant for Atari ST.  'setup_linea' absolutely *must*   */
/* be called before this or a crash will result ( dereferencing a    */
/* null pointer, and other problems, like total crashes from the mse */
/* functions ( which don't pass parameters, so in their case it      */
/* isn't the pointers which don't get set up ) ).                    */
/* ***************************************************************** */

void plot_pixel( short srow, short scol, short value )

{
   struct RegRec registers;
  
   /* plot a pixel using the linea routine */
   
   *ptr_ptsin = scol;
   
   *ptr_ptsin2 = srow;
   
   *ptr_intin = value;
   
   A001 ( &registers );
}

/* ******************************************************** clear screen */
/* based on VT52 info from Braga, but using the Prospero gemdos function */
/* to get the information to the screen.                                 */
/* ********************************************************************* */

void cls( void )
 
{
   gemdos ( 2, 27 );

   gemdos ( 2, 'E' );
}

...

Feels as if there ought to have been more to it than that, but there doesn't seem to have been.
To get a stable screen mode set up, you'd have to work through miles of magic numbers (for asm programmers) or interconnected API calls (for C programmers). On a home micro, it was only simple because either:
a) You were extremely lucky and didn't need a lot: if you hit some things in the right place in DOS you get nice and easy 320x200 8-bit colour graphics, but if you try to push it a little further, even just getting keyboard input, can be a headscratcher.
or, more likely:
b) A lot of the work was already done for you. You'd run in a safe environment where all the useful features were accessible with nice names, all designed to make things easier for the user. And there's nothing wrong with that! You want to make cool things happen, not spend time setting up the things that make cool things possible.
Exactly.
So, essentially, you want the modern equivalent of QBASIC for DOS or Blitz BASIC for the Amiga, but on the PC?

It sounds like you want something like, well, Blitz BASIC! (Blitz 3D and Plus are very similar and they're free now.)
That would be nice, I sent the quy from Blitz a PM here, there was no reply. I don't think I've got any way of paying him now, I don't do cheques much anymore, and I barely use my credit card.
You can get up a graphics screen in one line, and plop a pixel onto it with another. You get a nice self-contained environment with everything you could want within arms reach: text, graphics, keyboard and joystick input, sound, loading, saving, and a great big interactive help file for it all.

Because they're very old, there's TONS of example code on the net. Absolutely everybody and their dog has tried Blitz. They're also even blitzier now than they were when they were first released for Windows. You'll probably be a little disappointed that your screen-filling Mandelbrot won't appear crawling along the screen one pixel at a time! :P
You may well jest, I had a Life in Basic on the NewBrain using the fancy built in monochrome graphics with readable screen (there was a routine to see whether a pixel was black or white), and it took *minutes* per generation. Using block characters turned out to be much faster, but still not fast.
Don't be discouraged by anyone who says it's not 'real programming'! Fortunes have been made with less. (And don't bring up Dijkstra.)

And if BASIC is too kiddie for you, consider it a challenge to port your completed BASIC program to Python + PyGame. You'll be surprised at how much you -do- know.
That Pygame sounds useful, if there was a decent c for Windows a port of Pygame that ran under c for Windows would suit me nicely, or as you say Basic, preferably something that's not abandonware.
Last edited by zip accident on Sun Jan 11, 2015 3:24 am 0, edited 1 time in total.
"My way is the way of not fighting":- the book of Enter the Dragon.
User avatar
gravy
Sheepie Whore
Sheepie Whore
Posts: 19572
Joined: Wed May 01, 2002 1:28 pm 0
Location: The Other Place

Re: New programmable tech?

Post by gravy »

Well then you'd use SDL or SDL2 and C

Just about any language you can think of there's nice wrapper library to make that kind of thing really easy

Have a look for mingw and SDL
Post Reply