Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Fix for bridgeit.bf #31
Having read your comments about bridgeit.bf here, I decided to do some digging to see if I could find the BASIC book on which your implementation was based. And while I wasn't successful in that regard, I did come across a Personal Computing article from 1977 which described a winning strategy almost exactly like the one that you were using.
Once I knew how the game was supposed to work, and the strategy used to win, it didn't take that much to get the code working correctly. There were two or three values that were incorrect in the lookup table that determined the computers move. And some of the x coordinates were off by one in the table that determined the board output position. But most of the effort was just getting the board update code to work.
I didn't want to stray too far from your original design, but you really needed to output two different characters (
But once I had the output working for the computer's move, it didn't require that much more effort to output the user moves as well - it was largely just cut and paste. So I thought that was worth adding too, because it really does make the game more playable.
The end result was this:
I realise it's a bit late now, with version 2.25 having been released, but I thought you might appreciate it anyway, even if you don't want to add it back to the examples.