News for hackers. Stuff that matters.
Re:Is this the simplest (and most surprising) sorting algori... by ttul on Tuesday October 05, 2021 @05:11PM (#28765681)
Haha. Reminds me of a lab where we had to program a 6502 to play some sort of game, rendered on an oscilloscope. My genius friend stayed up all night writing code that rendered the snake by dynamically writing code, rather than the obvious approach of reading the “snake” coordinates and rendering those to the screen.

Our snake code ran at something obscene like 1,000 Hz. So much faster than anyone else’s. The professor couldn’t understand how we did it, so gave a low mark.

Re:Is this the simplest (and most surprising) sorting algori... by Ageodene on Tuesday October 05, 2021 @09:18PM (#28767972)
>The professor couldn’t understand how we did it, so gave a low mark.

That was genuinely upsetting to read.

Re:Is this the simplest (and most surprising) sorting algori... by flemhans on Tuesday October 05, 2021 @09:26PM (#28768053)
In High School 2004 I made a license plate detection system for our IT class project. It was not perfect, granted, but was able to locate license plates in a photograph pretty reliably and do OCR on them.

Teacher was like, nah, that's not possible, and clearly hadn't even read it. Gave me an A just to stop me complaining, still not understanding the project.

Re:Is this the simplest (and most surprising) sorting algori... by selcuka on Tuesday October 05, 2021 @09:43PM (#28768204)
My Fortran professor gave me a low mark because I used a lookup table for octal to binary conversion, instead of using division and modulo.
Re:Is this the simplest (and most surprising) sorting algori... by dann0 on Tuesday October 05, 2021 @07:56PM (#28767335)
In a teaching lab in 1995, I had to make a digital thermometer using a mcu. I wrote code that dynamically read the voltage drop on the sensor and calculated the temperature. It was fast enough and easy to calibrate. The code was small and easy to understand.

I didn’t pass because the point of the assignment was to use lookup tables, even though that was a more complex approach in this case :(

Re:Is this the simplest (and most surprising) sorting algori... by gerdesj on Tuesday October 05, 2021 @08:23PM (#28767585)
"It was fast enough and easy to calibrate."

Are you sure about easy to calibrate 8) Did your solution have the same level of accuracy across the range as the MCU would provide?

Bizarrely, you sometimes have to follow the standards because that is what everyone does. I can't think of an example now but there will and have been cases in engineering where the wrong answer is the right one because that is what is done. I know of mensuration devices that "model" some curves with a linear approximation and paper over the errors with cough error estimates and/or keeping within the nearly linear range. That too is fine if everyone understands what is going on.

Accuracy is a funny old thing.

However, I like your approach and it shows you probably understand the principles involved. Ideally, if you are going to be a smart arse like that, then submit two solutions - the proscribed one and your clever one.

You mention a MCU but not what sort of sensor ...

Re:Is this the simplest (and most surprising) sorting algori... by snarkypixel on Tuesday October 05, 2021 @11:29PM (#28768849)
Curious as to what you mean by "dynamically writing code"
Re:Is this the simplest (and most surprising) sorting algori... by NotSammyHagar on Wednesday October 06, 2021 @12:40AM (#28769265)
Like meta programming, creating a string to define a query and then executing the string. In the case above, you dynamically create the program you need to solve the problem and then execute it. This is different than "solving the problem". You are writing a program to "write the program to solve the problem".
Re:Is this the simplest (and most surprising) sorting algori... by moffkalast on Wednesday October 06, 2021 @10:08AM (#28773382)
Doesn't sound like this kind of complicated string eval would be able to do 1000Hz but then again I also have no clue where you could possibly need that for a snake game. On an oscilloscope you'd need to produce vector lines to move from/to right?
Re:Is this the simplest (and most surprising) sorting algori... by OvermindDL1 on Wednesday October 06, 2021 @02:22PM (#28776415)
More likely, I would wager that they were just overwriting the instructions to draw with new instructions that just inline everything so it didn't need to fetch out to anything.
Re:Is this the simplest (and most surprising) sorting algori... by ttul on Wednesday October 06, 2021 @09:00PM (#28780459)
Yes. This.