how do you create a multiplayer in the battleship
Something in particular stopping you, or just how to get started?
Thinking through how that program should behave would tell you a lot, have to decide what you are describing before you can think about how to describe it
Some things are rather obvious, such as that you’ll need two boards. Keep going through the features you’d need and consider how it could be done. You certainly don’t need to know any more programming features, a multiplayer version would be doing all the same things
You don’t necessarily have to write it. But you may find that you already know all you need, it’s just about thinking it through
Something that might be useful is to treat the two players as values instead of having special names for them. Changing turn would be as simple as switching place on those values, you’d use the same code for player 1 and player 2, neither would be special (this is an increase in abstraction level, instead of describing both players, you describe how a player behaves which lets you apply that to any number of players)
Yes, ionatan, you are right! Although if you want to move forward and come back to battleship after completing the rest of the Python Course, you’ll find it much easier to make an multiplayer version. If you already have, then it would basically be just making it and hard work! While loops would definitely help.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.