I'm trying to draw possible matches according to the instructions in the code but the code is not compiling and I can't figure out what the error is. I would appreciate all help on this.
My code editor is giving me the error 'Parsing error: Unexpected token i' at this line of my code -> for(let i = 0 ; i < possibleMatches.length ; i++)
This is the map so far where I've plotted CriminalSightings and AttackRecorded:

Here is the code:
/*
Officer: 3357927
CaseNum: 601-2-69352192-3357927
Case 601 - Murdering Again - stage 3
Now murders are beginning to occur - we're pretty sure that this is the work of Fry.
If we can place her near any of the recent crime scenes in the area we should be able narrow down her location.
In the setup function, use a for loop to traverse the sightings, marking all of the locations on the map
where she was last seen. Do this by drawing small, Goldenrod fill rectangles centered over each location.
In addition, we've assembled a list of recent thefts in the area. Using another for loop to traverse the
recent crime records, you should mark those locations on the map. Do this by drawing small, DarkGoldenrod fill triangles centered over each location.
Use X11 colours. You can find a reference table at https://en.wikipedia.org/wiki/Web_colors.
Let's try to catch Fry by looking patterns between sightings and crimes. If she was within less than 97 pixels of any of the crimes then the details
should be pushed to possible matches with the following format.
{ crime:{x: 0, y:0, victimName: "John Doe"}, suspect:{x: 0, y:0} }
Note that the possible matches are already being drawn.
Your job is simply to fill the array with the correct data.
For this mission you will need ONLY the following:
- for loop
- dist()
- if()
- fill
- rect() NB. Draw each rectangle with the point at its center.
- fill
- triangle() NB. Draw each triangle with the point roughly at its center.
*/
var countyMap;
var possibleMatches = [];
//Sightings of Casey Fry.
var CriminalSightings = [
{ Loc_X : 639, Loc_Y : 288},
{ Loc_X : 681, Loc_Y : 286},
{ Loc_X : 712, Loc_Y : 293},
{ Loc_X : 756, Loc_Y : 310},
{ Loc_X : 715, Loc_Y : 368},
{ Loc_X : 701, Loc_Y : 425},
{ Loc_X : 753, Loc_Y : 436},
{ Loc_X : 815, Loc_Y : 468},
{ Loc_X : 795, Loc_Y : 506},
{ Loc_X : 788, Loc_Y : 497},
{ Loc_X : 781, Loc_Y : 486},
{ Loc_X : 768, Loc_Y : 489},
{ Loc_X : 750, Loc_Y : 500},
{ Loc_X : 732, Loc_Y : 506},
{ Loc_X : 714, Loc_Y : 514},
{ Loc_X : 695, Loc_Y : 531},
{ Loc_X : 693, Loc_Y : 552},
{ Loc_X : 654, Loc_Y : 523},
{ Loc_X : 624, Loc_Y : 500},
{ Loc_X : 594, Loc_Y : 484},
{ Loc_X : 555, Loc_Y : 474}
];
//Recent crime records.
var AttackRecorded = [
{ coordinate_x : 409, coordinate_y : 446, victim_name : 'JENIFFER DEAUVILLE'},
{ coordinate_x : 443, coordinate_y : 419, victim_name : 'JACQUELINE DURANTS'},
{ coordinate_x : 465, coordinate_y : 548, victim_name : 'BRAD SILVEIRA'},
{ coordinate_x : 709, coordinate_y : 552, victim_name : 'DRUSILLA WARMAN'},
{ coordinate_x : 695, coordinate_y : 421, victim_name : 'LINETTE MOHWAWK'},
{ coordinate_x : 652, coordinate_y : 268, victim_name : 'SUMMER CASIMERE'},
{ coordinate_x : 641, coordinate_y : 306, victim_name : 'NELSON TINTLE'},
{ coordinate_x : 119, coordinate_y : 344, victim_name : 'HANG NIEMELA'},
{ coordinate_x : 114, coordinate_y : 359, victim_name : 'LAVERNE JACQUELIN'},
{ coordinate_x : 90, coordinate_y : 490, victim_name : 'JESSIA PORTOS'},
{ coordinate_x : 76, coordinate_y : 516, victim_name : 'TU DAVISWOOD'},
{ coordinate_x : 615, coordinate_y : 741, victim_name : 'LARRAINE PEGORD'},
{ coordinate_x : 349, coordinate_y : 796, victim_name : 'LIANNE COURTWOOD'},
{ coordinate_x : 456, coordinate_y : 770, victim_name : 'NICOLE ASHELY'}
];
function preload()
{
countyMap = loadImage("map.png")
}
function setup()
{
createCanvas(countyMap.width, countyMap.height);
image(countyMap, 0,0);
//add your code below here
noFill();
stroke(218, 165, 32);
for (i = 0; i < CriminalSightings.length; i++){
var sighting = CriminalSightings[i]
rect(sighting.Loc_X - 5, sighting.Loc_Y - 5, 5, 5);
}
stroke(184, 134, 11);
for (j = 0; j < AttackRecorded.length; j++){
var record = AttackRecorded[j]
triangle(record.coordinate_x, record.coordinate_y -5,record.coordinate_x - 5, record.coordinate_y + 5, record.coordinate_x + 5,record.coordinate_y + 5 );
}
for(var i =0; i<CriminalSightings.length; i++ )
{
for(var j = 0;AttackRecorded.length; j++ )
{
if(dist(CriminalSightings[i].Loc_X,CriminalSightings[i].Loc_Y,AttackRecorded[j].coordinate_x,AttackRecorded[j].coordinate_y) < 97)
{
possibleMatches.push
({ crime:{x: AttackRecorded[j].coordinate_x, y:AttackRecorded[j].coordinate_y, victimName: AttackRecorded[j].victim_name}, suspect:{x: CriminalSightings[i].Loc_X, y:CriminalSightings[i].Loc_Y} })
}
}
}
// code to draw the matches ( if any)
for(let i = 0 ; i < possibleMatches.length ; i++)
{
stroke(127);
strokeWeight(3);
line(possibleMatches[i].crime.x, possibleMatches[i].crime.y, possibleMatches[i].suspect.x, possibleMatches[i].suspect.y);
noStroke();
fill(127);
text(possibleMatches[i].crime.victimName, possibleMatches[i].crime.x + 15, possibleMatches[i].crime.y + 15);
}
}
//We are not using the draw function this time