Farmer's Feud Tips and Tricks!

Same purpose as the “Frozen fortress tips, tricks and chat” add tips, clever strategies and a place to improve your code, but in Farmer’s Feud. Have fun! :grin:

The hero.findMists(); and hero.findRains(); return an array that was hard to read at the beginning in Javascript. JSON.stringify() doesn’t work on them. It took me a lot to figure out how to read and use them. Here is a snippet to help others finding it difficult how to use those 2 methods.

  let tMistsA = hero.findMists();
  let tMistsRowsO = {};
  if (tMistsA) {
    for (let theItem of tMistsA) {
      tMistsRowsO[theItem.row] = theItem.type;
print("filter", JSON.stringify(tMistsRowsO));

Also, if you want to convert a column letter to a number here is an useful snippet. 65 is the codePoint of ‘A’. Use uppercase letters as lowercase returns a different number.

function letterToCol(pLetter) {
  return parseInt(pLetter.charCodeAt(0) - 65);
1 Like