hey one more problem, we need certain cards more common then others, infact we need there to be 4 ore and 2 fuel for each laser. I thought by increasing the resources in the array like so:
dim resources(6) as resource
resources(0).name = "Ore" : resources(0).count = 0
resources(1).name = "Fuel" : resources(1).count = 0
resources(2).name = "Ore" : resources(2).count = 0
resources(3).name = "Fuel" : resources(3).count = 0
resources(4).name = "Laser" : resources(4).count = 0
resources(5).name = "Ore" : resources(5).count = 0
resources(6).name = "Ore" : resources(6).count = 0
itd do it, and it kind does but it prints it like so:
how would i make it so that it prints it all on just 3 lines but includes the more common code?
heres the full code with the modded array:
type resource
name as string
count as integer
endtype
Rem set resources
dim resources(6) as resource
resources(0).name = "Ore" : resources(0).count = 0
resources(1).name = "Fuel" : resources(1).count = 0
resources(2).name = "Ore" : resources(2).count = 0
resources(3).name = "Fuel" : resources(3).count = 0
resources(4).name = "Laser" : resources(4).count = 0
resources(5).name = "Ore" : resources(5).count = 0
resources(6).name = "Ore" : resources(6).count = 0
Rem start the generator
Do
Rem say what the resources are
Print "The three resources are: Laser, Fuel and Ore"
Rem ask player to input how many resource cards they are getting
Input "Enter number of Cards: ", ResourceNum
Print "--"
Rem print they amount of cards
Print "You have ";ResourceNum;" resource cards. They are:"
Rem Reset the count of each resource
FOR i=0 to array count( resources() )
resources(i).count = 0
NEXT i
Rem write the resource cards ResourceNum amount of times
FOR rsrc = 1 TO ResourceNum
Rem increase the count of the random resource
inc resources( rnd(6) ).count
Rem write once more
NEXT rsrc
Rem print the rescources to the screen
FOR i=0 to array count( resources() )
if resources(i).count>0 then print resources(i).count,"x ",resources(i).name
NEXT i
Rem wait 1 second then print a divider
Wait (1000)
Print "----------------------------"
Loop
and heres how it was when unmodded:
type resource
name as string
count as integer
endtype
Rem set resources
dim resources(2) as resource
resources(0).name = "Laser" : resources(0).count = 0
resources(1).name = "Fuel" : resources(1).count = 0
resources(2).name = "Ore" : resources(2).count = 0
Rem start the generator
Do
Rem say what the resources are
Print "The three resources are: Laser, Fuel and Ore"
Rem ask player to input how many resource cards they are getting
Input "Enter number of Cards: ", ResourceNum
Print "--"
Rem print they amount of cards
Print "You have ";ResourceNum;" resource cards. They are:"
Rem Reset the count of each resource
FOR i=0 to array count( resources() )
resources(i).count = 0
NEXT i
Rem write the resource cards ResourceNum amount of times
FOR rsrc = 1 TO ResourceNum
Rem increase the count of the random resource
inc resources( rnd(2) ).count
Rem write once more
NEXT rsrc
Rem print the rescources to the screen
FOR i=0 to array count( resources() )
if resources(i).count>0 then print resources(i).count,"x ",resources(i).name
NEXT i
Rem wait 1 second then print a divider
Wait (1000)
Print "----------------------------"
Loop
any help appreciated