This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from enum import Enum, auto | |
# マスの状態 | |
class BoardState(Enum): | |
BLANK = auto() | |
PLAYER = auto() | |
AI = auto() | |
# ゲームの状態 | |
class GameState(Enum): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
missionary = "宣教師" | |
cannibal = "人食い人種" | |
# 初期状態 | |
initial_left_side = [missionary, missionary, missionary, cannibal, cannibal, cannibal] | |
initial_right_side = [] | |
# 最終状態 | |
final_left_side = [] | |
final_right_side = [missionary, missionary, missionary, cannibal, cannibal, cannibal] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
class ViewController: UIViewController { | |
@IBOutlet var view:UIView! | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if __name__ == '__main__': | |
n = 3 | |
array = ['A', 'B', 'C', 'D', 'E'] | |
for i in range(pow(2,len(array))): | |
if bin(i).count('1') == n: | |
string = list(str(format(i,'b').zfill(len(array))))[::-1] | |
for j in range(len(array)): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Info.plist に以下を追加 | |
Privacy - Microphone Usage Description | |
*/ | |
import UIKit | |
import MediaPlayer | |
class ViewController: UIViewController { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Info.plist に以下を追加 | |
Privacy - Media Library Usage Description | |
*/ | |
import UIKit | |
import MediaPlayer | |
class ViewController: UIViewController, MPMediaPickerControllerDelegate, AVAudioPlayerDelegate { | |
var audioPlayer: AVAudioPlayer! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ViewController: UIViewController { | |
// textField に関連付ける | |
@IBOutlet var textField: UITextField! | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
// 以下も記述 | |
textField.delegate = self | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
public class Lambda{ | |
public static void main(String[] args){ | |
List<Integer> list = new ArrayList<>(); | |
for(int i=0;i<10;i++) list.add((i+1)*10); | |
list.forEach(value -> System.out.println(value)); | |
list.forEach(System.out::println); |