Advertisement
uaa

ASCIIART benchmark, C translated -> Vala translated

uaa
Oct 1st, 2021
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. public class AsciiArtBenchmark : Object {
  2. public void benchmark() {
  3. int x, y, i;
  4. float a, b, ca, cb, t;
  5. string c = "0123456789ABCDEF ";
  6.  
  7. for (y = -12; y <= 12; y++) {
  8. for (x = -39; x <= 39; x++) {
  9. a = ca = x * 0.0458f;
  10. b = cb = y * 0.08333f;
  11.  
  12. for (i = 0; i <= 15; i++) {
  13. t = (a * a) - (b * b) + ca;
  14. b = (2 * a * b) + cb;
  15. a = t;
  16.  
  17. if ((a * a + b * b) > 4)
  18. break;
  19. }
  20. stdout.printf("%s", c.substring(i, 1));
  21. }
  22. stdout.printf("\n");
  23. }
  24. }
  25.  
  26. static void main() {
  27. var test = new AsciiArtBenchmark();
  28. test.benchmark();
  29. }
  30. }
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement