Hello everyone,,,
It has been a while since I have made something with python (as well as it has since I last posted something here). So I've always enjoyed physics and so I did with programming. But doing these stuff together was really amazing. Ladies and gentlemen, I present:
The A-Wave Simulator
[img]http://i72.servimg.com/u/f72/16/27/78/35/screen10.png[/img]
[img]http://i72.servimg.com/u/f72/16/27/78/35/screen11.png[/img]
The simulator supports simulating both Longitudinal and Transverse waves. Two waves (A & B) can be simulated at the same time, and are both needed in order to allow the Interference. Reflection of the wave can be allowed too, and the Interference of the 2 waves (the original and the reflected one) produces a stationary wave and much more.
Download link: http://www.mediafire.com/?dbmec16hdbss6nj
Source code (Fully made with pygame): Well, before you take a look at it, I would like to say, BEWARE! The code sucks when at neatness perspective. No multiple files, no classes and the code isn't commented at all. You still want to see it? http://pastebin.com/9gjSQ4SS
Comments would be nice ;) !
If you really made this it looks awesome man. Great job!!
Thank you very much! It was actually trashed by my "computer teacher". I knew programming work wouldn't be appreciated at school... But whatever. They don't understand it anyways.. :D
I've also started working on another project, actually another simulator which simulates atoms according to Bhor's model of an atom. I didn't really finish it (I had no more motivation), but you can check it out if you're interested: http://pastebin.com/SQftbk6b
I can't believe your computer teacher trashed that...
what do u mean by "trashed"? lol
did he not appreciate it? or was it below par on an assignment?
Well, since you are interested about what happened, here is the story:
I had this so called "Science Fair" at school, and I thought about participating for this year. Everyone did the same stuff taken from Youtube, and so I thought mine would be special and I could win. I submitted for it and everything, and the day of the "Science fair" arrived. So I went in the school, looking for the place where I will be presenting my project. Now even though I registered my project in the Physics section, they put me in the ICT section, and I didn't really mind it at all. Now when I was done adjusting the projector and the program was on the screen, the computer teacher came over: "Did you really make this on your own?". "Yes." I replied. "What is this supposed to be?" he asked again. "Its a wave simulator which can simulate ...." I explained. "Is there any music or sounds?" he asked. "Nope, and why would there be?" I exclaimed. "So this is the Sin wave, where is Tan and Cos?" He asked again. "Well, I guess you've misunderstood what this really is. These are no Maths related. The waves the simulator simulates are those of the Light, sound, radio waves... etcetera, and they are all sinusoidal." replied again. "I know but, whats new in all this?" he asked. I had almost no patience left. "Mister, I simulated the waves on a computer, and they are ready to be scaled. You know how they first calculated the energy of an exploding star? It was done with a computer simulation for the star exploding.." *I sighed. He talked again "You know, I have made a wave program, but mine was with sound. But yours, I can's see anything fun in it.". I thought how simple it was to make "the sound program" he made. A simple 20 lined program that uses "winsound" library for Python. "So you're trying to imply that what I did is completely useless?" I asked. "No of course not" he lied. "Can you show me around your program a little bit?" he talked. "Well, there is the mouse, and here is the program on the screen. Use the mouse to click on on the buttons. Everything else is self-explanatory." I replied. So he produced a stationary wave by accident. "Hey I have got an idea for you" he spitted again. "How about you play music with this wave on, and you tell the audience that the waves dance according to the music. Trust me this is going to work.". "This isn't what I came for." I replied. So he finally left. I sat on a chair next to a friend, then all of the sudden "Hey you, you can't enter without your school uniform" the computer teacher said to my friend. "I just came in, and I can barely find students who are wearing it" he told. "No you have to leave." the teacher spitted. "Alright then" he was about to go out. "Well if he's leaving, then I will leave" I said. "Rules are rules. If you want to leave then it's upto you" he spitted again. "They put me in the wrong section with the wrong teacher, in the wrong school.. And people here are looking for stuff that shines, when its suppose to be a Science Fair. This my wrong place, definitely. Bye!" And I finally left...
And yeah I know. I did wrong when I left. I should have stayed till the very end. "A man is the one whom if he decides he will do something, he will do it, no matter how it ends like" Quoted from a lecture I received from my father. lol
Very interesting and unique, what do you mean trashed?
Intensely underrated, looks down on, or you can say the vrey opposite of appreciated. More of crushed.
(May 3, 2013 11:47 PM)A-MAN Wrote: Intensely underrated, looks down on, or you can say the vrey opposite of appreciated. More of crushed.
code is horrible, can see why the teacher was trashing it (I kid, I kid; but that code, ever heard of a class/OOP code?)
I mean a simple thing to add to readability/cut down loads of coding time would be:
Code objects = [button1, button2, button3, someotherpygamesurface]
for item in objects:
item.blit()
practice making some classes, don't worry about parenting/subclassing, maybe make a menu of some sort which changes screens.
The program itself is alright, serves its purpose, however, wave velocity is usually constant, and the wave length will vary based on the frequency, not velocity on the other two...
Personally I had a teacher just like that (dumb bitch couldn't even write a python program longer then 10 lines(said she prefered VB, yet couldn't write anything that worked in that either), and just hated on me for some reason, I wasn't even cocky towards her, just totally ignored everything she said, and even after topping the subject without study she said I was only dropping the course because I didn't understand it LMAO), I just dropped software, wasn't worth wasting my time drawing diagrams that will never be used after the HSC (words of a uni professor, not mine :P)
As a side; What country/year are you in?
DO NOT DEAL WITH THIS MEMBER
Looks awesome! I don't like these dark colours but it's cool!
The thing that I like (and maybe one of the reasons that your teacher didn't like it) is the simplicity. I like some guis like that for some reason. Just the way that it is raw data, and that you focused on that instead of making a really pristine gui. Again, not sure why I like that, but simplicity appeals to me :)
(May 4, 2013 01:15 AM)Dmaster_773 Wrote: code is horrible, can see why the teacher was trashing it (I kid, I kid; but that code, ever heard of a class/OOP code?)
I mean a simple thing to add to readability/cut down loads of coding time would be:
Code objects = [button1, button2, button3, someotherpygamesurface]
for item in objects:
item.blit()
practice making some classes, don't worry about parenting/subclassing, maybe make a menu of some sort which changes screens. A-MAN Wrote:Source code (Fully made with pygame): Well, before you take a look at it, I would like to say, BEWARE! The code sucks when at neatness perspective. No multiple files, no classes and the code isn't commented at all. You still want to see it? http://pastebin.com/9gjSQ4SS I am already aware of this. I was in an absolute hurry when I wrote that. And just to let you know, he (the teacher) didn't see the source code. All what he saw was the program on the projector screen. Plus, the code isn't really THAT bad. I've got a function that blits, a function that draws the buttons, a function which adds the plotting for the interfered wave, another for the Longitudinal and did all the logic in the "while True" loop. And about the lack of the classes, it is just that I am not used to classes (as I never really NEEDED them for something to work right). And so, I don't usually use them at all when I write code by default. There is also a dead project of mine (another simulator), at which I used these classes on, here: http://pastebin.com/SQftbk6b
Check it out if you liked the first one :)
(May 4, 2013 01:15 AM)Dmaster_773 Wrote: The program itself is alright, serves its purpose, however, wave velocity is usually constant, and the wave length will vary based on the frequency, not velocity on the other two... Well, yes you are right, but that only applies to the electromagnetic waves. Also, the more control you have for a simulator, the more "simulator-ish" the simulator is. And if the user still wants a constant velocity between the two waves, he still can do it manually.
(May 4, 2013 01:15 AM)Dmaster_773 Wrote: Personally I had a teacher just like that (dumb bitch couldn't even write a python program longer then 10 lines(said she prefered VB, yet couldn't write anything that worked in that either), and just hated on me for some reason, I wasn't even cocky towards her, just totally ignored everything she said, and even after topping the subject without study she said I was only dropping the course because I didn't understand it LMAO), I just dropped software, wasn't worth wasting my time drawing diagrams that will never be used after the HSC (words of a uni professor, not mine :P)
As a side; What country/year are you in? Lol, so they are everywhere..
Year 11 at Yemen (somewhere at Arabia)
Aɴᴛʜʀᴀx Wrote:The thing that I like (and maybe one of the reasons that your teacher didn't like it) is the simplicity. I like some guis like that for some reason. Just the way that it is raw data, and that you focused on that instead of making a really pristine gui. Again, not sure why I like that, but simplicity appeals to me :) A fan of retro graphics, just like me B). Just wandering, did he (the teacher) really wanted to see HD effects and graphics in a scientific program? Meh... whatever..
Thanks for all of your comments guys! Appreciated!!
|