Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for bridgeit.bf #31

Open
j4james opened this issue Dec 15, 2018 · 1 comment
Open

Fix for bridgeit.bf #31

j4james opened this issue Dec 15, 2018 · 1 comment

Comments

@j4james
Copy link

j4james commented Dec 15, 2018

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 (| vs -) for different sections of the board, otherwise the bridges wouldn't make sense. And I also though it would be a good idea to overwrite both digits of the board number, otherwise the output was a bit messy. Unfortunately those two changes added a fair bit of complexity to the code.

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:

v >                                          v
 "Enter position of your move or 0 to quit: "<v
>1095+p                     vv*25             <
"  c    c    c    c    c   " <v*25
"h  1 h  2 h  3 h  4 h  5 h"  <v*25
"  c  6 c  7 c  8 c  9 c   "   <v*25
"h 10 h 11 h 12 h 13 h 14 h"    <v*25
"  c 15 c 16 c 17 c 18 c   "     <v*25
"h 19 h 20 h 21 h 22 h 23 h"      <v*25
"  c 24 c 25 c 26 c 27 c   "       <v*25
"h 28 h 29 h 30 h 31 h 32 h"        <v*25
"  c 33 c 34 c 35 c 36 c   "         <v*25
"h 37 h 38 h 39 h 40 h 41 h"          <v*25
"  c    c    c    c    c   ">#        #< #v*25    $# $# $#         v#
 AFGHIBCDEKJPQRSLMNOUTZ[\]VWXY_^defg`abcih>:#,_&:!#v_:95+g"@"-095+pv
738=BG5:?D38=BG5:?D38=BG5:?D38=BG5:?D38=BG
133333444455555666677777888899999::::;;;;;
v"My move is "                                                p+591<
>:#,_095+g:.v  v"I accept your wish to concede."*25<
  v,*25,"." <  >:#,_@
 ->97+g"/"-::2%!37*g\095+g96+g"0"-\p:2%45*g\095+g96+g"/"-\p 195v
-|vp\-"/"g+69g+591\g*73%2:p\-"0"g+69g+591\g*54!%2::-"/"g+79  g+<

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.

@cpressey
Copy link
Member

This is great. Thanks for doing this. Sorry it's taken me so long to respond here. I did mention it in an announcement on New Years Eve, so it got in under the wire, so to speak.

With luck there will be a 2.26 release, which will fix up a few of the annoying things that came to light last year, and it will include this. It's just that Befunge-93 is not in the priority spotlight right now, so to speak, so when that's gonna happen, I cannot say.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants