Skip to content

Instantly share code, notes, and snippets.

View thuzhf's full-sized avatar
🎯
Focusing

Fang Zhang thuzhf

🎯
Focusing
  • Tsinghua University
  • Beijing, China.
View GitHub Profile
@thuzhf
thuzhf / StrategySpeedRaceTwoFishesPassHole.cs
Last active April 15, 2016 07:47
机器鱼协作过孔代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using xna = Microsoft.Xna.Framework;
using URWPGSim2D.Common;
using URWPGSim2D.StrategyLoader;
using URWPGSim2D.Core;
@thuzhf
thuzhf / jiankangqiu.cs
Last active April 15, 2016 07:49
肩扛球部分代码(机器鱼协作过孔)
i = 1;
xna.Vector3 fp = mission.TeamsRef[teamId].Fishes[i].PositionMm; // fish position
float dir_x = -150f;
float dir_z = -dir_x / (float)Math.Sqrt(3);
xna.Vector3 dir = new xna.Vector3(dir_x, 0f, dir_z);
xna.Vector3 targetPoint = fp + dir;
float targetDirection = (float)Math.PI / 6 * 5;
StrategyHelper.Helpers.Dribble(
ref decisions[i], mission.TeamsRef[teamId].Fishes[i], targetPoint, targetDirection, 5, 10, 150, 14, 10, 15, 100, true
);
//-----------------------------------------------------------------------
// Copyright (C), 2010, PKU&HNIU
// File Name: Match5V5.cs
// Date: 20101119 Author: LiYoubing Version: 1
// Description: 两队对抗赛3VS3相关的仿真机器鱼,仿真环境和仿真使命定义文件
// Histroy:
// Date: 20110512 Author: LiYoubing
// Modification:
// 1.受RoboFish的碰撞状态标志改成标志列表的影响 标志值的比较改用List.Contains方法进行
// Date: 20110516 Author: LiYoubing
public Decision number_act(int i, int j, xna.Vector3 fishPm, xna.Vector3 ballsPm, RoboFish fish, xna.Vector3 finish_place)
{
double xg = finish_place.X;
double zg = finish_place.Z;//终点位置
double r = 58.0;
double x = fishPm.X;
double z = fishPm.Z; //鱼的刚体坐标
double num6 = ballsPm.X;
double num7 = ballsPm.Z; //球心坐标
double d = Math.Atan((zg - num7) / (xg - num6));//球心到目标点这条直线和x轴的角度正切值
@thuzhf
thuzhf / 5v5.cs
Last active April 15, 2016 07:48
机器鱼水球比赛5v5
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using xna = Microsoft.Xna.Framework;
using URWPGSim2D.Common;
using URWPGSim2D.StrategyLoader;
using URWPGSim2D.Core;
#include <string>
#include "rtklib.h"
#include "rtkcmn.h"
#include "stream.h"
#include "rtksvr.h"
#include "Result.h"
#include <iostream>
#ifndef RTK_TEST
#define RTK_TEST
#define MAXSTRRTK 8
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using xna = Microsoft.Xna.Framework;
using URWPGSim2D.Common;
using URWPGSim2D.StrategyLoader;
using URWPGSim2D.Core;
@thuzhf
thuzhf / 3v3-backup.cs
Created July 17, 2014 01:26
我的备份
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using xna = Microsoft.Xna.Framework;
using URWPGSim2D.Common;
using URWPGSim2D.StrategyLoader;
using URWPGSim2D.Core;
if (state == State.center_area)
{
if (ballsPm.X < -500)
{
state = (goal == 0 ? State.defense_area : State.attack_area);
}
else if (ballsPm.X > 500)
{
state = (goal == 0 ? State.attack_area : State.defense_area);
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using xna = Microsoft.Xna.Framework;
using URWPGSim2D.Common;
using URWPGSim2D.StrategyLoader;
using URWPGSim2D.Core;