Project for creating and displaying a table.

daeleo

New Member
Hi guys,
I'm relatively new to Picaxes and coding in general (though I've successfully churned out some useful gadgets already), and my current project has me stumped.

What I'm trying to do, is to use a 20m2 (or 20x2 if necessary), to read the ADC of a few knobs to generate a table of values, and randomly display each one only once through a 7 segment display.

Essentially, I'm making a unit for my Lazertag group, that you set the number of players per team (only 2 teams), and spies, and pass the unit to each player who is then privately assigned their role as a player or spy accordingly.

For example, if the unit is set to 5 players per team, and 1 spy, then it would generate a table containing 4xT1 4xT2 1xT1-S 1xT2-S, and upon a button press display either "1", "2", "1 _ S", or "2 _ S"... Each displayed privately to the player assigning them to team 1, team 2, team 1 (spying for team 2), and team 2 (spying for team 1), respectively. Ensuring that the device displays each value randomly once and only once. (Alternatively, I may simplify this to use a simple array of just 3 LEDS, 2 for team, and a separate one for spy, in which case I'd likely switch to 08m2).

And I can only think of doing this by means of a very convoluted series of if-thens..

Any ideas?
Thanks!
 

mrburnette

Senior Member
Consider:
- Max of two (2) teams
- Random number of players (always even number???)
- 1 player identified as a spy per team

So, if we were to do this with torn pieces of paper, we would need how many pieces?
2 x (N) right? Where N is the number of players.

With the computer, lets deal with the worst case... we can make N = 20 ('cause I am making up the rules as we go along and in my game, there are never more than 20 players!)

So, we need to allocate 2 x (10) or 20 allocations. Can we do this with a 08M2+ ...Ummm
Refer to: picaxem2.pdf page 4 and the section marked Memory Capacity. How much do we need? 20 Bytes... we can store both the A/B team Id AND the role in a byte with room to spare!

If Team A has a high-bit bias (+128) and team B has a high-bit bias (+0) then we could differentiate Team A from B by simply looking to see if the value of an assigned slot was < 128. So, lets do the roles:
Player = 1 and Spy (any of 2 / 4 / 8 / 16 / 32 / 64) ... I think I want to use 32, but you can use anything below 127.

I think we are on to something. ... all we need to know is the total even numbers of players, which team they are on, and if they are a spy or not. Simple is good.

Code:
Team A: (ADD 128 to total)                TeamB: (add 0 to total)
Spy value = +32                                Spy = +32
On the 08M2, we have variables b0 through b27, so I'm going to use the first 20 (or less, based on players). For a read on how to reprogram this logic without using any named variables, you can read this:
RAM-bank-switching
but there is no reason to do that today... it will only confuse you... it does me and I wrote it.

If I have a For / Next loop that starts at 0 and ends at 19 (20 steps), then I can "bptr" to cycle through these. Then the value read would logically look something like this:
If variable > 127 then gosub TeamA
else gosub TeamB
EndIf

Then in the TeamA or TeamB subroutines, we would do something like this:
If variable > 31 then goto Spy
else Print "You are on Team..."
endIF : Return

Spy:
Print "You are a SPY on Team..."
Return

Well, we have done the easy stuff, first? Yep. The tricky part is to pre-fill the variables b0 through b20 (or less) from a random routine. There are many threads on the forum about how to make sure random is random and you should search and read them, but for this reply, I'm just going to gloss over the details somewhat and over simplify. random/ BIG DEAL: Random creates a WORD value. We have used the first 20 bytes of named memory variables, so we must start with W10 ("W10" is made-up of byte variable b21 and b20).

Using instruction RANDOM W10 we wind up with W10 having a value of between 0 and 65535. If we were to clear b0 through b19 and then ran the random instruction in a loop, testing it as greater than 32767 or less than 32768 then we have one way that we could differentiate between teamA and teamB.

The code below will run in the simulator and will generate a pseudo-random array of 20 variables, b0 - b19, which will have a 10::10 distribution.

Think you can take this, add some logic to add two "spies" to the array and then work on the output routines for the players? You will also need to make some adjustment for the size of the array, etc. This is not elegant code, but is brute force. Gotta start somewhere...


- Ray


Code:
#picaxe08m2
SYMBOL Pr00 = B0		' B1-B0 over-mapped by W0 & by bit0 - bit7
SYMBOL Pr01 = B1
SYMBOL Pr02 = B2		' B3-B2 over-mapped by W1 & by bit8 - bit15
SYMBOL Pr03 = B3
SYMBOL Pr04 = B4		' B5-B4 over-mapped by W2 & by bit16 - bit31
SYMBOL Pr05 = B5
SYMBOL Pr06 = B6		' B7-B6 over-mapped by W3
SYMBOL Pr07 = B7
SYMBOL Pr08 = B8		' B9-B8 over-mapped by W4
SYMBOL Pr09 = B9
SYMBOL Pr10 = B10		' B11-10 over-mapped by W5
SYMBOL Pr11 = B11
SYMBOL Pr12 = B12		' B13-B12 over-mapped by W6
SYMBOL Pr13 = B13
SYMBOL Pr14 = B14		' B15-B14 over-mapped by W7
SYMBOL Pr15 = B15
SYMBOL Pr16 = B16		' B17-B16 over-mapped by W8
SYMBOL Pr17 = B17
SYMBOL Pr18 = B18		' B19-B18 over-mapped by W9
SYMBOL Pr19 = B19

; W10 is bytes B21 and B20
SYMBOL Ateam = B22
SYMBOL Bteam = B23

Ateam = 1 : Bteam= 0

for bptr = 0 to 19 : @bptr = 0 : next  ; clear b0 through b19

Again:
Let W10 = time : Random W10 ; seed random number

For bptr = 0 to 19
    Random W10
    If W10 > 32767 then
    	IF Ateam < 11 and @bptr = 0 then ; safety net for second time through if required
       	@bptr =  128 : INC Ateam
    	Else
    	 	EXIT
    	endIF
    EndIF
Next

; distributions in small sets are never predictable, so check and continue until we have a full Ateam
If Ateam < 11 then goto Again

; continue programming here...
 
Last edited:

daeleo

New Member
Brilliant!

I really do appreciate your thoroughness and citations, it helps immensely in furthering my understanding, I couldn't ask for a more helpful reply!

With all that you provided, the rest should come relatively easily, I plan on starting right away. =D

Thank you again!
 

daeleo

New Member
Ok, So my novicehood at code is still showing I'm afraid. Here's how I'm progressing..



Code:
;+5v
;Pin C.5 Main button
;Pin C.4 Player knob
;Pin C.3 Spy switch

;0v
;Pin C.0 LED 1
;Pin C.1 LED 2 
;Pin C.2 LED 3 




#picaxe 08m2
SYMBOL LED1 = C.0
SYMBOL LED2 = C.1
SYMBOL LED3 = C.2

SYMBOL Players = B26
SYMBOL Spies = B27

SYMBOL Pr00 = B0		' B1-B0 over-mapped by W0 & by bit0 - bit7
SYMBOL Pr01 = B1
SYMBOL Pr02 = B2		' B3-B2 over-mapped by W1 & by bit8 - bit15
SYMBOL Pr03 = B3
SYMBOL Pr04 = B4		' B5-B4 over-mapped by W2 & by bit16 - bit31
SYMBOL Pr05 = B5
SYMBOL Pr06 = B6		' B7-B6 over-mapped by W3
SYMBOL Pr07 = B7
SYMBOL Pr08 = B8		' B9-B8 over-mapped by W4
SYMBOL Pr09 = B9
SYMBOL Pr10 = B10		' B11-10 over-mapped by W5
SYMBOL Pr11 = B11
SYMBOL Pr12 = B12		' B13-B12 over-mapped by W6
SYMBOL Pr13 = B13
SYMBOL Pr14 = B14		' B15-B14 over-mapped by W7
SYMBOL Pr15 = B15
SYMBOL Pr16 = B16		' B17-B16 over-mapped by W8
SYMBOL Pr17 = B17
SYMBOL Pr18 = B18		' B19-B18 over-mapped by W9
SYMBOL Pr19 = B19

; W10 is bytes B21 and B20
SYMBOL Ateam = B22
SYMBOL Bteam = B23


Ateam = 1 : Bteam= 0
for bptr = 0 to 19 : @bptr = 0 : next  ; clear b0 through b19

Again:
For bptr = 0 to 19
    Let W10 = time : Random W10
    If W10 > 32767 then
    	IF Ateam < 11 and @bptr = 0 then ; safety net for second time through if required
       	@bptr =  128 : INC Ateam
    	Else
    	 	EXIT
    	endIF
    EndIF
Next
; distributions in small sets are never predictable, so check and continue until we have a full Ateam
If Ateam < 11 then goto Again
goto playercheck

;Recycling unneeded varibles for my portion of code.
'-----------------------------------------------------
playercheck:
ReadADC C.4, B22						;Reading from 10-position volume knob
If B22 > 225 then let players = 10 goto spycheck
endif
If B22 > 200 then let players = 9 goto spycheck
endif
If B22 > 180 then let players = 8 goto spycheck
endif
If B22 > 160 then let players = 7 goto spycheck
endif
If B22 > 140 then let players = 6 goto spycheck
endif
If B22 > 120 then let players = 5 goto spycheck
endif
If B22 > 100 then let players = 4 goto spycheck
endif
If B22 > 80 then let players = 3 goto spycheck	;3 players per team is the minimum.
endif

spycheck:							;Reading from 2-position switch
If pinC.3 = 0 then let Spies = 1
endif 
If pinC.3 = 1 then let Spies = 2                       ;Spies per team
endif


;B22, B23, B24, B25, W10 (20/21) available for recycling


Let W10 = time
Let B22 = 0 ;Spy Counter
Let B23 = 0 ;Player Counter
routine:

do
If pinC.5 = 1 then exit
Random W10    
loop

If B0 = 128 then High LED1
else High LED2
endif

If W10 > 50000 then 
	if B22 < Spies and B23 < players then Inc B22 High LED3
	endif
endif


Inc B23
Pause 3000
Low LED1 : Low LED2 : Low LED3

;rinse, repeat, for each player
I know with a little tweaking, I can eventually get this to work, but the lines it consumes alone is unforgivable.. Most of my knowledge comes directly from parsing the included manuals, I believe this can work eventually, but would you know of something a touch more... concise?

Thanks again for letting me pick your brain! =D
 

mrburnette

Senior Member
@daeleo:
I reworked the array routine to deal with the variable aspects. I moved your input blocks above the array code because you cannot fill the array until one knows the game parameters. I STILL HAVE NOT put in the code for the Spies... so you have some thinking to do to see if you can work this out with some experimenting and thinking. Think about it like this... If one spy per team then you must loop through the total array and put ONE +32 into a cell that has 128 in it and one +32 into a cell that has a value of 0.

See if this is more what you are thinking. You will need to remove the #REM and #ENDREM block to run the code... ALSO, you must remark this line in line#97:
Players = 4 : Spies = 2

Right now, it runs in the simulator for testing. I did not do a full test... only a few loops.

Code:
;+5v
;Pin C.5 Main button
;Pin C.4 Player knob
;Pin C.3 Spy switch

;0v
;Pin C.0 LED 1
;Pin C.1 LED 2 
;Pin C.2 LED 3 




#picaxe 08m2
SYMBOL LED1 = C.0
SYMBOL LED2 = C.1
SYMBOL LED3 = C.2

SYMBOL Pr00 = B0		' B1-B0 over-mapped by W0 & by bit0 - bit7
SYMBOL Pr01 = B1
SYMBOL Pr02 = B2		' B3-B2 over-mapped by W1 & by bit8 - bit15
SYMBOL Pr03 = B3
SYMBOL Pr04 = B4		' B5-B4 over-mapped by W2 & by bit16 - bit31
SYMBOL Pr05 = B5
SYMBOL Pr06 = B6		' B7-B6 over-mapped by W3
SYMBOL Pr07 = B7
SYMBOL Pr08 = B8		' B9-B8 over-mapped by W4
SYMBOL Pr09 = B9
SYMBOL Pr10 = B10		' B11-10 over-mapped by W5
SYMBOL Pr11 = B11
SYMBOL Pr12 = B12		' B13-B12 over-mapped by W6
SYMBOL Pr13 = B13
SYMBOL Pr14 = B14		' B15-B14 over-mapped by W7
SYMBOL Pr15 = B15
SYMBOL Pr16 = B16		' B17-B16 over-mapped by W8
SYMBOL Pr17 = B17
SYMBOL Pr18 = B18		' B19-B18 over-mapped by W9
SYMBOL Pr19 = B19
; W10 is bytes B21 and B20
SYMBOL Ateam = B22
SYMBOL Bteam = B23
SYMBOL Total = B24
SYMBOL Mor2Do= B25
SYMBOL Players= B26
SYMBOL Spies = B27
'-----------------------------------------------------
; Potentiometer value == number of Ateam players
; ASSUME Bteam has same number!
;
#REM

playercheck:

ReadADC C.4, players	;Reading from 10-position volume knob
select case players
	case > 225 
		players = 10 
		goto spycheck

	case > 200
		players = 9 
		goto spycheck

	case > 180
		players = 8
		goto spycheck

	case > 160 
		players = 7
		goto spycheck

	case > 140
		players = 6
		goto spycheck

	case > 120
		players = 5
		goto spycheck

	case > 100
		players = 4
		goto spycheck

	case > 80
		players = 3
		'goto spycheck	;3 players per team is the minimum.
	endselect

spycheck:							;Reading from 2-position switch
If pinC.3 = 0 then let Spies = 1
endif 
If pinC.3 = 1 then let Spies = 2                       ;Spies per team
endif

#endrem

Players = 4 : Spies = 2
Total = Players * 2 - 1 ' because I am using (0) as first array element
Mor2do = Players + 1
;-----------------------------------------------------------------
;--------------------------Initialize array-----------------------

Ateam = 1 : Bteam= 0
for bptr = 0 to Total : @bptr = 0 : next  ; clear b0 through b19 (max)

Again:
For bptr = 0 to Total
    Let W10 = time : Random W10
    If W10 > 32767 then
    	IF Ateam < Mor2Do and @bptr = 0 then ; safety net for second time through if required
       	@bptr =  128 : INC Ateam
    	Else
    	 	EXIT
    	endIF
    EndIF
Next

; distributions in small sets are never predictable, so check and continue until we have a full Ateam
If Ateam < Mor2Do then goto Again
; goto playercheck

; ----------------------------------------------------------
;Recycling unneeded varibles for my portion of code.
;B22, B23, B24, B25, W10 (20/21) available for recycling
; ----------------------------------------------------------
stop

Let W10 = time
Let B22 = 0 ;Spy Counter
Let B23 = 0 ;Player Counter
routine:

do
If pinC.5 = 1 then exit
Random W10    
loop

If B0 = 128 then High LED1
else High LED2
endif

If W10 > 50000 then 
	if B22 < Spies and B23 < players then Inc B22 High LED3
	endif
endif


Inc B23
Pause 3000
Low LED1 : Low LED2 : Low LED3

;rinse, repeat, for each player
-Ray
 

daeleo

New Member
It looks great friend, thanks again! I don't have time to work on it yet, but I'll post here again with results when I've had a chance to mix up the code.

Much appreciated! I can already tell it looks much cleaner!
 

mrburnette

Senior Member
@daeleo,
NP, but I left a few syntax errors in your code, but you can work that out as they are easy and the compiler will assist you.

I'm spending less time in the forum these days, but I will try and check back at least every other day to see if you have posted.
I am surprised some of out more knowledgeable members have not jumped in to assist, but if I'm not prompt with a reply, surely they will come to the rescue.

- Ray
 

daeleo

New Member
I apologize sincerely for such a long delay between replies Ray, but life has kept me rather busy as of late, and I haven't had time to tinker with this fun little project. :(

But I took to it again recently, and have attempted to follow your example to complete the code, but am still hitting a roadblock for some reason, here's what feels to be the final product, but I can't seem to get to work, once again, your input is greatly valued and appreciated!


Code:
;+5v
;Pin C.5 Main button
;Pin C.4 Player knob
;Pin C.3 Spy switch

;0v
;Pin C.0 LED 1
;Pin C.1 LED 2 
;Pin C.2 LED 3 




#picaxe 08m2
SYMBOL LED1 = C.0
SYMBOL LED2 = C.1
SYMBOL LED3 = C.2

SYMBOL Pr00 = B0		' B1-B0 over-mapped by W0 & by bit0 - bit7
SYMBOL Pr01 = B1
SYMBOL Pr02 = B2		' B3-B2 over-mapped by W1 & by bit8 - bit15
SYMBOL Pr03 = B3
SYMBOL Pr04 = B4		' B5-B4 over-mapped by W2 & by bit16 - bit31
SYMBOL Pr05 = B5
SYMBOL Pr06 = B6		' B7-B6 over-mapped by W3
SYMBOL Pr07 = B7
SYMBOL Pr08 = B8		' B9-B8 over-mapped by W4
SYMBOL Pr09 = B9
SYMBOL Pr10 = B10		' B11-10 over-mapped by W5
SYMBOL Pr11 = B11
SYMBOL Pr12 = B12		' B13-B12 over-mapped by W6
SYMBOL Pr13 = B13
SYMBOL Pr14 = B14		' B15-B14 over-mapped by W7
SYMBOL Pr15 = B15
SYMBOL Pr16 = B16		' B17-B16 over-mapped by W8
SYMBOL Pr17 = B17
SYMBOL Pr18 = B18		' B19-B18 over-mapped by W9
SYMBOL Pr19 = B19
; W10 is bytes B21 and B20
SYMBOL Ateam = B22
symbol SpyA = b22
symbol PlayerCounter = b22

SYMBOL Bteam = B23
symbol SpyB = b23

SYMBOL Total = B24
symbol SpyCountA = b24

SYMBOL Mor2Do= B25
symbol SpyCountB = b25

SYMBOL Players= B26
SYMBOL Spies = B27
'-----------------------------------------------------
; Potentiometer value == number of Ateam players
; ASSUME Bteam has same number!
;
#REM

playercheck:

ReadADC C.4, players	;Reading from 10-position volume knob
select case players
	case > 225 
		players = 10 
		goto spycheck

	case > 200
		players = 9 
		goto spycheck

	case > 180
		players = 8
		goto spycheck

	case > 160 
		players = 7
		goto spycheck

	case > 140
		players = 6
		goto spycheck

	case > 120
		players = 5
		goto spycheck

	case > 100
		players = 4
		goto spycheck

	case > 80
		players = 3
		'goto spycheck	;3 players per team is the minimum.
	endselect

spycheck:							;Reading from 2-position switch
If pinC.3 = 0 then let Spies = 1
endif 
If pinC.3 = 1 then let Spies = 2                       ;Spies per team
endif

#endrem

Players = 4 : Spies = 1
Total = Players * 2 - 1 ' because I am using (0) as first array element
Mor2do = Players + 1

;-----------------------------------------------------------------
;--------------------------Initialize array-----------------------

Ateam = 1 : Bteam= 0
for bptr = 0 to Total : @bptr = 0 : next  ; clear b0 through b19 (max)

Again:
For bptr = 0 to Total
    Let W10 = time : Random W10
    If W10 > 32767 then
    	IF Ateam < Mor2Do and @bptr = 0 then ; safety net for second time through if required
       	@bptr =  128 : INC Ateam
    	Else
    	 	EXIT
    	endIF
    EndIF
Next

; distributions in small sets are never predictable, so check and continue until we have a full Ateam
If Ateam < Mor2Do then goto Again
; goto playercheck


SpyA = 0 ; count of spies on team A
SpyB = 0
SpyCountA = 0
SpyCountB = 0


AgainSpy:
for bptr = 0 to Total
	Let W10 = time : Random W10
    If W10 > 50000 then
    	IF SpyCountA < Spies then ; safety net for second time through if required
		if SpyCountA < Spies AND @bptr > 128 then
		INC SpyA
			@bptr = @bptr + 32
		endif
	elseif SpyCountB < Spies then
		INC SpyB
		@bptr =  @bptr + 32
    	Else
    	 	EXIT
    	endIF
    EndIF
next

If SpyA < Spies then goto AgainSpy
If SpyB < Spies then goto AgainSpy




Let PlayerCounter = 0




DisplayRoutine:

For bptr = 0 to Total

Do
	If pinC.5 = 1 then exit;wait for button press
Loop

If @bptr = 0 then High LED1				;Team 1
 elseif @bptr = 32 then High LED1 High LED3	;Team 1 Spy
 elseif @bptr = 128 then High LED2			;Team 2
 elseif @bptr = 160then High LED2 High LED3	;Team 2 Spy
endif

Pause 3000
Low LED1 : Low LED2 : Low LED3
INC PlayerCounter

If PlayerCounter = players then end ;end the program once player cap is reached.
endif

next

end
 

daeleo

New Member
Ok, I finally got back around to fiddling with this silly project!
Here's the final code:
Code:
;+5v				;0v
;Pin C.5 Main button	;Pin C.0 LED 1
;Pin C.4 Player knob	;Pin C.1 LED 2 
;Pin C.3 Spy switch	;Pin C.2 LED 3 



#picaxe 08m2
SYMBOL LED1 = C.0
SYMBOL LED2 = C.1
SYMBOL LED3 = C.2

SYMBOL Pr00 = B0		' B1-B0 over-mapped by W0 & by bit0 - bit7
SYMBOL Pr01 = B1
SYMBOL Pr02 = B2		' B3-B2 over-mapped by W1 & by bit8 - bit15
SYMBOL Pr03 = B3
SYMBOL Pr04 = B4		' B5-B4 over-mapped by W2 & by bit16 - bit31
SYMBOL Pr05 = B5
SYMBOL Pr06 = B6		' B7-B6 over-mapped by W3
SYMBOL Pr07 = B7
SYMBOL Pr08 = B8		' B9-B8 over-mapped by W4
SYMBOL Pr09 = B9
SYMBOL Pr10 = B10		' B11-10 over-mapped by W5
SYMBOL Pr11 = B11
SYMBOL Pr12 = B12		' B13-B12 over-mapped by W6
SYMBOL Pr13 = B13
SYMBOL Pr14 = B14		' B15-B14 over-mapped by W7
SYMBOL Pr15 = B15
SYMBOL Pr16 = B16		' B17-B16 over-mapped by W8
SYMBOL Pr17 = B17
SYMBOL Pr18 = B18		' B19-B18 over-mapped by W9
SYMBOL Pr19 = B19
; W10 is bytes B21 and B20
SYMBOL Ateam = B22
symbol SpyA = b22 		'recycling
symbol PlayerCounter = b22	're-recycling

SYMBOL Bteam = B23
symbol SpyB = b23			'recycling

SYMBOL Total = B24

SYMBOL Mor2Do= B25

SYMBOL Players= B26
SYMBOL Spies = B27
'-----------------------------------------------------
; Potentiometer value == number of Ateam players
; ASSUME Bteam has same number!
;

playercheck:

ReadADC C.4, players	;Reading from 10-position volume Pot

select case players
	case > 225 
		players = 10 
		goto spycheck

	case > 200
		players = 9 
		goto spycheck

	case > 180
		players = 8
		goto spycheck

	case > 160 
		players = 7
		goto spycheck

	case > 140
		players = 6
		goto spycheck

	case > 120
		players = 5
		goto spycheck

	case > 100
		players = 4
		goto spycheck

	case > 80
		players = 3 ;3 players per team is the minimum.
	endselect

spycheck:							;Reading from 2-position switch
If pinC.3 = 0 then let Spies = 1
endif 
If pinC.3 = 1 then let Spies = 2                       ;Spies per team
endif



Spies = 1
Total = Players * 2 - 1 ' because I am using (0) as first array element
Mor2do = Players + 1

;-----------------------------------------------------------------
;--------------------------Initialize array-----------------------

Ateam = 1 : Bteam= 0
for bptr = 0 to Total : @bptr = 0 : next  ; clear b0 through b19 (max)

Again:
For bptr = 0 to Total

    Let W10 = time : Random W10
    
    If W10 > 32767 then
    	IF Ateam < Mor2Do and @bptr = 0 then ; safety net for second time through if required
       	@bptr =  128 : INC Ateam
       	
    	Else
    	 	EXIT
    	 	
    	endIF
    	
    EndIF
    
Next

; distributions in small sets are never predictable, so check and continue until we have a full Ateam
If Ateam < Mor2Do then goto Again


SpyA = 0 ; count of spies on team A
SpyB = 0


AgainSpy:
for bptr = 0 to Total
	Let W10 = time : Random W10
	
If W10 > 50000 then

    	If SpyA < Spies AND @bptr = 128 then
	INC SpyA
	@bptr = @bptr + 32
	endif
	
	ElseIf SpyB < Spies AND @bptr = 0 then
	INC SpyB
	@bptr =  @bptr + 32
    	Else
    	EndIF
   
next

If SpyA < Spies then goto AgainSpy
If SpyB < Spies then goto AgainSpy




PlayerCounter = 0
players = players * 2



DisplayRoutine:

For bptr = 0 to Total

Do
	If pinC.5 = 1 then exit;wait for button press
Loop

If @bptr = 0 then High LED1				;Team 1
 elseif @bptr = 32 then High LED1 High LED3	;Team 1 Spy
 elseif @bptr = 128 then High LED2			;Team 2
 elseif @bptr = 160then High LED2 High LED3	;Team 2 Spy
endif

Pause 3000
Low LED1 : Low LED2 : Low LED3
INC PlayerCounter

If PlayerCounter = players then end ;end the program once player cap is reached.
endif

next
I may end up using nearly identical code to create a blinking, defusable mine which blinks red with the occasional green, the pressing of which much coincide with the green LED.. (See Oddworld games)

But I digress, thanks again for your help!
 
Top