26F-Studio / Techmino_Galaxy

BSD 3-Clause "New" or "Revised" License
50 stars 13 forks source link

Update paperArtist.lua #19

Closed User670 closed 1 year ago

User670 commented 1 year ago

Okay, I guess I might help by explaining what I did there.

- function paperArtist.calculateFieldScore(field,cb,cy)
+ function paperArtist.calculateFieldScore(field,cb,cx,cy)

Adding cx is required for adding "place the piece into the field" immediately below.

+     -- Place the piece into the field

This chunk of code places the piece (cb) into the field, so that score can be given on the field AFTER landing the piece, instead of BEFORE (like it does in current version).

-        return 1e99
+        return 1e99,0,0

Inconsistent return type screws up code that calls this function (crash on perfect clear). This fixes it.

-            local clear,rowB,colB=paperArtist.calculateFieldScore(field,shape,cy)
+            local clear,rowB,colB=paperArtist.calculateFieldScore(F,shape,cx,cy)

Added the cx parameter that I requested... and actually plz check if using F here is a bad idea. Do keep in mind that calculateFieldScore now actually modifies the board that it's fed into it.