ProDeo
Would you like to react to this message? Create an account in a few clicks or log in to continue.
ProDeo

Computer Chess
 
HomeHome  CalendarCalendar  Latest imagesLatest images  FAQFAQ  SearchSearch  MemberlistMemberlist  UsergroupsUsergroups  RegisterRegister  Log in  

Post new topic   Reply to topic
 

 MAUI horror

Go down 
2 posters
Go to page : Previous  1, 2, 3, 4
AuthorMessage
TheSelfImprover

TheSelfImprover


Posts : 3110
Join date : 2020-11-18

MAUI horror - Page 4 Empty
PostSubject: Re: MAUI horror   MAUI horror - Page 4 EmptyFri Jun 28, 2024 3:38 pm

There's always the old favourite - Windows Forms (or WPF). You'd be able to focus on building your chess program rather than wrestling with the framework itself.
Back to top Go down
Henk




Posts : 1379
Join date : 2020-11-17

MAUI horror - Page 4 Empty
PostSubject: Re: MAUI horror   MAUI horror - Page 4 EmptyFri Jun 28, 2024 4:41 pm

I am currently still using MAUI for windows. Devil made/makes me do it. Something to do with MVVM. I have forgotten.
Who knows maybe I have to run it in on another operating system.
Back to top Go down
TheSelfImprover

TheSelfImprover


Posts : 3110
Join date : 2020-11-18

MAUI horror - Page 4 Empty
PostSubject: Re: MAUI horror   MAUI horror - Page 4 EmptyFri Jun 28, 2024 4:57 pm

If you use MAUI, it's supposed to then be possible to make apps for iOS, Android, macOS, and Windows from the same code base.
Back to top Go down
Henk




Posts : 1379
Join date : 2020-11-17

MAUI horror - Page 4 Empty
PostSubject: Re: MAUI horror   MAUI horror - Page 4 EmptySat Jun 29, 2024 9:44 am

I deleted too much now intellisense not working any more. Maybe I have to create a new project. But then again compile time often taking too long.

So I go on until it gets a real burden.
Back to top Go down
Henk




Posts : 1379
Join date : 2020-11-17

MAUI horror - Page 4 Empty
PostSubject: Re: MAUI horror   MAUI horror - Page 4 EmptySat Jun 29, 2024 12:59 pm

Now sometimes intellisense is working or maybe always. Don't know what happened.
Still found no good reason not to use WPF. Might be I could create the MAUI tools myself on WPF.
I don't know much about WPF.
Back to top Go down
Henk




Posts : 1379
Join date : 2020-11-17

MAUI horror - Page 4 Empty
PostSubject: Re: MAUI horror   MAUI horror - Page 4 EmptyTue Jul 02, 2024 10:07 am

TheSelfImprover wrote:
Henk wrote:
Probably nobody knows what data flow charts are. It is different from flow charts (only or mainly) focussing on data.

By the way I don't feel comfortable with multi-threading. One thread already complicated enough. In c# you use lock(object). I stupidly copy the pattern without thinking.

Looks like everything has to run asynchronously in user interfaces. Also adding complexity.


I understand your reticence with multi-threading: if you're not careful, everything goes wrong!

If you're aspiring to write a chess engine that competes with the best, though, you will need multi-threading unfortunately.

Ok. Method fails. Dataflow charts with objects and swimlanes. Dataflow charts with objects is called collaboration diagram. At school I already hated semaphores. Today you have to use tasks or threads


Last edited by Henk on Sat Jul 13, 2024 1:57 pm; edited 2 times in total
Back to top Go down
Henk




Posts : 1379
Join date : 2020-11-17

MAUI horror - Page 4 Empty
PostSubject: Re: MAUI horror   MAUI horror - Page 4 EmptyFri Jul 05, 2024 10:20 am

Code:

<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0</TargetFrameworks>


This is what I am using now. No other TargetFrameworks. Also I deleted some other non-windows code.
Even packages. But can't remember. Friday or saturday, last week being a destructive day.

Looks like visual studio is working fine now. But not sure.
Back to top Go down
Henk




Posts : 1379
Join date : 2020-11-17

MAUI horror - Page 4 Empty
PostSubject: Re: MAUI horror   MAUI horror - Page 4 EmptyFri Jul 12, 2024 12:24 pm

https://learn.microsoft.com/en-us/dotnet/maui/user-interface/controls/collectionview/?view=net-maui-8.0

In .NET MAUI 8 to learn about CollectionView you have to select or click on:

User interface:Controls:Views: Display collections: CollectionView

Of course one should add it to your favorites. But they can be lost.
Back to top Go down
Henk




Posts : 1379
Join date : 2020-11-17

MAUI horror - Page 4 Empty
PostSubject: Re: MAUI horror   MAUI horror - Page 4 EmptyTue Jul 16, 2024 6:47 pm

This kept me busy for at least a week: Answer is from ChatGPT:

Why is the Cancellation Check Not Enough Alone?
Continuous Execution:

If the loop executes continuously without any awaitable operations, it doesn't provide a break for the cancellation token's state change to be processed. The check while (!cancellationTokenSource.Token.IsCancellationRequested) will run rapidly, but the cancellation request handling is deferred until the loop naturally yields control or completes.
Blocking the Thread:

A tight loop can monopolize the CPU, blocking the thread from performing other tasks. This includes the task responsible for setting the IsCancellationRequested property of the token. Thus, the loop may continue running without realizing a cancellation has been requested.
Back to top Go down
Henk




Posts : 1379
Join date : 2020-11-17

MAUI horror - Page 4 Empty
PostSubject: Re: MAUI horror   MAUI horror - Page 4 EmptyTue Jul 16, 2024 6:50 pm

Code:

   private async Task StartAnalysisAsync()
   {         
         var position = Game.ChessBoard;
         string fen = position.ConvertToFen(Game.MoveNumber);
         stockfishAnalyzer.StartAnalysis(fen, EngineOptionsViewModel.Instance.MultiPV);

         AnalysisOutput.Clear();
      
         try
         {
            while (!cancellationTokenSource.Token.IsCancellationRequested)
            {
               var nextLine = stockfishAnalyzer.NextLine();

               if (nextLine == null) break;

               if (nextLine.Contains("pv")) // useful information
               {
                  var analysisLine = ParseStockFishLine(nextLine, position);
                  if (analysisLine != null)
                  {
                     AnalysisOutput.Insert(0, analysisLine);
                     ProgressBarValue = 0.5 + analysisLine.Value / 1000;
                  }
               }
               // Use Task.Delay to make the loop yield and check for cancellation
               await Task.Delay(10, cancellationTokenSource.Token);
            }
            
         }
         catch (OperationCanceledException)
         {
            //Handle the cancellation
         }         
   }
Back to top Go down
Henk




Posts : 1379
Join date : 2020-11-17

MAUI horror - Page 4 Empty
PostSubject: Re: MAUI horror   MAUI horror - Page 4 EmptyTue Jul 16, 2024 7:03 pm

O wait this is C#.Net
Back to top Go down
Sponsored content





MAUI horror - Page 4 Empty
PostSubject: Re: MAUI horror   MAUI horror - Page 4 Empty

Back to top Go down
 
MAUI horror
Back to top 
Page 4 of 4Go to page : Previous  1, 2, 3, 4

Permissions in this forum:You can reply to topics in this forum
ProDeo :: Programmer Corner-
Post new topic   Reply to topicJump to: