0% found this document useful (0 votes)
2 views5 pages

Main Program

The document provides an overview of the basic control flow charts for the CT800 software, detailing the structure and purpose of various modules within the software architecture, including the Chess Application Layer, HMI Layer, Library Layer, and Driver Layer. It outlines the single-threaded nature of the software and the handling of user input through a timer interrupt. Additionally, it includes simplified flow charts illustrating the main control flow and move computation processes in the chess application.

Uploaded by

dhruwin2008
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views5 pages

Main Program

The document provides an overview of the basic control flow charts for the CT800 software, detailing the structure and purpose of various modules within the software architecture, including the Chess Application Layer, HMI Layer, Library Layer, and Driver Layer. It outlines the single-threaded nature of the software and the handling of user input through a timer interrupt. Additionally, it includes simplified flow charts illustrating the main control flow and move computation processes in the chess application.

Uploaded by

dhruwin2008
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Basic flow charts for the CT800

The following pages contain some basic control flow charts in a simplified version, just for
getting some orientation:

- What each source text file contains


- How the overall control flow works
- How a response move is calculated (main flow in bold lines)

Time keeping, hash tables, menu logic and HMI are not shown in this overview. The menu
logic is simple enough anyway because the tree structure of the menu is directly reflected
in the call tree of the menu logic.

Note that this software is single-threaded; the only thing in parallel is the timer interrupt on
the target platform, which also handles the keypad input. Usually, this does not interfere
with the regular control flow, with one notable exception:

If the computer is calculating and the "GO!"-key is pressed, the keypad evaluation routine
will set up the "time is up" flag for the ongoing computation, simulating a time-over
condition.

Rasmus Althoff, November 2021


Overall Software Architecture

Chess Application Layer


module func. prefix purpose
play Play_ main(), overall game handling, move entering, menu
access
search Search_ search tree including quiescence
move_gen Mvgen_ move generator, in-check info
eval Eval_ static position evaluation
book Book_ opening book
hashtables Hash_ hashtable handling
kpk Kpk_ king+pawn vs. king endgame table
timekeeping Time_ time controls implementation

HMI Layer (Human-Machine Interface)


module func. prefix purpose
hmi Hmi_ dialogue system, game screen display, notation and
position viewer
menu Menu_ menu system
posedit Pos_ position editor

Library Layer
module func. prefix purpose
util Util_ various library utility functions
ctdefs - project-wide definitions of constants and data types
confdefs - definition of the configuration options and macros
Driver Layer
module func. prefix purpose
boot_stm32f405 - startup code, interrupt tables, RAM-test (ARM only)
hardware_arm Hw_ high level hardware interface (ARM only)
hardware_arm Hw_Disp_ display driver (ARM only)
_disp
hardware_arm Hw_Keybd_ keypad driver (ARM only)
_keybd
hardware_arm Hw_Sig_ LED and beeper driver (ARM only)
_signal
arm_driver Drv_ low level CPU hardware interface (ARM only)
hardware_pc Hw_ replacement for hardware_arm (PC only)
Simplified Control Flow Chart

main()
- system setup

main()
- endless loop
- computer colour

new Play_Handling()
game - move handling

Play_Handling()
- white move

no comp has yes


white?

Play_Get_Player_Move() Search_Get_Best_Move()
- move input - make move list
- menu access - check opening book
- pre-sort: Search_Play_And_Sort_Moves()
- iterative deepening: Search_Negascout()
- move calculated

Play_Handling()
- black move

no comp has yes


black?

Play_Get_Player_Move() Search_Get_Best_Move()
- move input - make move list
- menu access - check opening book
- pre-sort: Search_Play_And_Sort_Moves()
- iterative deepening: Search_Negascout()
- move calculated

Play_Handling()
- next move
Simplified Move Computation Chart
Search_Get_Best_Move()
- get legal moves

no moves yes
exist?

no in yes
no one yes
check?
move?
return return
STALEMATE MATE return
move
Book_Is_Line()
- check opening book

search depth: 1
no book yes
match?
Search_Play_
And_Sort_Moves() return
recursion random
- shallow search depth book move
return
move
captures / promotions scores

Search_Quiescence() Search_Get_Best_Move() return


recursion - pre-sort moves by score best
- until capture line ends - depth d = 2..20 (or until time is up) move

Eval_Static_Evaluation() search depth: d


- material
- pawns
- middle / end game Search_Negascout()
recursion
- given search depth
- time over check

return
best captures / promotions
move
Search_Quiescence()
recursion
- until capture line ends

Eval_Static_Evaluation()
- material
- pawns
- middle / end game

You might also like