Author Topic: Mine  (Read 12031 times)

0 Members and 1 Guest are viewing this topic.

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Mine
« on: November 20, 2011, 08:42:42 pm »
MIENCR4F7 IN TI-BASIC W0000T!!!11

J/k, I wish :P It's actually Minesweeper, but with flood-fill and everything! :D

http://img.removedfromgame.com/imgs/mine.gif

That's full speed on a TI-84 Plus, so you can tell that the flood-filling is a bit slow. I'm still trying to improve it, but the code's about as optimized as I can get it right now O.O

Multiple levels coming soon. It's actually fully implemented; all I need to do is add a menu.

LATEST UPDATE: http://omniurl.tk/11535/211326/

« Last Edit: November 24, 2011, 03:08:17 pm by Deep Thought »




Offline mrmprog

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 559
  • Rating: +35/-1
    • View Profile
Re: Mine
« Reply #1 on: November 20, 2011, 08:44:32 pm »
OMGZ! Minecraft! With better graphics!
Seriously, nice job. +1

Offline zeldaking

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 197
  • Rating: +15/-0
    • View Profile
Re: Mine
« Reply #2 on: November 20, 2011, 08:46:15 pm »
Looks pretty good for a ti-basic. A lot better than my version, which is very dumb. I like the white on black.

Offline epic7

  • Chopin!
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2200
  • Rating: +135/-8
  • I like robots
    • View Profile
Re: Mine
« Reply #3 on: November 20, 2011, 08:48:12 pm »
I never figured out how the heck to play minesweeper.

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Mine
« Reply #4 on: November 20, 2011, 08:49:28 pm »
What sort of fields should I use for medium/hard mode? The mode in the screenshot is Windows-classic Beginner (9x9 board with 10 mines), but their Intermediate and Expert modes (16x16 and 30x16) don't exactly fit on a calculator screen :P




Offline mrmprog

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 559
  • Rating: +35/-1
    • View Profile
Re: Mine
« Reply #5 on: November 20, 2011, 08:50:25 pm »
What size are the squares now?

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Mine
« Reply #6 on: November 20, 2011, 08:51:10 pm »
Each square is 5x5 with a border of one between any two rows/columns.




Offline epic7

  • Chopin!
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2200
  • Rating: +135/-8
  • I like robots
    • View Profile
Re: Mine
« Reply #7 on: November 20, 2011, 08:55:31 pm »
Make more mines for hard

Offline mrmprog

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 559
  • Rating: +35/-1
    • View Profile
Re: Mine
« Reply #8 on: November 20, 2011, 09:05:09 pm »
So with that, 16*10 is the max size?

Offline BrandonW

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 115
  • Rating: +38/-1
    • View Profile
Re: Mine
« Reply #9 on: November 20, 2011, 09:22:06 pm »
Your description implies you aren't randomly generating new boards. Why not?

Offline BalancedFury

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 722
  • Rating: +29/-2
    • View Profile
Re: Mine
« Reply #10 on: November 20, 2011, 09:23:03 pm »
MIENCR4F7 IN TI-BASIC W0000T!!!11

J/k, I wish :P It's actually Minesweeper, but with flood-fill and everything! :D



That's full speed on a TI-84 Plus, so you can tell that the flood-filling is a bit slow. I'm still trying to improve it, but the code's about as optimized as I can get it right now O.O

Multiple levels coming soon. It's actually fully implemented; all I need to do is add a menu.
Just some ideas but you should make the mines/ bombs into creepers XD
Antonio Nam = DualBLDR = Tony Arthur... U choose!





JOIN THE PETITION TO ADD THIS EMOTICON!!
[|:{P ------->


Yo dawg I herd u lost the game game so I coded the game game in your calc so you can lose the game game while you code your code about losing the game game.

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Mine
« Reply #11 on: November 20, 2011, 09:52:12 pm »
Your description implies you aren't randomly generating new boards. Why not?
I am; I'm just trying to decide what board sizes to use for the other difficulty levels.




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: Mine
« Reply #12 on: November 20, 2011, 10:07:22 pm »
Very nice, Deep.  Great job on this, as always.

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Mine
« Reply #13 on: November 20, 2011, 10:28:06 pm »
Cool!  What kind of flood fill algorithm are you using?  Often times the difference in speed is not due to optimization, but algorithm :D

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Mine
« Reply #14 on: November 20, 2011, 10:39:30 pm »
Yeah, I know why it's slow, and it's because my algorithm is pretty bad :/ Here's my flood-fill code:
Quote from: TI-BASIC
{~1.01,~.01,.99,~1,1,~.99,.01,1.01->L3
DelVar I{A+sub(B->L2
Repeat I=dim(L2
I+1->I
L2(Ans
F+pxl-Test(600fPart(Ans)+2,6iPart(Ans)+2->F
sum(seq(max(L1=L2(I)+L3(J)),J,1,8
If Ans
Then
" "+sub("12345678",Ans,1)+"
Else
For(J,1,8)
L2(I)+L3(J
If Ans>=0 and iPart(Ans)<C and |E2fPart(Ans)<D and prod(L2-Ans
Ans->L2(1+dim(L2
End
"     
End
Text(600fPart(L2(I))+1,6iPart(L2(I))+2,Ans
End
The stuff between lines 11 and 15 are what's really slowing the thing down. It goes through the eight surrounding pixels and individually tests them to see if they're valid or not, and if so they get appended to the queue (L2). Because it has to do this for every element on the queue that doesn't have any mines surrounding it, blank squares take a while to show up.

I tried to implement the third algorithm on the Wikipedia article, but since there are eight directions in Minesweeper and three classes of elements (blank, numbered, mine), it turned out to be even slower than the one I have.
« Last Edit: November 20, 2011, 10:40:02 pm by Deep Thought »