Love prgram

Blitz3D Forums/Blitz3D Beginners Area/Love prgram

Ok here it is some fun little thing I made after some wierd thing My friend told me what you thiink!

AppTitle"Love meter"
Graphics 800,600

Print "welcome to the love meter"
Print "to find out how muche two pepole love each other"
Print "What is the first persons name!"
name1I$ = Input()
Print "What is the second persons name"
name2I$ = Input()
Print "Canculating..."
n1c#=0
n2c#=0
n1l#=0
n2l#=0
I#=0
I#=0
I#=0
I#=0
I#=0

;format string
name1$=Lower$(name1I$)
name2$=Lower$(name2I$)

;canculations

n1l#= Len(name1$)
n2l#= Len(name1$)

;name 1 letter decipher
Repeat
n1m=Mid$(name$,n1l#,1)

If n1m= "l"
l#=l#+1
ElseIf n1m= "o"
o#=o#+1
ElseIf n1m="v"
v#=v#+1
ElseIf n1m="e"
e#=e#+1
ElseIf n1m="s"
s#=s#+1
EndIf

n1c#=n1c#+1
Until n1c#=(n1l+1)

;name 2 decipher

Repeat
n2m=Mid$(name$,n2l#,1)

If n2m= "l"
l#=l#+1
ElseIf n2m= "o"
o#=o#+1
ElseIf n2m="v"
v#=v#+1
ElseIf n2m="e"
e#=e#+1
ElseIf n2m="s"
s#=s#+1
EndIf

n2c#=n2c#+1
Until n2c#=(n2l+1)

;canculation

;level 1
I1#=l#+o#
I2#=o#+v#
I3#=v#+e#
I7#=e#+s#
;level 2
I4#=I1#+I2#
I5#=I2#+I3#
I8#=I3#+I7#
;level 3
I6#=I4#+I5#
I9#=I5#+I8#
;level 4
I10#=I6#+I9#
;display
Print"These two pepole are " +I10#+ "% compatible with each other"
Print"Press any key to continue"
WaitKey()
End


Unfortunally it reurns every time what ever I input as 0.0 % can any one see why

Interesting algorithm. Unfortunately my wife and I are only 8.0% compatible. Yipes! Should I tell her? ;-)

I think you need to make these changes:

Change n2l#= Len(name1$)
to n2l#= Len(name2$)

Change n1m=Mid$(name$,n1l#,1)
to n1m$=Mid$(name1$,n1c#,1)

Change n2m=Mid$(name$,n2l#,1)
to n2m$=Mid$(name2$,n2c#,1)

>Interesting algorithm. Unfortunately my wife and I are
>only 8.0% compatible. Yipes! Should I tell her? ;-)

Never divulge information to the enemy... All she can legally ask for is name, rank and serial number... If you do, then she'll think that it's YOUR fault so obviously YOU must change so that you can be 100 percent compatible!

Andy

Oh to be a ground critter in love...

What is the first persons name!
Ten Very Evil Boll Weevils
What is the second persons name
Seventeen Slightly Evil Voles
Canculating...
These two pepole are 100.0% compatible with each other



Well the only problem with that is there false I think you'll find that it is imposiblrr to get 100%

Acturly it is possible but it shouyldn't be well I am am going to update the program now and add some bits and bob maybe amke it more graphical

well see u l8ter then!

Apparently I'm 0.0% compatible with anyone...

what a crap program :)

Im not compatible with the girl who loves me XD

Ok I rewrote the algorthim and it should now work the same but it look a lot clearer

AppTitle"Love meter"
Graphics 800,600

Print "welcome to the love meter"
Print "to find out how muche two pepole love each other"
Print "What is the first persons name!"
name1I$ = Input()
Print "What is the second persons name"
name2I$ = Input()
Print "Canculating..."
n1c#=0
n2c#=0
n1l#=0
n2l#=0
I#=0
I#=0
I#=0
I#=0
I#=0

;format string
name1$=Lower$(name1I$)
name2$=Lower$(name2I$)

;canculations

n1l#= Len(name1$)

n2l#= Len(name2$)

;name 1 letter decipher
Repeat
n1m$=Mid$(name1$,n1l#,1)

If n1m= "l"
l#=l#+1
ElseIf n1m= "o"
o#=o#+1
ElseIf n1m="v"
v#=v#+1
ElseIf n1m="e"
e#=e#+1
ElseIf n1m="s"
s#=s#+1
EndIf

n1c#=n1c#+1
Until n1c#=(n1l+1)

;name 2 decipher

Repeat
n2m$=Mid$(name2$,n2l#,1)


If n2m= "l"
l#=l#+1
ElseIf n2m= "o"
o#=o#+1
ElseIf n2m="v"
v#=v#+1
ElseIf n2m="e"
e#=e#+1
ElseIf n2m="s"
s#=s#+1
EndIf

n2c#=n2c#+1
Until n2c#=(n2l+1)

;canculation

;level 1
I1#=l#+o#
I2#=o#+v#
I3#=v#+e#
I4#=e#+s#

;level 2
I5#=I1#+I2#
I6#=I2#+I3#
I7#=I3#+I4#

;level 3
I8#=I5#+I6#
I9#=I6#+I7#

;level 4
I10#=I8#+I9#

;display
Print"These two pepole are " +I10#+ "% compatible with each other"
Print"Press any key to continue"
WaitKey()
End


You still need to change this:
n2m$=Mid$(name2$,n2l#,1)
to this:
n2m$=Mid$(name2$,n2c#,1)

And this:
n1m$=Mid$(name1$,n1l#,1)
to this:
n1m$=Mid$(name1$,n1c#,1)

Otherwise you're starting at the end of the name.

And if it's not supposed to be 100%, then you're coding it wrong. In fact, it's possible to have over 100% -- if you just add one more evil boll weevil to the mix -- watch!

welcome to the love meter
to find out how muche two pepole love each other
What is the first persons name!
eleven very evil boll weevils
What is the second persons name
seventeen slightly evil voles
Canculating...
These two pepole are 115.0% compatible with each other
Press any key to continue


I don't think you realize... all you're doing is adding up all the letters L, O, V, E, S, in both of the names and calculating this:
L+(4*O)+(6*V)+(4*E)+S


This is your program:
Graphics 640, 480
Global l,o,v,e,s

name1$ = Input("Name 1:")
name2$ = Input("Name 2:")
Print name1+" & "+name2+" are "+Calculate(name1,name2)+"% compatible."
Print "press enter to continue"
Input 
End

Function Calculate%(name1$, name2$)
	Decipher(Lower(name1))
	Decipher(Lower(name2))
	Return L+(4*O)+(6*V)+(4*E)+S
End Function

Function Decipher(name$)
	For i% = 1 To Len(name)
		Select Mid$(name, i, 1)
			Case "l" : l=l+1
			Case "o" : o=o+1
			Case "v" : v=v+1
			Case "e" : e=e+1
			Case "s" : s=s+1
		End Select
	Next
End Function


Thx for tjhe help acturlly from this piece of code I have leart something! well probally!

Hopefully you've learned how to spell calculate ;)

yep me sepll god now??

guys,

come on!

I need to software to tell me my wife and I are *NOT* compatible! just ask her ;-)

lol