IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Basic Discussion :

Tutoriel Just Basic : problème de programmation


Sujet :

Basic

  1. #1
    Candidat au Club
    Inscrit en
    Juillet 2007
    Messages
    4
    Détails du profil
    Informations forums :
    Inscription : Juillet 2007
    Messages : 4
    Points : 2
    Points
    2
    Par défaut Tutoriel Just Basic : problème de programmation
    Bonjour j'ai utilisé un tuturial de JUST BASIC je l'ai traduit en français. Le but du jeu est de trouvé le chiffre que l'ordi a choisi entre 1 et 70 mais je voudrais intégrer un score par rapport aux essai. Par ex : 1 essai = 70 points
    2 essai = 69 points
    ect...
    Pouvez-vous m'aider ????????????????????????

  2. #2
    Membre habitué
    Profil pro
    Inscrit en
    Janvier 2007
    Messages
    123
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2007
    Messages : 123
    Points : 174
    Points
    174
    Par défaut
    Pour que l'on t'aide, il faudrait donner davantage d'informations.
    Quel est ce tutoriel?
    Peux-tu poster le source?
    Comment veux-tu afficher le score? Sur l'écran? Sur un objet?

  3. #3
    Candidat au Club
    Inscrit en
    Juillet 2007
    Messages
    4
    Détails du profil
    Informations forums :
    Inscription : Juillet 2007
    Messages : 4
    Points : 2
    Points
    2
    Par défaut Code source (en anglais)
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    ' WK4PROG8.BAS
        ' Here is an interactive HI-LO
        ' Program
     
        'don't use a main window
        nomainwin
     
    [start]
        guessMe = int(rnd(1)*100) + 1
     
        ' Clear the screen and print the title and instructions
        notice "HI-LO" + chr$(13) + _
         "I have decided on a number between one " + _
         "and a hundred, and I want you to guess " + _
         "what it is.  I will tell you to guess " + _
         "higher or lower, and we'll count up " + _
         "the number of guesses you use."
     
    [ask]
        ' Ask the user to guess the number and tally the guess
        prompt "OK.  What is your guess ?"; guess$
        guess = val(guess$)
     
        ' Now add one to the count variable to count the guesses
        let count = count + 1
     
        ' check to see if the guess is right
        if guess = guessMe then goto [win]
        ' check to see if the guess is too low
        if guess < guessMe then notice "Guess higher."
        ' check to see if the guess is too high
        if guess > guessMe then notice "Guess lower."
     
        ' go back and ask again
        goto [ask]
     
    [win]
        ' beep once and tell how many guesses it took to win
        beep
        notice "You win!  It took" + str$(count) + "guesses."
     
        ' reset the count variable to zero for the next game
        let count = 0
     
        ' ask to play again
        confirm "Play again (Y/N)?"; play$
        if instr("YESyes", play$) > 0 then goto [start]
     
        end

  4. #4
    Membre habitué
    Profil pro
    Inscrit en
    Janvier 2007
    Messages
    123
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2007
    Messages : 123
    Points : 174
    Points
    174
    Par défaut
    J'ai ajouté une variable score que j'initialise à 10 (il y aura 10 essais possibles).
    A chaque valeur proposée, score est diminué de 1. Si score est nul, le jeu est fini.
    En outre, j'ai affiche la valeur du score à chaque réponse de l'ordinateur.
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    ' WK4PROG8.BAS
    ' Here is an interactive HI-LO
    ' Program
    
    'don't use a main window
    nomainwin
    
    [start]
    guessMe = int(rnd(1)*100) + 1
    
    ' Clear the screen and print the title and instructions
    notice "HI-LO" + chr$(13) + _
    "I have decided on a number between one " + _
    "and a hundred, and I want you to guess " + _
    "what it is. I will tell you to guess " + _
    "higher or lower, and we'll count up " + _
    "the number of guesses you use."
    
    'initialise le score
    score = 10
    [ask]
    ' Ask the user to guess the number and tally the guess
    prompt "OK. What is your guess ?"; guess$
    guess = val(guess$)
    
    ' Now add one to the count variable to count the guesses
    let count = count + 1
    
    ' check to see if the guess is right
    if guess = guessMe then goto [win]
    ' check to see if the guess is too low
    if guess < guessMe then notice "Guess higher. The score is "+str$(score)
    ' check to see if the guess is too high
    if guess > guessMe then notice "Guess lower. The score is "+str$(score)
    'diminue le score
    let score = score - 1
    ' si score nul, c'est fini
    if score=0 then goto [fini]
    
    ' go back and ask again
    goto [ask]
    
    [win]
    ' beep once and tell how many guesses it took to win
    beep
    notice "You win! It took" + str$(count) + "guesses."
    
    ' reset the count variable to zero for the next game
    let count = 0
    
    ' ask to play again
    confirm "Play again (Y/N)?"; play$
    if instr("YESyes", play$) > 0 then goto [start]
    
    [fini]
    end

  5. #5
    Candidat au Club
    Inscrit en
    Juillet 2007
    Messages
    4
    Détails du profil
    Informations forums :
    Inscription : Juillet 2007
    Messages : 4
    Points : 2
    Points
    2
    Par défaut Merci
    Je suis super content merci PANORAMIC ,mais comment le compiler en format .exe

  6. #6
    Membre habitué
    Profil pro
    Inscrit en
    Janvier 2007
    Messages
    123
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2007
    Messages : 123
    Points : 174
    Points
    174
    Par défaut
    Cela se fait en 2 temps, comme expliqué dans l'aide :

    1) tu fais un fichier .TKN à partir de ton source score.bas
    Run / Make *.TKN file, tu obtiens par exemple le fichier score.tkn

    2) tu renommes jbrun101.exe en score.exe et tu joins les fichiers SDL:
    vbas31w.sll
    vgui31w.sll
    voflr31w.sll
    vthk31w.dll
    vtk1631w.dll
    vtk3231w.dll
    vvm31w.dll
    vvmt31w.dll

    C'est l'ensemble de ces 10 fichiers qui est exécutable indépendemment de justbasic:
    score.tkn
    score.exe
    vbas31w.sll
    vgui31w.sll
    voflr31w.sll
    vthk31w.dll
    vtk1631w.dll
    vtk3231w.dll
    vvm31w.dll
    vvmt31w.dll

Discussions similaires

  1. Réponses: 1
    Dernier message: 19/02/2012, 22h06
  2. Cherche guide et aide pour just basic
    Par Tirius dans le forum Débuter
    Réponses: 1
    Dernier message: 26/09/2010, 14h29
  3. Réponses: 0
    Dernier message: 20/07/2008, 22h40
  4. [Just Basic] Comment revenir de .TKN en .BAS ?
    Par FANFAN LA TULIPE dans le forum Basic
    Réponses: 3
    Dernier message: 28/04/2008, 07h16
  5. recherche tutoriel visual basic version 8
    Par shnouf dans le forum VB 6 et antérieur
    Réponses: 6
    Dernier message: 01/02/2006, 15h02

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo