-
Notifications
You must be signed in to change notification settings - Fork 0
/
analyzer-1.php
125 lines (102 loc) · 9.87 KB
/
analyzer-1.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<?php function 辅助($子字, $网格, $side){global$贴协_s;global$贴协_f;if($side=="s_"){$贴协_s[$网格]=$子字;}else{$贴协_f[$网格]=$子字;}$GLOBALS[$side.$子字]=$GLOBALS[$side.$子字].$网格;if(in_array($子字,array('B','N','R','P'))){$GLOBALS[$side.$子字].=",";}}
/*destr-analo*/$_SESSION["贴协_s"]=array();$贴协_s=array();$_SESSION["贴协_f"]=array();$贴协_f=array();
/*Input-catcher*/$FEN="";if(isset($_POST['username'])){$FEN=$_POST['username'];$f_output='';}
/*Pre-processing:*/$FEN_pos=strtok($FEN, " "); $side_to_move=strtok(" ");$castling_avail=strtok(" ");$en_passant=strtok(" ");$ch18_50=strtok(" ");$full_turn=strtok(" ");$FEN_length=strlen($FEN_pos);
/*Function-main:*/$s_B='B[';$s_N='N[';$s_Q='Q-';$s_K='K-';$s_R='R[';$s_P='P[';$F_B='B[';$F_N='N[';$F_Q='Q-';$F_K='K-';$F_R='R[';$F_P='P[';
$横数=8;$竖数=0;for($str_数=0; $str_数 < $FEN_length; $str_数++){
if(intval($FEN_pos[$str_数])!==0){$竖数=$竖数+intval($FEN_pos[$str_数]);}
elseif($FEN_pos[$str_数]=="/"){$竖数=0;$横数=$横数-1;}
else{$竖数=$竖数+1;
$网格=$分区[$竖数].$横数;
if(ctype_upper($FEN_pos[$str_数])==true){// Identifies f or s;
辅助($FEN_pos[$str_数], $网格, 'F_');}
else{辅助(strtoupper($FEN_pos[$str_数]),$网格,'s_');}}}
// Echo-funcs; recombine f/s_echo into 1-line:
$f_echo="<b>F</b>: ";if($F_B!="B["){$f_echo.= $F_B."]";}if($F_N!="N["){$f_echo.= $F_N."]";}if($F_Q!="Q-"){$f_echo .= $F_Q." ";}$f_echo.=$F_K." ";if($F_R!="R["){$f_echo .= $F_R."]";}if($F_P!="P["){$f_echo.=$F_P."]";}
$s_echo="<b>S</b>: ";if($s_B!="B["){$s_echo.= $s_B."]";}if($s_N!="N["){$s_echo.= $s_N."]";}if($s_Q!="Q-"){$s_echo .= $s_Q." ";}$s_echo.=$s_K." ";if($s_R!="R["){$s_echo .= $s_R."]";}if($s_P!="P["){$s_echo.=$s_P."]";}
echo$full_turn;if($side_to_move=="w"){echo"-f: ".$f_echo." | ".$s_echo;}else{echo"-s: ".$s_echo." | ".$f_echo;}if($ch18_50 > 9){echo"50-progress: ".$ch18_50;}
/*Sess-pu*/$_SESSION["set"]=$side_to_move;$_SESSION["贴协_s"]=$贴协_s;$_SESSION["贴协_f"]=$贴协_f;/*✅*/?>
<!-- http://chess/analyzer-1.php#h3 -->
<!--test-prog
header("Location: analy-main.php?FEN=$FEN") has some ini-issu w/ str-typ
in this cond, remov'n intval and type-check breaks compl: intval($FEN_pos[$str_数])!==0 -->
<!-- Notes:
Late.7th-14: /*this-func can gen all raw-data,subseq pseudoc: $POSTED_assoc = array_push($POSTED_assoc,*/ youtube.com/watch?v=PYf8DAQxOqs
12.31-22,6th.26:
Chess next: generate a list of squares per BP by total E, then tabulate # by each side
Chess.vision-AI[Chrome-ext] occ.d-sqs,onlichess.org/1RqeWuyI Debate: loop.each-zi, eman,autre or rever?
Ie for an "e7" R, I would log all E in E- and 7- either as (1) or 1 For a Q I can call an off-class line-gen for diags+rows
This wud allow pars of the c.u-b,c str; I can also transl into math-#; R: if_contains e, 7; Q-e7, run the R, and the B, 5+7=12; 4+6=10, diags are all "even" or "dark-sqs"<d'uh>
Eman-from resn'mor $time-here
PHP: function.array-push.php
12.31-22,5th.1:
FEN.convert-run POSTs the FEN.input-field to step.1-analysis,func, and the page refreshes, containing, now, no longer the FEN-str, but the B.C-output, and
POST to E-stacker input; once E-stacker is run, only those inputs, but not the B.C-output, will be forwarded to the 3rd-Instance of the pg, after a 2nd
refresh. In order to preserve the 2.lost-strs #: the og-FEN, and the B.C-output, these need to be included # in what is POST’d to the next pg-Instance,
through a refresh, and POST, the best option, over _GET for this, and AJAX is extraneous, being as this is the same pg-instance that does not last #
Also, since this is stepwise so far, we can simply # include these lost-strs, as ghost-variables # <p-f> inside the resulting Form, which is all of which that is # POST’d
Note that you may put multiple tokens in the token parameter. The string will be tokenized when any one of the characters in the token argument is found.
^strtok can take multiple tokens as either-or: https://www.php.net/manual/en/function.strtok.php
Use .= # to first concatenate the 2-strs from f-s, then run the tok into a looped echo # <Turing> into clickable Form drop-down fields #
Once this is done, and the form fields can be POST, and we have ghost-vars of the lost-strs, I can write the M-classes and the actual E.stack-analyzer;
currently, I can already start working on the, # as an independent test; the E.analyzer-function,proper, like zi_assembly_helper, can be located # in an off.site-require #
<!-- Issues / to do:
12.31-22,5th.1:
The var for each zi-print generated by FEN-convert is a string; this string needs to be converted to an array PHP-⚠️ before a for.each-op can be performed #
Str-Tok can be used to generate an array, but this might be redundancy # ~10%<acceptable>
IIRC, strtok can be echoed-direct, and we can use "," as the delimiter # after clipping the initial [ and prec #
Question: How do I use str-tok with 2 different delimiters?
The Script-RAM is uncertain; at what point do the filled-vars, which are echoed, empty? Some subseq-funcs retro-depend on these vars,filled #
Presently, I use no db-writes to maintain a mid.long-RAM<革新!><90%done>
<related-prec>⚠️ Clicking "Calculate" empties the C.U-B,C.output; var-RAM,fill.uncertain<80%>; page most-likely# refreshes
In the test-pos for E-Stacker, d5 is a Moment<ch-40>but it is 空; the E of d5, on e6 | f5-P | c6-N<abs-pin>, subseq-e5<空>
Sequential action: each Output by Analyzer should prompt user for neural-comp, subseq, another input, to trigger-AI # <对话>
Therefore, the E-output,stacker should fill the input options # <partial> for Anki-reps #
Also, consider this: as the user will pause after each Form Submission<HTML>, we can use the time before their next.Form-submit to offload-comp
Not every run will go to prog-term, as it is the goal, of each step, to compr #
Idea: add another zi-analysis, after compl-1
Idea: add some color, emoji for vis-highl
Idea<seq-act>make Effect-Stacker self-referencing continuation<ch-59>; source.E-zi, themselves, clickable, to generate +analysis #
// open-source this #
Skip Castling ability, unless the position has some special-char # that is test-worthy #
"En passant" notation appears only when-req; can skip all subsequent "-"
Termination: terminate after both file and rank counters have reached 8, and read one more char thereafter: side to move #
Hn+1S1: Catching POST same page demonstrates a micro.inner-RAM #
Copy icon; test this later: https://stackoverflow.com/a/63600698 attempt-1 12.31-22,4th.17: could not get it to work on <p>
Rather than use PHP-break in the for-main, which would add an extra CPU-unit per loop-run, in this long.run-func, we can add a single
post-processing step using some sort of str.recog-cut |
Post-processing: aggregate Pawns, easiest to do it within the loop, if the char is specifically a "P", and have a "P_f_" and "P_S_"
We can even aggregate all the zi and display such B[e8, d8] K[g8] N[d2, b2] and so forth # and these can be displayed # in a thematic order:
B, N, Q, K, R, P | Eg: B[f4,c1] N[f3,g1] Q-d1 K-e1 R[a1,h1] P[a2-b2-d4-e3-f2-g2-h2]
Note: the post-processing can also be PRE-processing,
Hu: This is assembly<x.ref-internal[fbno],helper>multiple-level #
Parlay: Blind-chess.com, where you can # submit moves in sequence, generate links to send # and games are entered by a secure ID,
can even enter IP addresses for extra-sec, self-responsible, db,
Build a controller that echoes a "hidden" attr to the <p> that will display # the output B-C, if no $_POST,yet https://www.w3schools.com/TAGS/att_hidden.asp
Add email capture + page counter if I put this online #
Build a deeper analyzer before E: P-str, etc; what would be lightest? And, I can use my bl-string, and generate these analyses, without a board
and also generate "higher-IQ" tables, dichotomous trees, and otherwise diagrams, with colors, and highlighting.
Hu: Going deeper, into an interest area, excavating MIC, pushing to book, excerpt to sections, will help me bullet analyses for others #gold?
PNG to FEN, PNG to board code, with analyses #
Build a legal move checker next, where a FEN input is stored in RAM # and you can type in a move in algebraic #<firm>to check for feedback #
-->
<!-- references:
https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_select
Sample strings:
rnbqk1nr/pp2ppbp/2p3p1/8/2pP1B2/2N1P3/PP3PPP/R2QKBNR w KQkq - 1 6 https://lichess.org/KNyd2OPJ/white
r2q1rk1/pp2pp1p/6p1/3P1b2/2PbN3/1P4P1/P4PBP/R1B1K2R w KQ - 0 13 https://lichess.org/Z4hXnGNx/black
r1q2rk1/1pp2ppp/p2p4/4p1Nb/1nP1P1n1/1P1P2P1/Pb3PBP/1QRN1R1K w - - 0 18 https://lichess.org/DcooWwmJ/white
Piece names:
= 'P' | 'N' | 'B' | 'R' | 'Q' | 'K' via https://www.chessprogramming.org/Forsyth-Edwards_Notation
Side to move: "w" but not "b" is a unique-char, up to their appearance #
Loop through chars in a string: https://www.tutorialkart.com/php/php-loop-through-characters-in-string/
Break statement, for loop: https://www.php.net/manual/en/control-structures.break.php
https://www.php.net/manual/en/control-structures.continue.php:
"Continue is used within looping structures to skip the rest of the current loop iteration and continue execution at the condition evaluation and then the beginning of the next iteration."
Hu: Continue really means to skip; skip the rest of this iteration of the loop #
Hu: "Condition evaluation" = termination condition, specified in the loop-header<definition>
Hu: Continue can take, optionally, an argument, a number, specifying how many, where skipping the rest of the current, is 1, iterations to skip # <80% 12.31-22,4th.18>
Library: if (gettype($FEN[$str_数])==integer) { } elseif () { } elseif () { } else { }
str_length counts spaces in a string as a char in count https://www.php.net/manual/en/function.strlen.php
Fen-sass: lichess.org/Tdtzvs7s Bxe6!
-->