import java.io.*;

/**
 * @author Dan Maynes-Aminzade <monzy@mit.edu>
 */


public class Datagram {
	public int team;
	public class Player {
		public float vx,vy;
		public float kick;
	}
	public Player[] players;

	Datagram() {
		team = 0;
		players = new Player[5];
		for (int i=0; i<5; i++) {
			players[i] = new Player();
			players[i].vx = 0;	players[i].vy = 0;
			players[i].kick = 0;
		}
	}

	public ByteArrayOutputStream getBytes() {
		ByteArrayOutputStream bout = new ByteArrayOutputStream();
		DataOutputStream dout = new DataOutputStream(bout);

		try {
			dout.writeInt(team); // team number
			// fill in the next 28 bytes (paused, score0, score1, ball xy, ballvxvy)
			// all of these are ignored by the server
			for (int i=0; i<7; i++) dout.writeInt(0);
			for (int i=0; i<5; i++) { // write out team 0 values
				dout.writeFloat(0.0f); dout.writeFloat(0.0f); //player xy
				dout.writeFloat(players[i].vx); dout.writeFloat(players[i].vy); //player vxvy
				dout.writeFloat(players[i].kick); // player kick
			}
			dout.flush();
		} catch (IOException e) {
			System.out.println(e.toString());
		}
		return bout;
	}	
}
