Lashtw commited on
Commit
87b93cd
·
verified ·
1 Parent(s): 4d0e95c

Upload skyscraper.html

Browse files
Files changed (1) hide show
  1. skyscraper.html +15 -10
skyscraper.html CHANGED
@@ -791,27 +791,32 @@
791
  if (this.s.timerActive && this._checkTimer()) return;
792
  const l2 = this._getL2(); if (!l2) return;
793
  const d = this.s.targetDist, l1 = this.s.line1;
794
- let totalErr = 0;
795
- this.s.markerTs.forEach(t => {
 
 
796
  const px = l1.p1.x + (l1.p2.x - l1.p1.x) * t, py = l1.p1.y + (l1.p2.y - l1.p1.y) * t;
797
- totalErr += Math.abs(this._perpDist(px, py, l2.p1, l2.p2) - d);
 
 
 
 
798
  });
799
- const avg = totalErr / this.s.markerTs.length;
800
  if (this.s.phase === 'tutorial') {
801
- if (avg < 2) {
802
  this._showPhaseModal('✅', '教學完成!', '垂直距離處處相等 = 平行!\n確認距離一致就代表兩條線平行', '確認,繼續 →', null);
803
  this.dom.tbtn.onclick = () => { this.dom.tm.classList.add('hidden'); this.s.lvIdx++; this._genLevel() }
804
  }
805
- else this._showToast('還不夠精確!各處的垂直距離必須完全相等才是平行', false);
806
  return;
807
  }
808
  if (this.s.fixMode) {
809
- if (avg < 1.5) { this._onCorrect(80) }
810
- else this._showToast('還不夠精確!垂直距離必須完全一致才算平行', false);
811
  return;
812
  }
813
- if (avg < 1.5) this._onCorrect(100);
814
- else this._showToast('垂直距離不一致,還不是完全平行!再調整', false);
815
  }
816
 
817
  judgeAnswer(says) {
 
791
  if (this.s.timerActive && this._checkTimer()) return;
792
  const l2 = this._getL2(); if (!l2) return;
793
  const d = this.s.targetDist, l1 = this.s.line1;
794
+ // 逐點檢查:每個測量點的四捨五入值必須完全等於 d
795
+ let allMatch = true;
796
+ let mismatchInfo = '';
797
+ this.s.markerTs.forEach((t, idx) => {
798
  const px = l1.p1.x + (l1.p2.x - l1.p1.x) * t, py = l1.p1.y + (l1.p2.y - l1.p1.y) * t;
799
+ const measured = Math.round(this._perpDist(px, py, l2.p1, l2.p2));
800
+ if (measured !== d) {
801
+ allMatch = false;
802
+ mismatchInfo = `目標 d = ${d},但有測量點顯示 ${measured}`;
803
+ }
804
  });
 
805
  if (this.s.phase === 'tutorial') {
806
+ if (allMatch) {
807
  this._showPhaseModal('✅', '教學完成!', '垂直距離處處相等 = 平行!\n確認距離一致就代表兩條線平行', '確認,繼續 →', null);
808
  this.dom.tbtn.onclick = () => { this.dom.tm.classList.add('hidden'); this.s.lvIdx++; this._genLevel() }
809
  }
810
+ else this._showToast(`還不完全平行!${mismatchInfo}`, false);
811
  return;
812
  }
813
  if (this.s.fixMode) {
814
+ if (allMatch) { this._onCorrect(80) }
815
+ else this._showToast(`還不完全平行!${mismatchInfo}`, false);
816
  return;
817
  }
818
+ if (allMatch) this._onCorrect(100);
819
+ else this._showToast(`還不是完全平行!${mismatchInfo}`, false);
820
  }
821
 
822
  judgeAnswer(says) {