nechci vám odporovat, ale já si dala jméno bejvalýho a vyšlo mi, že je dvojtá nula - ať to počítá jak to počítá, tohle je pravda
MAO
Zaslal: po 18. únor 2008 15:53 Předmět:
z žádnou ze svých bývalek jsem se nedostal přes 50%
Beat
Zaslal: po 18. únor 2008 15:05 Předmět:
Hmmm. Tak jsem si dal také pivo po vzoru Dieg0 a vyšel mi velice zajímavý výsledek. Tak to fkt nechápu podle čeho to počítá.
romulus
Zaslal: po 18. únor 2008 13:56 Předmět:
jirka: hezký...
jirkacv
Zaslal: po 18. únor 2008 13:54 Předmět:
a deti planujete?
Dieg0
Zaslal: po 18. únor 2008 13:49 Předmět:
Beat
Zaslal: po 18. únor 2008 09:23 Předmět:
Tak jsem si tam zadal všechna jména ženských za poslední dobu a nejvíce mi vyšla bejvalka!
To je pěkná ptááákovina. Je ale zase fakt, že jsem s ní byl 21let
krrttek
Zaslal: ne 17. únor 2008 12:10 Předmět:
podle mně sečte všechny písmenka a vydělí to dvěma
jirkacv
Zaslal: ne 17. únor 2008 02:51 Předmět:
tak priblizne jediny co sem z toho vycetl byly nazvy metod
jenda^^
Zaslal: ne 17. únor 2008 02:44 Předmět:
Takhle je ten kód, doufam, že je to vůbec ono:
kód:
/*
* Lovecalc.cs -- Lovecalculator class
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* Copyright (C) Meilof Veeningen <meilof@wanadoo.nl>, 2004
*/
namespace Lovecalculator
{
using System;
public class Lovecalc
{
/**
* Calculation step event handler
*
* This event handler will be called for every calculation step. The first
* argument is the current calculation string, the second argument will
* always be null.
*/
public static event EventHandler onStep;
/** Maximum number of calculation steps */
public static int patience = 50;
/** Maximum length of calculation string */
public static int maxLength = 100;
static int numberOfOccurences(String haystack, char needle)
{
int n = 0, ix = -1;
while ((ix = haystack.IndexOf(needle, ix + 1)) != -1) n++;
return n;
}
public static String countCharacters(String str)
{
String strL = str.ToLower();
String searchStr = "loves";
String ret = "";
for (int t = 0; t < searchStr.Length; t++)
ret += numberOfOccurences(strL, searchStr[t]).ToString();
return ret;
}
public static String step(String previous)
{
String ret = "";
for (int t = 0; t < previous.Length - 1; t++) {
ret += (int.Parse(""+previous[t])+int.Parse(""+previous[t+1])).ToString();
}
return ret;
}
/**
* Runs the lovecalc algoritm on the two given names
*
* @param name1 String First name
* @param name2 String Second name
*
* @return The percentage resulting from the lovecalc algorithm
*/
public static int loveCalc(String name1, String name2)
{
return loveCalc(countCharacters(name1+name2));
}
/**
* Runs the lovecalc algoritm on the given histogram string
*
* @param countstr String Histogram string
*
* @return The percentage resulting from the lovecalc algorithm
*/
public static int loveCalc(String countstr)
{
int mypatience = patience, val;
while (--mypatience >= 0 && countstr.Length < maxLength) {
if (onStep != null) onStep(countstr, null);
try { val = int.Parse(countstr); }
catch (Exception ex) { val = -1; }
if (val >= 0 && val < 100) return val;
countstr = step(countstr);
}
return 100;
}
/**
* Returns text description for the given percentage
*
* @param value int Percentage as returned by #loveCalc
*
* @return String describing the percentage
*/
public static String getDescription(int value)
{
if (value < 20) return "Sorry, poor match!";
else if (value < 40) return "Well, worth trying...";
else if (value < 60) return "It's a good chance";
else if (value < 80) return "Fine match!";
else if (value < 100) return "Go for it!";
else return "Eternal Flame!";
}
}