Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

5 Neutral

About FragmentedCurve

  • Rank

Profile Information

  • Location
    New York
  • Favorite Area of Science
    Mathematics & Physics

Recent Profile Visitors

692 profile views
  1. The top protocol might be useful to you. It's p2p and encrypted. It's intended as a instant messaging protocol but there's nothing stopping you from building an application on top of it instead. https://tox.chat/ Also, you might find it useful to play around with tox using the ratox client. https://ratox.2f30.org/
  2. Let's be a little more rigorous. It's not entirely accurate to say findComputerMove is not returning values. The problem is it's not returning a tuple and is instead returning the None type. Python is strongly typed. Let's go back and rewrite a previous code snippet: # Original code # a, b, c = self.findComputerMove(foo, bar, something) result = self.findComputerMove(foo, bar, something) a, b, c = result The first assignment is just a normal variable value assignment. At this moment, Python doesn't assert that the type returned by findComputerMove be a specific type. It will accept an integer, float, string, and even a tuple. Whatever type that findComputerMove returns, defines the result's type. However, the second assignment isn't the same as the first. It's a tuple assignment. The = symbol is a tuple assignment and it expects the right side to be a type that is iterable. And it must be the same length as the left. It's short for the following: result = self.findComputerMove(foo, bar, something) a = result[0] b = result[1] c = result[2] Here's some code about types for you to look over and think about: >>> def do_nothing(): ... pass ... >>> foo = do_nothing() >>> bar = None >>> type(foo) <class 'NoneType'> >>> type(bar) <class 'NoneType'> >>> foo is bar True >>> foo is None True >>> foo == bar True >>> foo == None True >>> def do_none(): ... return None ... >>> do_none() is do_nothing() True >>> do_none() == do_nothing() True >>>
  3. In your OP, findComputerMove is defined as: def findComputerMove(self, row, column, pieceStr): print("Inside find Computer Move") I don't see 3 values being returned. I don't see anything being returned. When you write a line of code like the following: a, b, c = self.findComputerMove(foo, bar, something) the assumption is that findComputerMove returns a tuple of length 3. Is that clear?
  4. import numpy as np class Board: # ... def findComputerMove(self, row, column, pieceStr): print("Inside find Computer Move") def computerModule(self, pieceStr): n = 8 row = -1 column = -1 pName = "" row, column, pName = self.findComputerMove(row, column, pieceStr) # This is the problem return True def main(self): # ... if __name__ == "__main__": objBoard = Board(8) objBoard.main() In computerModule you're calling findComputerMove. What does findComputerMove return? (Your code has more problems after you answer that and solve the problem.)
  5. If that's true, do we know why they'd prefer one species over another? And what would make them prefer one host over another within the same species?
  6. No. It was an impromptu hike into the woods behind my house -- a nature walk. We didn't have any kind of bug repellent. However, I don't know if he was wearing deodorant or cologne. The reason we did the experiment was because I've had so many anecdotal experiences like this with ticks, I wanted a real measurement. Especially with this particular friend. We'd walk the same path through tall grass or in the woods and I'd come out with ticks on me while he'd have none. On that day, I took the opportunity to have a somewhat controlled experiment, since I had the living tick. I should point out, if anyone tries to repeat this, I'd really like to know the results.
  7. I see where the miscommunication is -- how I got the tick. In this particular case, my friend saw it on my neck/shoulder area before it bit me. I just picked it up. The result could've been a coincidence. We only did 11 "trials". I thought it was enough to suggest that something is going on with how a tick finds a body.
  8. It wasn't latched. And no... I don't smoke anything... I'm not here for ethics (despite my avatar).
  9. Why would it be animal cruelty? Are you saying it's like dangling a treat in front of a dog but never giving it to him?
  10. While browsing around "Amateur Science" topics, I was reminded of an experiment I did a while ago. Whenever I'd go hiking with friends, especially one particular friend, I'd come out of the woods and he'd never have a single tick on him. I often wondered if ticks somehow choose a preferred host. So, one day after hiking, we took the tick that was on me and did a small experiment. We sat between two to three feet apart on a wood floor and placed the tick in the center of us. We would then wait to see who the tick would walk to. After he within a couple inches of our body, we would change our positions and orientation and put the tick in the center again. The result was 10 out of 11 times the tick walked to me.
  11. fun_list3 = [lambda e: e + i for i in range(5)] The variable i is outside the scope of the lambda function. Let's rewrite the above to make this clearer. fun_list3 = [] for i in range(5): fun_list3.append(lambda e: e + i) This will produce the same list you wrote but is more explicit about what's going on. The variable i in your lambda function is referencing the i variable from the for loop. It's not doing what you think, which is inserting the value of i over each iteration. The i in your lambda function and the i in the for loop are pointing to the same place in memory. You can see this by doing the following: Python 3.8.5 (default, Sep 5 2020, 10:50:12) [GCC 10.2.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> fun_list3 = [] >>> for i in range(5): ... fun_list3.append(lambda e: e + i) ... >>> print([f(10) for f in fun_list3]) [14, 14, 14, 14, 14] >>> i = 555 >>> print([f(10) for f in fun_list3]) [565, 565, 565, 565, 565] >>> You can do what Sensei said above, but that will introduce an optional argument for each of the lambda functions in the list. For example, Python 3.8.5 (default, Sep 5 2020, 10:50:12) [GCC 10.2.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> fun_list3 = [lambda e,f=i: e+f for i in range(5)] >>> print([f(10) for f in fun_list3]) [10, 11, 12, 13, 14] >>> print([f(10, 555) for f in fun_list3]) [565, 565, 565, 565, 565] >>> I personally would do the following which is have a lambda function that takes i as its argument and returns another lambda function. fun_list3 = [(lambda f: lambda e: e + f)(i) for i in range(5)] Python 3.8.5 (default, Sep 5 2020, 10:50:12) [GCC 10.2.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> fun_list3 = [(lambda f: lambda e: e + f)(i) for i in range(5)] >>> print([f(10) for f in fun_list3]) [10, 11, 12, 13, 14] >>> print([f(10, 555) for f in fun_list3]) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<stdin>", line 1, in <listcomp> TypeError: <lambda>() takes 1 positional argument but 2 were given >>>
  12. As Strange pointed out, understanding the concepts of algorithms, data structures, and design patterns is far more important than learning a specific language. However, I'd like to append the following to that. I'm assuming you want to learn how to program because of some curiosity drive deep down and not purely for filling out a job application. Whatever kind of software has caught your passion at the moment, look at what the developers use to build it. For example, if you're daydreaming about building kernels and bootloaders, look at what languages and tools the developers of Linux, FreeBSD, or Windows use. Are you dreaming up websites? Look at what the developers of stackoverflow or reddit use. Whatever it is, you can use that as a starting point.
  13. I never did this so why not now. You can just call me by my username. Back in the day (before stack overflow), I was very active on technical forums; mostly about programming. I kinda miss engaging on lively forums.
  14. No apologies are needed. These are exactly the kind of discussions I was hoping to stimulate. Given that I am more rusty than Carrock, I feel like I don't have a lot to contribute. I'm reviewing material and trying to answer my own questions before coming back here and naively pushing them onto you. I know it wouldn't produce a lot of electrical energy. Also, electrical energy isn't a requirement either. The reason I mentioned electrical energy is because its probably the most useful form of energy for practical purposes. But the end result doesn't matter much as long as its somewhat more useful than the input (the hot air). The point behind my post was about structuring a material that would be able to excite an electron on a chlorophyll-like molecule by only the kinetic energy of gaseous particles alone. I just realized why I'm having trouble communicating my response. There's really two parts to my inquiry. The first part is about constructing such a material. The second part is what are the effects of such a material on the temperature of a gaseous body. The thoughts about air conditioning were just the catalyst for thinking about the chemistry and physics of this situation. I attached a poorly drawn conceptual diagram. So the green particles hit A at the same time causing enough energy to be transferred to B and excite B's electron. Which laws of nature stop A from successfully exciting B's electron? I hope I did not come across a someone looking to convert heat with 100% efficiency or worse (someone looking for free energy).
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.