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
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
Version 2, December 2004 | |
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE> | |
Everyone is permitted to copy and distribute verbatim or modified | |
copies of this license document, and changing it is allowed as long | |
as the name is changed. | |
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |
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
import java.util.*; | |
// based on the work of Robert Sedgewick and Kevin Wayne | |
public class Graph<T> implements Iterable<T> { | |
private Map<T, Set<T>> verticesMap; | |
private int edgesCount; | |
public Graph() { | |
verticesMap = new HashMap<>(); |
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
import java.util.Objects; | |
public class Zone { | |
private String name; | |
public Zone(String name) { | |
this.name = name; | |
} | |
@Override |
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
public class Game { | |
public static void main(String[] args) { | |
Graph<Zone> gameMap = new Graph<>(); | |
Zone zone1 = new Zone("Zone1"); | |
Zone zone2 = new Zone("Zone2"); | |
Zone zone3 = new Zone("Zone3"); | |
Zone zone4 = new Zone("Zone4"); | |
Zone zone5 = new Zone("Zone5"); | |
Zone zone6 = new Zone("Zone6"); |
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
var Graph = function() { | |
this.verticesMap = new Map(); | |
this.edgesCount = 0; | |
}; | |
Graph.prototype.getNumVertices = function() { | |
return this.verticesMap.size; | |
} | |
Graph.prototype.getNumEdges = function() { |
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
var Zone = function(name) { | |
this.name = name; | |
} | |
Zone.prototype.toString = function() { | |
return "Zone " + this.name; | |
} |
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
var gameMap = new Graph(); | |
zone1 = new Zone("Zone1"); | |
zone2 = new Zone("Zone2"); | |
zone3 = new Zone("Zone3"); | |
zone4 = new Zone("Zone4"); | |
zone5 = new Zone("Zone5"); | |
zone6 = new Zone("Zone6"); | |
zone7 = new Zone("Zone7"); | |
zone8 = new Zone("Zone8"); |
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
{ | |
"T": { | |
"field": "title", | |
"operations": [ | |
{ | |
"function": "replace", | |
"regex": "\\s*[.:;?!|].*", | |
"replacement": "" | |
}, | |
{ |