MEMORY [jeu batch] code source
Posté : 11 sept. 2009 11:09
Bonjour à tous, je suis nouveau sur batcher.fr,
Voici un petit jeu que j'ai réalisé en batch:
Voici un petit jeu que j'ai réalisé en batch:
Code : Tout sélectionner
@echo off
title MEMORY © ^| By STRYK
mode con cols=42 lines=32 &color 1A
:: -------------------- stryk@live.fr ----------------------
:: Merci à : -------------------- http://www.batch.xoo.it/index.php ----------------------
:: Pour plus de lisibilitée, je vous recommande l'éditeur de texte : NOTEPAD++
:: il "reconnait" le language batch et affiche des couleurs différentes pour les commandes, les variables, les index, etc...
:: Lien: http://www.01net.com/telecharger/windows/Internet/editeur_de_site/fiches/29119.html
set SCORE=0
set ESSAI=1
set tc=
set tch=Bien jou‚
set tcl=Loup‚
set AF= º
set SELECT_one=one
set SELECT_two=two
set WELCOME_FLAG=TRUE
set FIRST_TIME=TRUE
set DOUBLE_SELECT=FALSE
set TEMPS_H=%time:~0,2%
set TEMPS_M=%time:~3,2%
set TEMPS_S=%time:~6,2%
set A1=Û
set A2=Û
set A3=Û
set A4=Û
set A5=Û
set A6=Û
set B1=Û
set B2=Û
set B3=Û
set B4=Û
set B5=Û
set B6=Û
set C1=Û
set C2=Û
set C3=Û
set C4=Û
set C5=Û
set C6=Û
set D1=Û
set D2=Û
set D3=Û
set D4=Û
set D5=Û
set D6=Û
set E1=Û
set E2=Û
set E3=Û
set E4=Û
set E5=Û
set E6=Û
set F1=Û
set F2=Û
set F3=Û
set F4=Û
set F5=Û
set F6=Û
echo ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
echo.
echo Bienvenue dans le jeu MEMORY
echo.
echo.
echo ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
echo.
echo.
echo Vous allez pouvoir tester votre m‚moire
echo.
echo.
echo RŠgles du jeu :
echo.
echo.
echo _ Vous devez retrouver 18 paires
echo de caractŠres dans une grille.
echo.
echo _ Pour cela, il suffit de retourner
echo deux cartes.
echo Si elles sont identiques, vous
echo passerez aux suivantes, sinon,
echo elles seront … nouveaux masqu‚es.
echo.
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
echo º Bon divertissement º
echo ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
echo.
echo Appuyez sur une touche pour jouer
pause>nul
:SET_SELECT
set A1=%A1%
set A2=%A2%
set A3=%A3%
set A4=%A4%
set A5=%A5%
set A6=%A6%
set B1=%B1%
set B2=%B2%
set B3=%B3%
set B4=%B4%
set B5=%B5%
set B6=%B6%
set C1=%C1%
set C2=%C2%
set C3=%C3%
set C4=%C4%
set C5=%C5%
set C6=%C6%
set D1=%D1%
set D2=%D2%
set D3=%D3%
set D4=%D4%
set D5=%D5%
set D6=%D6%
set E1=%E1%
set E2=%E2%
set E3=%E3%
set E4=%E4%
set E5=%E5%
set E6=%E6%
set F1=%F1%
set F2=%F2%
set F3=%F3%
set F4=%F4%
set F5=%F5%
set F6=%F6%
if %SCORE% GEQ 10 set AF=º
cls
if %WELCOME_FLAG%==TRUE ( echo.
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
echo º º
echo º ----- MEMORY ---- º
echo º º
echo ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
echo.
echo.
set WELCOME_FLAG=FALSE
) else (
echo ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
echo º
echo Score: %SCORE% %AF% %tc%
echo º
echo.
echo ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
)
echo.
echo.
echo ³ 1 ³ 2 ³ 3 ³ 4 ³ 5 ³ 6 ³
echo ³ ³ ³ ³ ³ ³ ³
echo ÄÄÄ+ÄÄÄ+ÄÄÄ+ÄÄÄ+ÄÄÄ+ÄÄÄ+ÄÄij
echo A ³ %A1% ³ %A2% ³ %A3% ³ %A4% ³ %A5% ³ %A6% ³
echo ÄÄÄ+ÄÄÄ+ÄÄÄ+ÄÄÄ+ÄÄÄ+ÄÄÄ+ÄÄij
echo B ³ %B1% ³ %B2% ³ %B3% ³ %B4% ³ %B5% ³ %B6% ³
echo ÄÄÄ+ÄÄÄ+ÄÄÄ+ÄÄÄ+ÄÄÄ+ÄÄÄ+ÄÄij
echo C ³ %C1% ³ %C2% ³ %C3% ³ %C4% ³ %C5% ³ %C6% ³
echo ÄÄÄ+ÄÄÄ+ÄÄÄ+ÄÄÄ+ÄÄÄ+ÄÄÄ+ÄÄij
echo D ³ %D1% ³ %D2% ³ %D3% ³ %D4% ³ %D5% ³ %D6% ³
echo ÄÄÄ+ÄÄÄ+ÄÄÄ+ÄÄÄ+ÄÄÄ+ÄÄÄ+ÄÄij
echo E ³ %E1% ³ %E2% ³ %E3% ³ %E4% ³ %E5% ³ %E6% ³
echo ÄÄÄ+ÄÄÄ+ÄÄÄ+ÄÄÄ+ÄÄÄ+ÄÄÄ+ÄÄij
echo F ³ %F1% ³ %F2% ³ %F3% ³ %F4% ³ %F5% ³ %F6% ³
echo ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
echo.
echo.
echo.
:: --------------------- Résultats ------------------
:: 1 2 3 4 5 6
::
:: A # $ " Q $ *
:: B # @ § M W §
:: C * @ U - € +
:: D W ? / M ? -
:: E U " = \ Z Z
:: F + / Q = \ €
:: -------------------------------------------------------
IF %SCORE%==18 goto :WINNER
if %DOUBLE_SELECT%==TRUE (
if /i %SELECT_one%==A1 (
if /i %SELECT_two%==B1 goto :NO_RESET )
if /i %SELECT_one%==A2 (
if /i %SELECT_two%==A5 goto :NO_RESET )
if /i %SELECT_one%==A3 (
if /i %SELECT_two%==E2 goto :NO_RESET )
if /i %SELECT_one%==A4 (
if /i %SELECT_two%==F3 goto :NO_RESET )
if /i %SELECT_one%==A6 (
if /i %SELECT_two%==C1 goto :NO_RESET )
if /i %SELECT_one%==B2 (
if /i %SELECT_two%==C2 goto :NO_RESET )
if /i %SELECT_one%==B3 (
if /i %SELECT_two%==B6 goto :NO_RESET )
if /i %SELECT_one%==B4 (
if /i %SELECT_two%==D4 goto :NO_RESET )
if /i %SELECT_one%==B5 (
if /i %SELECT_two%==D1 goto :NO_RESET )
if /i %SELECT_one%==C3 (
if /i %SELECT_two%==E1 goto :NO_RESET )
if /i %SELECT_one%==C4 (
if /i %SELECT_two%==D6 goto :NO_RESET )
if /i %SELECT_one%==C5 (
if /i %SELECT_two%==F6 goto :NO_RESET )
if /i %SELECT_one%==C6 (
if /i %SELECT_two%==F1 goto :NO_RESET )
if /i %SELECT_one%==D2 (
if /i %SELECT_two%==D5 goto :NO_RESET )
if /i %SELECT_one%==D3 (
if /i %SELECT_two%==F2 goto :NO_RESET )
if /i %SELECT_one%==E3 (
if /i %SELECT_two%==F4 goto :NO_RESET )
if /i %SELECT_one%==E4 (
if /i %SELECT_two%==F5 goto :NO_RESET )
if /i %SELECT_one%==E5 (
if /i %SELECT_two%==E6 goto :NO_RESET )
if /i %SELECT_one%==B1 (
if /i %SELECT_two%==A1 goto :NO_RESET )
if /i %SELECT_one%==A5 (
if /i %SELECT_two%==A2 goto :NO_RESET )
if /i %SELECT_one%==E2 (
if /i %SELECT_two%==A3 goto :NO_RESET )
if /i %SELECT_one%==F3 (
if /i %SELECT_two%==A4 goto :NO_RESET )
if /i %SELECT_one%==C1 (
if /i %SELECT_two%==A6 goto :NO_RESET )
if /i %SELECT_one%==C2 (
if /i %SELECT_two%==B2 goto :NO_RESET )
if /i %SELECT_one%==B6 (
if /i %SELECT_two%==B3 goto :NO_RESET )
if /i %SELECT_one%==D4 (
if /i %SELECT_two%==B4 goto :NO_RESET )
if /i %SELECT_one%==D1 (
if /i %SELECT_two%==B5 goto :NO_RESET )
if /i %SELECT_one%==E1 (
if /i %SELECT_two%==C3 goto :NO_RESET )
if /i %SELECT_one%==D6 (
if /i %SELECT_two%==C4 goto :NO_RESET )
if /i %SELECT_one%==F6 (
if /i %SELECT_two%==C5 goto :NO_RESET )
if /i %SELECT_one%==F1 (
if /i %SELECT_two%==C6 goto :NO_RESET )
if /i %SELECT_one%==D5 (
if /i %SELECT_two%==D2 goto :NO_RESET )
if /i %SELECT_one%==F2 (
if /i %SELECT_two%==D3 goto :NO_RESET )
if /i %SELECT_one%==F4 (
if /i %SELECT_two%==E3 goto :NO_RESET )
if /i %SELECT_one%==F5 (
if /i %SELECT_two%==E4 goto :NO_RESET )
if /i %SELECT_one%==E6 (
if /i %SELECT_two%==E5 goto :NO_RESET )
set DOUBLE_SELECT=FALSE
set %SELECT_one%=Û
set %SELECT_two%=Û
set tc=%tcl%
@ping localhost -n 2 >nul
goto :SET_SELECT )
if %FIRST_TIME%==TRUE (
set /p SELECT_one= S‚lectionner une case \\:
set FIRST_TIME=FALSE
set tc=
goto :VIEW_1
)
if %FIRST_TIME%==FALSE (
set /p SELECT_two= DeuxiŠme case [ essai N'%ESSAI% ]\\:
set FIRST_TIME=TRUE
set DOUBLE_SELECT=TRUE
set /a ESSAI = ESSAI + 1
goto :VIEW_2
)
:NO_RESET
set DOUBLE_SELECT=FALSE
set /a SCORE = SCORE + 1
set tc=%tch%
@ping localhost -n 2 >nul
goto :SET_SELECT
:VIEW_1
goto :1_%SELECT_one%
:1_A1
set A1=#
goto :SET_SELECT
:1_A2
set A2=$
goto :SET_SELECT
:1_A3
set A3="
goto :SET_SELECT
:1_A4
set A4=Q
goto :SET_SELECT
:1_A5
set A5=$
goto :SET_SELECT
:1_A6
set A6=*
goto :SET_SELECT
:1_B1
set B1=#
goto :SET_SELECT
:1_B2
set B2=@
goto :SET_SELECT
:1_B3
set B3=§
goto :SET_SELECT
:1_B4
set B4=M
goto :SET_SELECT
:1_B5
set B5=W
goto :SET_SELECT
:1_B6
set B6=§
goto :SET_SELECT
:1_C1
set C1=*
goto :SET_SELECT
:1_C2
set C2=@
goto :SET_SELECT
:1_C3
set C3=U
goto :SET_SELECT
:1_C4
set C4=-
goto :SET_SELECT
:1_C5
set C5=€
goto :SET_SELECT
:1_C6
set C6=+
goto :SET_SELECT
:1_D1
set D1=W
goto :SET_SELECT
:1_D2
set D2=?
goto :SET_SELECT
:1_D3
set D3=/
goto :SET_SELECT
:1_D4
set D4=M
goto :SET_SELECT
:1_D5
set D5=?
goto :SET_SELECT
:1_D6
set D6=-
goto :SET_SELECT
:1_E1
set E1=U
goto :SET_SELECT
:1_E2
set E2="
goto :SET_SELECT
:1_E3
set E3==
goto :SET_SELECT
:1_E4
set E4=\
goto :SET_SELECT
:1_E5
set E5=Z
goto :SET_SELECT
:1_E6
set E6=Z
goto :SET_SELECT
:1_F1
set F1=+
goto :SET_SELECT
:1_F2
set F2=/
goto :SET_SELECT
:1_F3
set F3=Q
goto :SET_SELECT
:1_F4
set F4==
goto :SET_SELECT
:1_F5
set F5=\
goto :SET_SELECT
:1_F6
set F6=€
goto :SET_SELECT
:VIEW_2
goto :2_%SELECT_two%
:2_A1
set A1=#
goto :SET_SELECT
:2_A2
set A2=$
goto :SET_SELECT
:2_A3
set A3="
goto :SET_SELECT
:2_A4
set A4=Q
goto :SET_SELECT
:2_A5
set A5=$
goto :SET_SELECT
:2_A6
set A6=*
goto :SET_SELECT
:2_B1
set B1=#
goto :SET_SELECT
:2_B2
set B2=@
goto :SET_SELECT
:2_B3
set B3=§
goto :SET_SELECT
:2_B4
set B4=M
goto :SET_SELECT
:2_B5
set B5=W
goto :SET_SELECT
:2_B6
set B6=§
goto :SET_SELECT
:2_C1
set C1=*
goto :SET_SELECT
:2_C2
set C2=@
goto :SET_SELECT
:2_C3
set C3=U
goto :SET_SELECT
:2_C4
set C4=-
goto :SET_SELECT
:2_C5
set C5=€
goto :SET_SELECT
:2_C6
set C6=+
goto :SET_SELECT
:2_D1
set D1=W
goto :SET_SELECT
:2_D2
set D2=?
goto :SET_SELECT
:2_D3
set D3=/
goto :SET_SELECT
:2_D4
set D4=M
goto :SET_SELECT
:2_D5
set D5=?
goto :SET_SELECT
:2_D6
set D6=-
goto :SET_SELECT
:2_E1
set E1=U
goto :SET_SELECT
:2_E2
set E2="
goto :SET_SELECT
:2_E3
set E3==
goto :SET_SELECT
:2_E4
set E4=\
goto :SET_SELECT
:2_E5
set E5=Z
goto :SET_SELECT
:2_E6
set E6=Z
goto :SET_SELECT
:2_F1
set F1=+
goto :SET_SELECT
:2_F2
set F2=/
goto :SET_SELECT
:2_F3
set F3=Q
goto :SET_SELECT
:2_F4
set F4==
goto :SET_SELECT
:2_F5
set F5=\
goto :SET_SELECT
:2_F6
set F6=€
goto :SET_SELECT
:WINNER
cls
set /a CHRONO_H = %time:~0,2% - %TEMPS_H%
set /a CHRONO_M = %time:~3,2% - %TEMPS_M%
set /a CHRONO_S = %time:~6,2% - %TEMPS_S%
echo.
echo.
echo.
echo.
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
echo º º
echo º BRAVO º
echo º º
echo ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
echo.
echo.
echo Vous avez trouv‚ les 18 paires
echo de symboles en :
if %CHRONO_S% GEQ 0 (
if %CHRONO_M% GEQ 0 (
echo %CHRONO_H% h %CHRONO_M% mn et %CHRONO_S% secondes
) else (
echo %CHRONO_H% h et %CHRONO_S% secondes
))
if %CHRONO_S% LSS 0 (
if %CHRONO_M% GEQ 0 (
echo %CHRONO_H% h %CHRONO_M% mn
) else (
echo %CHRONO_H% h
))
echo.
echo.
echo.
pause>nul