Loading

Search Code

Search code contents

Close File Browser

Execution Mode

Live: will automatically execute upon every character typed (warning: could result in issues if you have intensive or partially-completed code that results in an infinite loop)

Exited code editor: will automatically execute code when the code editor loses focus - i.e. when you click outside of the code editor

Run on click: code will only be executed when you click the triangular run/play button

File Manager

Search & browse files easily

Pseudocode

Write and run pseudocode

Java

See a Java equivalent to your pseudocode program

Note: the site doesn't allow executing Java. An IDE like IntelliJ will provide an easy installation of the JDK and is recommended for running Java locally

Python

See a Python equivalent to your pseudocode program

Note: the site doesn't allow executing Python. An IDE like PyCharm will provide an easy installation of the Python interpreter and is recommended for running Python locally

Visual Basic

See a Visual Basic (VB) equivalent to your pseudocode program

Note: the site doesn't allow executing Visual Basic. An IDE like Visual Studio will provide an easy installation of the Visual Studio compiler and is recommended for running Visual Basic locally

New Program

Choose from a number of pre-made programs or create your own

Modifying a pre-made program will automatically create a new program, ensuring the original & modified version are available

Create Trace Table

Automatically create trace tables for your code

Can use the BREAKPOINT keyword to add breakpoints at specific parts of your program

Use TRACE_NEXT_ROW to force new row to be created in trace table

Autoformat Code

Toggle original/formatted code

Pretty-printing/auto-formatting code will insert new lines, indentation and apply consistent styling rules. If enabled, pretty-printing will also occur each time you run your program

You can even try writing your entire program on one line...and it should still run and be formatted correctly :)

Note: code may be re-ordered (e.g. all declarations moved to the top) due to the way the site works

Tested and works for all demo programs - please contact me if this breaks any of your working code!

Show Abstract Syntax Tree

Display a visual representation of the parse result of the program

Load

Load a previously-saved pseudocode file (.pseudo default extension)

Download

Download a .pseudo file for future use

Note: programs will be saved periodically (every 10 seconds) to your browser's storage if changes are made - this means you can access your programs across multiple tabs

Upload

Save your program for public-viewing by anyone

Sharing

Share a direct link containing your code - your code will be contained in the URL and NOT stored on the server

Alternatively, you can select the upload option to upload your code publicly to the server

Quiet Editor

Remove bloat like the navigation bar & footer to focus only on the code editor

Note: can be toggled with CTRL + Q (quiet mode)

Fullscreen Quiet Mode

Toggle between regular and fullscreen mode

Note: pressing FN/F11/ESC keys isn't recommended, since they can't be detected by the site, hence the additional 'quite mode' settings can't be applied - the removing of the nav bar & footer. To enter this fullscreen mode, either use this button or the keyboard shortcut CTRL + M (minimise <-> maximise)

Add Favourite

Add this code as a favourite you can view later

No errors βœ…

Error Checks

The site aims to enforce the statically-typed nature of pseudocode - i.e. assigning a STRING to an INTEGER variable should be forbidden. Some combinations are allowed, however - such as assigning a CHAR to a STRING or an INTEGER to a REAL. Other additional checks to ensure valid pseudocode are also in place

The site has been well-tested and there aren't any bugs we are aware of, however, if you believe the site is incorrectly giving you an error & preventing your code from running, you can disable the error-checking

In such cases, please feel free to contact us

Note that it is not possible to disable fatal error messages such as syntax errors, runtime errors etc

Subroutine Signature Hints

If enabled, the following information will be shown:

  • Keyword/Identifier/Module Name Suggestions
  • Subroutine parameters & types
  • Return types
  • Subroutine descriptions
  • Examples

Switch Program Shortcuts

Choose whether CTRL + SHIFT + LEFT/RIGHT should navigate to the previous program - can be disabled to prevent accidental triggering

Toggle Keyboard Shortcuts

Enable or disable this website's additional keyboard shortcuts (switch program, change font size, code execution etc) - note: standard editor & browser shortcuts will still apply

Use Assignment Arrow

Will cause "<-" to be replaced with the Unicode "←" symbol as the user is typing - can also use CTRL + SHIFT + < to insert this symbol

Allow LENGTH() for Arrays

Turning this on will disable the warning message if using the LENGTH function to get the number of elements in an array

Require Variable Initialisation

If enabled, you will get warnings if trying to access uninitialised variables

Code Snippets

These are pre-written code templates - for example, if you type in "DECLARE" in the code editor, you will see options to declare single variables, 1 & 2D arrays - you can disable this option

Show Toolbar Program Browser

If enabled, will show the program browser in the toolbar even if the sidebar file browser is open

Show Welcome Message

Toggle the welcome message/popup in the bottom right corner from showing

Wait for Tips

Will show the loading screen until at least the tip (hint) has been displayed, even if the site is fully loaded. Disabling this can hence make the editor screen appear faster, if the page is ready

Max Execution Time

To prevent infinite loops resulting in the page becoming unresponsive, code will automatically terminate if this value (in seconds) is exceeded

If you have a legitimate long-running program, you can obviously set this to a high value - alternatively, setting to -1 will disable this check

IGCSE Syllabus (Pseudocode p35) O-Level Syllabus (Pseudocode p35) A-Level Syllabus A-Level Pseudocode Guide A-Level Pseudocode Functions Report Bugs
YouTube Tutorials Discord Help
AssemblyCode BooleanLogic CIESchedule Program52
DemosπŸ§‘πŸ»β€πŸ« Keyword ListπŸ“œ Monthly Challenge: Getting...πŸ“†
{"0":"Algorithms","1":"Selection","2":"Iteration","3":"Arrays","4":"Records","5":"ENUMs","6":"Custom Modules","7":"Files","8":"Object-Oriented Programming","9":"Abstract Data Types","10":"Sets","11":"Pointers","12":"Recursion","13":"Exam Questions","14":"Games","15":"Mathematics","16":"Art","17":"Utilities","18":"Other"}

Welcome to Pseudocode Pro

This site was developed to solve the problems of students either being completely stuck with pseudocode, or attempting a solution, but having no way of actually validating if it would work (other than a manual trace table). This site supports the entire Cambridge IGCSE (0478), O-Level (2210) and 9618 A-Level pseudocode specifications from the guide/syllabus, with extension modules supporting sound, canvas, events, custom html etc

Below are lists of both the currently support pseudocode and general website features:

  • πŸ“¦ Variables & Constants
  • βž• Arithmetic & Logical Operators
  • πŸ“₯πŸ“€ INPUT & OUTPUT
  • β“βŒ IF/ELSE & CASE
  • πŸ” FOR/WHILE/REPEAT...UNTIL Loops
  • πŸ”§ FUNCTIONS & PROCEDURES
  • πŸ”’ BYVAL & BYREF
  • πŸ”’ ARRAYs
  • πŸ“’ TYPEs (Records & Enums)
  • πŸ“„ File Handling (Text & RANDOM)
  • 🧩 Object-Oriented Programming
  • πŸͺ£ Sets
  • πŸ‘‰ Pointers
  • --- Extra Non-Syllabus Features ---
  • πŸ”Š Sound
  • 🎨 Canvas
  • πŸ–²οΈ Events
  • πŸ–₯️ Custom HTML

Additional programs uploaded by the community can be found on the search page.

While you are here, why not try one of the many - and ever increasing list of - pseudocode coding challenges.

To support hosting & domain costs, for $2, a premium account can be purchased - this has the following benefits:

Those last 2 features are currently in progress, so an extra 3 months free will be given to anyone who buys a license now to acknowledge this

For any issues, feature requests, comments etc, you can contact me

Token List

Work in progress: some buttons currently don't work...just select "All"

Token Description Example Parameters

Thanks for using the site - I hope you enjoy it and if you do, it would mean a lot if you could share it with your friends too :)

Drag & drop code or data files here

{"c":"\/\/ * Code Author: aryaanand.in@gmail.com\n\/\/ * Date: 2025\/12\/18\n\/\/ * Description: \n\/\/ * Categories: \n\nDECLARE choiceofgame : INTEGER \r\n\r\nDECLARE bubblesortarray : ARRAY [1:5] OF INTEGER \r\n\r\nDECLARE bubblesortcounter : INTEGER \r\n\r\nDECLARE bubblesortswap : BOOLEAN \r\n\r\nDECLARE bubblesorttemp : INTEGER \r\n\r\nDECLARE bubblesortlast : INTEGER \r\n\r\nDECLARE secretnum : INTEGER \r\n\r\nDECLARE secretnumguess : INTEGER \r\n\r\nDECLARE secretnumcounter : INTEGER \r\n\r\nDECLARE correctguess : BOOLEAN \r\n\r\nDECLARE gamemodechoice : INTEGER \r\n\r\n \r\n\r\nDECLARE highorlownumone : INTEGER \r\n\r\n \r\n\r\nDECLARE highorlownumtwo : INTEGER \r\n\r\n \r\n\r\nDECLARE highorlowguess : STRING \r\n\r\n \r\n\r\nDECLARE highorlowsymbol : STRING \r\n\r\n \r\n\r\nDECLARE highorlowno1 : INTEGER \r\n\r\n \r\n\r\nDECLARE highorlowno2 : INTEGER \r\n\r\n \r\n\r\nDECLARE highorlowcorrect : BOOLEAN \r\n\r\n \r\n\r\nDECLARE memoryarray : ARRAY [1:6] OF INTEGER \r\n\r\n \r\n\r\nDECLARE memorygamechoice : INTEGER \r\n\r\n \r\n\r\nDECLARE memorycounter : INTEGER \r\n\r\n \r\n\r\nDECLARE memorylast : INTEGER \r\n\r\n \r\n\r\nDECLARE memoryswap : BOOLEAN \r\n\r\n \r\n\r\nDECLARE memorytemp : INTEGER \r\n\r\n \r\n\r\nDECLARE memoryanscounter : INTEGER \r\n\r\n \r\n\r\nDECLARE memoryinput : ARRAY [1:6] OF INTEGER \r\n\r\n \r\n\r\nDECLARE memorynormcounter : INTEGER \r\n\r\n \r\n\r\nDECLARE name, lastResult : STRING \r\n\r\n \r\n\r\nDECLARE gamesRemaining : INTEGER \r\n\r\n \r\n\r\nDECLARE userScore : INTEGER \r\n\r\n \r\n\r\nDECLARE computerScore : INTEGER \r\n\r\n \r\n\r\nDECLARE userAnswer : CHAR \r\n\r\n \r\n\r\nDECLARE computerAnswer : CHAR \r\n\r\n \r\n\r\nDECLARE playAgain : CHAR \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\nmemorynormcounter \u2190 1 \r\n\r\n \r\n\r\nmemorylast \u2190 6 \r\n\r\n \r\n\r\nmemorycounter \u2190 1 \r\n\r\n \r\n\r\nbubblesortcounter \u2190 1 \r\n\r\n \r\n\r\nsecretnumcounter \u2190 1 \r\n\r\n \r\n\r\nbubblesortlast \u2190 5 \r\n\r\n \r\n\r\nOUTPUT \"Pick a game you would like to play : \r\n\r\n1. Bubble Sort Game \r\n\r\n2. Guess the Number \r\n\r\n3. Highest and Lowest number finder \r\n\r\n4. Memory check \r\n\r\n5. Rock, Paper, Scissors \r\n\r\n\" \r\n\r\n \r\n\r\nINPUT choiceofgame \r\n\r\n \r\n\r\nCASE OF choiceofgame \r\n\r\n \r\n\r\n1 : OUTPUT \" \r\n\r\nIn this game, you will give the computer 5 numbers. And the code will sort in ascending order \r\n\r\n\" \r\n\r\n \r\n\r\nFOR bubblesortcounter \u2190 1 TO 5 \r\n\r\n \r\n\r\nINPUT bubblesortarray[bubblesortcounter] \r\n\r\n \r\n\r\nNEXT bubblesortcounter \r\n\r\n \r\n\r\n \r\n\r\nREPEAT \r\n\r\n \r\n\r\nbubblesortswap \u2190 FALSE \r\n\r\n \r\n\r\nFOR bubblesortcounter \u2190 1 TO bubblesortlast - 1 \r\n\r\n \r\n\r\nIF bubblesortarray[bubblesortcounter] > bubblesortarray[bubblesortcounter + 1] THEN \r\n\r\n \r\n\r\nbubblesorttemp \u2190 bubblesortarray[bubblesortcounter] \r\n\r\n \r\n\r\nbubblesortarray[bubblesortcounter] \u2190 bubblesortarray[bubblesortcounter + 1] \r\n\r\n \r\n\r\nbubblesortarray[bubblesortcounter + 1] \u2190 bubblesorttemp \r\n\r\n \r\n\r\nbubblesortswap \u2190 TRUE \r\n\r\n \r\n\r\n \r\n\r\nENDIF \r\n\r\n \r\n\r\nNEXT bubblesortcounter \r\n\r\n \r\n\r\nbubblesortlast \u2190 bubblesortlast - 1 \r\n\r\n \r\n\r\nUNTIL bubblesortlast = 1 OR bubblesortswap = FALSE \r\n\r\n \r\n\r\nFOR bubblesortcounter \u2190 1 TO 5 \r\n\r\n \r\n\r\nOUTPUT \" \r\n\r\n \r\n\r\n\", bubblesortarray[bubblesortcounter] \r\n\r\n \r\n\r\nNEXT bubblesortcounter \r\n\r\n \r\n\r\n2 : OUTPUT \"In this game, you will try to guess a number. \r\n\r\n\" \r\n\r\n \r\n\r\nOUTPUT \"How it works. You will have to guess a number between 1 and 50. The code will give you basic clue's\" \r\n\r\n \r\n\r\nsecretnum \u2190 ROUND(RANDOM() * 49, 0) + 1 \r\n\r\n \r\n\r\nOUTPUT \"Lets start! Now enter a number and the code will give you a clue \r\n\" \r\n\r\n \r\n\r\nREPEAT \r\n\r\ncorrectguess \u2190 FALSE \r\n\r\n \r\n\r\nINPUT secretnumguess \r\n\r\n \r\n\r\nIF secretnumguess > secretnum THEN \r\n\r\n \r\n\r\nOUTPUT \"You have entered a number higher than the secret number \" \r\n\r\nsecretnumcounter \u2190 secretnumcounter + 1 \r\n\r\nELSE \r\n\r\nOUTPUT \"You have entered a number lower than the secret number\" \r\n\r\nsecretnumcounter \u2190 secretnumcounter + 1 \r\n\r\nENDIF \r\n\r\n \r\n\r\nIF secretnumguess < 0 THEN \r\n\r\n \r\n\r\nOUTPUT \"please enter a number between 1 and 50\" \r\n\r\n \r\n\r\nENDIF \r\n\r\n \r\n\r\nIF secretnumguess = secretnum THEN \r\n\r\n \r\n\r\nOUTPUT \"You got it. The Number was \", secretnum, \"!\" \r\n\r\n \r\n\r\ncorrectguess \u2190 TRUE \r\n\r\n \r\n\r\nENDIF \r\n\r\n \r\n\r\nIF secretnumguess > 50 THEN \r\n\r\nOUTPUT \"Sorry, the secret number is between 1 and 50\" \r\n\r\nENDIF \r\n\r\nUNTIL secretnumcounter = 10 OR correctguess = TRUE \r\n\r\n \r\n\r\n3 : OUTPUT \"Pick the mode you would like to play : \r\n\r\n1. Guess which number has higher value \r\n\r\n2. Give the code 2 numbers and it will tell which has the higher value\" \r\n\r\n \r\n\r\nINPUT gamemodechoice \r\n\r\nCASE OF gamemodechoice \r\n\r\n1 : OUTPUT \"Good choice, the code will give you 2 numbers and you will enter which number has a higher value\" \r\n\r\nhighorlownumone \u2190 ROUND(RANDOM() * 1000, 0) \r\n\r\nhighorlownumtwo \u2190 ROUND(RANDOM() * 1000, 0) \r\n\r\nOUTPUT \"These are the numbers \", highorlownumone, \" and \", highorlownumtwo, \" , now enter < or > and the code will tell you if you are correct\" \r\n\r\n \r\n\r\nREPEAT \r\n\r\nhighorlowcorrect \u2190 FALSE \r\n\r\nINPUT highorlowguess \r\n\r\n \r\n\r\nIF highorlownumone > highorlownumtwo THEN \r\n\r\nhighorlowsymbol \u2190 \">\" \r\n\r\nENDIF \r\n\r\n \r\n\r\nIF highorlownumone < highorlownumtwo THEN \r\n\r\nhighorlowsymbol \u2190 \"<\" \r\n\r\nENDIF \r\n\r\n \r\n\r\nIF highorlowguess = highorlowsymbol THEN \r\n\r\nOUTPUT \"You are correct\" \r\n\r\nhighorlowcorrect \u2190 TRUE \r\n\r\nENDIF \r\n\r\n \r\n\r\nUNTIL highorlowcorrect = TRUE OR highorlowguess = highorlowsymbol \r\n\r\n \r\n\r\n \r\n\r\n2 : OUTPUT \"Nice choice, in this mode you will give the computer 2 numbers and the code will tell which is the bigger number\" \r\n\r\n \r\n\r\nOUTPUT \"Enter the first number\" \r\n\r\nINPUT highorlowno1 \r\n\r\n \r\n\r\nOUTPUT \"Enter the second number\" \r\n\r\nINPUT highorlowno2 \r\n\r\n \r\n\r\nIF highorlowno1 > highorlowno2 THEN \r\n\r\nOUTPUT highorlowno1, \" > \", highorlowno2 \r\n\r\nELSE \r\n\r\nOUTPUT highorlowno1, \" < \", highorlowno2 \r\n\r\nENDIF \r\n\r\n \r\n\r\nOTHERWISE OUTPUT \"Enter a valid game mode\" \r\n\r\nENDCASE \r\n\r\n \r\n\r\n4 : OUTPUT \" \r\n\r\nIn this game, you will be able to check your memory. we will show you a set of numbers and you will try to guess a number from the set. the code will give you some clues \r\n\r\n\" \r\n\r\n \r\n\r\nmemoryarray \u2190 [666, 22, 43, -123, 887, -6767] \r\n\r\n \r\n\r\nOUTPUT \"Pick a number 1-ASC or 2-DESC\" \r\n\r\nINPUT memorygamechoice \r\n\r\n \r\n\r\nCASE OF memorygamechoice \r\n\r\n1 : OUTPUT \" \r\n\r\nGreat choice, now we will show you a number and you will have to enter the numbers in acsending order \r\n\r\n\" \r\n\r\n \r\n\r\nREPEAT \r\n\r\nmemoryswap \u2190 FALSE \r\n\r\n \r\n\r\nFOR memorycounter \u2190 1 TO memorylast - 1 \r\n\r\n \r\n\r\nIF memoryarray[memorycounter] > memoryarray[memorycounter + 1] THEN \r\n\r\n \r\n\r\nmemorytemp \u2190 memoryarray[memorycounter] \r\n\r\n \r\n\r\nmemoryarray[memorycounter] \u2190 memoryarray[memorycounter + 1] \r\n\r\n \r\n\r\nmemoryarray[memorycounter + 1] \u2190 memorytemp \r\n\r\n \r\n\r\nmemoryswap \u2190 TRUE \r\n\r\n \r\n\r\nENDIF \r\n\r\n \r\n\r\nNEXT memorycounter \r\n\r\n \r\n\r\nmemorycounter \u2190 memorycounter - 1 \r\n\r\n \r\n\r\nUNTIL memorylast = 1 OR memoryswap = FALSE \r\n\r\n \r\n\r\nOUTPUT \"Now that you have seen the numbers, now enter them in ascending order\" \r\n\r\n \r\n\r\nmemoryanscounter \u2190 1 \r\n\r\n \r\n\r\nFOR memoryanscounter \u2190 1 TO 6 \r\n\r\nINPUT memoryinput[memoryanscounter] \r\n\r\nNEXT memoryanscounter \r\n\r\n \r\n\r\nmemoryanscounter \u2190 1 \r\n\r\nmemorycounter \u2190 1 \r\n\r\n \r\n\r\nFOR memorynormcounter \u2190 1 TO 6 \r\n\r\nIF memoryarray[memorycounter] = memoryinput[memoryanscounter] THEN \r\n\r\nOUTPUT \"You have entered the correct number for position : \", memorynormcounter \r\n\r\nmemoryanscounter \u2190 memoryanscounter + 1 \r\n\r\nmemorycounter \u2190 memorycounter + 1 \r\n\r\nELSE \r\n\r\nOUTPUT \"You have enetered the wrong number for position : \", memorynormcounter \r\n\r\nENDIF \r\n\r\n \r\n\r\nNEXT memorynormcounter \r\n\r\n \r\n\r\n2 : OUTPUT \" \r\n\r\nGreat choice, now we will show you a number and you will have to enter the numbers in descending order \r\n\r\n\" \r\n\r\n \r\n\r\nREPEAT \r\n\r\nmemoryswap \u2190 FALSE \r\n\r\n \r\n\r\nFOR memorycounter \u2190 1 TO memorylast - 1 \r\n\r\n \r\n\r\nIF memoryarray[memorycounter] < memoryarray[memorycounter + 1] THEN \r\n\r\n \r\n\r\nmemorytemp \u2190 memoryarray[memorycounter] \r\n\r\n \r\n\r\nmemoryarray[memorycounter] \u2190 memoryarray[memorycounter + 1] \r\n\r\n \r\n\r\nmemoryarray[memorycounter + 1] \u2190 memorytemp \r\n\r\n \r\n\r\nmemoryswap \u2190 TRUE \r\n\r\n \r\n\r\nENDIF \r\n\r\n \r\n\r\nNEXT memorycounter \r\n\r\n \r\n\r\nmemorycounter \u2190 memorycounter - 1 \r\n\r\n \r\n\r\nUNTIL memorylast = 1 OR memoryswap = FALSE \r\n\r\n \r\n\r\nOUTPUT \"Now that you have seen the numbers, now enter them in descending order\" \r\n\r\n \r\n\r\nmemoryanscounter \u2190 1 \r\n\r\n \r\n\r\nFOR memoryanscounter \u2190 1 TO 6 \r\n\r\nINPUT memoryinput[memoryanscounter] \r\n\r\nNEXT memoryanscounter \r\n\r\n \r\n\r\nmemoryanscounter \u2190 1 \r\n\r\nmemorycounter \u2190 1 \r\n\r\n \r\n\r\nFOR memorynormcounter \u2190 1 TO 6 \r\n\r\nIF memoryarray[memorycounter] = memoryinput[memoryanscounter] THEN \r\n\r\nOUTPUT \"You have entered the correct number for position : \", memorynormcounter \r\n\r\nmemoryanscounter \u2190 memoryanscounter + 1 \r\n\r\nmemorycounter \u2190 memorycounter + 1 \r\n\r\nELSE \r\n\r\nOUTPUT \"You have enetered the wrong number for position : \", memorynormcounter \r\n\r\nENDIF \r\n\r\n \r\n\r\nNEXT memorynormcounter \r\n\r\nOTHERWISE OUTPUT \"Not a valid game choice\" \r\n\r\nENDCASE \r\n\r\n \r\n\r\n5 : \r\n\r\nOUTPUT \"Enter your name: \" \r\n\r\n \r\n\r\nINPUT name \r\n\r\n \r\n\r\nREPEAT \r\n\r\nOUTPUT \"Enter the number of games to play: \" \r\n\r\nINPUT gamesRemaining \r\n\r\n \r\n\r\nlastResult \u2190 \"\" \r\n\r\n \r\n\r\nuserScore \u2190 0 \r\n\r\ncomputerScore \u2190 0 \r\n\r\n \r\n\r\nWHILE gamesRemaining > 0 DO \r\n\r\nOUTPUT lastResult, \"Enter your choice (r, p s)\" \r\n\r\nINPUT userAnswer \r\n\r\nOUTPUT name, \" chose \", userAnswer \r\n\r\n \r\n\r\nDECLARE num : INTEGER \r\n\r\nnum <-- ROUND(RANDOM() * 2, 0) + 1 \r\n\r\n \r\n\r\nIF num = 1 THEN \r\n\r\ncomputerAnswer <-- 'r' \r\n\r\nELSE \r\n\r\nIF num = 2 THEN \r\n\r\ncomputerAnswer <-- 'p' \r\n\r\nELSE \r\n\r\ncomputerAnswer <-- 's' \r\n\r\nENDIF \r\n\r\nENDIF \r\n\r\nOUTPUT \"Computer chose \", computerAnswer \r\n\r\n \r\n\r\nIF (userAnswer = 'r' OR userAnswer = 'p' OR userAnswer = 's') THEN \r\n\r\nIF (userAnswer = 'r' AND computerAnswer = 's') OR (userAnswer = 'p' AND computerAnswer = 'r') OR (userAnswer = 's' AND computerAnswer = 'p') THEN \r\n\r\nlastResult <-- \"You won! \" \r\n\r\nuserScore <-- userScore + 1 \r\n\r\nELSE \r\n\r\nIF (computerAnswer = 'r' AND userAnswer = 's') OR (computerAnswer = 'p' AND userAnswer = 'r') OR (computerAnswer = 's' AND userAnswer = 'p') THEN \r\n\r\nlastResult <-- \"Unlucky, you lost...\" \r\n\r\ncomputerScore <-- computerScore + 1 \r\n\r\nELSE \r\n\r\nlastResult <-- \"You drew. \" \r\n\r\nENDIF \r\n\r\nENDIF \r\n\r\nELSE \r\n\r\nlastResult <-- \"You lost - '\" & userAnswer & \"' is not a valid choice. \" \r\n\r\ncomputerScore <-- computerScore + 1 \r\n\r\nENDIF \r\n\r\ngamesRemaining <-- gamesRemaining - 1 \r\n\r\nENDWHILE \r\n\r\n \r\n\r\nIF userScore > computerScore THEN \r\n\r\nlastResult <-- lastResult & \"\\n Congrats \" & name & \" - you won \" & userScore & \"-\" & computerScore \r\n\r\nELSE \r\n\r\nIF userScore < computerScore THEN \r\n\r\nlastResult <-- lastResult & \"\\n Too bad \" & name & \" - you lost \" & userScore & \"-\" & computerScore \r\n\r\nELSE \r\n\r\nlastResult <-- lastResult & \"\\n Good game \" & name & \" - you drew \" & userScore & \"-\" & computerScore \r\n\r\nENDIF \r\n\r\nENDIF \r\n\r\n \r\n\r\nOUTPUT lastResult, \". Play again (y\/n)?\" \r\n\r\nINPUT playAgain \r\n\r\nUNTIL LCASE(playAgain) <> 'y' \r\n\r\n \r\n\r\nOTHERWISE OUTPUT \"Not A valid game\" \r\n\r\nENDCASE","t":"CSC"}
{}
0478