Project

General

Profile

« Previous | Next » 

Revision ac722a43

Added by Leszek Koltunski over 4 years ago

More debugging for the case of suspicious submits.

View differences:

src/main/java/org/distorted/effects/scramble/ScrambleEffectRotations.java
34 34

  
35 35
public class ScrambleEffectRotations extends ScrambleEffect
36 36
  {
37
  private Random mRnd = new Random(0);
37
  private Random mRndGen = new Random(0);
38 38

  
39 39
///////////////////////////////////////////////////////////////////////////////////////////////////
40 40

  
41 41
  private Static4D generateNewRandomPoint()
42 42
    {
43
    float x = mRnd.nextFloat();
44
    float y = mRnd.nextFloat();
45
    float z = mRnd.nextFloat();
46
    float w = mRnd.nextFloat();
43
    float x = mRndGen.nextFloat();
44
    float y = mRndGen.nextFloat();
45
    float z = mRndGen.nextFloat();
46
    float w = mRndGen.nextFloat();
47 47

  
48 48
    float len = (float)Math.sqrt(x*x + y*y + z*z + w*w);
49 49

  
......
59 59
    mCubeEffectPosition = new int[] {2,3};
60 60
    mCubeEffects        = new Effect[mCubeEffectPosition.length];
61 61

  
62
    mRnd.setSeed(System.currentTimeMillis());
62
    mRndGen.setSeed(System.currentTimeMillis());
63 63

  
64 64
    int numRandomPoints = (int)(Math.pow(numScrambles,0.7f));
65 65

  
src/main/java/org/distorted/main/RubikPreRender.java
37 37
import org.distorted.dialogs.RubikDialogNewRecord;
38 38
import org.distorted.dialogs.RubikDialogSolved;
39 39
import org.distorted.effects.BaseEffect;
40
import org.distorted.effects.scramble.ScrambleEffect;
40 41
import org.distorted.library.message.EffectListener;
41 42
import org.distorted.objects.TwistyObject;
42 43
import org.distorted.objects.ObjectList;
......
77 78
  private long mAddRotationID, mRemoveRotationID;
78 79
  private int mCubit, mFace, mNewColor;
79 80
  private int mNearestAngle;
81
  private String mDebug;
82
  private long mDebugStartTime;
80 83

  
81 84
///////////////////////////////////////////////////////////////////////////////////////////////////
82 85

  
......
104 107
    mScrambleObjectNum = 0;
105 108

  
106 109
    mEffectID = new long[BaseEffect.Type.LENGTH];
110

  
111
    mDebug = "";
107 112
    }
108 113

  
109 114
///////////////////////////////////////////////////////////////////////////////////////////////////
......
338 343

  
339 344
  private void reportRecord()
340 345
    {
341
    final RubikActivity act = (RubikActivity)mView.getContext();
342
    FirebaseAnalytics analytics = act.getAnalytics();
346
    RubikStatePlay play = (RubikStatePlay) StateList.PLAY.getStateClass();
347
    RubikScores scores = RubikScores.getInstance();
343 348

  
344
    if( analytics!=null )
345
      {
346
      RubikStatePlay play = (RubikStatePlay) StateList.PLAY.getStateClass();
347
      RubikScores scores = RubikScores.getInstance();
349
    int object      = play.getObject();
350
    int size        = play.getSize();
351
    int level       = play.getLevel();
352
    ObjectList list = ObjectList.getObject(object);
353
    String name     = scores.getName();
348 354

  
349
      int object      = play.getObject();
350
      int size        = play.getSize();
351
      int level       = play.getLevel();
352
      ObjectList list = ObjectList.getObject(object);
353
      String name     = scores.getName();
355
    String record = list.name()+"_"+size+" level "+level+" time "+mNewRecord+" isNew: "+mIsNewRecord+" scrambleNum: "+mScrambleObjectNum;
354 356

  
355
      String record = list.name()+"_"+size+" level "+level+" time "+mNewRecord+" isNew: "+mIsNewRecord;
357
    if( BuildConfig.DEBUG )
358
       {
359
       android.util.Log.e("pre", mDebug);
360
       android.util.Log.e("pre", name);
361
       android.util.Log.e("pre", record);
362
       }
363
    else
364
      {
365
      final RubikActivity act = (RubikActivity)mView.getContext();
366
      FirebaseAnalytics analytics = act.getAnalytics();
356 367

  
357
      Bundle bundle = new Bundle();
358
      bundle.putString(FirebaseAnalytics.Param.CHARACTER, name);
359
      bundle.putString(FirebaseAnalytics.Param.LEVEL, record);
360
      analytics.logEvent(FirebaseAnalytics.Event.LEVEL_UP, bundle);
368
      if( analytics!=null )
369
        {
370
        Bundle bundle = new Bundle();
371
        bundle.putString(FirebaseAnalytics.Param.CONTENT_TYPE, mDebug);
372
        bundle.putString(FirebaseAnalytics.Param.CHARACTER, name);
373
        bundle.putString(FirebaseAnalytics.Param.LEVEL, record);
374
        analytics.logEvent(FirebaseAnalytics.Event.LEVEL_UP, bundle);
375
        }
361 376
      }
362 377
    }
363 378

  
......
444 459

  
445 460
///////////////////////////////////////////////////////////////////////////////////////////////////
446 461
//
462
///////////////////////////////////////////////////////////////////////////////////////////////////
463

  
464
  void rememberMove(int axis, int row, int angle)
465
    {
466
    mDebug += (" (m "+axis+" "+(1<<row)+" "+angle+" "+(System.currentTimeMillis()-mDebugStartTime)+")");
467
    }
468

  
447 469
///////////////////////////////////////////////////////////////////////////////////////////////////
448 470

  
449 471
  void setScreenSize(int width)
......
570 592
    mAddRotationRowBitmap = rowBitmap;
571 593
    mAddRotationAngle     = angle;
572 594
    mAddRotationDuration  = duration;
595

  
596
    if( listener instanceof ScrambleEffect )
597
      {
598
      mDebug += (" (a "+axis+" "+rowBitmap+" "+angle+" "+(System.currentTimeMillis()-mDebugStartTime)+")");
599
      }
573 600
    }
574 601

  
575 602
///////////////////////////////////////////////////////////////////////////////////////////////////
......
588 615
      {
589 616
      mScrambleObject = true;
590 617
      mScrambleObjectNum = num;
618
      mDebug = "";
619
      mDebugStartTime = System.currentTimeMillis();
591 620
      }
592 621
    }
593 622

  
src/main/java/org/distorted/main/RubikSurfaceView.java
410 410
      computeCurrentSpeedInInchesPerSecond();
411 411
      int angle = mPreRender.getObject().computeNearestAngle(mCurrentAngle, mCurrRotSpeed);
412 412
      mPreRender.finishRotation(angle);
413
      mPreRender.rememberMove(mCurrentAxis,mCurrentRow,angle);
413 414

  
414 415
      if( angle!=0 )
415 416
        {
src/main/java/org/distorted/objects/TwistyObject.java
69 69
  private static final float MAX_SIZE_CHANGE = 1.35f;
70 70
  private static final float MIN_SIZE_CHANGE = 0.8f;
71 71

  
72
  private static boolean mCreateFromDMesh = false;
72
  private static boolean mCreateFromDMesh = true;
73 73

  
74 74
  private static final Static3D CENTER = new Static3D(0,0,0);
75 75
  private static final int POST_ROTATION_MILLISEC = 500;

Also available in: Unified diff