473,386 Members | 1,764 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Re: Python fish simulation?

Is there any Python-based fish simulation project? I've tried
searching google and pypi, but no luck. No burning need, just seems
like it'd be fun.
Without much detail on what you want to simulate...

class Fish:
LITTLE, HUGE = range(2)
def __init__(self, name, size=None):
self.name = name
self.size = size
def swim(self):
print "blub..."
def slap(self, who):
"see here[2]"
if self.size:
if self.size == Fish.LITTLE:
print "slap"
else:
print "SLAP"
else:
print "Slap"
class Halibut(Fish):
def license(self, owner):
"See here[1]"
raise YoureALoonyException(owner)

john = Person("John")
michael = Person("Michael")
michael.hands.left = Fish(None, size=Fish.LITTLE)
michael.hands.right = Fish(None, size=Fish.LITTLE)
john.fish = Fish(None, size=Fish.HUGE)
michael.hands.left.slap(john)
sleep(1)
michael.hands.right.slap(john)
for _ in range(2):
sleep(1)
michael.hands.left.slap(john)
michael.hands.right.slap(john)
sleep(3)
john.fish.slap(michael)

pet = Halibut("Eric")
pet.license(john)
Hope this fish simulation meets your needs...

-tkc
[1]
http://www.youtube.com/watch?v=pnq96W9jtuw

[2]
http://www.youtube.com/watch?v=i9SSOWORzw4


Nov 10 '08 #1
0 1114

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Samir Patel | last post by:
For last couple of weeks, I was doing lot of research on various simulation libraries. Only one I find in python is http://simpy.sourceforge.net. It is very powerful, but it seems that it does not...
19
by: Nicolas Pernetty | last post by:
Hello, I'm looking for any work/paper/ressource about continuous system simulation using Python or any similar object oriented languages (or even UML theory !). I'm aware of SimPy for...
53
by: Michael Tobis | last post by:
Someone asked me to write a brief essay regarding the value-add proposition for Python in the Fortran community. Slightly modified to remove a few climatology-related specifics, here it is. I...
4
by: Richard Blackwood | last post by:
Hello all. I have a few questions about simulation programming. One, do all programmers know to how to code a simulation? By simulation I mean a model of real world relationships (i.e. like...
29
by: 63q2o4i02 | last post by:
Hi, I'm interested in using python to start writing a CAD program for electrical design. I just got done reading Steven Rubin's book, I've used "real" EDA tools, and I have an MSEE, so I know what...
7
by: holly.woodland | last post by:
Hi All Apologies in advance for the pretty basic question - but I can't seem to find an answer anywhere else. I am developing a fluid sim in C++ and have heard that many people use Python in...
5
by: Thuan Seah Tan | last post by:
Hi all, I am new to python and currently I am working on a traffic simulation which I plan to define the various agents using scripting. It's kind of like scripting for non-playable character...
1
by: Joe Strout | last post by:
Is there any Python-based fish simulation project? I've tried searching google and pypi, but no luck. No burning need, just seems like it'd be fun. Thanks, - Joe
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.