Hjonkiues The Second
@FriendlyGooseMan
I am FriendlyGooseMan. just a programming goose. I do optimizations for stuff nobody asked for
discord: FriendlyGooseMan#0371
Hey so I have an issue with my saving system. Not really the saving system but the loading system it says that it cannot convert my string-list (as in
Python
InvisibleOne You can convert a string list to a list like this:
mystrlist = "['banana','apple','orange']"
mylist = eval(mystr_list)
print(my_list)
print(type(my_list))
Output:
['banana', 'apple', 'orange']
Just be careful using eval() because it will execute any command given. And if someone managed to put something like import os;os.system('rm -rf') into it, it would delete your files.
If you are controlling the input however it should be fine.
Other then this there are a few other techniques you can 1 year ago
MrVoo Since a string is always made into a list the same way no matter what, you can't do it like that :( You have to find a way to change it back yourself1 year ago
I have optimized random number generation to be about 0.00001260415 per number (abt 6 seconds for 500K) but I think the reply community can take this
Python
Spacecraft ~3 seconds for 500k
import random
import time
mylist = []
i = 500000
print("Starting")
start=time.time()
for x in range(i):
mylist.append(random.randint(0,10000))
end=time.time()
print("%s ms Elapsed 500K numbers generated" %(end-start))
`1 year ago
Very Simple Slot machine that is going into a much bigger project of mine. click run and it will go fast (yes its laggy cuz repl.it and no I'm not buy
Python
So I still need
root.mainloop()
And I need an event to happen every second.
How would you do this, thanks in advance
Python
IMayBeMe For this to happen you want a regular python while loop which calls a function that will update the Tkinter interface. I also can give more specific help if you can tell me exactly what you are trying to achieve.2 years ago
ok so basically I made tic tac toe using a numpy matrix. I really just did this for learning. but I wanted to share anyways. You play by inputting a n
Python
Wanna make a team because Im bored. and like make a game or something. Also I can only use python because I am sad boi but like just say if you wanna
Some things you should do to write code is to plan it out, plan what you want to do, I'm working on AI and I just planed it out and it helped a lot. S
Jakman this is a great post. What other things programmers would want to do is see how everything comes together such as the structure of a building.3 years ago
DynamicSquid Why does your post have so many upvotes from 0-cycle accounts? It looks like most of them are bots3 years ago
So Dumb Idea, That imma do, I want to make an Auto clicker in repl, how would I do that
SixBeeps Can't really do it unless you make a VM repl. Even then, the clicks won't go outside of the VM.3 years ago
RomeroSchwarz Take input in the console, then write it to the chromium browser.
> If this post helped, mark it as the answer3 years ago
SixBeeps The only way is to google "at symbol" and copy-paste. It doesn't look like the shift key works.3 years ago
chromuim --allow-no-sandbox-job is weird and I dont know how to use it.
Bash
AlexanderTarn You only use global when you use a global variable in a function not a loop.3 years ago
I made a simple snake game (well followed a tutorial) because I was bored. Hope you like '_'
Edit Controls are WASD
Pygame
Why isn't local storage working? I really don't know how it works soo yeah
HTML, CSS, JS
Vandesm14 Your load function is not being run at all. Make sure you execute the load function in the first line of the cps function.3 years ago
This is confuse. and I have smol brain
Water is not working and I am mad
Python
FriendlyGooseMan @Nemoiscool Did Have the answer that helped more but @maazzubair99 Helped a lot too!3 years ago
Nemoiscool I have discovered a few issues. The first is on line 12:
'Water =- (Humans*2)' should be:
'Water -= (Humans*2)' (note the switch of the '-' and '=')
Next, variables declared outside of functions cannot be used inside functions unless you do one of a couple things:
At the beginning of every function you declare the variable to be global by typing this line: 'global Water.'
Another way would be to use parameters. to declare a parameter, simply put the parameter name inside the parenthesis when3 years ago
I really dont know how to use text wrap, I just wanna print some ascii text that I made and I want to print it so I went on google and it said text wr
Python
I need this because It's a clicker and It's no fun having to restart so I'm just asking. Thanks!
HTML, CSS, JS
Vandesm14 You can use local storage for that:
Set an item: localStorage.setItem('score', 300);
Get an item: localStorage.getItem('score');3 years ago
mwilki7 Not the best idea, but way I did something like this is to turn your game state into text and copy paste that manually into a file somewhere.3 years ago
How would I make it so that Buteen moves down a line so that it looks a lot better.
HTML, CSS, JS
Press enter to goto the next screen after the title. The Save screen is so glitchy and I dont know how to fix it.
Pygame
Vandesm14 Repl.it is just glitchy overall. The only way to avoid/fix this is to run it on your local machine.3 years ago
So im using a function to display the text if that helps Im Trying to figure out why its blinking white on the second screen (Press enter to goto next
Pygame