回答編集履歴

4

ソースを少し綺麗にしました。

2016/05/01 12:58

投稿

kentei_syunrai
kentei_syunrai

スコア946

test CHANGED
@@ -38,42 +38,42 @@
38
38
 
39
39
  reset = ->
40
40
 
41
- YourPoint = MyPoint = 0
41
+ YourPoint = MyPoint = 0
42
42
 
43
43
 
44
44
 
45
45
  calc = (_you) ->
46
46
 
47
- _me
47
+ _me
48
48
 
49
- disp = new Array("グー","チョキ","パー");
49
+ disp = new Array("グー","チョキ","パー")
50
50
 
51
- _me = Math.floor(Math.random() * 3);
51
+ _me = Math.floor(Math.random() * 3)
52
52
 
53
- style = document.form01
53
+ style = document.form01
54
54
 
55
- style.txt01.value = disp[_you];
55
+ style.txt01.value = disp[_you]
56
56
 
57
- style.txt02.value = disp[_me];
57
+ style.txt02.value = disp[_me]
58
58
 
59
- if _you-_me==0
59
+ if _you-_me == 0
60
60
 
61
- style.txt03.value ="DROW";
61
+ style.txt03.value ="DROW"
62
62
 
63
- else if _you-_me==-1 || _you-_me==2
63
+ else if _you-_me==-1 || _you-_me==2
64
64
 
65
- style.txt03.value ="WIN";
65
+ style.txt03.value ="WIN"
66
66
 
67
- YourPoint++;
67
+ YourPoint++
68
68
 
69
- else
69
+ else
70
70
 
71
- style.txt03.value ="LOSE";
71
+ style.txt03.value ="LOSE"
72
72
 
73
- MyPoint++;
73
+ MyPoint++
74
74
 
75
- style.txt04.value = YourPoint;
75
+ style.txt04.value = YourPoint
76
76
 
77
- style.txt05.value = MyPoint;
77
+ style.txt05.value = MyPoint
78
78
 
79
79
  ```

3

文章修正

2016/05/01 12:58

投稿

kentei_syunrai
kentei_syunrai

スコア946

test CHANGED
@@ -20,9 +20,9 @@
20
20
 
21
21
  ぐらいですかね。これでエラーはでなくなるはずです。
22
22
 
23
- ※実際動くかは試してないですが。
24
23
 
25
24
 
25
+ 2016-05-01 20:49 追記
26
26
 
27
27
  実際に動いたソースも追記しておきます。
28
28
 

2

変なコメントが残っていたので削除

2016/05/01 11:49

投稿

kentei_syunrai
kentei_syunrai

スコア946

test CHANGED
@@ -40,10 +40,6 @@
40
40
 
41
41
  YourPoint = MyPoint = 0
42
42
 
43
- #得点を初期化
44
-
45
-
46
-
47
43
 
48
44
 
49
45
  calc = (_you) ->

1

実動作確認ソース追加

2016/05/01 11:48

投稿

kentei_syunrai
kentei_syunrai

スコア946

test CHANGED
@@ -21,3 +21,63 @@
21
21
  ぐらいですかね。これでエラーはでなくなるはずです。
22
22
 
23
23
  ※実際動くかは試してないですが。
24
+
25
+
26
+
27
+ 実際に動いたソースも追記しておきます。
28
+
29
+
30
+
31
+ ```coffeeScript
32
+
33
+ YourPoint=0
34
+
35
+ MyPoint=0
36
+
37
+
38
+
39
+ reset = ->
40
+
41
+ YourPoint = MyPoint = 0
42
+
43
+ #得点を初期化
44
+
45
+
46
+
47
+
48
+
49
+ calc = (_you) ->
50
+
51
+ _me
52
+
53
+ disp = new Array("グー","チョキ","パー");
54
+
55
+ _me = Math.floor(Math.random() * 3);
56
+
57
+ style = document.form01
58
+
59
+ style.txt01.value = disp[_you];
60
+
61
+ style.txt02.value = disp[_me];
62
+
63
+ if _you-_me==0
64
+
65
+ style.txt03.value ="DROW";
66
+
67
+ else if _you-_me==-1 || _you-_me==2
68
+
69
+ style.txt03.value ="WIN";
70
+
71
+ YourPoint++;
72
+
73
+ else
74
+
75
+ style.txt03.value ="LOSE";
76
+
77
+ MyPoint++;
78
+
79
+ style.txt04.value = YourPoint;
80
+
81
+ style.txt05.value = MyPoint;
82
+
83
+ ```