Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
#JULIALANG AND SHOGI(JAPANESE CHESS)
twitter: @kimrin	

Takeshi KIMURA
IN THIS PRESENTATION:
!

About us	

Why we choose #Julialang	

Shogi and Chess: differences between two games	

principles...
ABOUT US:

Mecha Lady Shogi team (twitter = @mechajyo, 5 members):	

the team of Shogi Program developers	

with 2 Lady Sh...
WHY WE CHOOSE #JULIALANG:
Speed	

most other Shogi programs are written in C/C++	

needed H/W resources: CPU and Memory ac...
CHESS:
Chess:	

8x8=64 squares	

about 80 available moves in
middle game	

computer programs already
won by human professi...
SHOGI
Shogi	

9x9 = 81 squares	

can reuse captured pieces	

about160 available moves in
endgame	

most of pieces can prom...
PRINCIPLE AND TECHNICS IN
SHOGI PLAYING SOFTWARE

Alpha-Beta search	

bit board and magic board technics	

machine-learnin...
ALPHA-BETA SEARCH
problem:	

in the given Shogi board representation, find best move from
its available moves	

solution:	
...
function AlphaBeta( gs::GameStatus, WB, depth, alpha, beta)

if depth <= 0.0 

va = eval(gs, alpha, beta)

return va

end
...
PSEUDO CODE SUMMARY
If node is leaf node, return the value of evaluation function	

Generate child node moves(=available m...
BITBOARD TECHNICS	

(IN MOVE GENERATION)
In chess programs, board representation is 64bit Unsigned Integer
value: each bit...
BASIC IDEAS OF BITBOARD
for each pieces of white side(for example: White King):	

get piece position that of move from	

d...
SOURCE CODE OF WHITE KING
target = (~p.WhitePieces) & MaskOfBoard

!
bbp = p.bb[MJOU] #White King’s bitmap
while bbp > uin...
MJOU = White King(OU,王)	

tori/toru = capture	

!

Magic board (More advanced technics):	

calculate dest bitmap by multip...
MACHINE LEARNING

EVALUATION FUNCTIONS
This technic is established by Hoki-san’s “Bonanza” program	

Evaluation function v...
CONCLUSION:
We will attend WCSC24 (The 24th World Computer Shogi Championship)	

Mecha Lady Shogi (メカ女子将棋, @mechajyo) is u...
Upcoming SlideShare
Loading in …5
×

of

#Julialang and Computer Shogi (Japanese Chess) Slide 1 #Julialang and Computer Shogi (Japanese Chess) Slide 2 #Julialang and Computer Shogi (Japanese Chess) Slide 3 #Julialang and Computer Shogi (Japanese Chess) Slide 4 #Julialang and Computer Shogi (Japanese Chess) Slide 5 #Julialang and Computer Shogi (Japanese Chess) Slide 6 #Julialang and Computer Shogi (Japanese Chess) Slide 7 #Julialang and Computer Shogi (Japanese Chess) Slide 8 #Julialang and Computer Shogi (Japanese Chess) Slide 9 #Julialang and Computer Shogi (Japanese Chess) Slide 10 #Julialang and Computer Shogi (Japanese Chess) Slide 11 #Julialang and Computer Shogi (Japanese Chess) Slide 12 #Julialang and Computer Shogi (Japanese Chess) Slide 13 #Julialang and Computer Shogi (Japanese Chess) Slide 14 #Julialang and Computer Shogi (Japanese Chess) Slide 15 #Julialang and Computer Shogi (Japanese Chess) Slide 16
Upcoming SlideShare
[Computer Shogi(Japanese Chess)] Mechajyo team's position paper for WCSC24 (24th World Computer Shogi Championship)
Next
Download to read offline and view in fullscreen.

2 Likes

Share

Download to read offline

#Julialang and Computer Shogi (Japanese Chess)

Download to read offline

#Julialang based computer shogi program (@mechajyo) is introduced.
Also mentions basic technics of computer shogi programs.

Related Audiobooks

Free with a 30 day trial from Scribd

See all

#Julialang and Computer Shogi (Japanese Chess)

  1. 1. #JULIALANG AND SHOGI(JAPANESE CHESS) twitter: @kimrin Takeshi KIMURA
  2. 2. IN THIS PRESENTATION: ! About us Why we choose #Julialang Shogi and Chess: differences between two games principles and technics of Shogi playing software
  3. 3. ABOUT US: Mecha Lady Shogi team (twitter = @mechajyo, 5 members): the team of Shogi Program developers with 2 Lady Shogi Professionals, 2 ladies and a geek:) developing Japanese Chess Program written in #Julialang !
  4. 4. WHY WE CHOOSE #JULIALANG: Speed most other Shogi programs are written in C/C++ needed H/W resources: CPU and Memory access (not HDD access) Maintenance dynamic language like code style is very useful for developing Shogi programs
  5. 5. CHESS: Chess: 8x8=64 squares about 80 available moves in middle game computer programs already won by human professionals
  6. 6. SHOGI Shogi 9x9 = 81 squares can reuse captured pieces about160 available moves in endgame most of pieces can promote in enemy’s field computer programs NOT YET win by human professionals!
  7. 7. PRINCIPLE AND TECHNICS IN SHOGI PLAYING SOFTWARE Alpha-Beta search bit board and magic board technics machine-learning evaluation functions
  8. 8. ALPHA-BETA SEARCH problem: in the given Shogi board representation, find best move from its available moves solution: search partial tree of game tree and find a best move and root node’s tree value(Evaluation Value) Depth-first search by using a recursive function
  9. 9. function AlphaBeta( gs::GameStatus, WB, depth, alpha, beta) if depth <= 0.0 va = eval(gs, alpha, beta) return va end moves = generate(gs) for i = 1:length(moves) makeMove( gs, moves[i], WB) val = -AlphaBeta( gs, WB$1, depth-1.0, -beta, -alpha) takeBack( gs, moves[i], WB) if val > alpha # alpha-update alpha = val # save this move if alpha >= beta # beta-cutoff return beta end end end alpha end return eval (leaf node) generate moves
 (good move first) pseudo code (simplified) recursive
 calls find good moves cutoff redundant
 search
  10. 10. PSEUDO CODE SUMMARY If node is leaf node, return the value of evaluation function Generate child node moves(=available moves) For each moves: Make move Call myself(=this function) in NegaMax manner Take back move If it’s good move, record this move(=Alpha Update) if very good move, cutoff subsequent child node’s search(Beta Cutoff) return beta return alpha
  11. 11. BITBOARD TECHNICS (IN MOVE GENERATION) In chess programs, board representation is 64bit Unsigned Integer value: each bit represents existence of pieces Pawn, Knight,…, King, for each piece kinds, there are 2 bitmap values(one for White, another for Black) In Shogi programs, square of the board is 81. So in ordinal programming languages(such as C++), we use 3x32bit Unsigned Integer = 96bit bitmap values #Julialang’s 128bit Unsigned Integer is suitable for storing 81bit Shogi bitmaps!
  12. 12. BASIC IDEAS OF BITBOARD for each pieces of white side(for example: White King): get piece position that of move from dest = BitMapTable( piece, from, White) # available moves table dest &= (not White pieces) # with single bitwise AND! for each dest bits: generates Move and stores move buffers
  13. 13. SOURCE CODE OF WHITE KING target = (~p.WhitePieces) & MaskOfBoard ! bbp = p.bb[MJOU] #White King’s bitmap while bbp > uint128(0) from = trailing_zeros(bbp) bbp $= BitSet[from+1] dest::BitBoard = target & gs.AttackTableNonSlide[MJOU,from+1] toru::BitBoard = dest & p.BlackPieces #captured pieces while dest > uint128(0) to = trailing_zeros(dest) dest $= BitSet[to+1] toriflag = ((toru & BitSet[to+1]) > 0)?FLAG_TORI:0 count += 1 out[count] = Move(MJOU,from,to,toriflag,p.square[to+1]&0x0f,0)::Move InsertMoveAB(count,out,gs) end end
  14. 14. MJOU = White King(OU,王) tori/toru = capture ! Magic board (More advanced technics): calculate dest bitmap by multiples MAGIC numbers(one direction hash)
  15. 15. MACHINE LEARNING
 EVALUATION FUNCTIONS This technic is established by Hoki-san’s “Bonanza” program Evaluation function value = dot(WeightVector, FeatureVector) Val = w1*f1 + w2*f2 + … + wn*fn Hoki-san established the way of learning Weight Vectors by Machine Learning(reinforcement learning) King - OpponentKing - another piece relationships King - piece - and another piece relationships (Three pieces relationships) We use Hoki-san’s fv.bin for calculation function values
  16. 16. CONCLUSION: We will attend WCSC24 (The 24th World Computer Shogi Championship) Mecha Lady Shogi (メカ女子将棋, @mechajyo) is using #Julialang
 for her programming language メカ=Mecha, 女子=Girl, Lady But actually, playing ability of mechajyo is not so strong :( We will also attend DenOu Sen tournament (電王戦トーナメント) may will be hold in Nov. 2014 電王=Electrical King Thank you!
  • AndrePemmelaar

    May. 20, 2014
  • ilyadyachenko

    Jan. 19, 2014

#Julialang based computer shogi program (@mechajyo) is introduced. Also mentions basic technics of computer shogi programs.

Views

Total views

3,236

On Slideshare

0

From embeds

0

Number of embeds

679

Actions

Downloads

4

Shares

0

Comments

0

Likes

2

×