package fanch.multijeu;

import android.content.Intent;
import android.os.Bundle;

import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Toast;

import java.io.FileNotFoundException;

import fanch.multijeu.findwords.data.checker.RandomWordChekerList;
import fanch.multijeu.findwords.data.dictionaire.Dictionaire;
import fanch.multijeu.findwords.activity.WordActivity;
import fanch.multijeu.numbers.activity.SelectNumbersActivity;
import fanch.multijeu.numbers.activity.MenuNumberActivity;
import fanch.multijeu.numbers.data.Expression;
import fanch.multijeu.numbers.data.ExpressionParser;
import fanch.multijeu.sudoku.activity.SudokuActivity;
import fanch.multijeu.sudoku.activity.SudokuLauncher;

public class MenuActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_menu);
        ExpressionParser parser = new ExpressionParser("10*10-(50-1)");
        Expression e = parser.parse();
        int x = e.compute();
        Toast.makeText(this, "Value="+x, Toast.LENGTH_SHORT).show();

    }

    public void onNumber(View view) {
        //Intent in = new Intent(this, MenuNumberActivity.class);
        //startActivity(in);
        SelectNumbersActivity.start(this);
    }

    public void onText(View view) {
        try {
            Dictionaire d = new Dictionaire(this, R.raw.liste_francais_latin1);
            RandomWordChekerList rwcl = new RandomWordChekerList();
            WordActivity.start(this, d, rwcl);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }

    }

    public void onSudoku(View view) {
        SudokuLauncher.start(this);
    }
}
