Good day. I have a question about the structure of the program. I’m making a game based on sea battle mechanics. Ships will have various properties such as counterattack or evasion. There will be 4 types of ships with a unique set of properties. Also, ships in certain positions will acquire additional properties (again, unique for their type). And there will be a bonus weapon that opens not one cell, but several.
Please tell me how to implement it correctly. The game will be against AI. At this point, it’s also not clear to me how the switch between the player’s turn and the AI will take place.
I already tried to write this game, but the code was terrible, I had to invent something (patches) on the fly to somehow work. For example, I hung a listener on the cells of the AI field, and when I did a tap in the shot processing procedure, I called the player’s firing function.