競技会に使用したプログラム

競技結果
ホームへ戻る
program test {
	
#include 
#include 
#include 
#include 
sensor light1 on 1
light1 is light as percent
sensor rotation2 on 2
rotation2 is rotation as angle
event greater_counter1EventHigh when counter1 > 10
	
event lRange_light1EventRange when light1 is 0..40
	
event greater_counter1EventHigh0 when counter1 > 20
	
event lBrite_light1EventHigh when light1.high
	
	
	
main {
	ext InterfaceType "kFreestyle"
	rcx_ClearTimers
	bbs_GlobalReset([A B C])
	try {
		rcx_Calibrate(4,4)
		counter1 = -1
		power [ A  ] 2
		on [ A  ] 
	} retry on fail
	try {
		forever {
			if light1 is 41..49{

			if counter1 < 0{
				if rotation2 is -300..1{							direction [  ] [ B ]
					power [ B  ] 3
						on [ B  ]  for 1
					}
					else
					{
					} 
				}
				else
				{
					if rotation2 is -1..300{
						direction [ B  ] [ ]
						power [ B  ] 7
						on [ B  ]  for 1						}
					else
					{
					} 
				} 
			}
			else
			{
				if light1 is 50..70{
					sound 1
				}
				else
				{
					if light1 is 0..30{
						counter1 = -1
					}
					else
					{
						if light1 is 35..40{
							counter1 = 10
							if rotation2 is -1..300{
							direction [ B  ] [ ]
								power [ B  ] 3
							on [ B  ]  for 1
								}
								else
								{
								} 
							}
							else
							{
							} 
						} 
					} 
				} 
			}
		} retry on fail
	}
	
	
	fragment ( 692,823 ) {
		while light1 is 36..100 {
		}
	}
	fragment ( 735,20 ) {
		repeat {
		} until greater_counter1EventHigh
	}
	fragment ( 585,734 ) {
		repeat {
		} until lRange_light1EventRange
	}
	fragment ( 499,734 ) {
		repeat {
		} until greater_counter1EventHigh0
	}
	fragment ( 518,950 ) {
		if light1 is 40..49{
		}
		else
		{
			power [ B  ] 2
			on [ B  ]  for 20
			direction [ B  ] [ ]
		} 
	}
	fragment ( -251,265 ) {
		if light1 > lBrite_light1EventHigh.high {
		}
		else
		{
		} 
	}
	fragment ( 402,1037 ) {
		repeat 55 {
		}
	}
	fragment ( 581,-45 ) {
		while rotation2 is 0..100 {
		}
	}
	fragment ( -255,938 ) {
		repeat {
		} until lBrite_light1EventHigh
	}
	fragment ( -97,975 ) {
		while rotation2 is -3..32766 {
		}
	}
	fragment ( -35,832 ) {
		off [ B  ] 
	}
	fragment ( 328,772 ) {
		while rotation2 is -32767..3 {
		}
		off [ B  ] 
	}
	fragment ( 187,815 ) {
		sound 6
	}
	fragment ( 381,294 ) {
		on [ A B C  ]  for 100
	}
	fragment ( 135,876 ) {
		repeat 3 {
		}
	}
	fragment ( 210,1008 ) {
		if light1 > lBrite_light1EventHigh.high {
		}
		else
		{
		} 
	}
	fragment ( 419,744 ) {
		off [ A  ] 
		wait 200
		on [ A  ] 
	}
	fragment ( 245,851 ) {
		direction [  ] [ B ]
		power [ B  ] 3
		on [ A B C  ]  for 10
	}
}