开发者

I am a beginner programmer and want to design a Battleship program in LC3 assembly

开发者 https://www.devze.com 2023-01-19 03:58 出处:网络
I don\'t really know how or where to start my algorithm on showing the d开发者_如何学JAVAisplay grid for the game.Design the game in pseudocode first, so that you can get the general ideas worked out

I don't really know how or where to start my algorithm on showing the d开发者_如何学JAVAisplay grid for the game.


Design the game in pseudocode first, so that you can get the general ideas worked out (data structures, algorithms, etc). Once you have a theoretical design worked out then you can start coding.


Here's a good place to start:

http://twoguysonebit.com/2010/02/16/code-battleship-game-written-in-mips-assembly/


The simplest way would to just dump the display out as strings of text:

  0 1 2 3 4 5 6 7 8 9
0 x . B B B B * x x .
1 . . . . . x . . . .    

etc.

And let the map scroll.

Later, if you want to get fancy, you can (likely) output ANSI escape codes for an ANSI terminal, then you can just update the screen as you like...old school.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号