Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
629 B

  1. /*translation of the list test from The Great Computer Language Shootout
  2. */
  3. function compare_arr(a1,a2)
  4. {
  5. foreach(i,val in a1)
  6. if(val!=a2[i])return null;
  7. return 1;
  8. }
  9. function test()
  10. {
  11. local size=10000
  12. local l1=[]; l1.resize(size);
  13. for(local i=0;i<size;i+=1) l1[i]=i;
  14. local l2=clone l1;
  15. local l3=[]
  16. l2.reverse();
  17. while(l2.len()>0)
  18. l3.append(l2.pop());
  19. while(l3.len()>0)
  20. l2.append(l3.pop());
  21. l1.reverse();
  22. if(compare_arr(l1,l2))
  23. return l1.len();
  24. return null;
  25. }
  26. local n = ARGS.len()!=0?ARGS[0].tointeger():1
  27. for(local i=0;i<n;i+=1)
  28. if(!test())
  29. {
  30. print("failed");
  31. return;
  32. }
  33. print("oki doki");