Skip to content

Instantly share code, notes, and snippets.

tetsuzuki

Block or report user

Report or block tetsuzuki

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View position.js
function Position(){
this.Board = [];
this.Capture = [];
this.Capture[0] = [];
this.Capture[1] = [];
this.FuFlg = [];
this.FuFlg[0] = [];
View Move.js
function PiecePos(rank,file,piece){
this.rank = rank;
this.file = file;
this.piece = piece;
}
PiecePos.prototype = {
Add: function(pos1,pos2){
this.rank = pos1.rank + pos2.rank;
this.file = pos1.file + pos2.file;
View CanMove.js
//選択した駒が、選択したマスに動けるかどうかしらべる関数
var CanMove = function(pos){
for(var i = 0; i < 12; i++){
if(CanGo[i][selectedKoma]){
if(pos.dan == FromClickDan + Direction[i].dan && pos.suji == FromClickSuji + Direction[i].suji)return 1;
if(CanJump[i][selectedKoma]){
for(var j = 1; j <= 8; j++){
var moved = new Pos(0,0);
View array.js
function Pos(dan,suji){
this.dan = dan;
this.suji = suji;
}
Direction = [];
Direction[0] = new Pos(0,1); //←
Direction[1] = new Pos(1,1); //←↓
Direction[2] = new Pos(1,0); //↓
View pos.js
function Pos(dan,suji){
this.dan = dan;
this.suji = suji;
}
var showBoard = function(){
for(var dan = 1; dan <= 9; dan++){
for(var suji = 1; suji <= 9; suji++){
//中略
View struct.cpp
#include "struct.h"
Pos Pos::operator + (Pos& pos){
Pos ret;
ret.dan = dan + pos.dan;
ret.suji = suji + pos.suji;
return ret;
}
Pos& Pos::operator += (Pos& pos){
View struct.h
#include "define_koma.h"
#ifndef _struct
#define _struct
typedef struct Pos{
int dan,suji;
KomaInf koma;
Pos operator + (Pos& pos);
Pos& operator += (Pos& pos);
View define_koma.h
#define OUT_OF_BOARD 64
#define EMPTY 0
#define FU 1
#define KY 2
#define KE 3
#define GI 4
#define KI 5
#define KA 6
#define HI 7
#define OU 8
View shogi.js
<script type="text/javascript">
<!--
var piece_board; //盤上の駒の画像のIDを入れておく変数
var piece_black_capture; //先手の駒台の駒の画像のIDを入れておく変数
var piece_white_capture; //後手の駒台の駒の画像のIDを入れておく変数
var piece_promotion_window; //成/不成を選択するウインドウに表示する駒の画像のIDを入れておく変数
var promotion_window; //成/不成を選択するウインドウの画像のIDを入れておく変数
View test
#include <iostream>
using namespace std;
int main(){
cout << "Hello,World" << endl;
}
You can’t perform that action at this time.