Author Topic: Hi  (Read 8742 times)

Offline dsaddan

  • Bot Neophyte
  • *
  • Posts: 8
    • View Profile
Hi
« on: May 06, 2017, 04:24:22 AM »
Hi:

I just registered to the forum. I have a few questions:

Is the project alive in the sense that there is an active development going on?

Is there a development team that I can join?

Dror

Offline spike43884

  • Bot Overlord
  • ****
  • Posts: 656
    • View Profile
Re: Hi
« Reply #1 on: May 06, 2017, 05:23:32 AM »
Hello!  :D
Well, there is a few of us that still use DB2, it's a small community, but it exists.
The successor to Darwinbots 2, inventively called "Darwinbots 3" is being developed by Numsigl, you may be able to join him on working on it if he's okay with that.

Autism can allow so much joy, and at the same time sadness to be seen. Our world is weird, and full of contradiction everywhere, yet somehow at moments seems to come together, and make near perfect sense.

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Re: Hi
« Reply #2 on: May 06, 2017, 06:08:40 AM »
Yes, I'm doing active development on a next version.  I recently dropped a sort of preview thing here.

If you know/can learn C#, I'm sure I could give you some tasks you'd find interesting.  Information on getting the source code up and running is found here.

If you know Visual Basic 6, you could play around in the current version.  In some ways it's an easier codebase to figure out and modify, but it's also pretty easy to break stuff without knowing since it's not really tested.  Its SVN is here.

Offline dsaddan

  • Bot Neophyte
  • *
  • Posts: 8
    • View Profile
Do you need work done on the DB2 Visual Basic 6 based code?
« Reply #3 on: May 06, 2017, 05:36:21 PM »
I will be happy to work on the DB2 VB6 code to get to know the application.

Do you need any work such as bug fixing done there?

Dror

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Re: Hi
« Reply #4 on: May 07, 2017, 06:56:31 AM »
I haven't been doing any work in the VB6 code for many years now, so I don't know what all needs doing there.  I think bugs at least are pretty well squished.

If you were feeling really adventurous you could try and figure out testing.  Not knowing if a change is breaking something has been a huge issue for us in that code base.  From a quick google I found SimplyVBUnit.  If you wanted to you could try and figure out how to set that up so that we had some unit tests.  That would be a gigantic help.  If you aren't familiar with unit testing I think the Stepping Through the Looking Glass: Test-Driven Game Development is a good introduction.

In terms of what to test to start with, if you look in common.bas, there's a bunch of low level functions that get used all over the place.  Testing VectorMagnitude would be a good place to start.  Make sure it doesn't overflow especially.

When you're ready, you can create a SVN patch (for tortoise see Creating and Applying Patches) and upload it to the forums here in a post (if it's not too big).  I'll review it and make sure you're on the right track and check it in.  After a few such patches I'll give you an account to check code in with yourself.

Offline dsaddan

  • Bot Neophyte
  • *
  • Posts: 8
    • View Profile
Unit Tests
« Reply #5 on: May 07, 2017, 08:43:45 AM »
OK. I will look inyo creating unit tests for DB2.

What about minor changes to the code? For example:

Public Function SysvarTok(a As String, Optional n As Integer = 0) As Integer
  Dim t As Integer
 
  If Left(a, 1) = "." Then
    a = Right(a, Len(a) - 1)
       
    For t = 1 To UBound(sysvar)
      If LCase(sysvar(t).Name) = LCase(a) Then SysvarTok = sysvar(t).value
    Next t
   
    If n > 0 Then
      For t = 1 To UBound(rob(n).vars)
        If rob(n).vars(t).Name = a Then SysvarTok = rob(n).vars(t).value
      Next t
    End If
  Else
    SysvarTok = val(a)
  End If
End Function



Would not it be better to
LCase "a" just once?
LCase in the second loop on rob(n).vars?
Exit a loop once you have a hit?
Skip the first loop if n > 0 since we overwrite SysvarTok in the second loop? ==> Simply switch the loop order
Raise an error if the "a" is not found in sysvars or robot vars? Currently the code ignores the error and returns 0.

Why is there a need to LCase sysvar(I).Name) when this could be done after initializing sysvar?
Looks to me that this LCase is done for each DNA strand of each copy of each robot when starting the sim. Very wasteful.



'---------------------------------------------------------------------------------------
' Procedure : SysvarTok
' Author    :
' Date      : 07/05/2017
' Purpose   :
'---------------------------------------------------------------------------------------
Public Function SysVarTok(a As String, Optional n As Integer = 0) As Integer
10      On Error GoTo func_err
        Const FUNC_NAME = MOD_NAME & "SysVarTok"
        Dim I As Integer
       

20      If Left(a, 1) = "." Then
30        a = LCase(Right(a, Len(a) - 1))
             
40        If n > 0 Then
50          For I = 1 To UBound(rob(n).vars)
60            If LCase(rob(n).vars(I).Name) = a Then
70                SysVarTok = rob(n).vars(I).value
80                Exit Function
90            End If
100         Next
110       End If

120       For I = 1 To UBound(sysvar)
130         If LCase(sysvar(I).Name) = a Then
140           SysVarTok = sysvar(I).value
150           Exit Function
160         End If
170       Next
         
180       Err.Raise 19999, "", "Unknown SysVar or robot vars: ." & a & " in bot number " & n
         
190     Else
200       SysVarTok = val(a)
210     End If

220   Exit Function

func_err:
230   Err.Raise Err.Number, FUNC_NAME & "[" & Erl & "]" & "\" & Err.source, Err.Description
End Function



Dror

Offline dsaddan

  • Bot Neophyte
  • *
  • Posts: 8
    • View Profile
I added several unit tests
« Reply #6 on: May 07, 2017, 02:51:45 PM »
Hi:

I added the some unit tests for common.bas.

I found a bug in fRnd:
fRnd(10,10) ==> 11



In order to run the code you will need to do the following:

1. Install SimplyVBUnit 4.1.6 from http:// https://sourceforge.net/projects/simplyvbunit/files/latest/download
2. The DarwinBots2UnitTests.vbp contains two references that may be different in your system. Edit the file if necessary:

2   Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\Windows\SysWOW64\stdole2.tlb#OLE Automation
3   Reference=*\G{923925AC-1013-4D27-9FB1-4FF0B3B47BA2}#4.0#0#C:\WINDOWS\SysWow64\SimplyVBUnitType.tlb#SimplyVBUnit Type Library 4.0

The patch is here:
https://app.caspitweb.biz/content/db/Darwinbots2UnitTests_07_05_2017.7z

Dror

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Re: Hi
« Reply #7 on: May 08, 2017, 06:09:14 AM »
Looks good.  Give me a day or so to give it a look over and check it in.

Offline dsaddan

  • Bot Neophyte
  • *
  • Posts: 8
    • View Profile
Skip to patch Darwinbots2UnitTests_09_05_2017.patch
« Reply #8 on: May 08, 2017, 05:55:56 PM »
Hi:

Please ignore Darwinbots2UnitTests_07_05_2017.patch and skip to Darwinbots2UnitTests_09_05_2017.patch
https://app.caspitweb.biz/content/db/Darwinbots2UnitTests_09_05_2017.7z

Reason:
patch 07_05_2017 would not complie to an exe so I imported the missing modules, forms and classes.
I added more tests.

Dror

Offline Shadowgod2

  • Bot Destroyer
  • ***
  • Posts: 387
    • View Profile
Re: Hi
« Reply #9 on: May 08, 2017, 11:36:39 PM »
hi haven't been on db in a few days.. went on a bit of a trip. welcome to db :D glad to see you fitting in nicely.

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Re: Hi
« Reply #10 on: May 11, 2017, 01:12:40 PM »
Just an update that I haven't forgotten about you.

I recently had to reinstall Windows 7, so there was a lot of ActiveX wrangling to get Visual Basic working.  I'm trying to go through and sanitize it so this won't be as much of an issue in the future.

I'm sorry it's taking so long.  Next patch won't take so long for me to review I promise.

Offline dsaddan

  • Bot Neophyte
  • *
  • Posts: 8
    • View Profile
No problem ...
« Reply #11 on: May 13, 2017, 04:53:33 AM »
There is no particular rush.

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Re: Hi
« Reply #12 on: May 13, 2017, 11:07:56 AM »
I've checked in the unit tests.  I've put them in their own folder just so things don't get entirely crazy.  However, they don't seem to be showing up in the test app (it shows 0 tests).  I couldn't figure out where it went wrong.  Maybe you can take a look at it?