• 大小: 276KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-06-15
  • 语言: 其他
  • 标签: 点格棋  dots&amp  

资源简介

点格棋[Dots and Boxes]设计的源码,包括音乐、音效和图片

资源截图

代码片段和文件信息

/*
 * Created on 05/05/2005
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code style - Code Templates
 */

/**
 * 
 * TODO Short description of the class
 * 
 * @author Thiago Bassani(tbassani@ppgia.pucpr.br)   
 */
public class MathTest {

public static void main(String[] args) {
System.out.println(vectorOrientation(0.50));
System.out.println(vectorOrientation(10.5));
System.out.println(vectorOrientation(0.51));
System.out.println(vectorOrientation(00.5));
}
/**
 * @return 1 ?DOWN
 * @return 2 ?UP
 * @return 3 ?LEFT
 * @return 4 ?RIGHT
 */
public static int vectorOrientation(double xdouble y){
double centerX = 0.5;
double centerY = 0.5;
if(cosVectors(x-centerXy-centerYcenterX0) >= 0.701)
return 4;//RIGHT
if(cosVectors(x-centerXy-centerYcenterX0) <= -0.701)
return 3;//LEFT
if(cosVectors(x-centerXy-centerY0centerY) >= 0.701)
return 2;//UP
return 1;//DOWN
}

public static double cosVectors(double x1double y1double x2double y2){
double num = x1*x2 + y1*y2;
double den = Math.sqrt(x1*x1+y1*y1)*Math.sqrt(x2*x2+y2*y2);
double ret = num/den;
if(Double.isNaN(ret))
return 0;
return ret;
}
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件        1201  2005-05-13 09:44  MathTest.class
     文件        1272  2005-05-05 01:09  MathTest.java
     文件        1675  2005-05-13 09:44  RogalPlayer.class
     文件        2778  2005-05-05 10:23  RogalPlayer.java
     文件         330  2005-05-04 09:31  .settings\org.eclipse.jdt.core.prefs
     文件        1862  2005-05-09 08:56  doc\allclasses-frame.html
     文件        1682  2005-05-09 08:56  doc\allclasses-noframe.html
     文件        7234  2005-05-09 08:56  doc\constant-values.html
     文件        4992  2005-05-09 08:56  doc\deprecated-list.html
     文件       34459  2005-05-09 08:56  doc\edu\pucpr\engcomp\dotbox\Box.html
     文件       23897  2005-05-09 08:56  doc\edu\pucpr\engcomp\dotbox\class-use\Box.html
     文件        5831  2005-05-09 08:56  doc\edu\pucpr\engcomp\dotbox\class-use\DotsAndBoxesGame.html
     文件       17546  2005-05-09 08:56  doc\edu\pucpr\engcomp\dotbox\class-use\IPlayer.html
     文件       11412  2005-05-09 08:56  doc\edu\pucpr\engcomp\dotbox\class-use\PlayerAction.html
     文件       22165  2005-05-09 08:56  doc\edu\pucpr\engcomp\dotbox\DotsAndBoxesGame.html
     文件        5890  2005-05-09 08:56  doc\edu\pucpr\engcomp\dotbox\dummy\class-use\DummyPlayer.html
     文件       13940  2005-05-09 08:56  doc\edu\pucpr\engcomp\dotbox\dummy\DummyPlayer.html
     文件         987  2005-05-09 08:56  doc\edu\pucpr\engcomp\dotbox\dummy\package-frame.html
     文件        6309  2005-05-09 08:56  doc\edu\pucpr\engcomp\dotbox\dummy\package-summary.html
     文件        6293  2005-05-09 08:56  doc\edu\pucpr\engcomp\dotbox\dummy\package-tree.html
     文件        5521  2005-05-09 08:56  doc\edu\pucpr\engcomp\dotbox\dummy\package-use.html
     文件        5906  2005-05-09 08:56  doc\edu\pucpr\engcomp\dotbox\expert\class-use\ExpertPlayer.html
     文件       14956  2005-05-09 08:56  doc\edu\pucpr\engcomp\dotbox\expert\ExpertPlayer.html
     文件         994  2005-05-09 08:56  doc\edu\pucpr\engcomp\dotbox\expert\package-frame.html
     文件        6325  2005-05-09 08:56  doc\edu\pucpr\engcomp\dotbox\expert\package-summary.html
     文件        6309  2005-05-09 08:56  doc\edu\pucpr\engcomp\dotbox\expert\package-tree.html
     文件        5525  2005-05-09 08:56  doc\edu\pucpr\engcomp\dotbox\expert\package-use.html
     文件       10274  2005-05-09 08:56  doc\edu\pucpr\engcomp\dotbox\IPlayer.html
     文件        1477  2005-05-09 08:56  doc\edu\pucpr\engcomp\dotbox\package-frame.html
     文件        7161  2005-05-09 08:56  doc\edu\pucpr\engcomp\dotbox\package-summary.html
     文件        6586  2005-05-09 08:56  doc\edu\pucpr\engcomp\dotbox\package-tree.html
............此处省略78个文件信息

评论

共有 条评论

相关资源