I can send the assignment and the code I'm working with for clarification if needed. But the main issue and what I need help is a class and some funtionality in the code. So basically I have creates a class and objects with acids (from a file of 20 acids) and some of its attributes, in total 4 attributes. It's code, name, weight, something. What I want to do is to is be able to, from an input statement, get a sequences (like CAAC) which are the acid codes, so C, A, A, C and make both an object out of it as well as being able to calculate the weights from all sequnces of acids (every acids has a specific weight)
#Classes (basic)
72 messages · Page 1 of 1 (latest)
your problem is, that you dont know what you want to do.
Thats a beginner problem in programming.
If someone asks you how to make a fried egg, you would think:
- grab eggs
- place them in a pan
- fry till its like i want it
But in programming you need to think smaller, much smaller steps.
just to break down the first point here:
- go to fridge
- open fridge
- search for eggs
- grab eggs
- close fridge
- go to pan
- open egg carton
- grab egg
- break egg over pan
...
and even that can be made smaller.
Basically a program is dumb and cant do shit.
Based on how high the language is you use, you can do more easyer.
You need to think smaller about what you want and what you need for it.
A good help is explaining that to someone, who has no idea about PCs/coding and explain it, like they can follow you.
Because then you have made the steps so simple, you can follow them too 😉
I don't see the question in your original post
Where code?
I’m done with that code
Just to answer his reply
Tho I could use some help in my current project
What would be the best course of action for a single player battleships game where you have 10 textfiles with ships done
@lunar crater @past wing
Would it be to just print out an empty board and then make a list for the board you open to get coordinates
I can go into detail if needed
This may be super vague and horribly explained
It’s a battleships project anyway without randomized ship placements and no user interface
So I have already made 10 textfiles for the ship placements and the board
Why are you using text files?
s - - - S -
- - - - S -
- - S - - -
- - S - - -
- - S - - -
- S - - - -
isnt it ""py ""
?
Yeah
regardless its useless here
the text i sent it how the files look
the "-" is empty water spaces, and S are part of a ships
and I have 10 of those, and I will randomize and pick 1 each game to make it less predictable
question is it this is a good course of action to take given the circumstances:
to create an empty board for the player, to make a 2d list out of the radomized file, and somehow set it to, if the koordinate picked = S in the 2d file list, then replace that coordinate with X, otherwise O
or should I use classes or something
You could use a class
I get it depends on how you design the game and the classes
Like, you could do everything your class does with functions
Because you don't really need class instances
Yeah, there should be a ton pf ways to do this project
But as a 2 week old progrsmmer
I’m asking what the best course of action would be
Or a good one anyway
I dont want to start something stupid then get stuck mid way thru
I don't think you should get caught up on these trivial things so early on
Just make something that works and worry about how good it is later
Not how good, for instance I dont want to create a class for the ship or board
Then get stuck on functionality later on
Unsure
I’ve seen ppl with the same project use classes for ships and board tho
Never really understood why
I don't see a reason why you need to
I usually use classes for two reasons:
- As some sort of way to store data that isn't really nice to do with built in datatypes
- Some thing has relevant methods attached to it
Could have both
But in this case for your battlefield game, there isn't really a reason to use classes except maybe the board?
But then there's no reason to not use a 2d list and functions
Others might disagree tho 
Yea but even the board
What would we gain by assigning it a class?
We can access coordinates easily via 2d lists
That's why I'm telling you not to worry about it
Use a 2d list and functions
And then when you realise you need classes (which I doubt you do) you can refactor the code
bet
ez
@lunar crater
What