7 ms·
My first attempt at coding was with a Java Programming For Dummies book around the Java 1.1 era, using applets. That was a terrible choice for 12 year old non-n
by codebolt 6y ago
My first attempt at coding was with a Java Programming For Dummies book around the Java 1.1 era, using applets. That was a terrible choice for 12 year old non-native english speaking me, and I never got too far.
Somehow I ended up trying QBASIC a couple of years later and programming suddenly became a lot easier and fun. I especially loved that you could easily switch to graphics mode and just start drawing pixels and lines to the screen, it was like the perfect blank canvas to try out different ideas for a curious young mind.
- dirtydroog 6y agoI think I had the same book!
- dTal 6y agoAlas, that easy graphics programming environment - so critical to my early engagement with programming as well -is nowhere to be found. Even in the Python ecosystem, nothing approaches the simplicity of "SCREEN 12" and immediately being able to use POINT, LINE, CIRCLE etc.
- int_19h 6y agoPython ecosystem is precisely the one that does approach this level of simplicity, because it has turtle graphics out of the box. Here's one complete example from the docs: from turtle import * color('red', 'yellow') begin_fill() while True: forward(200) left(170) if abs(pos()) < 1: break end_fill() done()
- kragen 6y agoThis does "approach the simplicity of "SCREEN 12" and immediately being able to use POINT, LINE, CIRCLE etc.": #!/usr/bin/python from pygame import * pantalla = display.set_mode((0, 0), FULLSCREEN) draw.rect(pantalla, 128, (50, 100, 200, 400)) display.flip() time.delay(2000) That's from https://github.com/kragen/pyconar-talk/blob/master/helloneg1.py https://github.com/kragen/pyconar-talk/blob/master/helloneg1.... There are some more examples in that directory. They use PyGame, though, which isn't installed by default like POINT. By default Python comes with Tkinter, though, which lets you do this: from tkinter import * # or Tkinter in Python 2 w = Tk() button(w, text="Not OK", command=w.destroy).pack() That's a fuckload more than you can do graphically in GW-BASIC. For graphics, though, you're better off in JS and DHTML. In http://canonical.org/~kragen/sw/dev3/tweetfract.html http://canonical.org/~kragen/sw/dev3/tweetfract.html I have an HTML canvas which renders a fractal if you click on it, in 140 bytes: <canvas onclick="c=this.getContext('2d'); function d(x,y,k){c.fillRect(x,y,1,1); (k/=2)>1&&(d(x,y,k),d(x,y+=k,k),d(x+k,y,k)) }d(0,0,150)"> Moreover, if you put that on the web, you can link anyone in the world to it, and they can run it just by clicking the link. And you don't have to start that complicated; this works too: <b onclick='this.style.color="red"'>DO NOT CLICK ME</b> You don't even need a server; you can put that into the address bar of your browser as data:text/html,<b onclick='this.style.color="red"'>DO NOT CLICK ME</b>. LÖVE2D comes with a bunch of simple examples, like https://github.com/love2d-community/LOVE-Example-Browser/blob/master/examples/001_loading_image.lua https://github.com/love2d-community/LOVE-Example-Browser/blo...: -- Example: Loading an Image and displaying it --[[Description: Load an image using love.graphics.newImage(image_path) Draw it using love.graphics.draw ]] function love.load() image = love.graphics.newImage("assets/love-ball.png") end function love.draw() love.graphics.draw(image, 400, 300) end LÖVE is programmable in Lua, like Minetest and WoW, and it gives you rotatable, alpha-composited 2-D sprites with collision detection and particle systems. But Proce55ing is the paragon of this stuff. http://sketchpad.cc/ http://sketchpad.cc/, which uses processing.js, starts you off with this: // Pressing Control-R will render this sketch. int i = 0; void setup() { // this is run once. // set the background color background(255); // canvas size (Integers only, please.) size(300, 300); // smooth edges smooth(); // limit the number of frames per second frameRate(30); // set the width of the line. strokeWeight(12); } void draw() { // this is run repeatedly. // set the color stroke(random(50), random(255), random(255), 100); // draw the line line(i, 0, random(0, width), height); // move over a pixel if (i < width) { i++; } else { i = 0; } } That just fucking blows away anything I ever created in years of messing with GW-BASIC. And sketchpad.cc lets you edit your code in real time with someone else, and also save a link to the sketch you've made so that anyone else can see it. Still, I translated it to Python for my talk about this stuff at PyCon Ar (https://github.com/kragen/pyconar-talk/blob/master/hello1.py https://github.com/kragen/pyconar-talk/blob/master/hello1.py): #!/usr/bin/python from pygame import * from random import randrange pantalla = display.set_mode((0, 0), FULLSCREEN) ww, hh = pantalla.get_size() color = Color(64, 64, 192) for xx in range(0, ww, 5): h, s, v, a = color.hsva color.hsva = xx * 270 / ww, s, v, a # cambiar hue draw.line(pantalla, # surface color, (xx, 20), # punto de inicio (randrange(ww), hh - 20), # punto de terminar 10) # ancho de rayo display.flip() # para mostrar Maybe the biggest environment for this kind of thing nowadays is Roblox, which has a couple of million people writing games in Lua in a 3-D world. It's not free software, but neither was GW-BASIC at the time. Eat me, GW-BASIC.