// --------------------------------------------------
	// Approx function Value - solution_set's value at x_pos		
double Individual::approx_func(){
	double x = get_x_pos();
	double a, b;
	a = f_1(x, solution_set.at(0), solution_set.at(1));
	b = f_2(x, solution_set.at(2), solution_set.at(3));
	approx_value = (a + b);
	//cout << endl << "Approximate Value is: " << approx_value << endl;
	return approx_value;
}
// --------------------------------------------------			// TODO - MOVE to Function 
	// Real Function Value - real coefficient_set's value at x_pos
double Individual::real_func(){
	double x = get_x_pos();
	double a, b;
	a = f_1(x, real_set.at(0), real_set.at(1));
	b = f_2(x, real_set.at(2), real_set.at(3));
	real_value = (a + b);
	//cout << endl << "real value is: " << real_value << endl;
	return real_value;
}
Ejemplo n.º 3
0
void tank8_state::draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect)
{
	int i;

	for (i = 0; i < 8; i++)
	{
		int x = get_x_pos(8 + i);
		int y = get_y_pos(8 + i);

		x -= 4; /* ? */

		rectangle rect(x, x + 3, y, y + 4);
		rect &= cliprect;

		bitmap.fill((i << 1) | 0x01, rect);
	}
}
Ejemplo n.º 4
0
static void draw_bullets(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
	tank8_state *state = machine.driver_data<tank8_state>();
	int i;

	for (i = 0; i < 8; i++)
	{
		int x = get_x_pos(state, 8 + i);
		int y = get_y_pos(state, 8 + i);

		x -= 4; /* ? */

		rectangle rect(x, x + 3, y, y + 4);
		rect &= cliprect;

		bitmap.fill((i << 1) | 0x01, rect);
	}
}
Ejemplo n.º 5
0
void tank8_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
{
	int i;

	for (i = 0; i < 8; i++)
	{
		uint8_t code = ~m_pos_d_ram[i];

		int x = get_x_pos(i);
		int y = get_y_pos(i);

		m_gfxdecode->gfx((code & 0x04) ? 2 : 3)->transpen(bitmap,cliprect,
			code & 0x03,
			i,
			code & 0x10,
			code & 0x08,
			x,
			y, 0);
	}
}
Ejemplo n.º 6
0
static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
	tank8_state *state = machine.driver_data<tank8_state>();
	int i;

	for (i = 0; i < 8; i++)
	{
		UINT8 code = ~state->m_pos_d_ram[i];

		int x = get_x_pos(state, i);
		int y = get_y_pos(state, i);

		drawgfx_transpen(bitmap, cliprect, machine.gfx[(code & 0x04) ? 2 : 3],
			code & 0x03,
			i,
			code & 0x10,
			code & 0x08,
			x,
			y, 0);
	}
}
Ejemplo n.º 7
0
void tank8_state::screen_eof_tank8(screen_device &screen, bool state)
{
	// on falling edge
	if (!state)
	{
		int x;
		int y;
		const rectangle &visarea = m_screen->visible_area();

		m_tilemap->draw(screen, m_helper1, visarea, 0, 0);

		m_helper2.fill(8, visarea);
		m_helper3.fill(8, visarea);

		draw_sprites(m_helper2, visarea);
		draw_bullets(m_helper3, visarea);

		for (y = visarea.min_y; y <= visarea.max_y; y++)
		{
			int _state = 0;

			const UINT16* p1 = &m_helper1.pix16(y);
			const UINT16* p2 = &m_helper2.pix16(y);
			const UINT16* p3 = &m_helper3.pix16(y);

			if ((m_screen->frame_number() ^ y) & 1)
				continue; /* video display is interlaced */

			for (x = visarea.min_x; x <= visarea.max_x; x++)
			{
				UINT8 index;

				/* neither wall nor mine */
				if ((p1[x] != 0x11) && (p1[x] != 0x13))
				{
					_state = 0;
					continue;
				}

				/* neither tank nor bullet */
				if ((p2[x] == 8) && (p3[x] == 8))
				{
					_state = 0;
					continue;
				}

				/* bullets cannot hit mines */
				if ((p3[x] != 8) && (p1[x] == 0x13))
				{
					_state = 0;
					continue;
				}

				if (_state)
					continue;

				if (p3[x] != 8)
				{
					index = ((p3[x] & ~0x01) >> 1) | 0x18;

					if (1)
						index |= 0x20;

					if (0)
						index |= 0x40;

					if (1)
						index |= 0x80;
				}
				else
				{
					int sprite_num = (p2[x] & ~0x01) >> 1;
					index = sprite_num | 0x10;

					if (p1[x] == 0x11)
						index |= 0x20;

					if (y - get_y_pos(sprite_num) >= 8)
						index |= 0x40; /* collision on bottom side */

					if (x - get_x_pos(sprite_num) >= 8)
						index |= 0x80; /* collision on right side */
				}

				timer_set(screen.time_until_pos(y, x), TIMER_COLLISION, index);

				_state = 1;
			}