Go to advanced search

by jalih
Sun Oct 18, 2020 7:22 pm
Forum: Other projects
Topic: A Birthday Present for Fido
Replies: 215
Views: 6346

Re: A Birthday Present for Fido

It occured to me, that it might be more useful to build a list of neighbor nodes for every node: needs map/iter ns: maze a:new constant nodes : get-remove-rotate \ a -- a:shift a:shift swap a:shift a:push drop ; nodes ' get-remove-rotate curry: node : generate-edges \ --- a \ generate shuffled node ...
by jalih
Sun Oct 18, 2020 2:58 pm
Forum: Other projects
Topic: A Birthday Present for Fido
Replies: 215
Views: 6346

Re: A Birthday Present for Fido

Here is my "final" refactored version written in 8th for generating random edges between room nodes for Hunt the Wumpus game: ns: maze a:new constant nodes : get-remove-rotate \ a -- a:shift a:shift swap a:shift a:push drop ; nodes ' get-remove-rotate curry: node : generate-edges \ --- a \ generate ...
by jalih
Sat Oct 17, 2020 4:53 pm
Forum: Other projects
Topic: A Birthday Present for Fido
Replies: 215
Views: 6346

Re: A Birthday Present for Fido

I'm not sure I get your meaning there. Thing is in the current arrangement the node array shrinks as nodes get their 3rd connection and removed from consideration. So the information as to who is a nodes neighbor gets lost. If we just need to support some fixed number of nodes, we can shuffle the n...
by jalih
Sat Oct 17, 2020 10:47 am
Forum: Other projects
Topic: A Birthday Present for Fido
Replies: 215
Views: 6346

Re: A Birthday Present for Fido

Detecting neighbors in step 2 is not so simple, as it removes nodes from the list the information required is thrown away. See my post above. As node array is shuffled before step 1, how about just swapping node array contents, so there are no adjacent neighbor nodes after step 1. In step 2, just p...
by jalih
Sat Oct 17, 2020 7:37 am
Forum: Other projects
Topic: A Birthday Present for Fido
Replies: 215
Views: 6346

Re: A Birthday Present for Fido

To be clear then the issue is that my code will generate "A -- B" and "B -- A" on occasion. I noticed it with this 8th test code: : generate-edges \ n --- a ' noop 0 rot n:1- a:generate a:shuffle a:new swap ( swap over a:@ swap rot n:1+ over a:len nip n:mod a:@ rot swap 2 a:close 2 pick swap a:push...
by jalih
Fri Oct 16, 2020 9:13 pm
Forum: Other projects
Topic: A Birthday Present for Fido
Replies: 215
Views: 6346

Re: A Birthday Present for Fido

Now, this scheme will prevent connections being created that connect a node to itself, A -> A, but it will produce two way connections between neighbors, A -> B and B -> A. Is that allowed in wumpus? Other than TempleOS and Donald Knuth's literate programming system, do you know of a development en...
by jalih
Wed Oct 14, 2020 6:33 am
Forum: Other projects
Topic: A Birthday Present for Fido
Replies: 215
Views: 6346

Re: A Birthday Present for Fido

Heater wrote:
Tue Oct 13, 2020 8:39 pm
"entry" is not a keyword or reserved word in C.
It was a reserved word, but was dropped later on... Not suprising since, Ritchie worked on Multics operating system early on.

Old C reference manual.
by jalih
Tue Oct 13, 2020 8:18 pm
Forum: Other projects
Topic: A Birthday Present for Fido
Replies: 215
Views: 6346

Re: A Birthday Present for Fido

[*] Pascal's nested function definitions seem to be called closures by other students and the pseudo-intellectual elite. A closure and a nested function are very different things. A closure/lambda captures variables outside of itself but within it's scope. A function does not. Sounds like a broken ...
by jalih
Thu Sep 03, 2020 7:27 pm
Forum: General programming discussion
Topic: Tatami Pi Fun.
Replies: 321
Views: 32594

Re: Tatami Pi Fun.

Coincidentally someone made a memoization library for Rust that works just like the on in that Python video: https://crates.io/crates/cached It also shows that using something other than naive recursive Fibonacci function makes a lot bigger difference... Iterative or tail recursive version without ...
by jalih
Wed Jul 22, 2020 6:48 pm
Forum: General programming discussion
Topic: ADVICE: Create GUIs in Raspberry PI
Replies: 19
Views: 1208

Re: ADVICE: Create GUIs in Raspberry PI

I'll leave it to the powers that be to judge how critical this is. And when was the last time you saw open source code for hospital equipment? It's a frightening situation isn't it? Not really... Open source does not magically make software better! I will happily pay for a good software and support...
by jalih
Fri Jul 17, 2020 7:05 pm
Forum: Other programming languages
Topic: Anyone else using .NET Core 3.1 and ASP.NET Core?
Replies: 18
Views: 1567

Re: Anyone else using .NET Core 3.1 and ASP.NET Core?

Anyway, if the little recursive fibo is unconvincing I invite you to contribute a solution in C# of the "Million Digit Fibonacci Number Challenge". https://github.com/ZiCog/fibo_4784969. C# is currently a language missing from the contenders there, I would be quite happy to add your solution. Edit:...
by jalih
Mon Jun 01, 2020 1:25 pm
Forum: Java
Topic: initializing multi dim array R PI
Replies: 4
Views: 4440

Re: initializing multi dim array R PI

The question is about Java radapa. Besides your example is not even a 2d array as far as I am concerned. It's a 1D array of pointers to other 1D arrays. Rather than being a 2d array in contiguous memory. If you declare you array correctly you can allocate it in one go like so: array = int (*)[COLS]...
by jalih
Tue May 19, 2020 4:44 pm
Forum: C/C++
Topic: C API - terminating strings for MySQL
Replies: 33
Views: 1627

Re: C API

unsigned char pass[8] = { 'c' , 'x' , 'x' , 'x' , 'x' , 'x' , '0' , '7' }; unsigned char pass[9] = { 'c' , 'x' , 'x' , 'x' , 'x' , 'x' , '0' , '7' }; The string length of the password is 8. I defined the array to 8 and I got an error. When I was changed array to 9 , the program successfully connect...
by jalih
Thu May 14, 2020 2:40 pm
Forum: Other programming languages
Topic: javascript
Replies: 22
Views: 1729

Re: javascript

Javascript (and C) -12 % 5 returns -2 1 % -2 returns 1 BBC BASIC too: -12 MOD 5 returns -2 1 MOD -2 returns 1 Looks like Python is a bit of an outlier here, which is surprising. 8th: -12 mod 5 returns 3 1 MOD -2 returns 1 12 constant DOZEN : read-int \ -- n f:stdin f:getline nip >n 0 ?: ; : app:mai...
by jalih
Thu May 07, 2020 9:04 am
Forum: Off topic discussion
Topic: 60 years ago...
Replies: 48
Views: 4523

Re: 60 years ago...

COBOL does pounds & pence or dollars & cents (rounded to two decimals) really easily When I moved from COBOL to other languages I was flabbergasted to find that in pretty much all others you needed quite significant amounts of code (or special libraries such as Math::Fixpoint in Perl) just to add u...
by jalih
Thu May 07, 2020 8:58 am
Forum: Off topic discussion
Topic: 60 years ago...
Replies: 48
Views: 4523

Re: 60 years ago...

Here are comparative notes of Algol 68 and PL/I.

I still think old optimizing PL/I compiler from IBM is a thing of beauty! No reserved words, good diagnostic... It's a very complex beast!
by jalih
Thu May 07, 2020 6:39 am
Forum: Off topic discussion
Topic: 60 years ago...
Replies: 48
Views: 4523

Re: 60 years ago...

jahboater wrote:
Wed May 06, 2020 3:23 pm
DougieLawson wrote:
Wed May 06, 2020 1:05 pm
The other "interesting" ancient old language is Programming Language/I (PL/I) and that brings a whole raft of similar problems with it.
PL/1 was another of the really powerful and capable languages like Algol 68 and Ada.
It still is powerful and compilers receive updates!
by jalih
Tue Mar 24, 2020 7:19 am
Forum: Java
Topic: Ray-cast 3D Game Engine
Replies: 20
Views: 1865

Re: Ray-cast 3D Game Engine

And I've figured out why the game (Textures) doesn't work. Exception in thread "main" java.lang.ExceptionInInitializerError at Game.<init>(Game.java:44) at Game.main(Game.java:102) Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 4096 out of bounds for length 4096 at java.desktop/java.awt...
by jalih
Mon Mar 23, 2020 3:54 pm
Forum: Java
Topic: Movement in a basic 3D java engine
Replies: 9
Views: 1114

Re: Movement in a basic 3D java engine

Like this? if(right) { double oldxDir=xDir; xDir=xDir*Math.cos(-90) - yDir*Math.sin(-90); yDir=oldxDir*Math.sin(-90) + yDir*Math.cos(-90); double oldxPlane = xPlane; xPlane=xPlane*Math.cos(-90) - yPlane*Math.sin(-90); yPlane=oldxPlane*Math.sin(-90) + yPlane*Math.cos(-90); if(map[(int)(xPos + xDir *...
by jalih
Mon Mar 23, 2020 11:54 am
Forum: Java
Topic: Movement in a basic 3D java engine
Replies: 9
Views: 1114

Re: Movement in a basic 3D java engine

Yeahboi wrote:
Mon Mar 23, 2020 4:57 am
Like this?
Java gives me headache, just combine turning and movement codes and try playing with it. I'm sure you will figure it out yourself!

Here is some 8th code for raycaster
by jalih
Mon Mar 23, 2020 4:55 am
Forum: Java
Topic: Movement in a basic 3D java engine
Replies: 9
Views: 1114

Re: Movement in a basic 3D java engine

If you think about it, you could just rotate by 90 degrees, move and then rotate back by 90 degrees. Wait, how do I do that? You have the code, you just have to combine all the pieces together: - First save old direction: xDir -> OldxDir yDir -> OldyDir - Calculate new direction rotated by 90 degre...
by jalih
Sun Mar 22, 2020 8:59 am
Forum: Java
Topic: Movement in a basic 3D java engine
Replies: 9
Views: 1114

Re: Movement in a basic 3D java engine

Yeahboi wrote:
Sun Mar 22, 2020 6:31 am
So, I've figured out how to move forwards and backwards, and how to turn left and right. But i cant figure out how to strafe left or right.
You are making it more complex than it have to be. If you think about it, you could just rotate by 90 degrees, move and then rotate back by 90 degrees.
by jalih
Sat Mar 21, 2020 3:46 pm
Forum: Java
Topic: Ray-cast 3D Game Engine
Replies: 20
Views: 1865

Re: Ray-cast 3D Game Engine

Seems like you are using old raycasting tutorial by Lode Vandevenne as a reference? This is not Doom like, but a lot simpler wolfenstein 3d style raycasting. Doom uses BSP-trees, this is a lot simpler... I have not programmed in Java but can give you one advice: DON'T DRAW WALLS PIXEL BY PIXEL! It's...
by jalih
Tue Mar 17, 2020 8:45 am
Forum: Python
Topic: Standalone Arduino serial Plotter equivalent on Raspberry Pi?
Replies: 139
Views: 9576

Re: Standalone Arduino serial Plotter equivalent on Raspberry Pi?

rin67630 wrote:
Tue Mar 17, 2020 7:25 am
jalih wrote:
Tue Mar 17, 2020 5:33 am
I think you are not really listening what I try to say:
You didn't listen to either.
Fair enough! ;)

By the way, I also think storing timestamp directly into log data is a good idea!
by jalih
Tue Mar 17, 2020 5:33 am
Forum: Python
Topic: Standalone Arduino serial Plotter equivalent on Raspberry Pi?
Replies: 139
Views: 9576

Re: Standalone Arduino serial Plotter equivalent on Raspberry Pi?

No, give us your python code. Your Python code is likely to be better and faster than my Python code! Instead of just saying that my idea would be faster I made an effort and tested it with programming language more natural for me. My intention was not to hurt anyone's feelings but to discuss about...

Go to advanced search