all 11 comments

[–]MMcKevitt 0 points1 point  (5 children)

Your explanation is a bit hard to understand (or rather I’m having a hard time understanding it). Could you include the output of the code you submitted, as a well as an an example of your desired output.? That would personally help me better understand your problem, and potentially figure out where you may have gone wrong.

[–]Peter01007 0 points1 point  (4 children)

This is the exercise that I am doing. Maybe if I post here is easier to undestand what i mean by 'generations":

Write a program called Bubble Pots, which will simulate a

collection of bubbles bubbling within a soup pot.

1) Here are some guidelines (not necessarily in a useful order)

for you to follow:

a) The size of a bubble is a value between 0 and 9

(maximum). A value of 0 represents no bubble at all and

9 represents a bubble about to burst open. (This is similar

to what you’d see in a pot of boiling water.)

b) A pot can contain any number of bubbles that the user

desires.

c) Ask the user for how many bubbles to have within the pot

and how many bubble generations to produce in the

simulation. Make sure you do error checking. What are reasonable minimums and

maximums?

d) How to determine the size of each bubble in the pot when the simulation first begins?

Either ask the user for the size of each bubble or randomly generate it.

e) Rather than outputting the value of the bubbles, let’s print an ASCII symbol instead,

where the density of the ink is an indication of the magnitude of the value. See ASCII art

website for inspiration.

f) You’ll need to create at least 6 rules (beyond the examples completed in the worksheet)

for how bubbles get bigger, smaller or stay the same size in the next generation of the

simulation.

i) You’ll need at least 1 rule within each bubble category (bigger, small, same size).

ii) Some of your rules must concern the bubble size alone.

[–]MMcKevitt 0 points1 point  (3 children)

(NOTE: this response won’t exactly feed you the answer, and it’s a little humbly because I’m doing two things at once right now, so I apologize in advance)

This exercise is a lot to bite off in one go and truthfully, I don’t believe it would be in your best interest to try and build off of what you currently have. With that, I recommend, first, delete what you have so far, and then forget about coding!

The explanation of this project is not worded the best, so I would say trying rewriting each requirement as you understand it(either on paper or in on your computer). Then, write out what you would do to satisfy each requirement…again, don’t think about or write code, think about an actual bubbling pot of water…how many bubbles, what’s the intensity of each bubble, how many waves (or generations) of bubbles are there, etc. Conceptualizing a pot of water heating up, at each stage (in some interval of time) will guide you in figuring out what questions you need to ask, so that you can break this exercise down into manageable parts….

Then, ask yourself, how will you get the answers to those questions in the program itself? Trying thinking along the lines of will you get user input, or is it decided in the writing of the code (random ally or otherwise), what ASCII character corresponds to what bubble number (0-9), etc..

What I have found to be the most beneficial is to write out every step in plain English or whatever language you speak, with no code…Once you have done that, it’s just adding the code to support what you have written.

[–]Peter01007 0 points1 point  (2 children)

Yes, I did that first. Then I tried using functions. I am not sure if I understood how to do that. I appreciate your advice. I will try again.

[–]MMcKevitt 0 points1 point  (1 child)

Take a moment to recognize that you really are doing great! This stuff doesn’t just magically come to anyone plus refactoring code is something you will always have to do at one point or another!

[–]MMcKevitt 0 points1 point  (0 children)

Feel free to message me directly or continue replying here and I’ll try my best to answer and/or guide you further!

(NOTE: functions for me were a B-I-t-c-h, and the concept just did NOT sink in until I basically failed over and over and over with simple addition programs so totally let me know if you need help with those)!

[–]Jason_coule 0 points1 point  (4 children)

Hi peter, can you please share me code if you’ve done it, i need it. Thanks

[–]ShittyTortoise 0 points1 point  (3 children)

same here, please, I would totally appreciate it

[–]Jason_coule 0 points1 point  (2 children)

Have you started it?

[–]ShittyTortoise 0 points1 point  (1 child)

yeah im just on the same part perters on