Guest Posted September 20, 2020 Report Share Posted September 20, 2020 (edited) I was looking at some things regarding coding, and learned some cool stuff, so I decided to mess around with it, (specifically in Python). This thread is just for posting simple but interesting programming syntax, (and better if you explain it), but just for fun, nothing too complicated or serious. So with this one, you can estimate π with basically a number randomizer and by applying a formula after recounting the numbers. The idea is that if you randomize dots in a semi-uniform manner inside an overlapped & centered square & circle that have the same diameter/edge length, the dots that fall within the circle divided by the ones that fall in total, (so inside the square, and therefore inside the circle), should approximate (π/4), without you needing to input π at all. If you run this in Python, it should give you the estimate, with obviously a different result each time, and more accurate to the number the more iterations you give it, (here I put 1000000 times): import random def approx_pi(z): dot_in_circle = 0 dot_in_total = 0 for _ in range(z): x = random.uniform(0,1) y = random.uniform(0,1) rad = x**2 + y**2 if rad <= 1: dot_in_circle += 1 dot_in_total += 1 return 4 * dot_in_circle/dot_in_total print(approx_pi(1000000)) I didn't know about this until recently, I think it's pretty cool. Edited September 20, 2020 by MoraMoria Quote Link to comment Share on other sites More sharing options...
GuessWhat Posted September 20, 2020 Report Share Posted September 20, 2020 Cool. I didn't know you were into programing. 6 hours ago, babymngaming456 said: There's actually simple math behind it. Why you gotta shit on his parade, man? Quote Link to comment Share on other sites More sharing options...
Guest Posted September 20, 2020 Report Share Posted September 20, 2020 1 hour ago, GuessWhat said: Cool. I didn't know you were into programing. Just a bit. 8 hours ago, babymngaming456 said: There's actually simple math behind it. The point of this is to estimate π with a randomizer between numbers [0 and 1, included], and then applying a formula after recounting. You have to do it without having π, or the area of an already existing circle or square, (or circumference), that's why you use the randomizer. In your equation, you already have either of those, so it's pointless, you already have the solution. Your highlighted equation at the bottom of the image is already in the return statement, but "A_circle" was calculated with the help of the randomizer. Quote Link to comment Share on other sites More sharing options...
Guest Posted September 21, 2020 Report Share Posted September 21, 2020 (edited) This is something I did a while ago, but is related to programming. You can actually make an encoder & decoder of ciphertexts in Microsoft Excel, although it's not going to look super fancy. The one I did that's shown here, just encodes the plaintexts to Beaufort & Vigenère, and below it, a decoder of those two as well. You just enter the plaintext & key, (the only thing you do in this version is enter the data in the green-cells). It works by assigning a number to each letter of the alphabet, (made it for English), and then you just apply a formula to add or substract them & output the corresponding letter, depending on the cipher. But because it's Excel, you have to take a lot of things into consideration if you want to make it work, like making sure that the key loops correctly regardless of its length, and that the output for the result also assigns the correct letter no matter the length of the string, (with a limit for the one I made). One day I'll try it with a programming language instead of Excel, and I'm sure that some parts will be easier. Edited September 21, 2020 by MoraMoria Quote Link to comment Share on other sites More sharing options...
Guest Posted October 6, 2020 Report Share Posted October 6, 2020 I've done a bunch of things in Excel that I want to do with a programming language. Like with this, it basically shows a letter-frequency-analysis of the English language, (in the: "% English" row, according to some sources), and in the top one it counts the specific letters of the text you input, and colours it, according to its frequency. The result shows that the colours seem to match fairly well, so the text should have a decent chance of being written in English. So if I make this a bit more complex, it might work good with Caesar-Ciphertexts as well: Quote Link to comment Share on other sites More sharing options...
Guest Posted February 20, 2021 Report Share Posted February 20, 2021 I forgot to put this one here. It's a client-side redirect using the meta-tag, after 0 seconds. <meta http-equiv="refresh" content="0; url=https://thekingofhate.com/forums/"> Quote Link to comment Share on other sites More sharing options...
GuessWhat Posted February 21, 2021 Report Share Posted February 21, 2021 26 minutes ago, MoraMoria said: I forgot to put this one here. It's a client-side redirect using the meta-tag, after 0 seconds. <meta http-equiv="refresh" content="0; url=https://thekingofhate.com/forums/"> It's just suppose to send the user to the url site? Quote Link to comment Share on other sites More sharing options...
Guest Posted February 21, 2021 Report Share Posted February 21, 2021 3 minutes ago, GuessWhat said: It's just suppose to send the user to the url site? Yes, with that tag the user will be redirected to: https://thekingofhate.com/forums/ after 0 seconds, and you can change the 0 to the number you want. It's just a "trick" that would be used sometimes, instead of the alternatives. It's decently explained on Wikipedia in a brief manner: https://en.wikipedia.org/wiki/Meta_refresh Quote Link to comment Share on other sites More sharing options...
GuessWhat Posted February 21, 2021 Report Share Posted February 21, 2021 30 minutes ago, MoraMoria said: Yes, with that tag the user will be redirected to: https://thekingofhate.com/forums/ after 0 seconds, and you can change the 0 to the number you want. It's just a "trick" that would be used sometimes, instead of the alternatives. It's decently explained on Wikipedia in a brief manner: https://en.wikipedia.org/wiki/Meta_refresh Nice, I was just making sure I somewhat understood what the hell was happening. LOL , I wasn't trying to sound like an ass or anything. Quote Link to comment Share on other sites More sharing options...
Guest Posted February 21, 2021 Report Share Posted February 21, 2021 21 minutes ago, GuessWhat said: Nice, I was just making sure I somewhat understood what the hell was happening. LOL , I wasn't trying to sound like an ass or anything. Oh yeah, don't worry. I'm also learning about it, in this case you'd just put the <meta> tag inside the <head> of your HTML document. Quote Link to comment Share on other sites More sharing options...
musicboy Posted February 24, 2021 Report Share Posted February 24, 2021 (edited) @MoraMoria Oy! You do coding stuff too? That is cool. I just read through this whole topic. Cool! Edited February 24, 2021 by musicboy Quote Link to comment Share on other sites More sharing options...
Guest Posted February 24, 2021 Report Share Posted February 24, 2021 17 minutes ago, musicboy said: @MoraMoria Oy! You do coding stuff too? That is cool. Only basic stuff with some languages, I'm still testing some other stuff. Quote Link to comment Share on other sites More sharing options...
musicboy Posted February 24, 2021 Report Share Posted February 24, 2021 Hey, that is good. Cool! Quote Link to comment Share on other sites More sharing options...
MufflerBearing Posted May 2, 2021 Report Share Posted May 2, 2021 I don't know if I like coding. I've learned Java, C#, HTML5, CSS3, SQL (Oracle and MySQL). I think that's it. I'm not an expert. But I think I'm okay at it. 1 Quote Link to comment Share on other sites More sharing options...
musicboy Posted May 13, 2021 Report Share Posted May 13, 2021 Yeah, same here. Quote Link to comment Share on other sites More sharing options...
Guest Posted September 3, 2021 Report Share Posted September 3, 2021 I did a simple simulation of the "Monty Hall" problem on Excel, (that's the best quality I can give it, apparently). If I did it correctly, it should be calculating the percentage of wins the contestant gets, based on whether they stay, or swap the door. It calculates each scenario based on 8999 simulations. Quote Link to comment Share on other sites More sharing options...
Guest Posted September 18, 2021 Report Share Posted September 18, 2021 I did a mini-battle-simulator like Pokémon on Excel by using basic knowledge of VBA, (Visual Basic for Applications). You can roll the health/attack/defense/type as random, or by giving a range to it. You can also randomize the moves if you want. I made it so that there's types affectiveness, (Fire, Ghost, Normal, Earth, Water, Wind, Light, Bug, Electric), & side-effects for moves, (Attack/Defense/Accuracy decrease, flinch, burn, freeze, paralyze, sleep, curse, exhaust). It's kind of simple, but it's like an RPG battle where you just click on the attack you want. This is all within an Excel document. Quote Link to comment Share on other sites More sharing options...
musicboy Posted September 24, 2021 Report Share Posted September 24, 2021 (edited) On 9/17/2021 at 8:59 PM, MoraMoria said: I did a mini-battle-simulator like Pokémon on Excel by using basic knowledge of VBA, (Visual Basic for Applications). You can roll the health/attack/defense/type as random, or by giving a range to it. You can also randomize the moves if you want. I made it so that there's types affectiveness, (Fire, Ghost, Normal, Earth, Water, Wind, Light, Bug, Electric), & side-effects for moves, (Attack/Defense/Accuracy decrease, flinch, burn, freeze, paralyze, sleep, curse, exhaust). It's kind of simple, but it's like an RPG battle where you just click on the attack you want. This is all within an Excel document. Wow! That is really cool stuff you did there MoraMoria. Edited September 24, 2021 by musicboy Quote Link to comment Share on other sites More sharing options...
musicboy Posted July 1 Report Share Posted July 1 (edited) Mora are you still around. Edited July 1 by musicboy Quote Link to comment Share on other sites More sharing options...
MDCFAN101 Posted July 3 Report Share Posted July 3 On 7/1/2022 at 12:41 AM, musicboy said: Mora are you still around. Unfortunately no he is isn't. He told me a while ago that he was leaving the forums. I don't know why, he never really gave me his reasons as to why he was leaving. Quote Link to comment Share on other sites More sharing options...
KGhaleon Posted July 3 Report Share Posted July 3 1 hour ago, MDCFAN101 said: Unfortunately no he is isn't. He told me a while ago that he was leaving the forums. I don't know why, he never really gave me his reasons as to why he was leaving. He was always DMing me asking questions about Phil. Also noticed he was messing with forum code and spamming thousands of DMs every week. Had a second account too that was a secret. Ever time I pried for more information he would get hostile like I was snooping in his business. No strong feelings about the guy but there was some weird shit with him. Quote Link to comment Share on other sites More sharing options...
MDCFAN101 Posted July 3 Report Share Posted July 3 23 minutes ago, KGhaleon said: He was always DMing me asking questions about Phil. Also noticed he was messing with forum code and spamming thousands of DMs every week. Had a second account too that was a secret. Ever time I pried for more information he would get hostile like I was snooping in his business. No strong feelings about the guy but there was some weird shit with him. TBH, I felt the same way too about him, but he never gave me any trouble. Quote Link to comment Share on other sites More sharing options...
musicboy Posted July 12 Report Share Posted July 12 (edited) On 7/2/2022 at 9:01 PM, MDCFAN101 said: Unfortunately no he is isn't. He told me a while ago that he was leaving the forums. I don't know why, he never really gave me his reasons as to why he was leaving. Thanks for that info bro. On 7/2/2022 at 9:01 PM, MDCFAN101 said: He told me a while ago that he was leaving the forums. I don't know why, he never really gave me his reasons as to why he was leaving. That is quite strange. I hope everything is alright with him. Edited July 12 by musicboy Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.