Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Aug 13 2016 03:24
    @PeterWAWood banned @Vexercizer
zxq2233
@zxq2233
I am trying to make a simple notepad using red-lang.
Can I use the Windows Explorer window to open the file and get the path? Does the GUI control do it all?win-common-dlg-image2.png
Gregg Irwin
@greggirwin
Request-file is the function you want.
Use ? request-file to see details, and play in the console with it, to see how the refinements work. You can also do ? request to see the other requestors that are available.
zxq2233
@zxq2233
@greggirwin Thank you!
Rudolf Meijer
@meijeru
Here is an interesting example of Red's code = data property: with five LOC I add a new item to the console's menu
; get console face
cons: first head system/view/screens/1/pane

; add to console menu
append last cons/menu ["Check for updates" check-update]

; modify the body of the on-menu actor function
body: body-of :cons/actors/on-menu
insert third body [check-update [do %check-update.red]]

; rebuild the function from the spec and the modified body
cons/actors/on-menu: func spec-of :cons/actors/on-menu body
Toomas Vooglaid
@toomasv
@meijeru Beautiful! :+1:
Petr Krenzelok
@pekr
Really cool!
Gregg Irwin
@greggirwin
Very cool indeed.
Can you post the code for %check-updates.red as well?
Gregg Irwin
@greggirwin
Ah, I see your gist in the other room now. Thanks!
Jose Luis
@planetsizecpu
@meijeru Wow, useful!
Galen Ivanov
@GalenIvanov
Something I'm currently working on: Hamiltonian cycles generator
Galen Ivanov
@GalenIvanov
I need to improve the code, because the program crashes when I try bigger sizes. I don't know if this due to memory leak or recursion.
Hamilton_cycles.png
Boleslav Březovský
@rebolek
@GalenIvanov try recycle/off, it may be some GC bug.
Galen Ivanov
@GalenIvanov
@rebolek Thanks, I'll try it.
Gregg Irwin
@greggirwin
@GalenIvanov cool. Thanks for posting.
Galen Ivanov
@GalenIvanov
@greggirwin Thank you! It's just a WIP, I'll post the source of the finished projects on Github - I have ideas for 2 games based on this.
Galen Ivanov
@GalenIvanov
@rebolek A quick update: I decided to see if the program crashes when compiled. Surprisingly it doesn't crash. In the console it starts crashing with inputs around 16x16; the compiled one successfully generated a hamiltonian cycle on a grid of 40x40 points.
Boleslav Březovský
@rebolek
@GalenIvanov interesting, I'll check how my crashing stuff behaves when compiled because there's certainly some GC error in the interpreter.
Galen Ivanov
@GalenIvanov
@rebolek OK, thanks! I'll post my source when I'm ready - I don't rule out the possibility of more mistakes from my side.
By the way, success with 70x70 (it took maybe 15 minutes, but proves that my concept works) - I'll need much smaller grids, but was annoyed by the crashes.
Boleslav Březovský
@rebolek
@GalenIvanov crash is definitely not your problem. You should get an error, if your code is wrong, but not a crash.
Galen Ivanov
@GalenIvanov
@rebolek Yes, exactly!
Boleslav Březovský
@rebolek
definitely NOT...sorry for the typo :)
Galen Ivanov
@GalenIvanov
:)
Semseddin Moldibi
@endo64
@GalenIvanov "In the console it starts crashing with inputs around 16x16" is it on GUI console or both GUI and CLI?
Vladimir Vasilyev
@9214
@qtxie :point_up: I can't recall if garbage collection for image!s was implemented?
Qingtian
@qtxie
@9214 Not yet.
Vladimir Vasilyev
@9214
I generated FASS curves and L-system trees of quite a monstrous size back in the day, and haven't seen any crashes, only errors due to pair! overflow, which were expected.
Galen Ivanov
@GalenIvanov
@endo64 I only tested it on the GUI console
Vladimir Vasilyev
@9214
GUI / CLI difference has no bearing here, it's interpreter issue. @GalenIvanov you ought to provide at least some error or debug message, if you want it to be resolved. "It crashes" isn't terribly useful.
Galen Ivanov
@GalenIvanov
@9214 I'm aware that it could be entirely my fault. I just realized the big difference between the code inerpreted in the GUI console and the compiled code. Unfortunately I didn't receive any error message. I tried to naively debug the code with printing/probing some values, but when the program crashed in the console, I never got any error message. I'll post a link to my code tomorrow. Thank you all for your feedback.
@9214 BTW, here is my take on L-systems. I also didn't get any crashes.
Vladimir Vasilyev
@9214
@GalenIvanov it 's our fault that Red crashes, not yours :wink: Try to compile console in debug mode (-d flag) and launch it from command line, then paste here stack trace that you'll see after crash.
Galen Ivanov
@GalenIvanov
@9214 Thank you for your support. In the meantime I updated Red to the automated build - red-25sep19-f753e25c.exe - and there is no problem anymore, not a single crash. Sorry for wasting your time and not trying the most obvious thing. The version I have been using until now was really old - built on 22 Nov 2018.
Gregg Irwin
@greggirwin
:+1:
Gregg Irwin
@greggirwin
Does anyone remember why drop-list doesn't have a readable text facet? i.e., it's not set on selection.
Galen Ivanov
@GalenIvanov
Island_allleys_8x8.jpg
I almost finished the game for which I was coding my generator of Hamiltonian paths. I present you the "Island Alleys"
It is a logic puzzle in the vein of Slitherlink.
You need to connect the dots by clicking (not dragging) between them and form a closed loop that goes through all the dots on the grid. The numbers are placed only where two or more "alleys" meet at a right angle and indicate the total distance to the shore in all directions.
Galen Ivanov
@GalenIvanov
I'll add a thorough step by step example solve later.
Enjoy!
Semseddin Moldibi
@endo64
@GalenIvanov Very nice! You could also add a textbox so the user can select a specific game (value for random/seed).
Galen Ivanov
@GalenIvanov
@endo64 Thank you! Yes, that would be a good feature and it's easy to implement. I also need to make the "About" window modal; some of the contents of the canvas/draw block don't need to be computed at each click but only when needed.
One thing I observed (I'm not 100% sure though, I'll check tonight at home) is that style doesn't work correctly for the size of the button - the y part of the pair is not taken into consideration in Win 8.1. Here, on my Win 10 at work it's working correctly.
Toomas Vooglaid
@toomasv
@GalenIvanov Very nice game! :+1:
Toomas Vooglaid
@toomasv
@GalenIvanov When you add grid size to the title, I think you should copy the text first, otherwise several grid sizes are added if player reloads new game in desperation (as I did).
Toomas Vooglaid
@toomasv
image.png