Real Vim ninjas count every keystroke - do you?

Pick a challenge, fire up Vim, and show us what you got.

Changelog, Rules & FAQ, updates: @vimgolf, RSS.

Your VimGolf key: please sign in

$ gem install vimgolf
$ vimgolf setup
$ vimgolf put 4e31627b74ab580001000007

PHP <--> Java class conversion Part 1

Convert this tiny php class to adequate java one.

Start file
<?php
class Foo
{
	private $var1;
	private $var2;

	public function Foo($val)
	{
		$this->init($val);
		$this->doSomething();
	}

	private function init($val)
	{
		$this->var1 = $val;
	}
	
	private function doSomething()
	{
		$this->var2 = sqrt($this->var1);
	}

	public function getResult()
	{
		return $this->var2;
	}
}
?>
End file
public class Foo
{
	private double var1;
	private double var2;

	public Foo(double val)
	{
		init(val);
		doSomething();
	}

	private void init(double val)
	{
		var1 = val;
	}
	
	private void doSomething()
	{
		var2 = Math.sqrt(var1);
	}

	public double getResult()
	{
		return var2;
	}
}

View Diff

1,2c1
< <?php
< class Foo
---
> public class Foo
4,5c3,4
< 	private $var1;
< 	private $var2;
---
> 	private double var1;
> 	private double var2;
7c6
< 	public function Foo($val)
---
> 	public Foo(double val)
9,10c8,9
< 		$this->init($val);
< 		$this->doSomething();
---
> 		init(val);
> 		doSomething();
13c12
< 	private function init($val)
---
> 	private void init(double val)
15c14
< 		$this->var1 = $val;
---
> 		var1 = val;
18c17
< 	private function doSomething()
---
> 	private void doSomething()
20c19
< 		$this->var2 = sqrt($this->var1);
---
> 		var2 = Math.sqrt(var1);
23c22
< 	public function getResult()
---
> 	public double getResult()
25c24
< 		return $this->var2;
---
> 		return var2;
28d26
< ?>

Solutions by @gumnos:

Unlock 9 remaining solutions by signing in and submitting your own entry
Created by: @robrob12

61 active golfers, 212 entries

Solutions by @gumnos:
71
#8 - Tim Chase / @gumnos

07/31/2011 at 11:16PM

72
#>10 - Tim Chase / @gumnos

07/31/2011 at 07:35PM

73
#>10 - Tim Chase / @gumnos

07/30/2011 at 06:36PM

73
#>10 - Tim Chase / @gumnos

07/30/2011 at 06:43PM

76
#>10 - Tim Chase / @gumnos

07/29/2011 at 01:54AM

77
#>10 - Tim Chase / @gumnos

07/29/2011 at 01:50AM

79
#>12 - Tim Chase / @gumnos

07/29/2011 at 01:46AM

82
#>16 - Tim Chase / @gumnos

07/29/2011 at 01:35AM

84
#>19 - Tim Chase / @gumnos

07/28/2011 at 02:16PM