Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 31
» Latest member: nartex
» Forum threads: 110
» Forum posts: 847

Full Statistics

Online Users
There are currently 32 online users.
» 0 Member(s) | 30 Guest(s)
Bing, Facebook

Latest Threads
Happy Birthday
Forum: Everything else
Last Post: aliensoldier
2 hours ago
» Replies: 4
» Views: 24
That 3d thing
Forum: NaaLaa 7 Code
Last Post: aliensoldier
3 hours ago
» Replies: 16
» Views: 1,418
"A Game Jam is Coming Up"
Forum: Programming
Last Post: johnno56
Yesterday, 08:01 AM
» Replies: 1
» Views: 22
Enchanted Forest
Forum: NaaLaa 7 Code
Last Post: 1micha.elok
05-16-2024, 02:16 PM
» Replies: 8
» Views: 252
Scrolling
Forum: NaaLaa 7 Questions
Last Post: johnno56
05-15-2024, 06:25 PM
» Replies: 3
» Views: 101
Devil's Triangle (The Gam...
Forum: NaaLaa 7 Code
Last Post: 1micha.elok
05-15-2024, 10:51 AM
» Replies: 1
» Views: 137
S3D : the devil's triangl...
Forum: NaaLaa 7 Questions
Last Post: 1micha.elok
05-08-2024, 07:26 AM
» Replies: 9
» Views: 552
Just for the Star Wars fa...
Forum: Everything else
Last Post: johnno56
05-05-2024, 10:40 PM
» Replies: 7
» Views: 405
Convex hull, quick algori...
Forum: NaaLaa 7 Code
Last Post: johnno56
05-04-2024, 07:23 PM
» Replies: 7
» Views: 492
Wolf3D
Forum: NaaLaa 7 Questions
Last Post: johnno56
05-02-2024, 07:57 PM
» Replies: 24
» Views: 2,132

 
  Calculating 10000 digits of Pi
Posted by: Tomaaz - 02-07-2024, 06:07 PM - Forum: NaaLaa 7 Code - Replies (3)

OK. I know this is not the kind of program NaaLaa has been created for, but I use it to test the speed of any language I try. Well, NaaLaa is doing a pretty good job here and runing this example as fast as other fast interpreters. Smile 

Code:
n = 35001
a = 10000
d = 0
k = 0
g = 0
l = 0
f = []

for x = 0 to n
    f[x] = 2000
next

for c = n to 14 step -14
        d = 0
        for b = c to 1 step -1
            d = d * b
            g = b * 2 - 1
            d = d + f[b] * a
            f[b] = d % g
            d = floor(d / g)
            k = l + floor(d / a)
        next
        k2 = right("0000" + k, 4)
        write k
        l = d % a
next

EDIT: On my machine it takes about 1 min. to complete the task and this is the speed I'm expecting from an interpreted language. Python is slightly faster, while Perl being 25% faster than Python. Tcl is 10+ times slower than NaaLaa. It's worth to remember that NaaLaa runs through Wine, while Python, Perl and Tcl run natively.

Print this item

  Draw pixel and alpha channel
Posted by: Tomaaz - 02-07-2024, 05:50 PM - Forum: NaaLaa 7 Questions - Replies (13)

Here is the Bubble Universe example. It seems that alpha element doesn't affect drawing single pixels:

Code:
set window "Bubble Universe", 512, 512
r = 6.283185307179586 / 235
mw = 512
mh = 512
hw = mw / 2
hh = mh / 2
x = 0
v = 0
u = 0
t = 0
k = rnd(190) + 64
set redraw 0
while 1
    set color 0, 0, 0, 255
    draw rect 0, 0, 512, 512, 1
    for i = 0 to 255
        for j= 0 to 255
            u = sin(i + v) + sin(r * i + x)
            v = cos(i + v) + cos(r * i + x)
            x = u + t
            set color i, j, 255 - i, k
            draw pixel int(hw + u * hw * 0.4), int(hh + v * hh * 0.4)
        next
    next
    redraw
    t = t + 0.01
    k = rnd(190) + 64
wend
 
Is this a bug? I've tried draw pixel, set pixel and even both.

Print this item

  Does "everything else" include other programming languages?
Posted by: Tomaaz - 02-07-2024, 03:45 PM - Forum: Everything else - Replies (1)

Recently, I have been banned from a forum and my nickname has been added to censored words, so other users can't even mention my name. So, is it OK to talk here about other languages, projects etc.?

Sorry, I must have had a temporary brain malfunction. Big Grin There is already a section for discussing other languages and programming in general.

Print this item

  No luck with Wine
Posted by: Tomaaz - 02-05-2024, 09:22 AM - Forum: NaaLaa 7 Questions - Replies (9)

So, I've tried to run NaaLaa 7 on Linux, but didn't  have much success. NED runs, but the text is overlapping. That wouldn't be a big problem (as I use Geany with everything), but more complex examples fail to compile an run due to some .dlls missing. I'm aware that NaaLaa is Windows only and the problems have more to do with Wine than NaaLaa itself, but I wonder why much more complex applications run under Wine and NaaLaa doesn't.

Print this item

  Warm Day
Posted by: johnno56 - 02-04-2024, 06:04 PM - Forum: Everything else - Replies (15)

Well, it has taken until 4th of February, for us to get what I call a warm Melbourne summer's day... A very nice 38C... at last... It is rare that we get hot days, 45C+, but it does happen... How warm does it get for other Forum members?

(Well, the forum IS listed as "Everything Else"... I suppose the weather would be included in that category... Moo Ha Ha Ha)

Print this item

  String Command
Posted by: johnno56 - 02-02-2024, 09:40 PM - Forum: NaaLaa 7 Code - Replies (7)

Does N7/6 have the ability or command to perform Basic's string(var, text$) command?

J

In the meantime... I can use something like...

function String(var, txt)
    tmp = ""
    for z = 1 to var
        tmp = tmp + txt
    next
    return tmp
endfunc

Print this item

  PROLAN
Posted by: aurel - 02-02-2024, 04:32 PM - Forum: Programming - Replies (11)

Hi Marcus

I am glad that you have forum back. Smile

Print this item

  my second game, naalaa invader
Posted by: aliensoldier - 02-01-2024, 07:51 PM - Forum: NaaLaa 7 Code - Replies (15)

The game starts on the title screen by pressing the return key to start, the "p" key to pause, the arrow keys to move the ship and the "z" key to shoot. You have to shoot the central square of the enemies to destroy them.

This comment is for Marcus, the game has an error that I have not been able to solve because I don't know what the error is, I have left you a screenshot with the error.
The game sometimes works well and other times the error occurs, it usually happens more times when you beat the game and start a second game again, although it can also happen in the first game and there are times when it doesn't happen and you can beat the game without let nothing happen.



Attached Files
.zip   invader-1.1.zip (Size: 486.67 KB / Downloads: 4)
Print this item

  The json library
Posted by: Marcus - 02-01-2024, 04:40 PM - Forum: NaaLaa 7 Code - Replies (1)

I don't remember if I ever posted something about the json library in the old forum - the one that crashed. But it's very easy to use and can be used for saving and loading most n7 tables. You can read more about the file format here: https://en.wikipedia.org/wiki/JSON

Code:
' json_example.n7
' ---------------
' Using the json library you can turn "any" table into a json string. You can save this string to
' file and load it again to get an exact replica of the original table. So it's a very handy library
' and file format.

include "json.n7"

' Let's say you want to save the player's progress in a game.
data = []
data.lastSaved = time()
data.score = 1349
data.name = "Marcus"
data.level = 5
data.levelScores = [1439, 5131, 1486, 394]
data.position = [x: 10, y: 15]

' Create a file for saving.
f = createfile("savedata.json")
if file(f)
    ' Use JSON_ToString to create a json string and write it to the file.
    write file f, JSON_ToString(data)
    free file f
   
    ' Use JSON_FromFile (there's also JSON_FromString) to load the data into a variable.
    data = JSON_FromFile("savedata.json")
    ' Print out the information loaded from file.
    t = datetime(data.lastSaved)
    pln "lastSaved      = " + t.year + "-" + str(t.month, 2) + "-" + str(t.day, 2) +
            " " + str(t.hour, 2) + ":" + str(t.minute, 2) + ":" + str(t.second)
    pln "score          = " + data.score
    pln "name           = " + data.name
    pln "level          = " + data.level
    pln "levelScores[2] = " + data.levelScores[2]
    pln "position       = " + data.position.x + ", " + data.position.y
else
    pln "Couldn't create file!"
endif

system "pause"

Edit I wrote "most tables". You can assign functions to variabels in an n7 table, and json doesn't support that ofcourse.



Attached Files
.n7   json_example.n7 (Size: 1.39 KB / Downloads: 4)
Print this item

  primitive graphics without padding with more thickness
Posted by: aliensoldier - 01-27-2024, 08:40 PM - Forum: Suggestions - No Replies

While I was doing the pong I tried to create the graphics without filling and I like how it looked but the outline was too thin.

The suggestion is that a new parameter be added to the primitive graphics functions to increase the thickness of the contour, and some new functions to create other types of primitive graphics would not be bad either.

Print this item