Project

General

Profile

Download (21.2 KB) Statistics
| Branch: | Tag: | Revision:

magiccube / src / main / java / org / distorted / screens / RubikScreenPlay.java @ 8c93c0b1

1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2020 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Magic Cube.                                                              //
5
//                                                                                               //
6
// Magic Cube is free software: you can redistribute it and/or modify                            //
7
// it under the terms of the GNU General Public License as published by                          //
8
// the Free Software Foundation, either version 2 of the License, or                             //
9
// (at your option) any later version.                                                           //
10
//                                                                                               //
11
// Magic Cube is distributed in the hope that it will be useful,                                 //
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
14
// GNU General Public License for more details.                                                  //
15
//                                                                                               //
16
// You should have received a copy of the GNU General Public License                             //
17
// along with Magic Cube.  If not, see <http://www.gnu.org/licenses/>.                           //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19

    
20
package org.distorted.screens;
21

    
22
import android.content.Context;
23
import android.content.SharedPreferences;
24
import android.graphics.drawable.BitmapDrawable;
25
import android.os.Build;
26
import android.os.Bundle;
27
import android.util.TypedValue;
28
import android.view.Gravity;
29
import android.view.LayoutInflater;
30
import android.view.View;
31
import android.widget.Button;
32
import android.widget.GridLayout;
33
import android.widget.ImageButton;
34
import android.widget.LinearLayout;
35
import android.widget.PopupWindow;
36
import android.widget.ScrollView;
37

    
38
import org.distorted.objectlib.main.ObjectControl;
39
import org.distorted.objectlib.main.ObjectType;
40

    
41
import org.distorted.main.R;
42
import org.distorted.main.RubikActivity;
43
import org.distorted.dialogs.RubikDialogAbout;
44
import org.distorted.dialogs.RubikDialogPattern;
45
import org.distorted.dialogs.RubikDialogScores;
46
import org.distorted.dialogs.RubikDialogTutorial;
47
import org.distorted.helpers.TransparentButton;
48
import org.distorted.helpers.TransparentImageButton;
49
import org.distorted.network.RubikScores;
50

    
51
///////////////////////////////////////////////////////////////////////////////////////////////////
52

    
53
public class RubikScreenPlay extends RubikScreenBase
54
  {
55
  public static final int NUM_COLUMNS  = 4;
56
  public static final int LEVELS_SHOWN = 10;
57
  public static int MAX_LEVEL;
58
  public static final ObjectType DEF_OBJECT= ObjectType.CUBE_3;
59

    
60
  private static final int[] BUTTON_LABELS = { R.string.scores,
61
                                               R.string.patterns,
62
                                               R.string.solver,
63
                                               R.string.tutorials,
64
                                               R.string.about };
65

    
66
  private static final int NUM_BUTTONS = BUTTON_LABELS.length;
67
  private static final float LAST_BUTTON = 1.5f;
68
  private static final int[] mLocation = new int[2];
69

    
70
  private ImageButton mObjButton, mMenuButton, mSolveButton;
71
  private Button mPlayButton;
72
  private PopupWindow mObjectPopup, mMenuPopup, mPlayPopup;
73
  private ObjectType mObject = DEF_OBJECT;
74
  private int mObjectSize, mMenuLayoutWidth, mMenuLayoutHeight, mPlayLayoutWidth;
75
  private int mLevelValue;
76
  private float mButtonSize, mMenuItemSize, mMenuTextSize;
77
  private int mColCount, mRowCount, mMaxRowCount;
78
  private LinearLayout mPlayLayout;
79
  private int mUpperBarHeight;
80

    
81
  static
82
    {
83
    ObjectType[] types = ObjectType.values();
84
    int max = Integer.MIN_VALUE;
85

    
86
    for (ObjectType type : types)
87
      {
88
      int cur = getDBLevel(type);
89
      if( cur>max ) max = cur;
90
      }
91

    
92
    MAX_LEVEL = max;
93
    }
94

    
95
///////////////////////////////////////////////////////////////////////////////////////////////////
96

    
97
  void leaveScreen(RubikActivity act)
98
    {
99

    
100
    }
101

    
102
///////////////////////////////////////////////////////////////////////////////////////////////////
103

    
104
  void enterScreen(final RubikActivity act)
105
    {
106
    float width = act.getScreenWidthInPixels();
107
    float height= act.getScreenHeightInPixels();
108
    mUpperBarHeight = act.getHeightUpperBar();
109

    
110
    mMenuTextSize = width*RubikActivity.MENU_MED_TEXT_SIZE;
111
    mButtonSize   = width*RubikActivity.BUTTON_TEXT_SIZE;
112
    mMenuItemSize = width*RubikActivity.MENU_ITEM_SIZE;
113

    
114
    mRowCount = (ObjectType.NUM_OBJECTS + NUM_COLUMNS-1) / NUM_COLUMNS;
115
    mColCount = NUM_COLUMNS;
116

    
117
    // TOP ////////////////////////////
118
    LinearLayout layoutTop = act.findViewById(R.id.upperBar);
119
    layoutTop.removeAllViews();
120

    
121
    setupObjectWindow(act,width,height);
122
    setupObjectButton(act,width);
123
    layoutTop.addView(mObjButton);
124

    
125
    setupMenuWindow(act,width);
126
    setupMenuButton(act,width);
127
    layoutTop.addView(mMenuButton);
128

    
129
    setupPlayWindow(act,width);
130
    setupPlayButton(act,width,height);
131
    layoutTop.addView(mPlayButton);
132

    
133
    setupSolveButton(act,width);
134
    createBottomPane(act,width,mSolveButton);
135
    }
136

    
137
//////////////////////////////////////////////////////////////////////////////////////////////////
138

    
139
  private void setupObjectButton(final RubikActivity act, final float width)
140
    {
141
    final int margin  = (int)(width*RubikActivity.MARGIN);
142
    final int icon = RubikActivity.getDrawable(R.drawable.ui_small_cube_menu,R.drawable.ui_medium_cube_menu, R.drawable.ui_big_cube_menu, R.drawable.ui_huge_cube_menu);
143

    
144
    mObjButton = new TransparentImageButton(act, icon, width,LinearLayout.LayoutParams.MATCH_PARENT);
145

    
146
    mObjButton.setOnClickListener( new View.OnClickListener()
147
      {
148
      @Override
149
      public void onClick(View view)
150
        {
151
        if( mObjectPopup!=null && act.getControl().isUINotBlocked())
152
          {
153
          int rowCount = Math.min(mMaxRowCount,mRowCount);
154
          View popupView = mObjectPopup.getContentView();
155
          popupView.setSystemUiVisibility(RubikActivity.FLAGS);
156
          displayPopup(act,view,mObjectPopup,mObjectSize*mColCount,mObjectSize*rowCount,margin,margin);
157
          }
158
        }
159
      });
160
    }
161

    
162
///////////////////////////////////////////////////////////////////////////////////////////////////
163

    
164
  private void setupPlayButton(final RubikActivity act, final float width, final float height)
165
    {
166
    final int margin   = (int)(width*RubikActivity.MARGIN);
167
    final int maxHeight= (int)(0.9f*(height-mUpperBarHeight) );
168

    
169
    mPlayButton = new TransparentButton(act, R.string.play, mButtonSize, width);
170

    
171
    mPlayButton.setOnClickListener( new View.OnClickListener()
172
      {
173
      @Override
174
      public void onClick(View view)
175
        {
176
        if( mPlayPopup!=null && act.getControl().isUINotBlocked())
177
          {
178
          View popupView = mPlayPopup.getContentView();
179
          popupView.setSystemUiVisibility(RubikActivity.FLAGS);
180
          final int dbLevel = getDBLevel(mObject);
181
          final int levelsShown = Math.min(dbLevel,LEVELS_SHOWN);
182
          final int popupHeight = (int)(levelsShown*(mMenuItemSize+margin)+3*margin+mMenuItemSize*(LAST_BUTTON-1.0f));
183
          final int realHeight = Math.min(popupHeight,maxHeight);
184
          displayPopup(act,view,mPlayPopup,mPlayLayoutWidth,realHeight,margin,margin);
185
          }
186
        }
187
      });
188
    }
189

    
190
///////////////////////////////////////////////////////////////////////////////////////////////////
191

    
192
  private void setupMenuButton(final RubikActivity act, final float width)
193
    {
194
    final int margin  = (int)(width*RubikActivity.MARGIN);
195
    final int icon = RubikActivity.getDrawable(R.drawable.ui_small_menu,R.drawable.ui_medium_menu, R.drawable.ui_big_menu, R.drawable.ui_huge_menu);
196

    
197
    mMenuButton = new TransparentImageButton(act, icon, width,LinearLayout.LayoutParams.MATCH_PARENT);
198

    
199
    mMenuButton.setOnClickListener( new View.OnClickListener()
200
      {
201
      @Override
202
      public void onClick(View view)
203
        {
204
        if( mMenuPopup!=null && act.getControl().isUINotBlocked())
205
          {
206
          View popupView = mMenuPopup.getContentView();
207
          popupView.setSystemUiVisibility(RubikActivity.FLAGS);
208
          displayPopup(act,view,mMenuPopup,mMenuLayoutWidth,mMenuLayoutHeight,(int)(-width/12),margin);
209
          }
210
        }
211
      });
212
    }
213

    
214
///////////////////////////////////////////////////////////////////////////////////////////////////
215

    
216
  private void setupObjectWindow(final RubikActivity act, final float width, final float height)
217
    {
218
    int icon = RubikActivity.getDrawable(R.drawable.s_cube_2,R.drawable.m_cube_2, R.drawable.b_cube_2, R.drawable.h_cube_2);
219

    
220
    BitmapDrawable bd = (BitmapDrawable) act.getResources().getDrawable(icon);
221
    int cubeWidth = bd.getIntrinsicWidth();
222
    int margin = (int)(width*RubikActivity.LARGE_MARGIN);
223
    mObjectSize = (int)(cubeWidth + 2*margin + 0.5f);
224
    mMaxRowCount = (int)(0.9f*(height-mUpperBarHeight)/mObjectSize);
225
    GridLayout objectGrid = new GridLayout(act);
226
    mObjectPopup = new PopupWindow(act);
227
    mObjectPopup.setFocusable(true);
228

    
229
    if( mMaxRowCount<mRowCount )
230
      {
231
      ScrollView scrollView = new ScrollView(act);
232
      scrollView.addView(objectGrid);
233
      mObjectPopup.setContentView(scrollView);
234
      }
235
    else
236
      {
237
      mObjectPopup.setContentView(objectGrid);
238
      }
239

    
240
    GridLayout.Spec[] rowSpecs = new GridLayout.Spec[mRowCount];
241
    GridLayout.Spec[] colSpecs = new GridLayout.Spec[mColCount];
242

    
243
    objectGrid.setColumnCount(mColCount);
244
    objectGrid.setRowCount(mRowCount);
245

    
246
    int[] nextInRow = new int[mRowCount];
247

    
248
    for(int row=0; row<mRowCount; row++)
249
      {
250
      rowSpecs[row] = GridLayout.spec(row);
251
      nextInRow[row]= 0;
252
      }
253
    for(int col=0; col<mColCount; col++)
254
      {
255
      colSpecs[col] = GridLayout.spec(col);
256
      }
257

    
258
    for(int object = 0; object< ObjectType.NUM_OBJECTS; object++)
259
      {
260
      final ObjectType list = ObjectType.getObject(object);
261
      int iconSize = RubikActivity.getDrawableSize();
262
      int icons = list.getIconID(iconSize);
263
      final int obj = object;
264
      int row = object/NUM_COLUMNS;
265

    
266
      ImageButton button = new ImageButton(act);
267
      button.setBackgroundResource(icons);
268
      button.setOnClickListener( new View.OnClickListener()
269
        {
270
        @Override
271
        public void onClick(View v)
272
          {
273
          if( act.getControl().isUINotBlocked() && ScreenList.getCurrentScreen()== ScreenList.PLAY )
274
            {
275
            mObject = ObjectType.getObject(obj);
276
            act.changeObject(list, true);
277
            adjustLevels(act);
278
            mMovesController.clearMoves(act);
279
            }
280

    
281
          mObjectPopup.dismiss();
282
          }
283
        });
284

    
285
      GridLayout.LayoutParams params = new GridLayout.LayoutParams(rowSpecs[row],colSpecs[nextInRow[row]]);
286
      params.bottomMargin = margin;
287
      params.topMargin    = margin;
288
      params.leftMargin   = margin;
289
      params.rightMargin  = margin;
290

    
291
      nextInRow[row]++;
292

    
293
      objectGrid.addView(button, params);
294
      }
295
    }
296

    
297
///////////////////////////////////////////////////////////////////////////////////////////////////
298

    
299
  private void setupMenuWindow(final RubikActivity act, final float width)
300
    {
301
    LayoutInflater layoutInflater = (LayoutInflater)act.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
302
    final View layout = layoutInflater.inflate(R.layout.popup_menu, null);
303
    LinearLayout menuLayout = layout.findViewById(R.id.menuGrid);
304

    
305
    mMenuPopup = new PopupWindow(act);
306
    mMenuPopup.setContentView(layout);
307
    mMenuPopup.setFocusable(true);
308
    int margin  = (int)(width*RubikActivity.MARGIN);
309
    int padding = (int)(width*RubikActivity.PADDING);
310

    
311
    mMenuLayoutWidth = (int)(width/2);
312
    mMenuLayoutHeight= (int)(2*margin + NUM_BUTTONS*(mMenuItemSize+margin));
313

    
314
    LinearLayout.LayoutParams p = new LinearLayout.LayoutParams( mMenuLayoutWidth - 2*padding, (int)mMenuItemSize);
315

    
316
    for(int i=0; i<NUM_BUTTONS; i++)
317
      {
318
      final int but = i;
319
      Button button = new Button(act);
320
      button.setLayoutParams(p);
321
      button.setText(BUTTON_LABELS[i]);
322
      button.setTextSize(TypedValue.COMPLEX_UNIT_PX, mMenuTextSize);
323

    
324
      button.setOnClickListener( new View.OnClickListener()
325
        {
326
        @Override
327
        public void onClick(View v)
328
          {
329
          mMenuPopup.dismiss();
330
          MenuAction(act,but);
331
          }
332
        });
333

    
334
      menuLayout.addView(button);
335
      }
336
    }
337

    
338
///////////////////////////////////////////////////////////////////////////////////////////////////
339

    
340
  private void setupPlayWindow(final RubikActivity act, final float width)
341
    {
342
    LayoutInflater layoutInflater = (LayoutInflater)act.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
343
    final View layout = layoutInflater.inflate(R.layout.popup_play, null);
344
    mPlayLayout = layout.findViewById(R.id.playGrid);
345

    
346
    mPlayLayoutWidth = (int)(width*0.4f);
347

    
348
    mPlayPopup = new PopupWindow(act);
349
    mPlayPopup.setContentView(layout);
350
    mPlayPopup.setFocusable(true);
351

    
352
    adjustLevels(act);
353
    }
354

    
355
///////////////////////////////////////////////////////////////////////////////////////////////////
356

    
357
  private void MenuAction(RubikActivity act, int button)
358
    {
359
    switch(button)
360
      {
361
      case 0: Bundle sBundle = new Bundle();
362
              sBundle.putInt("tab", mObject.ordinal() );
363
              sBundle.putBoolean("submitting", false);
364
              RubikDialogScores scores = new RubikDialogScores();
365
              scores.setArguments(sBundle);
366
              scores.show(act.getSupportFragmentManager(), null);
367
              break;
368
      case 1: RubikDialogPattern pDiag = new RubikDialogPattern();
369
              pDiag.show( act.getSupportFragmentManager(), RubikDialogPattern.getDialogTag() );
370
              break;
371
      case 2: ScreenList.switchScreen(act, ScreenList.SVER);
372
              break;
373
      case 3: RubikDialogTutorial tDiag = new RubikDialogTutorial();
374
              tDiag.show( act.getSupportFragmentManager(), RubikDialogTutorial.getDialogTag() );
375
              break;
376
      case 4: RubikDialogAbout aDiag = new RubikDialogAbout();
377
              aDiag.show(act.getSupportFragmentManager(), null);
378
              break;
379
      }
380
    }
381

    
382
///////////////////////////////////////////////////////////////////////////////////////////////////
383

    
384
  void setupSolveButton(final RubikActivity act, final float width)
385
    {
386
    int icon = RubikActivity.getDrawable(R.drawable.ui_small_cube_solve,R.drawable.ui_medium_cube_solve, R.drawable.ui_big_cube_solve, R.drawable.ui_huge_cube_solve);
387
    mSolveButton = new TransparentImageButton(act, icon, width,LinearLayout.LayoutParams.MATCH_PARENT);
388

    
389
    mSolveButton.setOnClickListener( new View.OnClickListener()
390
      {
391
      @Override
392
      public void onClick(View v)
393
        {
394
        act.getControl().solveObject();
395
        mMovesController.clearMoves(act);
396
        }
397
      });
398
    }
399

    
400
///////////////////////////////////////////////////////////////////////////////////////////////////
401

    
402
  public void savePreferences(SharedPreferences.Editor editor)
403
    {
404
    editor.putString("statePlay_objName", mObject.name() );
405

    
406
    if( mObjectPopup!=null )
407
      {
408
      mObjectPopup.dismiss();
409
      mObjectPopup = null;
410
      }
411

    
412
    if( mMenuPopup!=null )
413
      {
414
      mMenuPopup.dismiss();
415
      mMenuPopup = null;
416
      }
417

    
418
    if( mPlayPopup!=null )
419
      {
420
      mPlayPopup.dismiss();
421
      mPlayPopup = null;
422
      }
423
    }
424

    
425
///////////////////////////////////////////////////////////////////////////////////////////////////
426

    
427
  public void restorePreferences(SharedPreferences preferences)
428
    {
429
    String objName= preferences.getString("statePlay_objName", DEF_OBJECT.name() );
430
    int ordinal = ObjectType.getOrdinal(objName);
431
    mObject = ordinal>=0 ? ObjectType.values()[ordinal] : DEF_OBJECT;
432
    }
433

    
434
///////////////////////////////////////////////////////////////////////////////////////////////////
435

    
436
  public boolean setObject(RubikActivity act, ObjectType obj)
437
    {
438
    if( mObject!=obj )
439
      {
440
      mObject = obj;
441
      if( mPlayLayout!=null ) adjustLevels(act);
442
      return true;
443
      }
444

    
445
    return false;
446
    }
447

    
448
///////////////////////////////////////////////////////////////////////////////////////////////////
449
// work around lame bugs in Android's version <= 10 pop-up and split-screen modes
450

    
451
  private void displayPopup(RubikActivity act, View view, PopupWindow window, int w, int h, int xoff, int yoff)
452
    {
453
    View topLayout = act.findViewById(R.id.relativeLayout);
454
    boolean isFullScreen;
455

    
456
    if( topLayout!=null )
457
      {
458
      topLayout.getLocationOnScreen(mLocation);
459
      isFullScreen = (mLocation[1]==0);
460
      }
461
    else
462
      {
463
      isFullScreen = true;
464
      }
465

    
466
    // if on Android 11 or we are fullscreen
467
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R || isFullScreen )
468
      {
469
      window.showAsDropDown(view, xoff, yoff, Gravity.CENTER);
470
      window.update(view, w, h);
471
      }
472
    else  // Android 10 or below in pop-up mode or split-screen mode
473
      {
474
      view.getLocationOnScreen(mLocation);
475
      int width  = view.getWidth();
476
      int height = view.getHeight();
477
      int x = mLocation[0]+(width-w)/2;
478
      int y = mLocation[1]+height+yoff;
479

    
480
      window.showAsDropDown(view);
481
      window.update(x,y,w,h);
482
      }
483
    }
484

    
485
///////////////////////////////////////////////////////////////////////////////////////////////////
486

    
487
  private void adjustLevels(final RubikActivity act)
488
    {
489
    int dbLevel = getDBLevel(mObject);
490
    int numScrambles = ObjectType.getNumScramble(mObject.ordinal());
491
    int numLevel = Math.min(dbLevel, LEVELS_SHOWN);
492
    String[] levels = new String[numLevel];
493

    
494
    for(int i=0; i<numLevel-1; i++)
495
      {
496
      levels[i] = act.getString(R.string.lv_placeholder,i+1);
497
      }
498

    
499
    if( numLevel>0 )
500
      {
501
      levels[numLevel-1] = act.getString(R.string.level_full);
502
      }
503

    
504
    if( mLevelValue>dbLevel || mLevelValue<1 ||
505
       (mLevelValue<dbLevel || mLevelValue>LEVELS_SHOWN ) )
506
      {
507
      mLevelValue=1;
508
      }
509

    
510
    float width  = act.getScreenWidthInPixels();
511
    int margin   = (int)(width*RubikActivity.MARGIN);
512
    int padding  = (int)(width*RubikActivity.PADDING);
513
    int butWidth = mPlayLayoutWidth - 2*padding;
514
    int butHeight= (int)mMenuItemSize;
515
    int lastButH = (int)(mMenuItemSize*LAST_BUTTON) ;
516

    
517
    LinearLayout.LayoutParams pM = new LinearLayout.LayoutParams( butWidth, butHeight );
518
    pM.setMargins(margin, 0, margin, margin);
519
    LinearLayout.LayoutParams pT = new LinearLayout.LayoutParams( butWidth, butHeight );
520
    pT.setMargins(margin, margin, margin, margin);
521
    LinearLayout.LayoutParams pB = new LinearLayout.LayoutParams( butWidth, lastButH  );
522
    pB.setMargins(margin, margin, margin, 2*margin);
523

    
524
    mPlayLayout.removeAllViews();
525

    
526
    RubikScores scores = RubikScores.getInstance();
527

    
528
    for(int i=0; i<numLevel; i++)
529
      {
530
      final int level     = i<numLevel-1 ? i+1 : dbLevel;
531
      final int scrambles = i<numLevel-1 ? i+1 : numScrambles;
532
      Button button = new Button(act);
533
      button.setLayoutParams(i==0 ? pT : (i==numLevel-1 ? pB : pM));
534
      button.setText(levels[i]);
535
      button.setTextSize(TypedValue.COMPLEX_UNIT_PX, mMenuTextSize);
536

    
537
      int icon = scores.isSolved(mObject.ordinal(), level-1) ? R.drawable.ui_solved : R.drawable.ui_notsolved;
538
      button.setCompoundDrawablesWithIntrinsicBounds(icon,0,0,0);
539

    
540
      button.setOnClickListener( new View.OnClickListener()
541
        {
542
        @Override
543
        public void onClick(View v)
544
          {
545
          ObjectControl control = act.getControl();
546

    
547
          if(control.isUINotBlocked())
548
            {
549
            if( mPlayPopup!=null ) mPlayPopup.dismiss();
550
            mLevelValue = level;
551
            control.scrambleObject(scrambles);
552
            }
553
          }
554
        });
555

    
556
      mPlayLayout.addView(button);
557
      }
558
    }
559

    
560
///////////////////////////////////////////////////////////////////////////////////////////////////
561
// historically older versions of the app had lower 'maxScrambles' in case of several objects and
562
// those got remembered in the server-side DB already, so we need to keep using them. This function
563
// provides a map between 'maxScramble' of an object and its 'dbLevel'. All new objects will have
564
// those two values the same.
565

    
566
  public static int getDBLevel(ObjectType object)
567
    {
568
    switch(object)
569
      {
570
      case CUBE_3: return 16;
571
      case CUBE_4: return 20;
572
      case CUBE_5: return 24;
573
      case PYRA_4: return 14;
574
      case PYRA_5: return 20;
575
      case MEGA_5: return 35;
576
      case DIAM_2: return 10;
577
      case DIAM_3: return 18;
578
      case REDI_3: return 14;
579
      case HELI_3: return 18;
580
      case SKEW_3: return 17;
581
      case REX_3 : return 16;
582
      case MIRR_3: return 16;
583
      default    : return ObjectType.getNumScramble(object.ordinal());
584
      }
585
    }
586

    
587
///////////////////////////////////////////////////////////////////////////////////////////////////
588

    
589
  public int getLevel()
590
    {
591
    return mLevelValue;
592
    }
593

    
594
///////////////////////////////////////////////////////////////////////////////////////////////////
595

    
596
  public ObjectType getObject()
597
    {
598
    return mObject;
599
    }
600
  }
(5-5/10)