Bees program

A forum for general discussion of the Python programming language.

Bees program

Postby XndrK » Sat Sep 14, 2013 7:47 pm

I came up with an idea for a program that demonstrates swarm intelligence after watching this video.

Here's some pseudocode I wrote.

Code: Select all
def bee(): #Bees! runs on global variables
    if nearby(Predator): #uses weighted random numbers to determine if a predator is near enough to warrant removal and returns bool
        sting(Predator)
    elif low_food(): #uses method described above to determine if food is low and returns bool
        get_food()
    elif too_hot(): #reads temperature and returns bool based on rands
        vent()
    else: #Nothing to do
        dawdle() #basically wander around doing nothing

for bee in bees: #basically a list of dictionaries with each bee's position and state
    bee()


There would also be a map and predators and whatnot. Unfortunately, I'm a complete n00b and can't do this. I don't know what modules to use, but would prefer the builtins (I don't have admin privileges, so I can't install any extra modules :oops: ).

Consider it a challenge.
Proverbs 26:14 describes me a bit too well.

Version: Python 2.7.5

https://github.com/4of92000
https://github.com/PythonForum/
User avatar
XndrK
 
Posts: 172
Joined: Sat Jun 15, 2013 7:57 pm

Re: Bees program

Postby stranac » Sun Sep 15, 2013 8:44 am

XndrK wrote:(I don't have admin privileges, so I can't install any extra modules :oops: )

You don't need admin privileges to install 3rd-party modules.
You can just install them locally(for a single user).

Also, I will be moving this to General Discussions, as the Bar is meant for off-topic(so non-python) discussions.
Friendship is magic!

R.I.P. Tracy M. You will be missed.
User avatar
stranac
 
Posts: 1117
Joined: Thu Feb 07, 2013 3:42 pm

Re: Bees program

Postby XndrK » Sun Sep 15, 2013 8:17 pm

Okey doke.

Figured out classes would be a better idea, but how do I automate making variables?
Proverbs 26:14 describes me a bit too well.

Version: Python 2.7.5

https://github.com/4of92000
https://github.com/PythonForum/
User avatar
XndrK
 
Posts: 172
Joined: Sat Jun 15, 2013 7:57 pm

Re: Bees program

Postby stranac » Mon Sep 16, 2013 9:32 am

You don't.
You use a list/dict/whatever.
Friendship is magic!

R.I.P. Tracy M. You will be missed.
User avatar
stranac
 
Posts: 1117
Joined: Thu Feb 07, 2013 3:42 pm

Re: Bees program

Postby metulburr » Mon Sep 16, 2013 9:58 am

you could recreate that using tkinter, but i would use pygame.

Based on your previous posts (actually based on this post), you should not be worrying about such tasks when you do not know how to install 3rd party modules yet. Besides, the AI/GUI programming in that video looks way too advanced than what i believe you are capable of. I think you should work on the basics on python, using terminal/command line programs, until you get the basics down.
New Users, Read This
OS Ubuntu 14.04, Arch Linux, Gentoo, Windows 7/8
https://github.com/metulburr
steam
User avatar
metulburr
 
Posts: 1420
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY

Re: Bees program

Postby XndrK » Mon Sep 16, 2013 4:22 pm

Yeah, I just wanted to put the idea out there.
Proverbs 26:14 describes me a bit too well.

Version: Python 2.7.5

https://github.com/4of92000
https://github.com/PythonForum/
User avatar
XndrK
 
Posts: 172
Joined: Sat Jun 15, 2013 7:57 pm


Return to General Discussions

Who is online

Users browsing this forum: Excelsior, W3C [Linkcheck] and 2 guests