Posts

Python Ellipsis

Image
I ran across this oddity experimenting with getting the locals() to print from a for loop. a stack overflow reference I used for help: https://stackoverflow.com/questions/26544091/checking-if-type-list-in-python I don't know if I'll get through it tonight to explain, or figure it out, maybe tomorrow. But, check it out. Curious. Lets break it! Update 12/22/2020: The three dots [...] Ellipsis, are a python placeholder for a big list of items... basically.  Here's A stackoverflow link with more eloquent answers: StackOverFlow Python Ellipsis UPDATE 10/9/18 below I asked about this in the LearnCodeTheHardWay forum to see if I could get suggestions how to decipher this. On suggestion, I ran some profile tests on two separate codes. What I really want to know is WTH is that [...] called, and what is python doing there? Picture & Code for test on the size 1 million for loop locals() list: ** 1.993 seconds *** Code: #!usr/bin/python3 ...

Revised Binary Tree, with the pytest file

Image
Finally went through and fixed my spaghetti monster. update(12/21/2020) moved code into 'code blocks'. I will probably be moving this one next to My WordPress site:  Nellie's Noodles I might go back and add recursions, but for the purpose of showing readers how I made the code, while loops are much easier to follow, in my opinion. The diagram of how I decided to do delete from a parent node with two children. Python Binary Tree: --Start Code Block-- class BinaryTreeNode(object): def __init__(self, key, value, left, right): self.key = key self.value = value self.left = left self.right = right def __repr__(self): nleft = self.left and self.left.value or None nright = self.right and self.right.value or None return f"{nleft} {nright}" class BinaryTree(object): def __init__(self, median): self.median = median self.root_node = BinaryTreeNode(self.median, 'bina...

be back soon

Life has given me some lemons, So I'm attempting some lemonade. I'll be back to making and posting code soon hopefully.  I love it, and no way am I giving up. But meanwhile, I have to find a place for my family to live, get my health figured out, and wrestle with poor internet. So, a neat little tip I figured out today: My dad had a text file he saved in some crazy format, and I needed to fix it after I saved to a .txt file. The simple text editors I had did not have what I needed to find and replace all the leftover formatting prompts from the cross to a text document. So hey,  My code editor can do that!!!! Atom on my alienware (currently in storage),  and BlueFish on my laptop. Find all --->  \par replace with --->   *spaces *click option, replace all done....  240 \par's gone. Anyways, I'll see you all around!

back to michigan, a silly snake game in python 2.7 and pygame

I'll be trying to get the forced perspective experiment done in the next couple days. I'm headed back to Michigan soon. (So long California!) There's a lot to do before we hit the road so between that and some health problems I don't know if I'll get that experiment done and posted. If you don't see a post in a while, No worries, I'll be back when I can. Here's a bit of an old code I wrote in pygame python 2.7.   It's messy, and you'd have to put you're own images in, but it's basically a snake game. If coding can't be fun, what's the point? Remember it's from before I really did any real diving into code, so it's not written how I would do it today.  Have fun! Reak havoc, whoever you are! # .....I didn't test it.  I know it did work back in 2013 #  .....  all be it badly.  import sys import pygame from pygame.locals import* from sys import exit import random from random import randint pygame.init() Unic...

Github links for Wiwa, and pygame experiments

Wiwa:  "whispering wall" https://github.com/nelliesnoodles/Whispering-Wall pygame collision demo: https://github.com/nelliesnoodles/pygame pygame paint project:   https://github.com/nelliesnoodles/pygame-paint Currently dusting off the 3D experiment in pygame to get that showcasing the theory I had about forced perspective.  Will hopefully add it soon.

ubuntu on older CPU freezes _crash_

Update 6-23-18: I may have been very wrong.  On the suggestion of my sister, I opened up the casing of the alienware and blew out the 5 years of dust collected in it... So far no crashes.... No fans going nuts... no wierdness... Dust... dust bunnies were most likely  cause of all these issues. Simplest explanation is most likely the right one. ######### original ########## Ok, so I'm trying to figure out why my computer refuses to shutdown, or recognize the keyboard or mouse if I plug the mouse in after it boots up. It may or may not have anything to do with the mouse. It has crashed on me before where I could not shutdown without either pulling the power supply or holding the power button. Not sure why this stuff keeps happening on my computers other then they are old (in alienware case) or weak(in the laptop case), and the newest Operating systems may not be compatible with them. I imagine when new operating systems are designed and built, they do not consider o...

playing with trigonometry sin in pygame

Image
Ok I am so far from understanding, so don't take this as any kind of math lesson. Also, every time I thought I knew what I was doing.... pygame would show me differently. Still a work in progress, but for now, something to play with. Update: SinWaveTime class added to produce that particular weaving effect Tinkering with the different sin wave variables: I wrote this piece separate from my 3D experiment to see how to manipulate the sin wave. While trying to use time as the factor to move my pygame draw circle on the x-axis, i got this crazy little doo-dad : I don't think it's drawing two circles at once, but if I figure out what the heck it's doing I'll let you know.  Or hey if you know, drop a comment.  I don't know if my comments are just not working, or no one wants to. So, here's some pygame code to play with the sin wave.  Alter the different variables to see it in action. picture of SinWave.move_with_time() see changes, SinWaveTime c...