Simulation

2023_09_27__2023_09_27_at_home_003

Goals:

4 cigarettes
no alcohol
normal nutrition
Complete module 6 of the course "Crash Course on Python"
Learn Bubble Sort in java and ZX Spectrum basic
Schedule
07:00 Wake up. YES
07:00 07:30 Morning activities
1 Coffee, 1 cigarette
YES
07:30 09:00 Preparatory works
2 coffees, 2 cigarettes
YES
09:00 10:30 Daily activity
1 coffees, 1 cigarette
YES
10:30 11:00 Breakfast YES
11:00 12:30 Daily activity YES
12:30 14:00 Exercise module 6 "Crash Course on Python" YES
14:00 14:30 Dinner YES
14:30 16:00 Daily activity I'm tired and gave up!
The Java and ZX Spectrum basic
versions was done the next day.
16:00 17:30 Afternoon snack
Watch the TV series
17:30 19:00 Free time
19:00 20:30 Supper
Watch the TV series
20:30 21:00 Evening activities
21:00 22:30 Bubble Sort in java and ZX Spectrum basic
22:30 23:30 Read my book
23:30 07:00 Sleep
Java Bubble sort:
    import java.util.*;

    public class Main{
        public static void main(String[] args){
            boolean m=true; // Ascendance
            int[] ar={8,2,9,1,7,0,3,6,4,5};
            int n=ar.length;
            for (int i=0;i<n-1;i++){
                boolean done=true;
                for (int j=0;j<n-i-1;j++){
                    if (m ^ (ar[j]<ar[j+1])){
                        int t=ar[j];
                        ar[j]=ar[j+1];
                        ar[j+1]=t;
                        done=false;
                    }
                }
                if (done){
                    break;
                }
            }
            System.out.println(Arrays.toString(ar));
        }
    }
ZX Spectrum Basic Bubble sort: