00:00:00 --- log: started forth/19.08.23 00:20:26 --- quit: ryke (Ping timeout: 248 seconds) 00:23:39 --- join: dys (~dys@2003:5b:203b:100:a64c:c8ff:fef4:13a6) joined #forth 00:37:47 --- quit: chunkypuffs (Quit: ZNC 1.7.1 - https://znc.in) 00:51:08 --- join: chunkypuffs (~chunkypuf@static.203.112.216.95.clients.your-server.de) joined #forth 00:55:23 --- quit: rdrop-exit (Quit: Lost terminal) 01:28:59 --- join: logiqub (5ca33649@amontsouris-651-1-184-73.w92-163.abo.wanadoo.fr) joined #forth 02:20:48 --- quit: tp (Remote host closed the connection) 02:33:08 --- quit: gravicappa (Ping timeout: 258 seconds) 02:33:24 --- quit: jedb (Ping timeout: 268 seconds) 03:25:59 --- join: jedb (~jedb@185.128.24.51) joined #forth 04:10:11 --- join: gravicappa (~gravicapp@h109-187-46-216.dyn.bashtel.ru) joined #forth 05:58:44 --- join: MrMobius (~default@c-73-134-82-217.hsd1.va.comcast.net) joined #forth 06:30:00 --- join: dddddd (~dddddd@unaffiliated/dddddd) joined #forth 06:37:55 --- join: um4r0t (~um4r0t@39.52.245.144) joined #forth 06:50:03 --- quit: um4r0t (Remote host closed the connection) 06:50:18 --- join: um4r0t (~um4r0t@39.52.245.144) joined #forth 06:56:17 --- quit: um4r0t (Remote host closed the connection) 06:56:35 --- join: um4r0t (~um4r0t@39.52.245.144) joined #forth 07:47:12 --- quit: dave0 (Quit: dave's not here) 07:47:41 --- quit: tabemann (Ping timeout: 276 seconds) 08:08:21 --- quit: um4r0t (Read error: Connection reset by peer) 08:12:57 --- quit: a3f (Ping timeout: 252 seconds) 08:20:17 --- join: a3f (~a3f@chimeria.ext.pengutronix.de) joined #forth 08:42:21 --- quit: dys (Ping timeout: 250 seconds) 10:03:20 --- join: wildtrees (~wildtrees@unaffiliated/wildtrees) joined #forth 10:32:25 i have a programming question, but it's not about forth, but it could also be about forth as well, if the code were written in forth. is it ok if i ask it here? 10:58:47 --- quit: cp (Quit: Disappeared in a puff of smoke) 11:02:49 --- join: cp (~cp@b157153.ppp.asahi-net.or.jp) joined #forth 11:12:40 cheater, probably. I dont think anyone will kick you immediately if that's what you mean. also there is ##programming 11:22:31 cheater: feel free to ask 11:25:16 --- join: karswell (~user@cust125-dsl91-135-5.idnet.net) joined #forth 11:27:02 MrMobius crc thanks. it looks like ##programming is dead, there's no chat there... also they mostly talk about like, java and stuff, this isn't it 11:27:22 so the question is... can someone help me understand this code? i wrote most of it but i just don't understand why it works. i added a description, but some of it might be wrong. http://paste.ubuntu.com/p/J2ZPcCbfqx/ 11:31:57 Looks like haskell. 11:33:27 yeah, but the question is about the mathematical expression 11:33:54 it's "just" normal high school algebra but i have no idea how it works 11:38:05 I have no experience with haskell and I am pretty much guessing how the syntax works... 11:39:57 cheater, ##programming is not really dead. you might have to wait a while for an answer like most channels 11:40:05 have you tried #haskell? 11:47:15 Wow, that language is so convoluted. 11:56:21 cheater: So basically what is does is, that it checks how far the closest edge is, and then sets the number to that distance squared. 11:58:33 cheater: #learnprogramming is a nice channel for this sort of thing. but... if you added the comments here, they seem pretty sensible. 12:07:54 cheater: You wrote "n**2" in your comment, in the square you drew, it goes "0 1 2" though. 12:08:18 0**2=0; 1**2=1; 2**2=4, not 2. 12:09:01 Or is it just a marking for the rings and not the actual numbers? 12:10:19 Anyway, here is the algorithm implemented in forth: https://bpaste.net/show/aFEF 12:16:05 And just because I am really bored, here is a port of that algorithm to RETRO: https://bpaste.net/show/-i1E 12:24:11 And to show that I really got nothing better to do, here it is in C: https://bpaste.net/show/mwrP 12:25:44 Hmm, right, I didn't see the part following it. 12:26:35 It gets a bit more complex there, but it really is nothing more than calculating what number is at that place, given the x and y coordinates. 12:30:04 --- quit: john_cephalopoda (Quit: WeeChat 2.3) 12:31:10 --- join: john_cephalopoda (~john@unaffiliated/john-cephalopoda/x-6407167) joined #forth 12:40:10 --- quit: gravicappa (Ping timeout: 248 seconds) 12:44:57 --- join: gravicappa (~gravicapp@h109-187-46-216.dyn.bashtel.ru) joined #forth 13:22:17 --- join: h4shc4t (2734f590@39.52.245.144) joined #forth 13:28:22 --- quit: h4shc4t (Remote host closed the connection) 14:15:16 --- quit: gravicappa (Ping timeout: 272 seconds) 14:57:57 john_cephalopoda: that's because n is 0, 1, 2 and n**2 is 0, 1, 4. the final formula uses (...) * (...) as its first part 14:58:26 john_cephalopoda: i know it's calculating what number is at what place. that's the part i get. 14:58:32 i also get that you count the ring you're in 14:58:49 but then it goes a bit like this... you find some number that's on the left of the formula 14:58:58 --- join: dys (~dys@tmo-100-6.customers.d1-online.com) joined #forth 14:59:06 like eg (n - 2 * e ) * (n - 2 * e ) 14:59:28 and then count steps away from that number using the other part, eg - (i - e + s j - e) 14:59:45 i don't understand how the numbers work out. 15:00:12 like, for example, why in the lower triangle we start out at (n - 2 * (e + 1)) * (n - 2 * (e + 1)) ? 15:00:33 why does then adding steps like this work out? + (i - e + s j - e) 15:00:46 i don't know where those numbers come from. 15:01:55 in the upper triangle, when we're inside a ring that's k*k cells (i.e. k cells across, k cells high) we start at k^2, ie the largest number in that ring. 15:02:10 or rather k**2, let's keep notation the same 15:02:17 but in the lower triangle, we start at (k-1)**2 15:02:29 and i don't see how we're "counting steps" from there, that's confusing 15:04:30 (btw out of all channels I have tried this is the only one where the question got any reaction at all!) 15:05:32 btw, k is obviously k = n - 2 * e 15:05:53 and i made an error. in the lower triangle we start at (k-2)**2 15:06:02 --- quit: logiqub (Remote host closed the connection) 15:06:12 because the ring is two smaller in either dimension 15:08:31 btw, you can try out the code here. https://repl.it/repls/AnchoredFlakyRouter 15:08:40 Anchored Flaky Router describes it well 15:09:04 showRegion is a bit convoluted because originally it is also used somewhere else 15:09:14 <> is string concatenation in this context 15:28:19 --- quit: reepca (Ping timeout: 245 seconds) 16:03:12 updated it with literally every form of visualisation i could come up with. still same link: https://repl.it/repls/AnchoredFlakyRouter 16:14:59 i got part of it. for odd n (see n=5 visualization), look at the number right in the center, and then the one to the upper right, and the one to the upper right of that. i.e. a "ray" going out from the center, to the upper right corner. that always contains the largest number in the ring. call that number M. if we go counter cockwise, we have to deduct 1 per step as long as we're in the ring and ... 16:15:05 ... haven't gone past the opposite ray (going bottom left). if we go clockwise, two things happen. first of all, we have to add 1 per step. second of all, during the first step, the spiral comes in from the smaller ring, and the previous step /in spiral direction/ was the largest number in the smaller ring, call that m. so if we go clockwise, it's like the M cell actually contains m. 16:15:31 the M cell contains the largest number of the ring because that's where the spiral exits the ring, and continues onto the next, larger, ring. 16:16:10 and the largest number of the ring is k**2 because the spiral has had exactly k**2 cells to fill before it has to exit the ring and go onto the larger ring. 16:19:37 --- quit: john_cephalopoda (Ping timeout: 264 seconds) 16:28:20 similarly in the even n situation, look at the ray going out from the center (which is between cells) and going to the lower left corner. this will contain: no number (place between cells), 4, 16, 36, i.e. 2**2, 4**2, 6**2, ... 16:28:42 this is always the largest number in a 2x2 square, 4x4 square, 6x6 square, etc. 16:30:29 the cells counter-clockwise from this cell will remove 1 per step. if we go clockwise, we have to add 1 per step, with a similar caveat like before, where we're not adding to M, but to m. 16:32:22 --- join: john_cephalopoda (~john@unaffiliated/john-cephalopoda/x-6407167) joined #forth 16:32:25 the start of the spiral, 1, is at a +1 step in its ring, but we start adding from m = 0, which is the largest number in a 0x0 square. 16:32:41 *a 0x0 square filled with consecutive numbers starting with 1 16:35:21 the switch between M and m is designated with the branch, "if i <= s j". This also allows us to create the "clockwise" and "counter clockwise" step count. 16:35:39 alright, that explained everything to me 16:35:42 thanks for the help guys! 16:37:28 special thx to crc 17:18:54 --- quit: wildtrees (Quit: Leaving) 17:20:17 --- join: rdrop-exit (~markwilli@112.201.162.86) joined #forth 17:25:31 Good morning Forthwrights :) 17:25:42 hi rdrop-exit 17:25:50 Hello cheater 17:25:57 we've been having fun figuring out some code that's not exactly forth 17:26:06 but you just missed out on that ( 17:26:08 (: 17:26:43 I see 17:29:54 i can show you the log though 17:30:12 I'm looking now 17:31:04 Haskell? I wouldn't have been of any help. 17:31:52 I don't speak functional :) 17:33:49 i'm an object-oriented programming guy myself 17:34:01 i solve software problems by objecting to them 17:34:45 I don't speak OO either :) 17:37:37 --- join: dave0 (~dave0@069.d.003.ncl.iprimus.net.au) joined #forth 17:38:48 eh the idea was to figure out the math formulas :) 17:38:56 you can read on and i explain everything 17:39:15 the syntax really is the same in the code as python, pascal, java, whatever 17:39:21 :) 17:59:03 --- join: ryke (~Thunderbi@71-9-169-152.dhcp.jcsn.tn.charter.com) joined #forth 18:11:16 --- join: tp (~Terry@2001:44b8:314b:a800::10) joined #forth 18:11:16 --- quit: tp (Changing host) 18:11:16 --- join: tp (~Terry@mecrisp/staff/tp) joined #forth 18:43:54 --- quit: karswell (Read error: Connection reset by peer) 18:45:31 --- join: karswell (~user@cust125-dsl91-135-5.idnet.net) joined #forth 18:47:43 --- quit: chunkypuffs (Quit: ZNC 1.7.1 - https://znc.in) 19:08:51 --- join: chunkypuffs (~chunkypuf@static.203.112.216.95.clients.your-server.de) joined #forth 20:40:22 --- quit: dave0 (Quit: dave's not here) 21:40:17 --- join: gravicappa (~gravicapp@h109-187-46-216.dyn.bashtel.ru) joined #forth 21:43:33 --- join: reepca (~user@208.89.170.37) joined #forth 23:20:55 --- quit: dddddd (Remote host closed the connection) 23:52:14 --- quit: ryke (Ping timeout: 272 seconds) 23:59:59 --- log: ended forth/19.08.23