## Search found 330 matches

- Apr 11, 2021 19:15
- Forum: Beginners
- Topic: Exist a Type for more than one variable?
- Replies:
**3** - Views:
**268**

### Re: Exist a Type for more than one variable?

Types can be nested. type typethingA piece1 as Integer piece2 as integer end type type typethingb piece1 as integer piece2 as integer end type type typearray thingA as typethingA thingB as typethingB end type dim as typearray array(5) array(1).thingA.piece1=10 array(4).thingB.piece2=15 print array(...

- Apr 11, 2021 13:41
- Forum: Beginners
- Topic: Exist a Type for more than one variable?
- Replies:
**3** - Views:
**268**

### Re: Exist a Type for more than one variable?

This is the best I could do. Exists something better? Type ListaMovidas Desde As Integer Hacia As Integer Tipo As Integer Corona As Integer AlPaso As Integer ValorOrden As Integer End Type Dim Shared LM(1 To 100,1 To 500) As ListaMovidas Dim As Integer Profundidad, Movida Profundidad=5 Movida=23 LM(...

- Apr 11, 2021 13:31
- Forum: Beginners
- Topic: Exist a Type for more than one variable?
- Replies:
**3** - Views:
**268**

### Exist a Type for more than one variable?

I´m coming from the Sinclair Spectrum Basic and I use arrays for everything. I discovered something interesting in clarity that is "Type". Instead of Array (1 to 3) I could use: Array.ThingA; Array.ThingB and Array.ThingC What about if I need Array (1 to 2, 1 to 2)? Exist something that al...

- Apr 04, 2021 17:22
- Forum: Beginners
- Topic: Problem adding Ulongint numbers
- Replies:
**30** - Views:
**847**

### Re: Problem adding Ulongint numbers

Don't use ^ with integers. The ^ operator takes 2 doubles as inputs and returns a double. When used with integers, automatic conversion to and from doubles is done. Example: Dim a As ULongInt a=18049651735527936 Print a+2^0 Sleep Prints: 1.804965173552794e+16 Interestingly fbc 32-bit behaves differ...

- Apr 04, 2021 17:20
- Forum: Beginners
- Topic: Problem adding Ulongint numbers
- Replies:
**30** - Views:
**847**

### Re: Problem adding Ulongint numbers

A 64 bits word is used as a chessboard. Fine, but not enough information about the layout. If I assume for instance: field (on chess board) A1 is represented in bit 0 (lowermost bit) then: is bit 1 representative for A2, or B1? e.t.c. while you might know those things, others here don't ... Is my f...

- Apr 04, 2021 13:13
- Forum: Beginners
- Topic: Problem adding Ulongint numbers
- Replies:
**30** - Views:
**847**

### Re: Problem adding Ulongint numbers

Yeah I'm confused too. Why are you doing exponentiation when you're really just after a bit mask. Just use bit shifting. That's what it's there for and CPUs can do it super efficiently with no math. To be clear, say you want to turn on bits x,y, and z. Instead of multiplying out 2 to the powers of ...

- Apr 04, 2021 12:26
- Forum: Beginners
- Topic: Problem adding Ulongint numbers
- Replies:
**30** - Views:
**847**

### Re: Problem adding Ulongint numbers

Wow! Thanks for your time dodicat!

I need time to understand it.

I need time to understand it.

- Apr 04, 2021 5:13
- Forum: Beginners
- Topic: Problem adding Ulongint numbers
- Replies:
**30** - Views:
**847**

### Re: Problem adding Ulongint numbers

As I said, do not matter the time it takes cause it is needed just before start the game. But may be is nicer the way you said. I need to understand it better.

- Apr 04, 2021 5:12
- Forum: Beginners
- Topic: Problem adding Ulongint numbers
- Replies:
**30** - Views:
**847**

### Re: Problem adding Ulongint numbers

Yeah I'm confused too. Why are you doing exponentiation when you're really just after a bit mask. Just use bit shifting. That's what it's there for and CPUs can do it super efficiently with no math. To be clear, say you want to turn on bits x,y, and z. Instead of multiplying out 2 to the powers of ...

- Apr 04, 2021 2:30
- Forum: Beginners
- Topic: Problem adding Ulongint numbers
- Replies:
**30** - Views:
**847**

### Re: Problem adding Ulongint numbers

I need to caclulate it for a bishop in each of the 64 squares of the board and in the 4 directions it could move.

The same for the rook.

The same for the rook.

- Apr 04, 2021 2:28
- Forum: Beginners
- Topic: Problem adding Ulongint numbers
- Replies:
**30** - Views:
**847**

### Re: Problem adding Ulongint numbers

So I need to calculate 2^x1+2*x2+...+2^xn (where xi are any numbers from 0 to 63) exactly, because if not, that means the bishop could move where it couldnt. Or do not move where it could.

- Apr 04, 2021 2:26
- Forum: Beginners
- Topic: Problem adding Ulongint numbers
- Replies:
**30** - Views:
**847**

### Re: Problem adding Ulongint numbers

I don't really understand what exactly you're after. If it's the maximum value a ULongInt can hold use: Const As ULongInt ULImax = &hFFFFFFFFFFFFFFFF Just print it out to get the DEC equivalent. Sorry, not understand :-( I need to calculate the addition of several 2^x numbers. A 64 bits word is...

- Apr 04, 2021 2:16
- Forum: Beginners
- Topic: Problem adding Ulongint numbers
- Replies:
**30** - Views:
**847**

### Re: Problem adding Ulongint numbers

Seems this works:

Code: Select all

`Function POT(ByVal num As Integer)As ULongInt`

Dim i As Integer

Dim resultado As ULongInt

resultado=1

For i=1 To num

resultado=resultado*2

Next

POT=resultado

End Function

- Apr 04, 2021 2:08
- Forum: Beginners
- Topic: Problem adding Ulongint numbers
- Replies:
**30** - Views:
**847**

### Re: Problem adding Ulongint numbers

caseih wrote:Why would it not be safe? Are you concerned about an overflow?

I need the exactly result. A differencie of just 1 means a piece could moves wrongly.

Or do not see a possible move.

- Apr 04, 2021 1:55
- Forum: Beginners
- Topic: Problem adding Ulongint numbers
- Replies:
**30** - Views:
**847**

### Re: Problem adding Ulongint numbers

Is this safer for 2^63?

I just need to do it once at the begining of the game, no matter if consumes more time.

I just need to do it once at the begining of the game, no matter if consumes more time.