<JordanBrown[m]>
On a different subject... I have a build that implements most of the object/geometry-as-data/module-reference stuff that we've discussed - in fact, it implements two different variations. What would be the best way to work through the open issues around which variation to use? The biggest *difficult* issue is how you can take a geometry-as-data value and bring it into the model. The obvious answer, that in statement context an
<JordanBrown[m]>
expression that evaluates to a geometry value is added to the model, has a lot of syntactic trouble.
galaxy_knuckles is now known as escobear
snaked has quit [Ping timeout: 260 seconds]
epony has joined #openscad
ur5us has joined #openscad
Guest48 has joined #openscad
<Guest48>
Hi Everyone. Is this the right place to post for help on how to achieve things in OpenSCAD? I've read the tutorials and am trying to transition from FreeCAD to OpenSCAD, but can't see how I might generate some complex shapes.
<teepee>
Guest48: yep, ask away :)
<teepee>
JordanBrown[m]: I guess a PR would be easiest to comment on, but if you don't feel like creating one, a branch in your repo should work fine too
<JordanBrown[m]>
My immediate reaction is that a PR is for when I think it's almost ready to merge, but indeed that might be the best place for a discussion.
<teepee>
you can matk as Draft to make it clear it's not considered ready
<Guest48>
How would you go about creating a cylinder with a fillet on the end. The end would still need to be flat and the fillet should be tangential to both the barrel of the cylinder and the end. In FreeCAD I could either create the cylinder and use the Fillet tool on the edge, or create a sketch of a rectangle except with one corner rounded and then
<Guest48>
revolve that around the axis. Can't quite see how to do it in OpenSCAD.
<JordanBrown[m]>
Creating a rectangle with a rounded corner and feeding it rotate_extrude() would work.
<JordanBrown[m]>
that it, feeding it *to* rotate_extrude
<JordanBrown[m]>
(Boy, typo city today, sigh.)
<teepee>
yep, that, or use a library like BOSL2 which has tons of such primitives
<JordanBrown[m]>
BOSL2 does indeed have tons of cool stuff like that. Here's one from first principles: https://bpa.st/T65Q
<Guest48>
Ahh, thanks. I've got some more learning to do now. Much appreciated.
<JordanBrown[m]>
It's a very powerful way of thinking about design, but it does take some getting used to.
<JordanBrown[m]>
Fillets are particularly hard, because in general they are a non-obvious combination of two shapes.
<JordanBrown[m]>
I believe there are some mathematically correct general solutions based on Minkowski sums, but Minkowski sums are *very* slow.
<JordanBrown[m]>
But for that particular case, working from first principles, you're probably working with a rotate_extrude of a square with a circle cut away from it.
Guest48 has quit [Ping timeout: 260 seconds]
fling has quit [Write error: Connection reset by peer]
aiyion has quit [Write error: Connection reset by peer]
aiyion has joined #openscad
fling has joined #openscad
teepee has quit [Ping timeout: 255 seconds]
califax has quit [Remote host closed the connection]
califax has joined #openscad
TheAssassin has quit [Ping timeout: 255 seconds]
TheCoffeMaker has joined #openscad
TheAssassin has joined #openscad
<linext>
is it possible to access a 2D array using two numbers?
<linext>
i wrote it entirely in the web-based monaco editor
<linext>
press reload to start a new game
ur5us has joined #openscad
snaked has quit [Ping timeout: 268 seconds]
califax has quit [Ping timeout: 255 seconds]
<linext>
make sure to turn off "Rotate Model" and turn on "Lock Camera/Position" in Viewer Settings
GNUmoon has quit [Ping timeout: 255 seconds]
califax has joined #openscad
GNUmoon has joined #openscad
snaked has joined #openscad
teepee has joined #openscad
teepee has quit [Ping timeout: 255 seconds]
<InPhase>
linext: Wait. You didn't implement the AI for the second player.
GNUmoon has quit [Remote host closed the connection]
<Friithian>
it's hard to have an AI with tic-tac-toe, bit too solved for that
GNUmoon has joined #openscad
<InPhase>
Friithian: That is the only thing that would make it even possible in OpenSCAD, because we have no retained state. ;)
<InPhase>
When you make your second move, it will have no memory of making its first move.
teepee has joined #openscad
<JordanBrown[m]>
Hmm. You could use the customizer and the human for state.
<JordanBrown[m]>
Customizer has 9 variables, each set to "empty", "X", or "O".
<JordanBrown[m]>
F5, program tells you where it wants to move.
<JordanBrown[m]>
You flip that variable in the customizer, flip your variable in the customizer, and F5.
<JordanBrown[m]>
Auto refresh could look at how many Xs and how many Os there are, and know whether to prompt you to move or tell you what its move is.
<Friithian>
I think it possible with no retained state, you just have… a lot of models
ur5us has quit [Ping timeout: 260 seconds]
<JordanBrown[m]>
Here... I threw together a Nim / Battle of Numbers game. Follow the instructions in the console.
<JordanBrown[m]>
With auto preview turned on.
califax has quit [Remote host closed the connection]
califax has joined #openscad
<JordanBrown[m]>
Playing against it is a little weird, but it knows how to play and will win if it can.
<JordanBrown[m]>
Just pretend you are playing against somebody with no hands, so you have to make their move for them.
<JordanBrown[m]>
Oh, I suppose it would be good if I gave the link, eh?
<JordanBrown[m]>
Without reading it in detail, I think it considers a move and plays out all possible games that follow from that move.
<InPhase>
Our requirement is different if you don't have state. Given a set of x positions, generate all the o positions from the past moves before we got there plus the new one.
<JordanBrown[m]>
Hmm. Can you really do that?
<JordanBrown[m]>
Order matters.
<JordanBrown[m]>
I think.
<InPhase>
I think it might not, but I didn't get far enough to prove it.
<JordanBrown[m]>
But you could have the input be a list of the five player moves.
<InPhase>
There are some additional unintuitive constraints based on the fact that the x moves can't be on top of past o moves. (We assume the player isn't cheating.)
<JordanBrown[m]>
The player can cheat by changing history :-)
<InPhase>
Yes, and then they deserve an inconsistent history. ;)
<JordanBrown[m]>
It lets you play first. Set one of the board squares to 1, and tab. (Or F5 if no auto preview.)
<JordanBrown[m]>
First time it seems to take a long time thinking, ~45s on my system.
<JordanBrown[m]>
Maybe not that long. That was when I was having it move first.
<JordanBrown[m]>
But I think it caches across games; it doesn't seem to really "think" most of the time.
<JordanBrown[m]>
Oh, no, my error. It wasn't printing diag output, but it seems that either I deleted the diag output or I accidentally undid it when I killed it when it was running too long.
<JordanBrown[m]>
it's just way, way faster when you make the first move. Because, I think, at that point there are 9x fewer games to consider.
<JordanBrown[m]>
Slightly improved. Now lets you decide who should go first.
<JordanBrown[m]>
One thing that's interesting is that it assumes that the human plays optimally, and that assumption sometimes makes it play sub-optimally.
<JordanBrown[m]>
You can cheat: you don't have to put its move where it tells you to. It will then pick the best play from that point.
<JordanBrown[m]>
One improvement would be, for no-win cases, to pick the move that puts the loss off the longest, in the hope that the human will make a mistake before then.
<JordanBrown[m]>
I think that could be done by increasing the score for each move until the result. That is, a loss in one move would get a score of -10, a loss in two moves would get a score of -9, et cetera. But I don't feel like figuring out the details right now.
califax has quit [Remote host closed the connection]
califax has joined #openscad
<InPhase>
How do I make the computer go?
<JordanBrown[m]>
You have the customizer up?
<JordanBrown[m]>
You have it set to automatic preview?
<InPhase>
Yeah, I set my x.
<InPhase>
Moved one grid to 1 and got an x.
<JordanBrown[m]>
Console should say "who should go first?"
<InPhase>
I set that to human.
<InPhase>
But there is no O.
<InPhase>
Only my X in the middle.
<InPhase>
Oh, I fill in from the echo?
<InPhase>
That was scrolled off window.
<JordanBrown[m]>
Console should say (after a few seconds) "I move to XXX"
<JordanBrown[m]>
You have to make its move for it.
<InPhase>
Yep. This functions as a game. :)
<InPhase>
Only mildly tedious to enter the computer's moves. It's functional.
<JordanBrown[m]>
Like I said, surprisingly playable.
<JordanBrown[m]>
Use the arrow buttons to make the moves; then you don't have to do anything to make it notice them.
<JordanBrown[m]>
Put it in the pile of "unexpected things you can write in OpenSCAD" :-)
<JordanBrown[m]>
I was thinking about writing chess or checkers.
<JordanBrown[m]>
Probably not trying to write anything like a real AI, but at least have it make legal moves.
<InPhase>
It clearly plays optimally, and for a nice touch randomizes between equivalent outcome moves.
<InPhase>
I was able to win only by mis-entering one of its moves.
<JordanBrown[m]>
Yes, if you read my monologue from last night you will see that I added that feature. I got bored with it always playing the same.
<JordanBrown[m]>
Right.
<JordanBrown[m]>
Which can yield a kind of interesting behavior that I mentioned last night: if it's going to lose, sometimes it won't block an obvious player win.
<InPhase>
Ah, missed that section of chat.
<InPhase>
You could weight delayed losses as better, increasing the chance of a mistake.
<InPhase>
It can weight delayed wins as equivalent, assuming it won't make mistakes.
<JordanBrown[m]>
Yes. (See this morning's monologue :-)
<InPhase>
Okay, Mr. I Thought of Everything. ;)
<JordanBrown[m]>
:-)
<JordanBrown[m]>
There was nobody to talk to, so I had to think of everything first :-)
<InPhase>
The sufferings of life.
<InPhase>
linext: You should take a look at JordanBrown[m]'s update when you get back: https://bpa.st/RVHA
<InPhase>
JordanBrown[m]: Now... Computer vs computer with $t timesteps?
<JordanBrown[m]>
:-)
<InPhase>
JordanBrown[m]: Since you have randomness, we should get a diverse set of draws, right?
<InPhase>
Perhaps hard-code the first move to choose one at random, to speed it up, since clearly it will choose from any of 9 squares.
<JordanBrown[m]>
Hmm. True. But maybe not right if you weigh by when the win/loss happens. And of course if you want to take advantage of mistakes you don't take a side space.
<InPhase>
Well, only take advantage of delays if a loss scenario can be forced.
<InPhase>
Oh, and maybe... Always reduce the number of ways the opponent can win.
<InPhase>
So if it's setup into a fork, it should always close one fork.
<InPhase>
One of the forked paths.
<JordanBrown[m]>
Uh huh. I spent enough time on this last night and this morning. Your turn to have some fun :-)
<JordanBrown[m]>
My new cabinetry got installed yesterday so I need to get serious about designing tool holders for my new tool drawer.
<InPhase>
Have fun. :)
<InPhase>
I also have a list of other things I'm looking to do today.
<linext>
i see
<linext>
the reason why I created the example was to show how real-time rendering of parameters works on 3dcustomizer.net
<linext>
it is possible to have a computer player, and randomly decided who goes first with my example
<linext>
i just didn't want to dig into it that much
linext has quit [Read error: Connection reset by peer]
linext has joined #openscad
califax has quit [Remote host closed the connection]
<linext>
time for me to clone and improve some customizers on thingiverse
<JordanBrown[m]>
Caution for copyright issues.
<linext>
not copy the code, but the ideas
<linext>
i think i'll add a feature where if the font is in google web fonts and is shareable, my app will auto-download it
califax has joined #openscad
Junxter has joined #openscad
snaked has quit [Ping timeout: 256 seconds]
<teepee>
hmm, we did not have a mandelbrot script yet? that needs to be fixed I guess https://imgur.com/a/Lx9Rz3D
<teepee>
J1A8446: what's that color scheme you use? DeepOcean?
<J1A8446>
öh öh
<J1A8446>
jupp
<teepee>
cool, I guess it will look better overall if the backgrounds are mostly same
<J1A8446>
mandelbrot .. could use the blockheight as result (color) and have it 3D
<J1A8446>
oh you already did
<J1A8446>
nice Ü
<teepee>
yep :)
othx has quit [Ping timeout: 256 seconds]
othx has joined #openscad
<teepee>
strange github does not like the track.png but it does show in the calendar
ur5us has joined #openscad
<linext>
i'm noticing a weird bug
milza has quit [Quit: milza]
<linext>
trying to make the font word pen, but not using the 8-bit mcad font