DeepSeek and Xojo... interesting

Took DeepSeek - the chinese AI company which you probably heard off, which is crashing the big AI tech stock at the moment - for a spin using questions on and classic AI tests, for Xojo.

  • I made it write a nice tetris game in one go
  • Snake game
  • Custom control using a canvas.
  • and provide a few solutions using external methods on Mac OS and Windows.

Everything ran in first go… really impressive and the story behind the model is very interesting.

4 Likes

Ask if xojo has an array reverse sort.

1 Like

Ask sort a point array by point distance.

how about add a hi-score to the tetris game visible in web.

From DeepSeek:

As of my knowledge cutoff in July 2024, Xojo does not have a built-in method to reverse an array. You would need to implement your own method, such as the one I provided earlier, to reverse an array.

However, Xojo does provide some array manipulation methods, such as Sort, Insert, Remove, and Append, but reversing an array is not one of the built-in functionalities. If this has changed in a newer version of Xojo, I recommend checking the official Xojo documentation for updates.

If you frequently need to reverse arrays, you could encapsulate the logic into a reusable method or extend the array functionality using a module or class. Here’s an example of how you could create a reusable method in a module:

Module: ArrayUtilities

Module ArrayUtilities
  Sub ReverseArray(Array() As Variant)
    Dim lowIndex As Integer = 0
    Dim highIndex As Integer = Array.Ubound
    
    While lowIndex < highIndex
      ' Swap the elements
      Dim temp As Variant = Array(lowIndex)
      Array(lowIndex) = Array(highIndex)
      Array(highIndex) = temp
      
      ' Move towards the center
      lowIndex = lowIndex + 1
      highIndex = highIndex - 1
    Wend
  End Sub
End Module

Usage:

Dim myArray() As String = ["Apple", "Banana", "Cherry", "Date"]
ArrayUtilities.ReverseArray(myArray)

' myArray will now be ["Date", "Cherry", "Banana", "Apple"]

This approach keeps your code clean and reusable. If Xojo adds a built-in method for reversing arrays in the future, you can easily update your code to use the native functionality.

1 Like

It’s factually correct about not having a reverse, but that code won’t work, and even if corrected, would only work for the very specific array of variants and not for other array types.

2 Likes

instead of reverse an array i would iterate backwards, no need to swap data.

For i As Integer = data.LastIndex DownTo data.FirstIndex 
Next

Xojo can use a compare method Sort(AddressOf methodName)
basically for the content but could also be a class with few properties.

3 Likes

lol I read this plagiarism machine is being investigated for plagiarizing the existing plagiarism machines, and the existing plagiarism machines are all boohoo about having their work stolen.

18 Likes

This is the Quicksort routine which is slow. You should better use Shellsort which is much faster.

It’s worthwhile to read about different sort techniques (Wikipedia) to see which one most closely matches the initial state and number of elements you expect to have.

Here’s bit on using the best Gap in the Shell Sort:


Regarding the best gap sequence, the choice of gap sequence is crucial to shell sort’s performance. A gap sequence determines how far elements are sorted apart from each other and directly affects the efficiency of the sorting process.

Some popular gap sequences include:

  1. Shell’s Original Sequence: Halving the number of elements each time (N/2, N/4, ..., 1). This sequence is easy to implement but not the most efficient.

  2. Hibbard’s Sequence: Powers of two minus one (1, 3, 7, 15, ...). This tends to perform better than Shell’s original sequence.

  3. Knuth’s Sequence: Formula is 1, 4, 13, 40, ... which is h = 3h + 1. It often performs better in practical use.

  4. Sedgewick’s Sequences: These are more complex sequences designed for superior performance in practice, especially for larger arrays.

  5. Ciura’s Sequence: An empirically derived sequence (1, 4, 10, 23, 57, 132, 301, 701, 1750). This sequence has been shown to produce efficient results for practical problems.

Be careful what you choose to reveal publicly.
10:1 AI of some sort is scraping the Xojo forum.

No it’s not.

How do you know that the AI’s do not scrape the Forum? Is it just not possible this Forum or what?

I would think that this Forum would be the richest source of Xojo code and comments for AI’s. There is the Documentation but not that much else out there.

A couple of other (quite specialized, not social media) forums I belong to have already proven they have been scraped by both Google, and DeepSeek.

They posed specific questions where a very specific unique answer is on the forum and DeepSeek regurgitated it, although somewhat verbosely. But good enough to prove it scraped the forum. Google simply coughed up a direct link to the relevant thread in that forum, as usual.

so long as ur careful not to post certain info publicly (for humans or LLMs to see) I for one welcome such scraping. Why not have an LLM read 2 decades of posts and synthesize an organized response for you? That said, as concerns Xojo, the LLMs frequently come back with bogus code using functions that sound good but don’t exist. They’re much better with C and python (in fact their python ability is scary good e.g Perplexity)

It’s pointless to ponder whether one should publish source code on GitHub, in the forum, or anywhere else.

The fact is that current development can no longer be stopped, and Xojo can only lose the less source code is available for processing and thus for training the LLMs.

In my opinion, the knowledge that my source code could be used by LLMs should not influence my willingness to share my knowledge with the community. Otherwise, not only the Xojo language but also the entire Xojo community will lose out. And that cannot be our goal.

Just my 2c …

5 Likes