Page 1 of 1 1
Topic Options
#88325 - 2002-09-27 03:31 PM KiXWeeper v1.3 - Kixtart in MAJOR!
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
code:
$name="KiXWeeper v1.3"
$author="1.0 Shawn","1.1 Lonkero","1.2 Lonkero","1.3 Lonkero"
$Form = CreateObject("Kixtart.Form")
$Form.Caption = $name
$Form.BackColor = 255,255,255
$Form.ForeColor = 50,0,170
$Form.FontName = "Courier New"
$Form.FontBold = 1
$Form.FontSize = 10

$level=$form.slider(,15,12,75,25)
$level.tooltip="Level: 0"
$level.min=11
$level.onscroll="$$level.tooltip='Level: '+($$level.value-11)"
$=11
for $height=390 to $form.screen.height step 25 $=$+1 next
$level.max=$-1 ;<-if you remove this -1 you will get error every time!
$thislevel=11

Global $Button[$,$], $mine
$map=$Button
$r=0 $b=0
For $Top = 50 To ($*25+25) Step 25
For $Left = 10 To ($*25-15) Step 25
$map[$r,$b] = $Form.label(,$left,$top,25,25)
$map[$r,$b].hide
$map[$r,$b].alignment=2
$map[$r,$b].FontSize=14
$map[$r,$b].BorderStyle=1
$Button[$r,$b] = $Form.button(,$left,$top,25,25)
$Button[$r,$b].hide
$Button[$r,$b].FontBold = 1
$Button[$r,$b].onclick="button_click($r,$b)"
$b=$b+1
Next
$b=0
$r=$r+1
Next

$Time = $Form.Label
$Time.Size = 75,30
$Time.Alignment = 1
$Time.BorderStyle = 4
$Time.Fontname = "Courier New"
$Time.Fontsize = 14
$Time.Fontbold = 1
$Time.BackColor = 0
$Time.ForeColor = 255,255,0

$start=$form.button("New Game",225,10,75,25)
$start.onclick="new($$level.value)"

new(11)
$Form.Show

While $Form.Visible
$=Execute($Form.DoEvents)
Loop

Exit 1

Function Button_Click($r,$b)
$=$thislevel
select
case not $Button[$r,$b].visible
case " "=$map[$r,$b].caption
$Button[$r,$b].Hide
$Score=$Score+1
$Button[$r,$b].hide
if $b>0 and $r>0 button_click($r-1,$b-1) endif
if $r>0 button_click($r-1,$b) endif
if $b<$ and $r>0 button_click($r-1,$b+1) endif
if $b>0 button_click($r,$b-1) endif
if $b<$ button_click($r,$b+1) endif
if $b>0 and $r<$ button_click($r+1,$b-1) endif
if $r<$ button_click($r+1,$b) endif
if $b<$ and $r<$ button_click($r+1,$b+1) endif
case instr($map[$r,$b].caption,"X")
$map[$r,$b].forecolor=255,0,0
$Button[$r,$b].Hide
$map[$r,$b].show
for $r=0 to $
for $b=0 to $
if $button[$r,$b].visible $Button[$r,$b].caption=$map[$r,$b].caption $Button[$r,$b].enabled=0 endif
next
next
$timer=0
case 1
$map[$r,$b].forecolor=50,0,170
$Button[$r,$b].Hide
$Score=$Score+1
endselect
$map[$r,$b].show
if $Score = ($+1)*($+1)-($+1)*($+1)/10
$timer=0
$=messagebox("GOOD! You made your way trough the mine fields!",$name)
endif
if $timer and $timer<>0
$timer=$Form.timer(1000)
$timer.ontimer="$$time.caption=1+val($$time.caption)"
endif
EndFunction

function new($size)
$score=0
$thislevel=$size
$timer=1
$Time.Caption = 0
$mine=" ,"
srnd(@ticks)
do $=rnd(($size+1)*($size+1))
if not instr($mine,$) $mine="$mine ,"+$ endif
until (($size+1)*($size+1)/10+1)<ubound(split($mine," ,"))

for $r=0 to $level.max
for $b=0 to $level.max
if $b>$size or $r>$size
$Button[$r,$b].hide
else
$Button[$r,$b].caption=""
$Button[$r,$b].enabled=1
$Button[$r,$b].show
endif
$map[$r,$b].hide
$map[$r,$b].caption=""
next
next

$Form.Width = $size*25+50
$Form.Height = $size*25+115
$Form.Center
$Time.Center
$Time.Top = 10
$start.left=$form.width-95

$c=1
for $r=0 to $size
for $b=0 to $size
if instr($mine,",$c ,") $map[$r,$b].caption="X" endif
$c=$c+1
next
next

for $r=0 to $size
for $b=0 to $size
if not instr($map[$r,$b].caption,"X")
$=0
if $b>0 and $r>0 if instr($map[$r-1,$b-1].caption,"X") $=$+1 endif endif
if $r>0 if instr($map[$r-1,$b].caption,"X") $=$+1 endif endif
if $b<$size and $r>0 if instr($map[$r-1,$b+1].caption,"X") $=$+1 endif endif
if $b>0 if instr($map[$r,$b-1].caption,"X") $=$+1 endif endif
if $b<$size if instr($map[$r,$b+1].caption,"X") $=$+1 endif endif
if $b>0 and $r<$size if instr($map[$r+1,$b-1].caption,"X") $=$+1 endif endif
if $r<$size if instr($map[$r+1,$b].caption,"X") $=$+1 endif endif
if $b<$size and $r<$size if instr($map[$r+1,$b+1].caption,"X") $=$+1 endif endif
if $=0 $map[$r,$b].caption=" " else $map[$r,$b].caption=$ endif
endif
next
next
endfunction



[ 29. October 2002, 10:28: Message edited by: Lonkero ]
_________________________
!

download KiXnet

Top
#88326 - 2002-09-27 03:35 PM Re: KiXWeeper v1.3 - Kixtart in MAJOR!
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
ah, it can be also downloaded from:
http://www.gwspikval.com/jooel/scripts/KiXweeper/

requirements are the usual, but recommended are:
kix 4.12 beta1
kixforms 2.0.5

 
_________________________
!

download KiXnet

Top
#88327 - 2002-09-30 04:04 AM Re: KiXWeeper v1.3 - Kixtart in MAJOR!
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
Updated.
changelog:
-instead of 10 mines 15
-empty shown as empty (was 0)
-if empty field, uncovers the ones next to it (just like the m$ mine does...)

still lacks the level, but working on it...
_________________________
!

download KiXnet

Top
#88328 - 2002-09-30 05:32 AM Re: KiXWeeper v1.3 - Kixtart in MAJOR!
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Is your link working there Jooel ? Can't connect !
Top
#88329 - 2002-09-30 05:34 AM Re: KiXWeeper v1.3 - Kixtart in MAJOR!
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
it seems our webserver is down.
 

{edit}
no, it's actually sonera's network body...
sonera is always down.
this outage has been there already for several hours...

[ 30. September 2002, 05:37: Message edited by: Lonkero ]
_________________________
!

download KiXnet

Top
#88330 - 2002-09-30 05:39 AM Re: KiXWeeper v1.3 - Kixtart in MAJOR!
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
you can still copy&paste it from above...
_________________________
!

download KiXnet

Top
#88331 - 2002-09-30 05:45 AM Re: KiXWeeper v1.3 - Kixtart in MAJOR!
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Very nice ... very well done.

Suggestions: Make it so that if you right click on a button .. it drops a flag - like change the caption to "M" to mean "Mine" ...

Is it possible to actually destroy the button when it opens up ... and paint the numbers on the background using different colors ?

Top
#88332 - 2002-09-30 05:47 AM Re: KiXWeeper v1.3 - Kixtart in MAJOR!
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
yes, the first 1.0 did that but...

the redrawing did not work. meaning that every new came would need replacing the whole background (in english: re-create the form)
_________________________
!

download KiXnet

Top
#88333 - 2002-09-30 06:51 AM Re: KiXWeeper v1.3 - Kixtart in MAJOR!
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I faced also the stack overflow! [Big Grin]

making dynamic sizes according to desktop size...

it was enough to have 17*17 board and almost every time it ended up with stack overflow...
 
_________________________
!

download KiXnet

Top
#88334 - 2002-09-30 08:59 AM Re: KiXWeeper v1.3 - Kixtart in MAJOR!
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
latest update 1.3:
- level can be self adjusted.
amount of mines comes along.
size limit is the screen height.
- minor fixes

a word of warning. running with 4.12 beta 1 almost 1 of 3 games end up in stack overflow.

it probably has something to do with nested functions but still, it should not do that.
so, seems like a bug...

anyway, it's pretty much I can do now as I'm getting tired.

maybe someone else wants to add the flag thingie in there.

btw, current record 19s.
_________________________
!

download KiXnet

Top
#88335 - 2002-09-30 02:03 PM Re: KiXWeeper v1.3 - Kixtart in MAJOR!
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Wow Jooel - this is impressive stuff.
Top
#88336 - 2002-09-30 03:40 PM Re: KiXWeeper v1.3 - Kixtart in MAJOR!
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
that is really [Cool] . I will have to dig through the code next weekend so that I can learn something new.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#88337 - 2002-10-21 02:03 PM Re: KiXWeeper v1.3 - Kixtart in MAJOR!
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
has anyone got any change to "dig" into this?

I changed some syntax and all I'm getting still is stack overflow...
_________________________
!

download KiXnet

Top
#88338 - 2002-10-22 09:00 AM Re: KiXWeeper v1.3 - Kixtart in MAJOR!
Ruud van Velsen Moderator Offline
Developer
*****

Registered: 1999-05-06
Posts: 391
Loc: Amsterdam, The Netherlands
Just checking: is the stack overflow still there with 4.12 beta 2?

Ruud

Top
#88339 - 2002-10-22 09:14 AM Re: KiXWeeper v1.3 - Kixtart in MAJOR!
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
yep.

 
_________________________
!

download KiXnet

Top
#88340 - 2002-10-29 10:30 AM Re: KiXWeeper v1.3 - Kixtart in MAJOR!
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
Hey!
It really is gone in 4.12 RC-1!!!

played in full screen mode some laps and no overflows anymore!

thanks ruud.
_________________________
!

download KiXnet

Top
Page 1 of 1 1


Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 1172 anonymous users online.
Newest Members
StuTheCoder, M_Moore, BeeEm, min_seow, Audio
17884 Registered Users

Generated in 0.04 seconds in which 0.018 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org