File tree Expand file tree Collapse file tree 16 files changed +229
-174
lines changed Expand file tree Collapse file tree 16 files changed +229
-174
lines changed Original file line number Diff line number Diff line change 11install :
2- composer install
2+ @ composer install
33
44brain-games :
5- bin/brain-games
5+ @ bin/brain-games
66
77brain-even :
8- bin/brain-even
8+ @ bin/brain-even
99
1010brain-calc :
11- bin/brain-calc
11+ @ bin/brain-calc
1212
1313brain-gcd :
14- bin/brain-gcd
14+ @ bin/brain-gcd
1515
1616brain-progression :
17- bin/brain-progression
17+ @ bin/brain-progression
1818
1919brain-prime :
20- bin/brain-prime
20+ @ bin/brain-prime
2121
2222validate :
23- composer validate
23+ @ composer validate
2424
2525 lint :
26- composer exec --verbose phpcs -- --standard=PSR12 src bin
26+ @ composer exec --verbose phpcs -- --standard=PSR12 src bin
2727
2828correct :
29- composer exec -- phpcbf --standard=PSR12 src bin
29+ @ composer exec -- phpcbf --standard=PSR12 src bin
Original file line number Diff line number Diff line change 1818** Доступные игры**
19191 . Brain Even - Проверка на чётность
2020 Определите, является ли случайное число чётным.
21- make brain-even
21+
22+ Команда: make brain-even
2223Демонстрация - https://asciinema.org/a/PZIB0AMPHDWAigwTO2UAGq9PI
2324
24252 . Brain Calc - Калькулятор
2526 Решите простое арифметическое выражение.
2627
27- make brain-calc
28+ Команда: make brain-calc
2829Демонстрация - https://asciinema.org/a/5gDhJ6Taqf9GAgZvAtUY4W16l
2930
30313 . Brain GCD - Наибольший общий делитель
3132 Найдите Наибольший общий делитель двух случайных чисел.
3233
33- make brain-gcd
34+ Команда: make brain-gcd
3435Демонстрация - https://asciinema.org/a/bBiNGAePf6ZXq4p0odlB5zFD6
3536
3637
3738
38394 . Brain Progression - Арифметическая прогрессия
3940 Найдите пропущенный элемент в прогрессии.
4041
41- make brain-progression
42+ Команда: make brain-progression
4243Демонстрация - https://asciinema.org/a/HawCHRR9MDuvTWbaOEE4d76Zh
4344
44455 . Brain Prime - Простое число
4546 Определите, является ли число простым.
4647
47- make brain-prime
48+ Команда: make brain-prime
4849Демонстрация - https://asciinema.org/a/JuOx3oZ2UACiALbcsQ5da10V2
4950
5051** Требования**
Original file line number Diff line number Diff line change 11#!/usr/bin/env php
2-
32<?php
43
5- require_once __DIR__ . '/../vendor/autoload.php ' ;
6- require_once __DIR__ . '/../src/Engine.php ' ;
7- require_once __DIR__ . '/../src/Games/Calc.php ' ;
4+ $ autoloadPath1 = __DIR__ . '/../../../autoload.php ' ;
5+ $ autoloadPath2 = __DIR__ . '/../vendor/autoload.php ' ;
6+
7+ if (file_exists ($ autoloadPath1 )) {
8+ require_once $ autoloadPath1 ;
9+ } else {
10+ require_once $ autoloadPath2 ;
11+ }
812
9- runGame (' Calc ' );
13+ BrainGames \ Games \ Calc \ runGame ();
Original file line number Diff line number Diff line change 11#!/usr/bin/env php
2-
32<?php
43
5- require_once __DIR__ . '/../vendor/autoload.php ' ;
6- require_once __DIR__ . '/../src/Engine.php ' ;
7- require_once __DIR__ . '/../src/Games/Even.php ' ;
4+ $ autoloadPath1 = __DIR__ . '/../../../autoload.php ' ;
5+ $ autoloadPath2 = __DIR__ . '/../vendor/autoload.php ' ;
6+
7+ if (file_exists ($ autoloadPath1 )) {
8+ require_once $ autoloadPath1 ;
9+ } else {
10+ require_once $ autoloadPath2 ;
11+ }
812
9- runGame (' Even ' );
13+ BrainGames \ Games \ Even \ runGame ();
1014
1115
1216
Original file line number Diff line number Diff line change 11#!/usr/bin/env php
2-
32<?php
43
5- require_once __DIR__ . '/../vendor/autoload.php ' ;
6- require_once __DIR__ . '/../src/Cli.php ' ;
4+ $ autoloadPath1 = __DIR__ . '/../../../autoload.php ' ;
5+ $ autoloadPath2 = __DIR__ . '/../vendor/autoload.php ' ;
6+
7+ if (file_exists ($ autoloadPath1 )) {
8+ require_once $ autoloadPath1 ;
9+ } else {
10+ require_once $ autoloadPath2 ;
11+ }
12+
13+ BrainGames \Cli \welcome ();
Original file line number Diff line number Diff line change 11#!/usr/bin/env php
2-
32<?php
43
5- require_once __DIR__ . '/../vendor/autoload.php ' ;
6- require_once __DIR__ . '/../src/Engine.php ' ;
7- require_once __DIR__ . '/../src/Games/Gcd.php ' ;
4+ $ autoloadPath1 = __DIR__ . '/../../../autoload.php ' ;
5+ $ autoloadPath2 = __DIR__ . '/../vendor/autoload.php ' ;
6+
7+ if (file_exists ($ autoloadPath1 )) {
8+ require_once $ autoloadPath1 ;
9+ } else {
10+ require_once $ autoloadPath2 ;
11+ }
812
9- runGame (' Gcd ' );
13+ BrainGames \ Games \ Gcd \ runGame ();
Original file line number Diff line number Diff line change 11#!/usr/bin/env php
2-
32<?php
43
5- require_once __DIR__ . '/../vendor/autoload.php ' ;
6- require_once __DIR__ . '/../src/Engine.php ' ;
7- require_once __DIR__ . '/../src/Games/Prime.php ' ;
4+ $ autoloadPath1 = __DIR__ . '/../../../autoload.php ' ;
5+ $ autoloadPath2 = __DIR__ . '/../vendor/autoload.php ' ;
6+
7+ if (file_exists ($ autoloadPath1 )) {
8+ require_once $ autoloadPath1 ;
9+ } else {
10+ require_once $ autoloadPath2 ;
11+ }
812
9- runGame (' Prime ' );
13+ BrainGames \ Games \ Prime \ runGame ();
Original file line number Diff line number Diff line change 11#!/usr/bin/env php
2-
32<?php
43
5- require_once __DIR__ . '/../vendor/autoload.php ' ;
6- require_once __DIR__ . '/../src/Engine.php ' ;
7- require_once __DIR__ . '/../src/Games/Progression.php ' ;
4+ $ autoloadPath1 = __DIR__ . '/../../../autoload.php ' ;
5+ $ autoloadPath2 = __DIR__ . '/../vendor/autoload.php ' ;
6+
7+ if (file_exists ($ autoloadPath1 )) {
8+ require_once $ autoloadPath1 ;
9+ } else {
10+ require_once $ autoloadPath2 ;
11+ }
812
9- runGame (' Progression ' );
13+ BrainGames \ Games \ Progression \ runGame ();
Original file line number Diff line number Diff line change 2727 "scripts" : {
2828 "phpcs" : " phpcs --standard=PSR12 src bin" ,
2929 "phpcbf" : " phpcbf --standard=PSR12 src bin"
30+ },
31+ "autoload" : {
32+ "files" : [
33+ " src/Engine.php" ,
34+ " src/Cli.php" ,
35+ " src/Games/Even.php" ,
36+ " src/Games/Calc.php" ,
37+ " src/Games/Gcd.php" ,
38+ " src/Games/Prime.php" ,
39+ " src/Games/Progression.php"
40+ ]
3041 }
3142}
Original file line number Diff line number Diff line change 11<?php
22
3- namespace Src \Cli ;
3+ namespace BrainGames \Cli ;
44
55use function cli \line ;
66use function cli \prompt ;
77
8- line ('Welcome to the Brain Games! ' );
9- $ name = prompt ('May I have your name? ' );
10- line ("Hello, %s! " , $ name );
8+ function welcome (): void
9+ {
10+ line ('Welcome to the Brain Games! ' );
11+ $ name = prompt ('May I have your name? ' );
12+ line ("Hello, %s! " , $ name );
13+ }
You can’t perform that action at this time.
0 commit comments