Hello. For the BPC contest, I plan on making a Battleship game, so I decided to make this thread because I anticipate having more than a few questions and I also wanted your feedback. Here is the code for the menu:
BASIC Code wrote:
:0,1,0,6,5,4,3,2,1,0,7,0,6,5,4,3,2,1,0,1,0,0→L4
:0,1,1,2,2,2,2,2,2,2,3,3,4,4,4,4,4,4,4,5,5,6→L5
:ClrDraw
:ClrHome
:DelVar ADelVar B0→Xmin
:0→Ymin
:92→Xmax
:64→YMax
:Repeat C=45 or (C=21 and B=9)
:DelVar CClrDraw
:Text(‾1,0,0,"BATTLESHIP BASIC
:Text(8,0,"CREATED BY ROBERTO SANCHEZ
:Horizontal(47
:Text(24,29,"START GAME
:Text(32,29,"INSTRUCTIONS
:Text(40,29,"ABOUT
:Text(48,29,"EXIT")
:StorePic 1
:20→A
:33→B
:Repeat C=21 or C=45
:1→dim(L1
:1→dim(L2
:augment(L1,L4+A→L1
:augment(L2,L5+B→L2
:Plot1Scatter ,L1,L2,[Dot])
:RecallPic 1
:Repeat C=21 or (C=25 and B≠33) or (C=34 and B≠9) or C=45
:getKey→C
:End
:B+8(C=25→B
:B-8(C=34→B
:End
:PlotsOff
:End
:DelVar ADelVar BDelVar CDelVar Pic1ClrDraw
:Output(1,1,"
Generated by SourceCoder, © 2005 Cemetech

Here is some code I made that I would use to place the ships on a grid, the example is for the PT Boat:
BASIC Code wrote:
:3,2,4,1,5,4,3,2,1,0,3,2,4,3,2,3,2→∟A
:0,0,1,1,2,2,2,2,2,2,3,3,4,4,4,5,5→∟B
:8,8→dim([E]
:DelVar DPlotsOff
:For(B,0,64,8
:Line(0,B,64,B
:Vertical B
:End
:1→C
:DelVar ADelVar BStorePic 1
:Repeat D=21
:1→dim(L1
:1→dim(L2
:augment(L1,∟A+(8A)→L1
:augment(L2,∟B+(8B)→L2
:Plot1Scatter ,L1,L2,[Dot]
:RecallPic 1
:Repeat D=21 or (D=24 and A≠0) or (D=26 and A≠7) or (D=25 and B≠7) or (D=34 and B≠0)
:getKey→D
:End
:A+(D=26→A
:A-(D=24→A
:B+(D=25→B
:B-(D=34→B
:End
:StorePic 1
:A+1→A
:7-B→B
:C→[E](B,A
:C+1→C
:DelVar D
Generated by SourceCoder, © 2005 Cemetech


My questions are:
1. Is there some faster way to generate the menu/grid? I noticed that when plotting the statisical sprites it erases everything on the graphscreen, so I decided the easiest way was to store the text and line in a temporary picture, and recall the picture after the sprite was plotted.
2. In the menu, the sprite for the cursor has a gap, yet when I plot it on the bottom-left of the screen, it doesn't have the gap. Why does this happen?

Thanks in advance for the help.
Re: #2: you don't have a consistent delta X or delta Y between the menu window and the play window. Check your zooming.
KermMartian wrote:
Re: #2: you don't have a consistent delta X or delta Y between the menu window and the play window. Check your zooming.

Yes that was the problem. Xmax set to 96 solves it.
Awesome. Now for #1 - that grid code looks as 1337 as it's gonna get. I'm not sure about the rest of the code for the vehicle rendering though.
KermMartian wrote:
Awesome. Now for #1 - that grid code looks as 1337 as it's gonna get. I'm not sure about the rest of the code for the vehicle rendering though.

Vehicle rendering??
I also have a little side question for Java programmers. In the CD that came with the Learning Computer Programming book, I found an application called Forte and installed it. However, it did not come with any documentation and the book didn't explain it. Anyone around here use Forte?
Sorry, vessel rendering, as in ships. You're using StatSprites for that, correct? If so, I can't think of anything better to do there.
KermMartian wrote:
Sorry, vessel rendering, as in ships. You're using StatSprites for that, correct? If so, I can't think of anything better to do there.

woot...woot. Very Happy

sorry. Just had to do that.
Before anymore help is given here, I need to point this to you. No cheating. Smile
Confused Who's cheating? I don't see any cheating going on, unless you mean it's cheating to ask for help...
The "this" was a link. We can't ask for help. Sad
Ohh....should I close this topic then?
lol, yes it should be. Razz
Birdman said it's ok, so I unlocked it.
Oh I didn't know about this rule. Birdman you should have posted those rules on the contest page. Anyways my plans for this program are to include the "Start Game" ,"Instructions" ,and "About" options all in If...Then statements, and including a series of Repeat loops inside the If...Then for the "Start Game". But then I started thinking about program fatigue, and how a program would slow down if it didn't reach the "end". Considering my current plans, will program fatigue be a problem? I would also like to give many thanks for Elfprince's Stat Sprite program. It is a big help. Good Idea
something1990 wrote:
Oh I didn't know about this rule. Birdman you should have posted those rules on the contest page. Anyways my plans for this program are to include the "Start Game" ,"Instructions" ,and "About" options all in If...Then statements, and including a series of Repeat loops inside the If...Then for the "Start Game". But then I started thinking about program fatigue, and how a program would slow down if it didn't reach the "end". Considering my current plans, will program fatigue be a problem? I would also like to give many thanks for Elfprince's Stat Sprite program. It is a big help. Good Idea


for a game like Battleship, program fatigue is almost certainly a problem. the longer you play and the bigger the program, the worse it becomes. plus, you want to demonstrate good coding for a contest, right?
If you had read the "fine print" you would have found something along the lines of
Quote:
A project that prior to this contest has been released or distributed will not qualify as a valid entry and is subject to rejection.


So, interpreted, Before the contest winners are announced, if you post your code or a beta version etc. anywhere, you are screwed. Meaning -3 points and a whack on the head Smile

It's not a big deal. Don't worry about the -3 points or whatnot.
elfprince13 wrote:
for a game like Battleship, program fatigue is almost certainly a problem. the longer you play and the bigger the program, the worse it becomes. plus, you want to demonstrate good coding for a contest, right?

a. That was one of my worst fears. To avoid Labels and Gotos I wanted to keep the whole thing in one Repeat loop, then keep the options in If...Then, and keep the gameplay in another series of Repeat/While Loops. Will this cause severe program fatigue or moderate program faigue that might not ba as noticeably considering the gameplay of Battleship?
@Birdman That isn't fine print. Your rules didn't have fine print. I thought the rules were preety clear until we came to this problem. You might also say the menu I have could be used as some sort of tutorial for using graphical menus, and for the gameplay part, you can say it is used as some sort of tutorial teaching how matrices can be used in a program.
I was joking about the fine print. I was in one of those odd comedic moods.

As I said, don't worry about it.
something1990 wrote:
elfprince13 wrote:
for a game like Battleship, program fatigue is almost certainly a problem. the longer you play and the bigger the program, the worse it becomes. plus, you want to demonstrate good coding for a contest, right?

<font color=red>censored</font>. That was one of my worst fears. To avoid Labels and Gotos I wanted to keep the whole thing in one Repeat loop, then keep the options in If...Then, and keep the gameplay in another series of Repeat/While Loops. Will this cause severe program fatigue or moderate program faigue that might not ba as noticeably considering the gameplay of Battleship?
@Birdman That isn't fine print. Your rules didn't have fine print. I thought the rules were preety clear until we came to this problem. You might also say the menu I have could be used as some sort of tutorial for using graphical menus, and for the gameplay part, you can say it is used as some sort of tutorial teaching how matrices can be used in a program.


Umm..."program fatigue" doesn't actually exist, it's just an effect of Gotoing out loops or conditionals.
What you're saying is I shouldn't listen to Elfprince and stop worrying about it?
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 2
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement