Question regarding to the several detail of assignment

0 votes
asked Apr 16, 2022 in System Modelling by Ai_Yoshida (30 points)  

Dear Professor

I have several question regarding to the mandatory assignment.
My assignment is about chessclock.

1). Could you please tell me why this equation did not work??
https://bmeedu-my.sharepoint.com/:i:/g/personal/ai_yoshida_edu_bme_hu/EXn-TmvTDttMhTo_JxhnhUgB44OUUZ9k0F6RYsQkq7SwIQ?e=lbTcr7

To limit max time of white and black Display variables, I wanted to make equation
condition like this

[name of variables]
maxtime...internal variable which I made to put maximum time for white and black DisplaDy variable
reward...internal variable which I set to put reward time

Buttons.whiteButton/ Display.whiteDisplay < maxtime ? Display.whiteDisplay += reward : Display.whiteDisplay = maxtime

I checked that this conditional expression is available in yakindu user guide.
Although the expression

Buttons.whiteDisplay/Display.whiteDisplay += reward

works, but when I change equation to ①, error appears.
The error says
- mismatched input "+-=" expecting ":"
- Failed to parse Expression ":"
- The left-hand side of an assignment must be a variable

I do not understand what these errors mean.
Could you please tell me why these error occurs?
If conditional expression is not appropriate to set maximum value for Display.whiteDisplay variable, what expression will be good solution?

2) I did not understand the meaning of "postpone" part.
https://bmeedu-my.sharepoint.com/:i:/g/personal/ai_yoshida_edu_bme_hu/EXUNhJiLs4dChUs6xQIXOCIBM7daWFXAQAwyIMy6BNUSjA?e=MCAXEG

Could you please tell me what does it mean for "appropriate button"?? which button does this word means?
Does it mean that one pressing "mode" make white and black timers stop, and second pressing "mode" goes back to the normal turns?
Could you please specify what is the condition for "white/black adjourned" are showed??

3) Could you please give me advice for how to exchange min from seconds?

It is one of mandatory condition for showing timers in min, not second.
However, I could not find how can I show them in that way.
Could you please give me some advice??

4) How to display values?
There are many instructions which says display the value of white and black clock to the user. However, there is no [operation of display] in the original interface.
Could you give me advice for how to display values?
Since I cannot add "display operation" in internal space.

Thank you so much for your cooperation.
Your reply will help me a lot!

Sincerely yours,
Ai Yoshida

1 Answer

0 votes
answered Apr 17, 2022 by AdamZsofi (165 points)  

Hi,
1. Please read this snippet about what the conditional expression means again (from 10.8.4 in here):

expr1 ? expr2 : expr3
If expr1 evaluates to true, this returns expr2, else exp3. This can be used to assign values to variables

Assign values to variable as in assign either expr2 or expr3, like in this example:
y = x > 5 ? 1 : 2

"Display.whiteDisplay += reward" and "Display.whiteDisplay = maxtime" are not expressions, but statements (assignments), so these cannot be used here.

Maybe using choices instead would be the easiest here.
2. Appropriate here means the current players button (either black or white).
3. Maybe you should just divide the seconds with 60 to get the minutes?
4. Just set the appropriate values on the Display.whiteDisplay, Display.blackDisplay and Display.text variable. If you run your model with the provided GUI, you will see, that the display changes accordingly.

commented Apr 17, 2022 by Ai_Yoshida (30 points)  
Thank you for your reply.

I would like to ask more about second → min display.
I tried to divide the values, but it does not become [90sec→ 1:30]but, it become [90sec →1]with "/", and [90sec→30]with "%"
How can I show them in one to "Display.whiteDisplay"??

Thank you for your help in advance
Sincerely yours,
Ai Yoshida
https://bmeedu-my.sharepoint.com/:i:/g/personal/ai_yoshida_edu_bme_hu/Ee7NtRASAeVBgSo4P1iloi4BVC6SJ54YpjjHSTR5Nk88Cg?e=u56zF7
...