Big Integer handling in Blitz Basic 2D?

Miscellaneous Forums/General Discussion/Big Integer handling in Blitz Basic 2D?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

The answer is because if you've ever played "Trump: The Board game", it lowest dominator is 10 million, you can win potentially up to 1 billion +

In addition, in the game SWOS (Sensible World of Soccer) it used 1m 1.5m, 2.5k, etc (including a unit of measure) to aid usability and visual appeal, I wanted all of that -- but still wanted to do percentage cuts, and a multiplier of profits card (or multiple taxes card).

The way I resolved this problem was to do;

; This may be the wrong version, as I have different versions of the same code on my machine
; --------------------------------
Const	use_tender		= True
Const  	min_tender		= 10
Global 	cash_millions 	= 10
Global 	cash_billions 	= 1

Function add( millions=0, billions=0 )

	If (millions > 0) Then
		cash_millions = cash_millions + millions
	End If
	
	If (billions > 0) Then
		cash_billions = cash_billions + billions
	End If
	
	If cash_millions > 999 Then
		Repeat
			sum = (1000 - cash_millions)
			cash_millions = ( 0 ) + sum
			cash_billions = cash_billions + 1
		Until cash_millions < 1000
	End If
	
	If cash_billions > 10 Then cash_billions = 10
	
End Function

Function subtract( millions=0, billions=0 )

	If (millions > 0) Then
		If (cash_billions > 0) Then
			cash_millions = 1000
			cash_billions = cash_billions - min_tender
		End If

		If cash_millions > 0 Then
			cash_millions = cash_millions - millions	
		End If
	End If
	
	If (billions > 0) Then
		cash_billions = cash_billions - billions
	End If
	
	If cash_millions < 0 Then cash_milions  = 0
	If cash_billions < 0 Then cash_billions = 0	
End Function

add(0,0)


While Not KeyHit(1)
	Cls
	
		Text 100, 100 , cash_millions + "m"
		Text 100, 110 , cash_billions + "b"
				
		
		WaitKey()
		subtract(10)
		
	Flip
Wend


I did not try floats, but seeing as I just uninstalled BB2D, I'll have to reinstall it to find out if I can go to at least 10 billion.