Author Topic: Battle Ship  (Read 12667 times)

0 Members and 1 Guest are viewing this topic.

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Battle Ship
« Reply #15 on: August 02, 2010, 04:59:37 pm »
Update:
So I have completely rewritten the game. I have fixed all the issues, I believe, and so far it is about 100 bytes less than it was. I have one bug that I'm working on right now then I will post the new one.
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline yunhua98

  • You won't this read sentence right.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2718
  • Rating: +214/-12
  • Go take a dive in the River Lethe.
    • View Profile
Re: Battle Ship
« Reply #16 on: August 02, 2010, 05:39:26 pm »
cool!  Do you think it will be small enough to put into ztrumpet's Homescreen Gamepack?

EDIT:  200th post!
« Last Edit: August 02, 2010, 05:39:43 pm by yunhua98 »

Spoiler For =====My Projects=====:
Minor setback due to code messing up.  On hold for Contest.
<hr>
On hold for Contest.


Spoiler For ===Staff Memberships===:






Have you seen any good news-worthy programs/events?  If so, PM me with an article to be included in the next issue of CGPN!
The Game is only a demo, the code that allows one to win hasn't been done.
To paraphrase Oedipus, Hamlet, Lear, and all those guys, "I wish I had known this some time ago."
Signature Last Updated: 12/26/11
<hr>

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Battle Ship
« Reply #17 on: August 02, 2010, 05:52:46 pm »
cool!  Do you think it will be small enough to put into ztrumpet's Homescreen Gamepack?

EDIT:  200th post!

Nah. Well technically it is but it will add almost a kilobyte to the program. I'm about to update the original post and upload this new one.

Edit:
The original post has been edited and the new version has been posted.
« Last Edit: August 02, 2010, 06:13:47 pm by meishe91 »
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline shmibs

  • しらす丼
  • Administrator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2132
  • Rating: +281/-3
  • try to be ok, ok?
    • View Profile
    • shmibbles.me
Re: Battle Ship
« Reply #18 on: August 02, 2010, 06:19:20 pm »
just tried it out, and i am impressed
i rarely play anything in basic anymore, but this one's a keeper. props =D
EDIT: i glanced through the code really quickly and didnt see any obvious optimizations (cept mebbe where you used 1->x:1->y and then later 1->x:ans->y), but i like i said i havent messed with basic in a while and never on a screen this large, so...
DOUBLE EDIT: here's the code
Code: [Select]
:ClrHome
:"3221110000→Str2
:"MH  →Str1
:0identity(16→[A]
:DelVar TDelVar SDelVar LRepeat S=20 and T=20
:ClrHome
:For(A,1,8
:Output(A,9-8L,"++++++++
:End
:Output(1,9-8L,"PLAYER
:Output(1,16-8L,L+1
:1→X
:1→Y
:DelVar G1→R
:Repeat R=11
:Repeat K=21
:For(A,0,expr(sub(Str2,R,1
:Output(X+AG,Y+Anot(G)+8L,sub("* ",2-[A](X+AG,Y+Anot(G)+8L),1
:End
:If Ans=31
:not(G→G
:min(8-Gexpr(sub(Str2,R,1)),max(1,X+sum(DeltaList(K={25,34→X
:min(8-not(G)expr(sub(Str2,R,1)),max(1,Y+sum(DeltaList(K={24,26→Y
:For(A,0,expr(sub(Str2,R,1
:Output(X+AG,Y+Anot(G)+8L,"*
:End
:Repeat Ans
:getKey→K
:End
:End
:DelVar HFor(A,0,expr(sub(Str2,R,1
:H+[A](X+AG,Y+Anot(G)+8L→H
:End
:If not(H
:Then
:For(A,0,expr(sub(Str2,R,1
:1→[A](X+AG,Y+Anot(G)+8L
:End
:If L
:T+1+expr(sub(Str2,R,1→T
:If not(L
:S+1+expr(sub(Str2,R,1→S
:R+1→R
:End
:End
:not(L→L
:End
:1→X
:Ans→Y
:randInt(0,1→L
:Lbl 1
:Repeat S=0 xor T=0
:ClrHome
:For(A,1,8
:Output(A,1+8L,"++++++++
:End
:Output(1,1+8L,"PLAYER
:Output(1,8+8L,L+1
:For(A,1,8
:For(B,9-8L,16-8L
:Output(A,B,sub(Str1,4-[A](A,B),1
:End
:End
:1→X
:9→Y
:Repeat K=21
:Output(X,Y-8L,sub(Str1,4-[A](X,Y-8L),1
:min(8,max(1,X+sum(DeltaList(K={25,34→X
:min(16,max(9,Y+sum(DeltaList(K={24,26→Y
:Output(X,Y-8L,"S
:Output(3,4+8L,sub("ABCDEFGH",X,1
:Output(3,5+8L,Y-8
:Repeat Ans
:getKey→K
:End
:End
:If 1<[A](X,Y-8L
:Then
:Output(5,1+8L,"TRY
:Output(6,4+8L,"AGAIN
:Pause
:Goto 1
:End
:If not([A](X,Y-8L
:Then
:Output(5,3+8L,"MISS
:3→[A](X,Y-8L
:not(L→L
:Pause
:Goto 1
:End
:If 1=[A](X,Y-8L
:Then
:Output(5,3+8L,"HIT!
:If L
:T-1→T
:If not(L
:S-1→S
:2→[A](X,Y-8L
:not(L→L
:Pause
:End
:End
:End
:DelVar [A]ClrHome
:not(L→L
:Output(4,5,"PLAYER
:Output(4,12,L+1
:Output(5,7,"WON!
« Last Edit: August 02, 2010, 06:24:37 pm by shmibs »

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Battle Ship
« Reply #19 on: August 02, 2010, 06:21:38 pm »
Thanks, I'll upload the source to see if anyone else can do anymore with it. I don't think there is though, but I'm very tired so I might have missed something.
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Battle Ship
« Reply #20 on: August 02, 2010, 06:26:31 pm »
Making *any* game in a kilobyte or less is quite a task.  I myself had a pack of 1 kilobyte games in a folder somewhere but i dont have them anymore...

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Battle Ship
« Reply #21 on: August 02, 2010, 06:31:19 pm »
just tried it out, and i am impressed
i rarely play anything in basic anymore, but this one's a keeper. props =D
EDIT: i glanced through the code really quickly and didnt see any obvious optimizations (cept mebbe where you used 1->x:1->y and then later 1->x:ans->y), but i like i said i havent messed with basic in a while and never on a screen this large, so...
DOUBLE EDIT: here's the code
Spoiler For To keep this post smaller:
Code: [Select]
:ClrHome
:"3221110000→Str2
:"MH  →Str1
:0identity(16→[A]
:DelVar TDelVar SDelVar LRepeat S=20 and T=20
:ClrHome
:For(A,1,8
:Output(A,9-8L,"++++++++
:End
:Output(1,9-8L,"PLAYER
:Output(1,16-8L,L+1
:1→X
:1→Y
:DelVar G1→R
:Repeat R=11
:Repeat K=21
:For(A,0,expr(sub(Str2,R,1
:Output(X+AG,Y+Anot(G)+8L,sub("* ",2-[A](X+AG,Y+Anot(G)+8L),1
:End
:If Ans=31
:not(G→G
:min(8-Gexpr(sub(Str2,R,1)),max(1,X+sum(DeltaList(K={25,34→X
:min(8-not(G)expr(sub(Str2,R,1)),max(1,Y+sum(DeltaList(K={24,26→Y
:For(A,0,expr(sub(Str2,R,1
:Output(X+AG,Y+Anot(G)+8L,"*
:End
:Repeat Ans
:getKey→K
:End
:End
:DelVar HFor(A,0,expr(sub(Str2,R,1
:H+[A](X+AG,Y+Anot(G)+8L→H
:End
:If not(H
:Then
:For(A,0,expr(sub(Str2,R,1
:1→[A](X+AG,Y+Anot(G)+8L
:End
:If L
:T+1+expr(sub(Str2,R,1→T
:If not(L
:S+1+expr(sub(Str2,R,1→S
:R+1→R
:End
:End
:not(L→L
:End
:1→X
:Ans→Y
:randInt(0,1→L
:Lbl 1
:Repeat S=0 xor T=0
:ClrHome
:For(A,1,8
:Output(A,1+8L,"++++++++
:End
:Output(1,1+8L,"PLAYER
:Output(1,8+8L,L+1
:For(A,1,8
:For(B,9-8L,16-8L
:Output(A,B,sub(Str1,4-[A](A,B),1
:End
:End
:1→X
:9→Y
:Repeat K=21
:Output(X,Y-8L,sub(Str1,4-[A](X,Y-8L),1
:min(8,max(1,X+sum(DeltaList(K={25,34→X
:min(16,max(9,Y+sum(DeltaList(K={24,26→Y
:Output(X,Y-8L,"S
:Output(3,4+8L,sub("ABCDEFGH",X,1
:Output(3,5+8L,Y-8
:Repeat Ans
:getKey→K
:End
:End
:If 1<[A](X,Y-8L
:Then
:Output(5,1+8L,"TRY
:Output(6,4+8L,"AGAIN
:Pause
:Goto 1
:End
:If not([A](X,Y-8L
:Then
:Output(5,3+8L,"MISS
:3→[A](X,Y-8L
:not(L→L
:Pause
:Goto 1
:End
:If 1=[A](X,Y-8L
:Then
:Output(5,3+8L,"HIT!
:If L
:T-1→T
:If not(L
:S-1→S
:2→[A](X,Y-8L
:not(L→L
:Pause
:End
:End
:End
:DelVar [A]ClrHome
:not(L→L
:Output(4,5,"PLAYER
:Output(4,12,L+1
:Output(5,7,"WON!

Ya, I thought I had something like that but that doesn't make to big of deal though because both are really fast as is and it won't reduce the size any. You can take the source down though, I got it up onto the original post :) Thanks though :D

Making *any* game in a kilobyte or less is quite a task.  I myself had a pack of 1 kilobyte games in a folder somewhere but i dont have them anymore...

Really? I didn't realize it was hard to keep games like this under a kilobyte. What kind of games did you have?
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Battle Ship
« Reply #22 on: August 02, 2010, 06:49:04 pm »
There was a Snake game, Tetris, LunarLander, A defense game, among others

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Battle Ship
« Reply #23 on: August 02, 2010, 07:00:49 pm »
Oh, nice. Sorry to hear they all got deleted.
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Battle Ship
« Reply #24 on: August 02, 2010, 07:12:50 pm »
Yeah its fine, ill recreate them if i ever get bored :D

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Battle Ship
« Reply #25 on: August 02, 2010, 07:14:26 pm »
Haha sounds good :P
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline shmibs

  • しらす丼
  • Administrator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2132
  • Rating: +281/-3
  • try to be ok, ok?
    • View Profile
    • shmibbles.me
Re: Battle Ship
« Reply #26 on: August 02, 2010, 07:20:04 pm »
i think i remember that lunar lander?(or was it a different one[regardless, fine precision games like that just dont work with ascii :P])
i'd love to see the others remade, though
« Last Edit: August 02, 2010, 07:20:48 pm by shmibs »

Offline Raylin

  • Godslayer
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1392
  • Rating: +83/-25
  • I am a certifiable squirrel ninja.
    • View Profile
    • Ray M. Perry
Re: Battle Ship
« Reply #27 on: August 02, 2010, 07:59:46 pm »
It's actually quite a decent game.
I just played it. :)
Bug me about my book.

Sarah: TI-83 Plus Silver Edition [OS 1.19]
Cassie: TI-86 [OS 1.XX]
Elizabeth: TI-81 [OS 1.XX]
Jehuty: TI-83 Plus Silver Edition [OS 1.19]
Tesla: CASIO Prizm







Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Battle Ship
« Reply #28 on: August 03, 2010, 04:43:42 am »
Thank ya.
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Battle Ship
« Reply #29 on: August 03, 2010, 01:32:37 pm »
Nice job on the re-worked program. :)