“AI” means nothing. If you want to learn about machine learning algorithms, neutral network programming (actual programming), heuristic collective intelligence, or path finding, then maybe we can have a conversation.
Of course AI does mean something - but it’s a very broad term. It’s a bit like saying you want to buy a vehicle. Could be a boat, car, truck or even a zeppelin.
One of the first real programs I wrote was a program to display telemetry data from a CAN bus. I was on the solar car team at uni, and we wanted to be able to view the data from the various systems live during the race. The CAN network was connected to a CAN-ethernet converter, which sent UDP packets over a wireless ethernet link to our lead car. I had no experience with networking, or UDP or CAN at all, but I had some documentation and a lot of free time, so I got to work.
Each device on the CAN network had a bit mask to identify it. For example, the bit mask for the motor controller might have been 0x1200. This meant that any packet starting with 0x12 belonged to the motor controller. For example, 0x1201 was one type of message, and 0x1202 another type, but both belonged to the motor controller.
There was specific logic for each device on the network, so you needed to first figure out which device owned a packet using the bit mask, then apply the relevant logic to decode the packet.
Looking back, I realise the correct way to approach this would be to have a list of bit masks:
Then simply bitwise & any incoming packet with 0xff00, and lookup the result in the list of bit masks.
Not knowing better however, what I actually did was create a giant dictionary of every possible packet value, so I could lookup any packet and determine which system it came from. This was so repetitive that I had to make use of my newfound super-power – vim macros – to complete the 8000 line dictionary…
Honestly, this is a good rule for programming in general. With user input, make sure it’s in its own area where it can’t interact with anything else and make sure to read and process in such a way that it can’t fuck with the operation of the program.
I did that many times with my game engine, and every time I have had to postpone a release by at least two weeks: one week of implementing the feature, one week of debugging it. (Where can I find people who want to work on an open source game engine?)
If I had a dollar for every time I proposed spending more time on something to make it flexible and able to grow but being told to “hard code it” to save time, I’d have several dollars. If I had a dollar for every time I had to patch that 6 months later, I’d have several more dollars.
You couldn’t pay me enough dollars to cover the therapy caused by having to maintain the “flexible” code that added complexity and abstraction for a single use case that was never expanded to handle more.
programmer_humor
Top
This magazine is from a federated server and may be incomplete. Browse more on the original instance.