For my project I am coding battleship. I don't know how i should go about

1. mapping the board spots (dictionaries?)
2. randomizing ship placement

any advice would be greatly appreciated

PS. I am using pygame as well.

For my project I am coding battleship. I don't know how i should go about

1. mapping the board spots (dictionaries?)
2. randomizing ship placement

any advice would be greatly appreciated

PS. I am using pygame as well.

1. You can use the basic 2D array of integers or byte with type of integer or char. Depends how many data you want to store.

2. Place a random point on the field. Then choose randomly from 4 on which side it should be oriented. Then like how far from the point the ship rear is (random(length of the ship) starting.

Good luck :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.