how do you map this logic to human language?
You mean something like this:
- Keep track of the first point and its key in some local variables.
- Look at each key+point pair in turn, comparing its Y value to the one in that local variable.
- If the current point's Y is larger than the Y in the local variable, replace the contents of the local variables with the current point and its key.
- Once all points have finished being compared, the local variables should now contain the values of the largest point, so return them as the last statement in the function.
I was always thinking there was a way to tell the machine what to do as it was your employee, but I cant really see it possible, (otherwise there wasnt a need for programing language i guess).
That's still just a pipe dream ... one that was thought up in the 50s - 60s: What's referred to as a 4th generation programming language, i.e. a natural human language. 3rd being the normal programming languages we use mostly (e.g. Lisp / C / Python / etc.), 2nd being assembly code (i.e. CPU instructions as abreviated words), 1st being the 1s and 0s representing the on/off signals the CPU actually receives and sends.
Unfortunately human languages are very complex with lots of ambiguity, not the best thing for a computer to "understand". For these to actually work, you'd need a computer with "true" artificial intelligence, i.e. it would need to "understand" your meaning instead of just following a set of steps.