Sorting games on the website

Started by , Wed 16/08/2006 13:18:53

Previous topic - Next topic

mw22

Hi,

It would be really useful when searching for a game to play if the page could be sorted by rating.  At present it seems only to sort alphabetically.

For an example see http://www.adventuregamestudio.co.uk/games.php?category=6

Cheers, Mark
:)

Ishmael

The games page doesn't have the feature, but someone (SSH?) made a script that compiled a list (which I fail to find right now) sortable by rating. And that list revealed a partial reason for you not being able to sort by rating; spam votes, which some games have gotten for a reason or another. Meaning, people voted games for perfect or worst possible scores because of how they think about the author, for example. Altho now that being logged in on the forum is required to vote, I don't know if that is going to change at any point...
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

DoorKnobHandle

People can still quite easily create double accounts and keep voting 100% positive for their own game, only to make people play it. Either we have people control the ratings or we don't offer that feature.

SSH

You can sort the digest page by clicking on the column headings: http://www.adventuregamestudio.co.uk/games.php?action=digest

My page is at http://ssh.me.uk/ranking.htm and can also be sorted by clicking column headings, but is based on the ratings at the point I captured them a while ago
12

mw22

Quote from: SSH on Wed 16/08/2006 14:09:32
You can sort the digest page by clicking on the column headings: http://www.adventuregamestudio.co.uk/games.php?action=digest

Thanks.  There are no ratings though.

Quote
My page is at http://ssh.me.uk/ranking.htm and can also be sorted by clicking column headings, but is based on the ratings at the point I captured them a while ago

That's great - is there a way of getting an up-to-date version of this?

Mark

SSH

Yes, run this script on PHP, but not too often as it throws lots of HTTP requests at CJ's server

Code: ags

<?php

function array_average($arr) {
	$sum = array_sum($arr);
	$num = sizeof($arr);
	return ($sum/$num);
}

function distributor_compare($a, $b) {
   $adist = intval($a['avg']);
   $bdist = intval($b['avg']);
  
   if ($adist == $bdist) {
     return 0;
     }
     return ($adist > $bdist) ? -1 : 1;   
}

$i=1;

if ($fh=fopen("ranking.csv", "r")) {
	while ($line=fgets($fh)) {
		$i++;
	}
	fclose($fh);
}
print "Start from: $i
";
$fh=fopen("ranking.csv", "a");

for (; $i < 750; $i++) {

	$url="http://www.adventuregamestudio.co.uk/games.php?action=detail&id=" . $i
	$ch = curl_init($url);


	curl_setopt($ch, CURLOPT_HEADER, 1);
   	curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
   	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);
	curl_setopt($ch, CURLOPT_PROXY, 'web-proxy:8088'); 
	
   	$data = curl_exec($ch);
	if (curl_errno($ch)) {
   		print "Error: " . curl_error($ch) . "
";
	} else {
   		curl_close($ch);
	

		$pattern='/<title>(.*) - AGS Games Database</title>/';
		preg_match($pattern, $data, $matches);
		$gamename=$matches[1];
			
		$pattern='/<tr><td>Visual:</td><td><b>(d+)\%</b> </td></tr><tr><td>Immersion:</td><td><b>(d+)\%</b> </td></tr><tr><td>Puzzles & Pacing:</td><td><b>(d+)\%</b> </td></tr><tr><td>Overall Enjoyment:</td><td><b>(d+)\%</b>/';
		
		if (preg_match($pattern, $data, $matches)) {
			fprintf($fh, "%s,%s,%d,%d,%d,%d,%d
", $url, $gamename, $matches[1],$matches[2],$matches[3],$matches[4], array_average(array($matches[1],$matches[2],$matches[3],$matches[4])));
			
	
		}
	}
	
}

fclose($fh);

12

Kweepa

Very neat!
Although it would be better to loop until the game title is "Game not found", rather than 750 (there are now 764 games).
Still waiting for Purity of the Surf II

SMF spam blocked by CleanTalk