Advertisement
PifyZ

Exercice du lundi n°4

Jul 15th, 2014
1,051
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SIZE = 20
  2.  
  3. TextWindow.Write("Saisie (ex : 3E 7F FC F8 F8 FC 7F 3E) : ")
  4.  
  5. drawing = Text.ConvertToUpperCase(TextWindow.Read())
  6.  
  7. If Text.GetLength(drawing) <> 23 Then
  8.   drawing = "3E 7F FC F8 F8 FC 7F 3E"
  9. EndIf
  10.  
  11. For i = 1 To 8
  12.   new_drawing[i] = ""
  13. EndFor
  14.  
  15. y = 0
  16.  
  17. For i = 1 To Text.GetLength(drawing) Step 1
  18.   chr = Text.GetSubText(drawing, i, 1)
  19.  
  20.   If chr = " " Then
  21.     y = y + 1
  22.   ElseIf chr = "0" Then
  23.     new_drawing[y] = Text.Append(new_drawing[y], "0000")
  24.   ElseIf chr = "1" Then
  25.     new_drawing[y] = Text.Append(new_drawing[y], "0001")
  26.   ElseIf chr = "2" Then
  27.     new_drawing[y] = Text.Append(new_drawing[y], "0010")
  28.   ElseIf chr = "3" Then
  29.     new_drawing[y] = Text.Append(new_drawing[y], "0011")
  30.   ElseIf chr = "4" Then
  31.     new_drawing[y] = Text.Append(new_drawing[y], "0100")
  32.   ElseIf chr = "5" Then
  33.     new_drawing[y] = Text.Append(new_drawing[y], "0101")
  34.   ElseIf chr = "6" Then
  35.     new_drawing[y] = Text.Append(new_drawing[y], "0110")
  36.   ElseIf chr = "7" Then
  37.     new_drawing[y] = Text.Append(new_drawing[y], "0111")
  38.   ElseIf chr = "8" Then
  39.     new_drawing[y] = Text.Append(new_drawing[y], "1000")
  40.   ElseIf chr = "9" Then
  41.     new_drawing[y] = Text.Append(new_drawing[y], "1001")
  42.   ElseIf chr = "A" Then
  43.     new_drawing[y] = Text.Append(new_drawing[y], "1010")
  44.   ElseIf chr = "B" Then
  45.     new_drawing[y] = Text.Append(new_drawing[y], "1011")
  46.   ElseIf chr = "C" Then
  47.     new_drawing[y] = Text.Append(new_drawing[y], "1100")
  48.   ElseIf chr = "D" Then
  49.     new_drawing[y] = Text.Append(new_drawing[y], "1101")
  50.   ElseIf chr = "E" Then
  51.     new_drawing[y] = Text.Append(new_drawing[y], "1110")
  52.   ElseIf chr = "F" Then
  53.     new_drawing[y] = Text.Append(new_drawing[y], "1111")
  54.   EndIf
  55. EndFor
  56.  
  57. GraphicsWindow.Title  = "Rendu graphique"
  58. GraphicsWindow.Width  = SIZE * 8
  59. GraphicsWindow.Height = SIZE * 8
  60. GraphicsWindow.Show()
  61.  
  62. For y = 0 To 7
  63.   For x = 1 To 8
  64.     If Text.GetSubText(new_drawing[y], x, 1) = "1" Then
  65.       GraphicsWindow.BrushColor = "black"
  66.       GraphicsWindow.FillRectangle(x * SIZE - SIZE, y * SIZE, SIZE, SIZE)
  67.     EndIf
  68.   EndFor
  69. EndFor
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement