Originally posted by Kuciwalker
View Post
Announcement
Collapse
No announcement yet.
Java problem - help please!
Collapse
X
-
If there are rules external to the sub governing where it can move, then the logic to determine if the sub can move should be external to the sub object."The issue is there are still many people out there that use religion as a crutch for bigotry and hate. Like Ben."
Ben Kenobi: "That means I'm doing something right. "
Comment
-
That's why I hated programming assignments. They're usually not well constructed, and don't lead to well-designed solutions."The issue is there are still many people out there that use religion as a crutch for bigotry and hate. Like Ben."
Ben Kenobi: "That means I'm doing something right. "
Comment
-
Originally posted by Asher View PostThat's why I hated programming assignments. They're usually not well constructed, and don't lead to well-designed solutions.With or without religion, you would have good people doing good things and evil people doing evil things. But for good people to do evil things, that takes religion.
Steven Weinberg
Comment
-
I agree with Asher and BlackCat on this one.Jon Miller: MikeH speaks the truth
Jon Miller: MikeH is a shockingly revolting dolt and a masturbatory urine-reeking sideshow freak whose word is as valuable as an aging cow paddy.
We've got both kinds
Comment
-
Guys, I got the job done using the magic word 'this', to relate the object and its container. I'll post the details later. A slight confession - the seas and subs was a metaphor for the actual requirements. The OP was originally written for the course forum, where we shouldn't be discussing details of assignment work, so I substituted (har har) the allotment and various vegetable types for another example.
The moveSub method was equivalent to (eg) plantCarrot and checkMove equated to plotValid in the allotment class. Veg types had to be placed in the field according to certain rules which were checked in plotValid. The difference was that there was only one allotment in the scenario, rather than the multiple seas, so all the fighting over that was probably not necessary, even though you doubtless enjoyed it. I certainly did. Sorry about that.
The assignment was part 1 of a game (which to me looks like some sort of vegetarian version of Battleships) where a number of different veg types of different shapes are plotted in a field-grid according to certain rules, with the total number of occupied plots (tiles) summed for each row and column. Part 2 (not required in this assignment) is for the second player to guess the positions of all veg in the minimum number of turns, by enquiring into the status of individual plots. This assignment (which I've now done) is just about setting up the board.
I'll post my implementation of the relationship between object and container in due course, and maybe you can explain the shortcomings of it. Thanks for all your contributions so far.
Oh, I should add that in this or any subsequent questions where I seek your valued collective wisdom, I am looking for an understanding of principles, rather than for anyone to solve a logical problem for me, or to do my work for me, which would be unethical and illegal under university rules, and rightly so. I can solve problems logically and devise algorithms well, but I'm stuck with decades of procedural programming thinking, and having to adapt to OOP, which for me is the challenging part.
Comment
Comment