D
D
denis_213213212020-10-08 17:55:50
Database design
denis_21321321, 2020-10-08 17:55:50

Implementation of the game "Battleship" on the server side?

I want to create a game "Battleship" over the network on the site.

I decided to make logic, check on the server, and not on the client side, for security. Make 200 columns in the database table (100 columns for the 1st player's card, 100 for the 2nd). On the move, there is a request to the server, add this move to those 100 columns and return those 100 columns from the database and check if he won.
Is the implementation of this game on the server correct?

Or can it be implemented somehow more correctly, without creating these 200 columns?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vladimir Korotenko, 2020-10-08
@denis_21321321

I'd
Row
Column
UserId
State
Gameid
And no jisung

D
Dmitry Roo, 2020-10-08
@xez

I would try to get by with this structure:
Batch number | time (if needed) | move | id
123455 | 12:35:56 | b5 |
And just each time I made a selection by the number of the game and each time determined its outcome. Performance problems (if any) can be solved by caching.

P
Papa, 2020-10-08
Stifflera @PapaStifflera

All your data can be stored in two int columns.
Go to the library, take textbooks for the school course of computer science / algebra. Key words: bit, matrix. Although here you can do without matrices ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question