Last summer, I set out to work on a Python project that I thought would really help move me along in the language, be fun to program, and be a good way to showcase my skills in the future. Now, I’ve since moved away from programming and the emphasis I placed on Python to be 100% cybersecurity focused for the time being, however, the whole experience taught me a lot about project organization and having to switch roles.
By switch roles, I mean that there came a point where I realized I was going to need graphical assets for the program. Most likely, these graphical assets are already out there, created by professionals, or by people who are much better at that sort of thing than I am. ChatGPT could probably quickly direct me to just the assets I’m looking after about 5 minutes of chatting. However, in the moment, I didn’t want to waste time doing endless searches. Now, I would naturally know where to look, and who to ask, but at the time I just wanted to get going with my program.
Creating the graphical assets meant that I had to figure out what sizes everything had to be. For instance, what about the grid? How large does it have to be? Also, the ships are placed on the grid, how big do the ships have to be? At this very moment, I can think of a thousand ways to get the assets I need at the right size, and in better quality. There’s probably a thousand games out there that have boats in them like you might find in Battleship, no problem there. There’s probably already stuff online! However, I chose to find pictures of the actual ships in Battleship, and use those.
So, what this meant, was that I had to make sure the ships were appropriately sized, so that when they were placed on the grid, they fit within the specific series of squares that they did. They all had to be some multiple of the size of an individual square, and for that, I had to mathematically work out just what that would be. And with that knowledge, I could adjust the size of the images so that when they were placed on the grid, they fit nice and snug in the series of squares. Furthermore, I didn’t know how to rotate these images in Python, which is probably a trivial matter with the right library. Also, ChatGPT could probably bang out code that does just this in a matter of seconds. But this was ancient history, ie, before ChatGPT, 2022. After all of this was over, I had the graphical assets I needed – A gameboard, and properly sized images for each ship in the horizontal and vertical directions.
The final piece of the puzzle came with the code necessary to compensate for the offsets in placing the assets. For instance, I didn’t know how to just say “Okay Python, put the destroyer at A4”. I had to work out how many pixels away from the border of the game board that A4 actually was, and then work in some more mathemagic that accounted for the individual pixels in the black lines that surrounded each square. In the end, I had my equation to place any ship, and I had the code that turned what was initially a text based Battleship clone, into something that could actually place ships on the game board.
I was glad to have undertaken this, because, it was a great exercise in organization and program development. I had to take on the role “lead artist” or something — it wasn’t a very artistic endeavor, but it did involve the acquisition of graphical assets. So call that whatever it is, I don’t know what it is. I suppose I could go ask ChatGPT and they could tell me…