This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://www.evanmiller.org/how-not-to-sort-by-average-rating.html | |
Float:Rating_Score(tOne, tTwo, tThree, tFour, tFive, Float:brenouli_param = 0.9604) | |
{ | |
new total = tOne + tTwo + tThree + tFour + tFive, | |
Float:positive = tTwo * 0.25 + tThree * 0.5 + tFour * 0.75 + tFive, | |
Float:negative = total - positive; | |
return Float:(((positive + 1.9208) / (positive + negative) - 1.96 * floatsqroot(((positive * negative) / (positive + negative)) + brenouli_param) / (positive + negative)) / (1 + 3.8416 / (positive + negative))); | |
} | |
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define RUN_TESTS | |
#include <YSI_Core\y_testing> | |
removeColorCode(const str[],output[]) | |
{ | |
new bad, out_track = -1, back_track; | |
for (new i, length = strlen(str); i < length; ++i) | |
{ | |
if (str[i] == '{' && i < length - 1 - 7 && str[i + 7] == '}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool:IsSequence( main_string[ ] , sub_string[ ] , first_size = sizeof( main_string ) , second_size = sizeof( sub_string ) ) | |
{ | |
if( !second_size ) return true; | |
if( !first_size ) return false; | |
if( main_string[ first_size - 1 ] == sub_string[ second_size - 1 ] ) | |
return IsSequence( main_string , sub_string , first_size - 1 , second_size - 1 ); | |
return IsSequence( main_string , sub_string , first_size - 1 , second_size ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ShuffleArray( array[ ] , start = 0 , end = sizeof( array ) )//by Sreyas | |
{ | |
new rand_index , i , difference,temp; | |
i = start, | |
difference = end - start + 1; | |
while(i < end) | |
rand_index = random( difference ) + start , temp = array[ i ],array[ i ] = array[ rand_index ],array[ rand_index ] = temp,++i; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ShuffleArray( array[ ] , start = 0 , end = sizeof( array ) )//by Sreyas | |
for( new rand_index = random( end - start + 1 ) + start, i = start; i < end; ++i , rand_index = random( end - start + 1 ) + start ) | |
array[ i ] = array[ rand_index ] + array[ i ] - ( array[ rand_index ] = array[ i ] ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SubDel(string[],sub_string[],bool:case_sen=false)//by Sreyas | |
{ | |
if(strfind(string,sub_string, case_sen) == -1) return; | |
new i=strfind(string,sub_string), | |
j=strlen(sub_string); | |
while((i=strfind(string,sub_string,case_sen) )!= -1) | |
strdel(string, i, j+i); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Swapping two variables without the use of 3rd one using XOR | |
swap(&a,&b) | |
{ | |
a ^= b; | |
b ^= a; | |
a ^= b; | |
} | |
//Checking two numbers have same signs using XOR | |
bool:IsSameSign(a,b) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool:isValidDate(str[])//by Sreyas | |
{ | |
new count,i,j; | |
new daysinmonth[12]={31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; | |
new parts[3][5],Index_Beg; | |
new bool:legit; | |
while(str[i]!='\0') | |
{ | |
if(str[i] < 48 || str[i] > 57) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SubDel(string[],sub_string[])//by Sreyas | |
{ | |
new i, | |
j, | |
beg = -1, | |
bool:flag; | |
while( string[ i ] != '\0' ) | |
{ | |
j = 0; | |
flag = true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define strcpy(%0,%1) strcat((%0[0] = '\0', %0), %1) | |
/*Alphabet sorter by Sreyas*/ | |
alpha(str[MAX_NAMES][MAX_PLAYER_NAME]) //MAX_NAME - total number of strings in that matrix | |
{ | |
new i, j,t[24]; | |
for(i=1; i<MAX_NAMES; i++) |
NewerOlder